coinley-pay 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("wagmi"),require("@tanstack/react-query"),require("@wagmi/core"),require("@wagmi/core/chains"),require("@wagmi/connectors"),require("viem"),require("react-dom"),require("qrcode"),require("axios"),require("react-dom/client")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","wagmi","@tanstack/react-query","@wagmi/core","@wagmi/core/chains","@wagmi/connectors","viem","react-dom","qrcode","axios","react-dom/client"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CoinleyTest={},e.React,e.React,e.Wagmi,e.ReactQuery,e.WagmiCore,e.chains,e.connectors,e.Viem,e.ReactDOM,e.QRCode,e.axios,e.ReactDOM)}(this,function(e,t,r,n,i,o,s,a,c,l,u,h,d){"use strict";for(var p=Object.defineProperty,f=((e,t,r)=>((e,t,r)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r)),m={},g={byteLength:function(e){var t=k(e),r=t[0],n=t[1];return 3*(r+n)/4-n},toByteArray:function(e){var t,r,n=k(e),i=n[0],o=n[1],s=new b(function(e,t,r){return 3*(t+r)/4-r}(0,i,o)),a=0,c=o>0?i-4:i;for(r=0;r<c;r+=4)t=v[e.charCodeAt(r)]<<18|v[e.charCodeAt(r+1)]<<12|v[e.charCodeAt(r+2)]<<6|v[e.charCodeAt(r+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;2===o&&(t=v[e.charCodeAt(r)]<<2|v[e.charCodeAt(r+1)]>>4,s[a++]=255&t);1===o&&(t=v[e.charCodeAt(r)]<<10|v[e.charCodeAt(r+1)]<<4|v[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t);return s},fromByteArray:function(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(S(e,s,s+o>a?a:s+o));1===n?(t=e[r-1],i.push(y[t>>2]+y[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(y[t>>10]+y[t>>4&63]+y[t<<2&63]+"="));return i.join("")}},y=[],v=[],b="undefined"!=typeof Uint8Array?Uint8Array:Array,w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=0;x<64;++x)y[x]=w[x],v[w.charCodeAt(x)]=x;function k(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function _(e){return y[e>>18&63]+y[e>>12&63]+y[e>>6&63]+y[63&e]}function S(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(_(n));return i.join("")}v["-".charCodeAt(0)]=62,v["_".charCodeAt(0)]=63;var C={
2
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
+ read:function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,l=c>>1,u=-7,h=r?i-1:0,d=r?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=l}return(p?-1:1)*s*Math.pow(2,o-n)},write:function(e,t,r,n,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*c-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[r+p]=255&s,p+=f,s/=256,l-=8);e[r+p-f]|=128*m}};
4
+ /*!
5
+ * The buffer module from node.js, for the browser.
6
+ *
7
+ * @author Feross Aboukhadijeh <https://feross.org>
8
+ * @license MIT
9
+ */
10
+ !function(e){const t=g,r=C,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i;const{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:a}=globalThis;function c(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new o(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=c(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(s.isView(e))return function(e){if(X(e,o)){const t=new o(e);return f(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,s)||e&&X(e.buffer,s))return f(e,t,r);if(void 0!==a&&(X(e,a)||e&&X(e.buffer,a)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);const i=function(e){if(l.isBuffer(e)){const t=0|m(e.length),r=c(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||Q(e.length)?c(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return h(e),c(e<0?0:0|m(e))}function p(e){const t=e.length<0?0:0|m(e.length),r=c(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new o(e):void 0===r?new o(e,t):new o(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function y(e,t){if(l.isBuffer(e))return e.length;if(s.isView(e)||X(e,s))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(i)return n?-1:Z(e).length;t=(""+t).toLowerCase(),i=!0}}function v(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return M(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function w(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:x(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof o.prototype.indexOf?i?o.prototype.indexOf.call(e,t,r):o.prototype.lastIndexOf.call(e,t,r):x(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function x(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(l(e,o+n)!==l(t,n)){r=!1;break}if(r)return o}return-1}function k(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Q(n))return s;e[r+s]=n}return s}function _(e,t,r,n){return J(Z(t,e.length-r),e,r,n)}function S(e,t,r,n){return J(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function I(e,t,r,n){return J(Y(t),e,r,n)}function E(e,t,r,n){return J(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function M(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N));return r}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{const e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,o.prototype),Object.setPrototypeOf(l,o),l.alloc=function(e,t,r){return function(e,t,r){return h(e),e<=0?c(e):void 0!==t?"string"==typeof r?c(e).fill(t,r):c(e).fill(t):c(e)}(e,t,r)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(X(e,o)&&(e=l.from(e,e.offset,e.byteLength)),X(t,o)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},l.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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=l.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(X(t,o))i+t.length>n.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(n,i)):o.prototype.set.call(n,t,i);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},l.byteLength=y,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)b(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?M(this,0,e):v.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(X(e,o)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(s,a),u=this.slice(n,i),h=e.slice(t,r);for(let o=0;o<c;++o)if(u[o]!==h[o]){s=u[o],a=h[o];break}return s<a?-1:a<s?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return k(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return S(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function P(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function T(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function O(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=t;o<r;++o)i+=ee[e[o]];return i}function B(e,t,r){const n=e.slice(t,r);let i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function R(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i){G(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function U(e,t,r,n,i){G(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function D(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,n,i,o){return t=+t,n>>>=0,o||D(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function z(e,t,n,i,o){return t=+t,n>>>=0,o||D(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=te(function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))}),l.prototype.readBigUInt64BE=te(function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||R(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||R(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=te(function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),l.prototype.readBigInt64BE=te(function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||R(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||R(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||R(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||R(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=te(function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=te(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=te(function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=te(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return z(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return z(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof o.prototype.copyWithin?this.copyWithin(t,r,n):o.prototype.set.call(e,this.subarray(r,n),t),i},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=l.isBuffer(e)?e:l.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const q={};function $(e,t,r){q[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function G(e,t,r,n,i,o){if(e>r||e<t){const r="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`,new q.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||V(t,e.length-(r+1))}(n,i,o)}function H(e,t){if("number"!=typeof e)throw new q.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,r){if(Math.floor(e)!==e)throw H(e,r),new q.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new q.ERR_BUFFER_OUT_OF_BOUNDS;throw new q.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}$("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),$("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),$("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=W(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=W(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);const K=/[^+/0-9A-Za-z-_]/g;function Z(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const ee=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function te(e){return"undefined"==typeof BigInt?re:e}function re(){throw new Error("BigInt not supported")}}(m);const I=m.Buffer,E=m.Blob,A=m.BlobOptions,M=m.Buffer,N=m.File,P=m.FileOptions,T=m.INSPECT_MAX_BYTES,O=m.SlowBuffer,B=m.TranscodeEncoding,R=m.atob,L=m.btoa,j=m.constants,U=m.isAscii,D=m.isUtf8,F=m.kMaxLength,z=m.kStringMaxLength,q=m.resolveObjectURL,$=m.transcode,W=Object.freeze(Object.defineProperty({__proto__:null,Blob:E,BlobOptions:A,Buffer:M,File:N,FileOptions:P,INSPECT_MAX_BYTES:T,SlowBuffer:O,TranscodeEncoding:B,atob:R,btoa:L,constants:j,default:I,isAscii:U,isUtf8:D,kMaxLength:F,kStringMaxLength:z,resolveObjectURL:q,transcode:$},Symbol.toStringTag,{value:"Module"}));function G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var H,V,K={exports:{}},Z=K.exports={};function Y(){throw new Error("setTimeout has not been defined")}function J(){throw new Error("clearTimeout has not been defined")}function X(e){if(H===setTimeout)return setTimeout(e,0);if((H===Y||!H)&&setTimeout)return H=setTimeout,setTimeout(e,0);try{return H(e,0)}catch(t){try{return H.call(null,e,0)}catch(r){return H.call(this,e,0)}}}!function(){try{H="function"==typeof setTimeout?setTimeout:Y}catch(e){H=Y}try{V="function"==typeof clearTimeout?clearTimeout:J}catch(e){V=J}}();var Q,ee=[],te=!1,re=-1;function ne(){te&&Q&&(te=!1,Q.length?ee=Q.concat(ee):re=-1,ee.length&&ie())}function ie(){if(!te){var e=X(ne);te=!0;for(var t=ee.length;t;){for(Q=ee,ee=[];++re<t;)Q&&Q[re].run();re=-1,t=ee.length}Q=null,te=!1,function(e){if(V===clearTimeout)return clearTimeout(e);if((V===J||!V)&&clearTimeout)return V=clearTimeout,clearTimeout(e);try{return V(e)}catch(t){try{return V.call(null,e)}catch(r){return V.call(this,e)}}}(e)}}function oe(e,t){this.fun=e,this.array=t}function se(){}Z.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];ee.push(new oe(e,t)),1!==ee.length||te||X(ie)},oe.prototype.run=function(){this.fun.apply(null,this.array)},Z.title="browser",Z.browser=!0,Z.env={},Z.argv=[],Z.version="",Z.versions={},Z.on=se,Z.addListener=se,Z.once=se,Z.off=se,Z.removeListener=se,Z.removeAllListeners=se,Z.emit=se,Z.prependListener=se,Z.prependOnceListener=se,Z.listeners=function(e){return[]},Z.binding=function(e){throw new Error("process.binding is not supported")},Z.cwd=function(){return"/"},Z.chdir=function(e){throw new Error("process.chdir is not supported")},Z.umask=function(){return 0};const ae=G(K.exports);var ce;if("undefined"==typeof window){var le={hostname:""};ce={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:le,referrer:""},screen:{width:0,height:0},location:le,addEventListener:function(){},removeEventListener:function(){},dispatchEvent:function(){},CustomEvent:function(){}}}else ce=window;function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function he(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(uh){return void r(uh)}a.done?t(c):Promise.resolve(c).then(n,i)}function de(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){he(o,n,i,s,a,"next",e)}function a(e){he(o,n,i,s,a,"throw",e)}s(void 0)})}}function pe(e,t,r){return(pe=_e()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&we(i,r.prototype),i}).apply(null,arguments)}function fe(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function me(){return me=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},me.apply(this,arguments)}function ge(e){return(ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ye(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&we(e,t)}function ve(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function be(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function we(e,t){return(we=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xe(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ke(e){var t="function"==typeof Map?new Map:void 0;return ke=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return pe(e,arguments,ge(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),we(n,e)},ke(e)}function _e(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_e=function(){return!!e})()}function Se(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ue(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(e,t):void 0}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ce(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(a){o=[6,a],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function Ie(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var Ee,Ae=Object.defineProperty,Me=function(e,t,r){return function(e,t,r){return t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r}(e,"symbol"!==(void 0===t?"undefined":xe(t))?t+"":t,r)},Ne=Object.defineProperty,Pe=function(e,t,r){return function(e,t,r){return t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r}(e,"symbol"!==(void 0===t?"undefined":xe(t))?t+"":t,r)},Te=function(e){return 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}(Te||{}),Oe={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Be={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Re={};function Le(e){if(Re[e])return Re[e];var t=globalThis[e],r=t.prototype,n=e in Oe?Oe[e]:void 0,i=Boolean(n&&n.every(function(e){var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in Be?Be[e]:void 0,s=Boolean(o&&o.every(function(e){var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s&&!globalThis.Zone)return Re[e]=t.prototype,t.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var c=a.contentWindow;if(!c)return t.prototype;var l=c[e].prototype;return document.body.removeChild(a),l?Re[e]=l:r}catch(u){return r}}var je={};function Ue(e,t,r){var n,i=e+"."+String(r);if(je[i])return je[i].call(t);var o=Le(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(je[i]=s,s.call(t)):t[r]}var De={};function Fe(e,t,r){var n=e+"."+String(r);if(De[n])return De[n].bind(t);var i=Le(e)[r];return"function"!=typeof i?t[r]:(De[n]=i,i.bind(t))}var ze={childNodes:function(e){return Ue("Node",e,"childNodes")},parentNode:function(e){return Ue("Node",e,"parentNode")},parentElement:function(e){return Ue("Node",e,"parentElement")},textContent:function(e){return Ue("Node",e,"textContent")},contains:function(e,t){return Fe("Node",e,"contains")(t)},getRootNode:function(e){return Fe("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Ue("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Ue("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Ue("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Ue("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Le("MutationObserver").constructor},patch:function(e,t,r){try{if(!(t in e))return function(){};var n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,function(){e[t]=n}}catch(o){return function(){}}}};function qe(e){return e.nodeType===e.ELEMENT_NODE}function $e(e){var t=e&&"host"in e&&"mode"in e&&ze.host(e)||null;return Boolean(t&&"shadowRoot"in t&&ze.shadowRoot(t)===e)}function We(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function Ge(e){try{var t=e.rules||e.cssRules;if(!t)return null;var r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);var n=Array.from(t,function(e){return He(e,r)}).join("");return(i=n).includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}catch(uh){return null}var i}function He(e,t){if(function(e){return"styleSheet"in e}(e)){var r;try{r=Ge(e.styleSheet)||function(e){var t=e.cssText;if(t.split('"').length<3)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(uh){r=e.cssText}return e.styleSheet.href?nt(r,e.styleSheet.href):r}var n,i=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,i=i.replace(n,"$1\\$2")),t?nt(i,t):i}var Ve=function(){function e(){Pe(this,"idNodeMap",new Map),Pe(this,"nodeMetaMap",new WeakMap)}var t=e.prototype;return t.getId=function(e){var t;if(!e)return-1;var r=null==(t=this.getMeta(e))?void 0:t.id;return null!=r?r:-1},t.getNode=function(e){return this.idNodeMap.get(e)||null},t.getIds=function(){return Array.from(this.idNodeMap.keys())},t.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},t.has=function(e){return this.idNodeMap.has(e)},t.hasNode=function(e){return this.nodeMetaMap.has(e)},t.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},t.replace=function(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Ke(e){var t=e.element,r=e.maskInputOptions,n=e.tagName,i=e.type,o=e.value,s=e.maskInputFn,a=o||"",c=i&&Ze(i);return(r[n.toLowerCase()]||c&&r[c])&&(a=s?s(a,t):"*".repeat(a.length)),a}function Ze(e){return e.toLowerCase()}var Ye="__rrweb_original__";function Je(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Ze(t):null}function Xe(e,t){var r;try{r=new URL(e,null!=t?t:window.location.href)}catch(o){return null}var n,i=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!=(n=null==i?void 0:i[1])?n:null}var Qe=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,et=/^(?:[a-z+]+:)?\/\//i,tt=/^www\..*/i,rt=/^(data:)([^,]*),(.*)/i;function nt(e,t){return(e||"").replace(Qe,function(e,r,n,i,o,s){var a,c=n||o||s,l=r||i||"";if(!c)return e;if(et.test(c)||tt.test(c))return"url("+l+c+l+")";if(rt.test(c))return"url("+l+c+l+")";if("/"===c[0])return"url("+l+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)+l+")";var u=t.split("/"),h=c.split("/");u.pop();for(var d,p=Se(h);!(d=p()).done;){var f=d.value;"."!==f&&(".."===f?u.pop():u.push(f))}return"url("+l+u.join("/")+l+")"})}function it(e,t){return void 0===t&&(t=!1),t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function ot(e,t){return function(e,t,r){void 0===r&&(r=!1);var n=Array.from(t.childNodes),i=[],o=0;if(n.length>1&&e&&"string"==typeof e)for(var s=it(e,r),a=s.length/e.length,c=1;c<n.length;c++)if(n[c].textContent&&"string"==typeof n[c].textContent){for(var l=it(n[c].textContent,r),u=3;u<l.length&&(l[u].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,u),1));u++);for(;u<l.length;u++){var h=l.substring(0,u),d=s.split(h),p=-1;if(2===d.length)p=d[0].length;else if(d.length>2&&""===d[0]&&""!==n[c-1].textContent)p=s.indexOf(h,1);else if(1===d.length){if(h=h.substring(0,h.length-1),(d=s.split(h)).length<=1)return i.push(e),i;u=101}else u===l.length-1&&(p=s.indexOf(h));if(d.length>=2&&u>100){var f=n[c-1].textContent;if(f&&"string"==typeof f){var m=it(f).length;p=s.indexOf(h,m)}-1===p&&(p=d[0].length)}if(-1!==p){for(var g=Math.floor(p/a);g>0&&g<e.length;){if((o+=1)>50*n.length)return i.push(e),i;var y=it(e.substring(0,g),r);if(y.length===p){i.push(e.substring(0,g)),e=e.substring(g),s=s.substring(p);break}y.length<p?g+=Math.max(1,Math.floor((p-y.length)/a)):g-=Math.max(1,Math.floor((y.length-p)*a))}break}}}return i.push(e),i}(e,t).join("/* rr_split */")}var st,at,ct=1,lt=new RegExp("[^a-z0-9-_:]");function ut(){return ct++}var ht=/^[^ \t\n\r\u000c]+/,dt=/^[, \t\n\r\u000c]+/;var pt=new WeakMap;function ft(e,t){return t&&""!==t.trim()?gt(e,t):t}function mt(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function gt(e,t){var r=pt.get(e);if(r||(r=e.createElement("a"),pt.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function yt(e,t,r,n){return n?"src"===r||"href"===r&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&"#"!==n[0]?ft(e,n):"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,i=e.exec(t.substring(r));return i?(n=i[0],r+=n.length,n):""}for(var i=[];n(dt),!(r>=t.length);){var o=n(ht);if(","===o.slice(-1))o=ft(e,o.substring(0,o.length-1)),i.push(o);else{var s="";o=ft(e,o);for(var a=!1;;){var c=t.charAt(r);if(""===c){i.push((o+s).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){r+=1,i.push((o+s).trim());break}"("===c&&(a=!0)}s+=c,r+=1}}}return i.join(", ")}(e,n):"style"===r?nt(n,gt(e)):"object"===t&&"data"===r?ft(e,n):n:ft(e,n):n}function vt(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function bt(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&bt(ze.parentNode(e),t,r);for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return!0}return!!r&&bt(ze.parentNode(e),t,r)}function wt(e,t,r,n){var i;if(qe(e)){if(i=e,!ze.childNodes(i).length)return!1}else{if(null===ze.parentElement(e))return!1;i=ze.parentElement(e)}try{if("string"==typeof t){if(n){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if(bt(i,t,n))return!0;if(r)if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}catch(o){}return!1}function xt(e,t){var r=t.doc,n=t.mirror,i=t.blockClass,o=t.blockSelector,s=t.needsMask,a=t.inlineStylesheet,c=t.maskInputOptions,l=void 0===c?{}:c,u=t.maskTextFn,h=t.maskInputFn,d=t.dataURLOptions,p=void 0===d?{}:d,f=t.inlineImages,m=t.recordCanvas,g=t.keepIframeSrcFn,y=t.newlyAddedElement,v=void 0!==y&&y,b=t.cssCaptured,w=void 0!==b&&b,x=function(e,t){if(!t.hasNode(e))return;var r=t.getId(e);return 1===r?void 0:r}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Te.Document,childNodes:[],compatMode:e.compatMode}:{type:Te.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Te.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:x};case e.ELEMENT_NODE:return function(e,t){for(var r,n=t.doc,i=t.blockClass,o=t.blockSelector,s=t.inlineStylesheet,a=t.maskInputOptions,c=void 0===a?{}:a,l=t.maskInputFn,u=t.dataURLOptions,h=void 0===u?{}:u,d=t.inlineImages,p=t.recordCanvas,f=t.keepIframeSrcFn,m=t.newlyAddedElement,g=void 0!==m&&m,y=t.rootId,v=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return!0}if(r)return e.matches(r)}catch(o){}return!1}(e,i,o),b=function(e){if(ve(e,HTMLFormElement))return"form";var t=Ze(e.tagName);return lt.test(t)?"div":t}(e),w={},x=e.attributes.length,k=0;k<x;k++){var _=e.attributes[k];vt(b,_.name,_.value)||(w[_.name]=yt(n,b,Ze(_.name),_.value))}if("link"===b&&s){var S=Array.from(n.styleSheets).find(function(t){return t.href===e.href}),C=null;S&&(C=Ge(S)),C&&(delete w.rel,delete w.href,w._cssText=C)}if("style"===b&&e.sheet){var I=Ge(e.sheet);I&&(e.childNodes.length>1&&(I=ot(I,e)),w._cssText=I)}if("input"===b||"textarea"===b||"select"===b){var E=e.value,A=e.checked;"radio"!==w.type&&"checkbox"!==w.type&&"submit"!==w.type&&"button"!==w.type&&E?w.value=Ke({element:e,type:Je(e),tagName:b,value:E,maskInputOptions:c,maskInputFn:l}):A&&(w.checked=A)}"option"===b&&(e.selected&&!c.select?w.selected=!0:delete w.selected);"dialog"===b&&e.open&&(w.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===b&&p)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;r<e.width;r+=50)for(var n=0;n<e.height;n+=50){var i=t.getImageData,o=Ye in i?i[Ye]:i;if(new Uint32Array(o.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(function(e){return 0!==e}))return!1}return!0})(e)||(w.rr_dataURL=e.toDataURL(h.type,h.quality));else if(!("__context"in e)){var M=e.toDataURL(h.type,h.quality),N=n.createElement("canvas");N.width=e.width,N.height=e.height,M!==N.toDataURL(h.type,h.quality)&&(w.rr_dataURL=M)}if("img"===b&&d){st||(st=n.createElement("canvas"),at=st.getContext("2d"));var P=e,T=P.currentSrc||P.getAttribute("src")||"<unknown-src>",O=P.crossOrigin,B=function(){P.removeEventListener("load",B);try{st.width=P.naturalWidth,st.height=P.naturalHeight,at.drawImage(P,0,0),w.rr_dataURL=st.toDataURL(h.type,h.quality)}catch(e){if("anonymous"!==P.crossOrigin)return P.crossOrigin="anonymous",void(P.complete&&0!==P.naturalWidth?B():P.addEventListener("load",B));console.warn("Cannot inline img src="+T+"! Error: "+e)}"anonymous"===P.crossOrigin&&(O?w.crossOrigin=O:P.removeAttribute("crossorigin"))};P.complete&&0!==P.naturalWidth?B():P.addEventListener("load",B)}if("audio"===b||"video"===b){var R=w;R.rr_mediaState=e.paused?"paused":"played",R.rr_mediaCurrentTime=e.currentTime,R.rr_mediaPlaybackRate=e.playbackRate,R.rr_mediaMuted=e.muted,R.rr_mediaLoop=e.loop,R.rr_mediaVolume=e.volume}g||(e.scrollLeft&&(w.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(w.rr_scrollTop=e.scrollTop));if(v){var L=e.getBoundingClientRect(),j=L.width,U=L.height;w={class:w.class,rr_width:j+"px",rr_height:U+"px"}}"iframe"!==b||f(w.src)||(e.contentDocument||(w.rr_src=w.src),delete w.src);try{customElements.get(b)&&(r=!0)}catch(D){}return{type:Te.Element,tagName:b,attributes:w,childNodes:[],isSVG:mt(e)||void 0,needBlock:v,rootId:y,isCustom:r}}(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:h,dataURLOptions:p,inlineImages:f,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:v,rootId:x});case e.TEXT_NODE:return function(e,t){var r=t.needsMask,n=t.maskTextFn,i=t.rootId,o=t.cssCaptured,s=ze.parentNode(e),a=s&&s.tagName,c="",l="STYLE"===a||void 0,u="SCRIPT"===a||void 0;u?c="SCRIPT_PLACEHOLDER":o||(c=ze.textContent(e),l&&c&&(c=nt(c,gt(t.doc))));!l&&!u&&c&&r&&(c=n?n(c,ze.parentElement(e)):c.replace(/[\S]/g,"*"));return{type:Te.Text,textContent:c||"",rootId:i}}(e,{doc:r,needsMask:s,maskTextFn:u,rootId:x,cssCaptured:w});case e.CDATA_SECTION_NODE:return{type:Te.CDATA,textContent:"",rootId:x};case e.COMMENT_NODE:return{type:Te.Comment,textContent:ze.textContent(e)||"",rootId:x};default:return!1}}function kt(e){return null==e?"":e.toLowerCase()}function _t(e,t){var r=t.doc,n=t.mirror,i=t.blockClass,o=t.blockSelector,s=t.maskTextClass,a=t.maskTextSelector,c=t.skipChild,l=void 0!==c&&c,u=t.inlineStylesheet,h=void 0===u||u,d=t.maskInputOptions,p=void 0===d?{}:d,f=t.maskTextFn,m=t.maskInputFn,g=t.slimDOMOptions,y=t.dataURLOptions,v=void 0===y?{}:y,b=t.inlineImages,w=void 0!==b&&b,x=t.recordCanvas,k=void 0!==x&&x,_=t.onSerialize,S=t.onIframeLoad,C=t.iframeLoadTimeout,I=void 0===C?5e3:C,E=t.onStylesheetLoad,A=t.stylesheetLoadTimeout,M=void 0===A?5e3:A,N=t.keepIframeSrcFn,P=void 0===N?function(){return!1}:N,T=t.newlyAddedElement,O=void 0!==T&&T,B=t.cssCaptured,R=void 0!==B&&B,L=t.needsMask,j=t.preserveWhiteSpace,U=void 0===j||j;L||(L=wt(e,s,a,void 0===L));var D,F=xt(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:L,inlineStylesheet:h,maskInputOptions:p,maskTextFn:f,maskInputFn:m,dataURLOptions:v,inlineImages:w,recordCanvas:k,keepIframeSrcFn:P,newlyAddedElement:O,cssCaptured:R});if(!F)return console.warn(e,"not serialized"),null;D=n.hasNode(e)?n.getId(e):function(e,t){if(t.comment&&e.type===Te.Comment)return!0;if(e.type===Te.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===Xe(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(kt(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===kt(e.attributes.name)||"icon"===kt(e.attributes.rel)||"apple-touch-icon"===kt(e.attributes.rel)||"shortcut icon"===kt(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&kt(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(kt(e.attributes.property).match(/^(og|twitter|fb):/)||kt(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===kt(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===kt(e.attributes.name)||"googlebot"===kt(e.attributes.name)||"bingbot"===kt(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===kt(e.attributes.name)||"generator"===kt(e.attributes.name)||"framework"===kt(e.attributes.name)||"publisher"===kt(e.attributes.name)||"progid"===kt(e.attributes.name)||kt(e.attributes.property).match(/^article:/)||kt(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===kt(e.attributes.name)||"yandex-verification"===kt(e.attributes.name)||"csrf-token"===kt(e.attributes.name)||"p:domain_verify"===kt(e.attributes.name)||"verify-v1"===kt(e.attributes.name)||"verification"===kt(e.attributes.name)||"shopify-checkout-api-token"===kt(e.attributes.name)))return!0}}return!1}(F,g)||!U&&F.type===Te.Text&&!F.textContent.replace(/^\s+|\s+$/gm,"").length?-2:ut();var z=Object.assign(F,{id:D});if(n.add(e,z),-2===D)return null;_&&_(e);var q=!l;if(z.type===Te.Element){q=q&&!z.needBlock,delete z.needBlock;var $=ze.shadowRoot(e);$&&We($)&&(z.isShadowHost=!0)}if((z.type===Te.Document||z.type===Te.Element)&&q){g.headWhitespace&&z.type===Te.Element&&"head"===z.tagName&&(U=!1);var W={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:L,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:h,maskInputOptions:p,maskTextFn:f,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:w,recordCanvas:k,preserveWhiteSpace:U,onSerialize:_,onIframeLoad:S,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:M,keepIframeSrcFn:P,cssCaptured:!1};if(z.type===Te.Element&&"textarea"===z.tagName&&void 0!==z.attributes.value);else{z.type===Te.Element&&void 0!==z.attributes._cssText&&"string"==typeof z.attributes._cssText&&(W.cssCaptured=!0);for(var G,H=Se(Array.from(ze.childNodes(e)));!(G=H()).done;){var V=_t(G.value,W);V&&z.childNodes.push(V)}}var K=null;if(qe(e)&&(K=ze.shadowRoot(e)))for(var Z,Y=Se(Array.from(ze.childNodes(K)));!(Z=Y()).done;){var J=_t(Z.value,W);J&&(We(K)&&(J.isShadow=!0),z.childNodes.push(J))}}var X=ze.parentNode(e);return X&&$e(X)&&We(X)&&(z.isShadow=!0),z.type===Te.Element&&"iframe"===z.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var i,o=!1;try{i=n.document.readyState}catch(uh){return}if("complete"===i){var s="about:blank";if(n.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout(function(){o||(t(),o=!0)},r);e.addEventListener("load",function(){clearTimeout(a),o=!0,t()})}}}(e,function(){var t=e.contentDocument;if(t&&S){var r=_t(t,{doc:t,mirror:n,blockClass:i,blockSelector:o,needsMask:L,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:h,maskInputOptions:p,maskTextFn:f,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:w,recordCanvas:k,preserveWhiteSpace:U,onSerialize:_,onIframeLoad:S,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:M,keepIframeSrcFn:P});r&&S(e,r)}},I),z.type===Te.Element&&"link"===z.tagName&&"string"==typeof z.attributes.rel&&("stylesheet"===z.attributes.rel||"preload"===z.attributes.rel&&"string"==typeof z.attributes.href&&"css"===Xe(z.attributes.href))&&function(e,t,r){var n,i=!1;try{n=e.sheet}catch(uh){return}if(!n){var o=setTimeout(function(){i||(t(),i=!0)},r);e.addEventListener("load",function(){clearTimeout(o),i=!0,t()})}}(e,function(){if(E){var t=_t(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:L,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:h,maskInputOptions:p,maskTextFn:f,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:w,recordCanvas:k,preserveWhiteSpace:U,onSerialize:_,onIframeLoad:S,iframeLoadTimeout:I,onStylesheetLoad:E,stylesheetLoadTimeout:M,keepIframeSrcFn:P});t&&E(e,t)}},M),z}function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ct(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return ve(this,e)?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var It={exports:{}},Et=String,At=function(){return{isColorSupported:!1,reset:Et,bold:Et,dim:Et,italic:Et,underline:Et,inverse:Et,hidden:Et,strikethrough:Et,black:Et,red:Et,green:Et,yellow:Et,blue:Et,magenta:Et,cyan:Et,white:Et,gray:Et,bgBlack:Et,bgRed:Et,bgGreen:Et,bgYellow:Et,bgBlue:Et,bgMagenta:Et,bgCyan:Et,bgWhite:Et}};It.exports=At(),It.exports.createColors=At;var Mt=It.exports,Nt=Ct(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),Pt=Mt,Tt=Nt,Ot=function(e){function t(r,n,i,o,s,a){var c;return(c=e.call(this,r)||this).name="CssSyntaxError",c.reason=r,s&&(c.file=s),o&&(c.source=o),a&&(c.plugin=a),void 0!==n&&void 0!==i&&("number"==typeof n?(c.line=n,c.column=i):(c.line=n.line,c.column=n.column,c.endLine=i.line,c.endColumn=i.column)),c.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(c,t),c}ye(t,e);var r=t.prototype;return r.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},r.showSourceCode=function(e){var t=this;if(!this.source)return"";var r=this.source;null==e&&(e=Pt.isColorSupported),Tt&&e&&(r=Tt(r));var n,i,o=r.split(/\r?\n/),s=Math.max(this.line-3,0),a=Math.min(this.line+2,o.length),c=String(a).length;if(e){var l=Pt.createColors(!0),u=l.bold,h=l.gray,d=l.red;n=function(e){return u(d(e))},i=function(e){return h(e)}}else n=i=function(e){return e};return o.slice(s,a).map(function(e,r){var o=s+1+r,a=" "+(" "+o).slice(-c)+" | ";if(o===t.line){var l=i(a.replace(/\d/g," "))+e.slice(0,t.column-1).replace(/[^\t]/g," ");return n(">")+i(a)+e+"\n "+l+n("^")}return" "+i(a)+e}).join("\n")},r.toString=function(){var e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e},t}(ke(Error)),Bt=Ot;Ot.default=Ot;var Rt={};Rt.isClean=Symbol("isClean"),Rt.my=Symbol("my");var Lt={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var jt=function(){function e(e){this.builder=e}var t=e.prototype;return t.atrule=function(e,t){var r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{var i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}},t.beforeAfter=function(e,t){var r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");for(var n=e.parent,i=0;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){var o=this.raw(e,null,"indent");if(o.length)for(var s=0;s<i;s++)r+=o}return r},t.block=function(e,t){var r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")},t.body=function(e){for(var t=e.nodes.length-1;t>0&&"comment"===e.nodes[t].type;)t-=1;for(var r=this.raw(e,"semicolon"),n=0;n<e.nodes.length;n++){var i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}},t.comment=function(e){var t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)},t.decl=function(e,t){var r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)},t.document=function(e){this.body(e)},t.raw=function(e,t,r){var n;if(r||(r=t),t&&void 0!==(n=e.raws[t]))return n;var i=e.parent;if("before"===r){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return Lt[r];var o=e.root();if(o.rawCache||(o.rawCache={}),void 0!==o.rawCache[r])return o.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(e,r);var s,a="raw"+((s=r)[0].toUpperCase()+s.slice(1));return this[a]?n=this[a](o,e):o.walk(function(e){if(void 0!==(n=e.raws[t]))return!1}),void 0===n&&(n=Lt[r]),o.rawCache[r]=n,n},t.rawBeforeClose=function(e){var t;return e.walk(function(e){if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return(t=e.raws.after).includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t},t.rawBeforeComment=function(e,t){var r;return e.walkComments(function(e){if(void 0!==e.raws.before)return(r=e.raws.before).includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r},t.rawBeforeDecl=function(e,t){var r;return e.walkDecls(function(e){if(void 0!==e.raws.before)return(r=e.raws.before).includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r},t.rawBeforeOpen=function(e){var t;return e.walk(function(e){if("decl"!==e.type&&void 0!==(t=e.raws.between))return!1}),t},t.rawBeforeRule=function(e){var t;return e.walk(function(r){if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return(t=r.raws.before).includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t},t.rawColon=function(e){var t;return e.walkDecls(function(e){if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t},t.rawEmptyBody=function(e){var t;return e.walk(function(e){if(e.nodes&&0===e.nodes.length&&void 0!==(t=e.raws.after))return!1}),t},t.rawIndent=function(e){return e.raws.indent?e.raws.indent:(e.walk(function(r){var n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){var i=r.raws.before.split("\n");return t=(t=i[i.length-1]).replace(/\S/g,""),!1}}),t);var t},t.rawSemicolon=function(e){var t;return e.walk(function(e){if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&void 0!==(t=e.raws.semicolon))return!1}),t},t.rawValue=function(e,t){var r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r},t.root=function(e){this.body(e),e.raws.after&&this.builder(e.raws.after)},t.rule=function(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")},t.stringify=function(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)},e}(),Ut=jt;jt.default=jt;var Dt=Ut;function Ft(e,t){new Dt(t).stringify(e)}var zt=Ft;Ft.default=Ft;var qt=Rt.isClean,$t=Rt.my,Wt=Bt,Gt=Ut,Ht=zt;function Vt(e,t){var r=new e.constructor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&"proxyCache"!==n){var i=e[n],o=void 0===i?"undefined":xe(i);"parent"===n&&"object"===o?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(function(e){return Vt(e,r)}):("object"===o&&null!==i&&(i=Vt(i)),r[n]=i)}return r}var Kt=function(){function e(e){for(var t in void 0===e&&(e={}),this.raws={},this[qt]=!1,this[$t]=!0,e)if("nodes"===t){this.nodes=[];for(var r,n=Se(e[t]);!(r=n()).done;){var i=r.value;"function"==typeof i.clone?this.append(i.clone()):this.append(i)}}else this[t]=e[t]}var t=e.prototype;return t.addToError=function(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){var t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,"$&"+t.input.from+":"+t.start.line+":"+t.start.column+"$&")}return e},t.after=function(e){return this.parent.insertAfter(this,e),this},t.assign=function(e){for(var t in void 0===e&&(e={}),e)this[t]=e[t];return this},t.before=function(e){return this.parent.insertBefore(this,e),this},t.cleanRaws=function(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between},t.clone=function(e){void 0===e&&(e={});var t=Vt(this);for(var r in e)t[r]=e[r];return t},t.cloneAfter=function(e){void 0===e&&(e={});var t=this.clone(e);return this.parent.insertAfter(this,t),t},t.cloneBefore=function(e){void 0===e&&(e={});var t=this.clone(e);return this.parent.insertBefore(this,t),t},t.error=function(e,t){if(void 0===t&&(t={}),this.source){var r=this.rangeBy(t),n=r.end,i=r.start;return this.source.input.error(e,{column:i.column,line:i.line},{column:n.column,line:n.line},t)}return new Wt(e)},t.getProxyProcessor=function(){return{get:function(e,t){return"proxyOf"===t?e:"root"===t?function(){return e.root().toProxy()}:e[t]},set:function(e,t,r){return e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0}}},t.markDirty=function(){if(this[qt]){this[qt]=!1;for(var e=this;e=e.parent;)e[qt]=!1}},t.next=function(){if(this.parent){var e=this.parent.index(this);return this.parent.nodes[e+1]}},t.positionBy=function(e,t){var r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){var n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r},t.positionInside=function(e,t){for(var r=t||this.toString(),n=this.source.start.column,i=this.source.start.line,o=0;o<e;o++)"\n"===r[o]?(n=1,i+=1):n+=1;return{column:n,line:i}},t.prev=function(){if(this.parent){var e=this.parent.index(this);return this.parent.nodes[e-1]}},t.rangeBy=function(e){var t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){var n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}},t.raw=function(e,t){return(new Gt).raw(this,e,t)},t.remove=function(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this},t.replaceWith=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(this.parent){for(var n,i=this,o=!1,s=Se(t);!(n=s()).done;){var a=n.value;a===this?o=!0:o?(this.parent.insertAfter(i,a),i=a):this.parent.insertBefore(i,a)}o||this.remove()}return this},t.root=function(){for(var e=this;e.parent&&"document"!==e.parent.type;)e=e.parent;return e},t.toJSON=function(e,t){var r={},n=null==t;t=t||new Map;var i=0;for(var o in this)if(Object.prototype.hasOwnProperty.call(this,o)&&"parent"!==o&&"proxyCache"!==o){var s=this[o];if(Array.isArray(s))r[o]=s.map(function(e){return"object"===(void 0===e?"undefined":xe(e))&&e.toJSON?e.toJSON(null,t):e});else if("object"===(void 0===s?"undefined":xe(s))&&s.toJSON)r[o]=s.toJSON(null,t);else if("source"===o){var a=t.get(s.input);null==a&&(a=i,t.set(s.input,i),i++),r[o]={end:s.end,inputId:a,start:s.start}}else r[o]=s}return n&&(r.inputs=[].concat(t.keys()).map(function(e){return e.toJSON()})),r},t.toProxy=function(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache},t.toString=function(e){void 0===e&&(e=Ht),e.stringify&&(e=e.stringify);var t="";return e(this,function(e){t+=e}),t},t.warn=function(e,t,r){var n={node:this};for(var i in r)n[i]=r[i];return e.warn(t,n)},fe(e,[{key:"proxyOf",get:function(){return this}}]),e}(),Zt=Kt;Kt.default=Kt;var Yt=function(e){function t(t){var r;return t&&void 0!==t.value&&"string"!=typeof t.value&&(t=me({},t,{value:String(t.value)})),(r=e.call(this,t)||this).type="decl",r}return ye(t,e),fe(t,[{key:"variable",get:function(){return this.prop.startsWith("--")||"$"===this.prop[0]}}]),t}(Zt),Jt=Yt;Yt.default=Yt;var Xt=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},Qt=Nt.SourceMapConsumer,er=Nt.SourceMapGenerator,tr=Nt.existsSync,rr=Nt.readFileSync,nr=Nt.dirname,ir=Nt.join;var or=function(){function e(e,t){if(!1!==t.map){this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");var r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=nr(this.mapFile)),n&&(this.text=n)}}var t=e.prototype;return t.consumer=function(){return this.consumerCache||(this.consumerCache=new Qt(this.text)),this.consumerCache},t.decodeInline=function(e){var t;if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),I?I.from(t,"base64").toString():window.atob(t);var r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)},t.getAnnotationURL=function(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()},t.isMap=function(e){return"object"===(void 0===e?"undefined":xe(e))&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))},t.loadAnnotation=function(e){var t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(t){var r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}},t.loadFile=function(e){if(this.root=nr(e),tr(e))return this.mapFile=e,rr(e,"utf-8").toString().trim()},t.loadMap=function(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(ve(t,Qt))return er.fromSourceMap(t).toString();if(ve(t,er))return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}var r=t(e);if(r){var n=this.loadFile(r);if(!n)throw new Error("Unable to load previous source map: "+r.toString());return n}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){var i=this.annotation;return e&&(i=ir(nr(e),i)),this.loadFile(i)}}},t.startWith=function(e,t){return!!e&&e.substr(0,t.length)===t},t.withContent=function(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)},e}(),sr=or;or.default=or;var ar=Nt.SourceMapConsumer,cr=Nt.SourceMapGenerator,lr=Nt.fileURLToPath,ur=Nt.pathToFileURL,hr=Nt.isAbsolute,dr=Nt.resolve,pr=Xt,fr=Nt,mr=Bt,gr=sr,yr=Symbol("fromOffsetCache"),vr=Boolean(ar&&cr),br=Boolean(dr&&hr),wr=function(){function e(e,t){if(void 0===t&&(t={}),null==e||"object"===(void 0===e?"undefined":xe(e))&&!e.toString)throw new Error("PostCSS received "+e+" instead of CSS string");if(this.css=e.toString(),"\ufeff"===this.css[0]||"๏ฟพ"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!br||/^\w+:\/\//.test(t.from)||hr(t.from)?this.file=t.from:this.file=dr(t.from)),br&&vr){var r=new gr(this.css,t);if(r.text){this.map=r;var n=r.consumer().file;!this.file&&n&&(this.file=this.mapResolve(n))}}this.file||(this.id="<input css "+pr(6)+">"),this.map&&(this.map.file=this.from)}var t=e.prototype;return t.error=function(e,t,r,n){var i,o,s;if(void 0===n&&(n={}),t&&"object"===(void 0===t?"undefined":xe(t))){var a=t,c=r;if("number"==typeof a.offset){var l=this.fromOffset(a.offset);t=l.line,r=l.col}else t=a.line,r=a.column;if("number"==typeof c.offset){var u=this.fromOffset(c.offset);o=u.line,s=u.col}else o=c.line,s=c.column}else if(!r){var h=this.fromOffset(t);t=h.line,r=h.col}var d=this.origin(t,r,o,s);return(i=d?new mr(e,void 0===d.endLine?d.line:{column:d.column,line:d.line},void 0===d.endLine?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,n.plugin):new mr(e,void 0===o?t:{column:r,line:t},void 0===o?r:{column:s,line:o},this.css,this.file,n.plugin)).input={column:r,endColumn:s,endLine:o,line:t,source:this.css},this.file&&(ur&&(i.input.url=ur(this.file).toString()),i.input.file=this.file),i},t.fromOffset=function(e){var t;if(this[yr])t=this[yr];else{var r=this.css.split("\n");t=new Array(r.length);for(var n=0,i=0,o=r.length;i<o;i++)t[i]=n,n+=r[i].length+1;this[yr]=t}var s=0;if(e>=t[t.length-1])s=t.length-1;else for(var a,c=t.length-2;s<c;)if(e<t[a=s+(c-s>>1)])c=a-1;else{if(!(e>=t[a+1])){s=a;break}s=a+1}return{col:e-t[s]+1,line:s+1}},t.mapResolve=function(e){return/^\w+:\/\//.test(e)?e:dr(this.map.consumer().sourceRoot||this.map.root||".",e)},t.origin=function(e,t,r,n){if(!this.map)return!1;var i,o,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof r&&(i=s.originalPositionFor({column:n,line:r})),o=hr(a.source)?ur(a.source):new URL(a.source,this.map.consumer().sourceRoot||ur(this.map.mapFile));var c={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:o.toString()};if("file:"===o.protocol){if(!lr)throw new Error("file: protocol is not available in this PostCSS build");c.file=lr(o)}var l=s.sourceContentFor(a.source);return l&&(c.source=l),c},t.toJSON=function(){for(var e={},t=0,r=["hasBOM","css","file","id"];t<r.length;t++){var n=r[t];null!=this[n]&&(e[n]=this[n])}return this.map&&(e.map=me({},this.map),e.map.consumerCache&&(e.map.consumerCache=void 0)),e},fe(e,[{key:"from",get:function(){return this.file||this.id}}]),e}(),xr=wr;wr.default=wr,fr&&fr.registerInput&&fr.registerInput(wr);var kr=Nt.SourceMapConsumer,_r=Nt.SourceMapGenerator,Sr=Nt.dirname,Cr=Nt.relative,Ir=Nt.resolve,Er=Nt.sep,Ar=Nt.pathToFileURL,Mr=xr,Nr=Boolean(kr&&_r),Pr=Boolean(Sr&&Ir&&Cr&&Er),Tr=function(){function e(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}var t=e.prototype;return t.addAnnotation=function(){var e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";var t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"},t.applyPrevMaps=function(){for(var e,t=Se(this.previous());!(e=t()).done;){var r=e.value,n=this.toUrl(this.path(r.file)),i=r.root||Sr(r.file),o=void 0;!1===this.mapOpts.sourcesContent?(o=new kr(r.text)).sourcesContent&&(o.sourcesContent=null):o=r.consumer(),this.map.applySourceMap(o,n,this.toUrl(this.path(i)))}},t.clearAnnotation=function(){if(!1!==this.mapOpts.annotation)if(this.root)for(var e,t=this.root.nodes.length-1;t>=0;t--)"comment"===(e=this.root.nodes[t]).type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t);else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))},t.generate=function(){if(this.clearAnnotation(),Pr&&Nr&&this.isMap())return this.generateMap();var e="";return this.stringify(this.root,function(t){e+=t}),[e]},t.generateMap=function(){if(this.root)this.generateString();else if(1===this.previous().length){var e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=_r.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new _r({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]},t.generateString=function(){var e=this;this.css="",this.map=new _r({file:this.outputFile(),ignoreInvalidMapping:!0});var t,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,function(a,c,l){if(e.css+=a,c&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,c.source&&c.source.start?(s.source=e.sourcePath(c),s.original.line=c.source.start.line,s.original.column=c.source.start.column-1,e.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,e.map.addMapping(s))),(t=a.match(/\n/g))?(n+=t.length,r=a.lastIndexOf("\n"),i=a.length-r):i+=a.length,c&&"start"!==l){var u=c.parent||{raws:{}};("decl"===c.type||"atrule"===c.type&&!c.nodes)&&c===u.last&&!u.raws.semicolon||(c.source&&c.source.end?(s.source=e.sourcePath(c),s.original.line=c.source.end.line,s.original.column=c.source.end.column-1,s.generated.line=n,s.generated.column=i-2,e.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,e.map.addMapping(s)))}})},t.isAnnotation=function(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(function(e){return e.annotation}))},t.isInline=function(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;var e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(function(e){return e.inline}))},t.isMap=function(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0},t.isSourcesContent=function(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(function(e){return e.withContent()})},t.outputFile=function(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"},t.path=function(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;var t=this.memoizedPaths.get(e);if(t)return t;var r=this.opts.to?Sr(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(r=Sr(Ir(r,this.mapOpts.annotation)));var n=Cr(r,e);return this.memoizedPaths.set(e,n),n},t.previous=function(){var e=this;if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(function(t){if(t.source&&t.source.input.map){var r=t.source.input.map;e.previousMaps.includes(r)||e.previousMaps.push(r)}});else{var t=new Mr(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps},t.setSourcesContent=function(){var e=this,t={};if(this.root)this.root.walk(function(r){if(r.source){var n=r.source.input.from;if(n&&!t[n]){t[n]=!0;var i=e.usesFileUrls?e.toFileUrl(n):e.toUrl(e.path(n));e.map.setSourceContent(i,r.source.input.css)}}});else if(this.css){var r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}},t.sourcePath=function(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))},t.toBase64=function(e){return I?I.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))},t.toFileUrl=function(e){var t=this.memoizedFileURLs.get(e);if(t)return t;if(Ar){var r=Ar(e).toString();return this.memoizedFileURLs.set(e,r),r}throw new Error("`map.absolute` option is not available in this PostCSS build")},t.toUrl=function(e){var t=this.memoizedURLs.get(e);if(t)return t;"\\"===Er&&(e=e.replace(/\\/g,"/"));var r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r},e}(),Or=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="comment",r}return ye(t,e),t}(Zt),Br=Or;Or.default=Or;var Rr,Lr,jr,Ur,Dr=Rt.isClean,Fr=Rt.my,zr=Jt,qr=Br;function $r(e){return e.map(function(e){return e.nodes&&(e.nodes=$r(e.nodes)),delete e.source,e})}function Wr(e){if(e[Dr]=!1,e.proxyOf.nodes)for(var t,r=Se(e.proxyOf.nodes);!(t=r()).done;){Wr(t.value)}}var Gr=function(e){function t(){return e.apply(this,arguments)||this}ye(t,e);var r=t.prototype;return r.append=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=Se(t);!(n=i()).done;)for(var o,s=n.value,a=Se(this.normalize(s,this.last));!(o=a()).done;){var c=o.value;this.proxyOf.nodes.push(c)}return this.markDirty(),this},r.cleanRaws=function(t){if(e.prototype.cleanRaws.call(this,t),this.nodes)for(var r,n=Se(this.nodes);!(r=n()).done;){r.value.cleanRaws(t)}},r.each=function(e){if(this.proxyOf.nodes){for(var t,r,n=this.getIterator();this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],!1!==(r=e(this.proxyOf.nodes[t],t)));)this.indexes[n]+=1;return delete this.indexes[n],r}},r.every=function(e){return this.nodes.every(e)},r.getIterator=function(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;var e=this.lastEach;return this.indexes[e]=0,e},r.getProxyProcessor=function(){return{get:function(e,t){return"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var o;return(o=e)[t].apply(o,[].concat(n.map(function(e){return"function"==typeof e?function(t,r){return e(t.toProxy(),r)}:e})))}:"every"===t||"some"===t?function(r){return e[t](function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return r.apply(void 0,[].concat([e.toProxy()],n))})}:"root"===t?function(){return e.root().toProxy()}:"nodes"===t?e.nodes.map(function(e){return e.toProxy()}):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t]},set:function(e,t,r){return e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0}}},r.index=function(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))},r.insertAfter=function(e,t){var r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(var o,s=Se(i);!(o=s()).done;){var a=o.value;this.proxyOf.nodes.splice(n+1,0,a)}for(var c in this.indexes)n<(r=this.indexes[c])&&(this.indexes[c]=r+i.length);return this.markDirty(),this},r.insertBefore=function(e,t){var r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(var s,a=Se(o);!(s=a()).done;){var c=s.value;this.proxyOf.nodes.splice(n,0,c)}for(var l in this.indexes)n<=(r=this.indexes[l])&&(this.indexes[l]=r+o.length);return this.markDirty(),this},r.normalize=function(e,r){var n=this;if("string"==typeof e)e=$r(Rr(e).nodes);else if(void 0===e)e=[];else if(Array.isArray(e))for(var i,o=Se(e=e.slice(0));!(i=o()).done;){var s=i.value;s.parent&&s.parent.removeChild(s,"ignore")}else if("root"===e.type&&"document"!==this.type)for(var a,c=Se(e=e.nodes.slice(0));!(a=c()).done;){var l=a.value;l.parent&&l.parent.removeChild(l,"ignore")}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error("Value field is missed in node creation");"string"!=typeof e.value&&(e.value=String(e.value)),e=[new zr(e)]}else if(e.selector)e=[new Lr(e)];else if(e.name)e=[new jr(e)];else{if(!e.text)throw new Error("Unknown node type in node creation");e=[new qr(e)]}return e.map(function(e){return e[Fr]||t.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[Dr]&&Wr(e),void 0===e.raws.before&&r&&void 0!==r.raws.before&&(e.raws.before=r.raws.before.replace(/\S/g,"")),e.parent=n.proxyOf,e})},r.prepend=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=Se(t=t.reverse());!(n=i()).done;){for(var o,s=n.value,a=this.normalize(s,this.first,"prepend").reverse(),c=Se(a);!(o=c()).done;){var l=o.value;this.proxyOf.nodes.unshift(l)}for(var u in this.indexes)this.indexes[u]=this.indexes[u]+a.length}return this.markDirty(),this},r.push=function(e){return e.parent=this,this.proxyOf.nodes.push(e),this},r.removeAll=function(){for(var e,t=Se(this.proxyOf.nodes);!(e=t()).done;){e.value.parent=void 0}return this.proxyOf.nodes=[],this.markDirty(),this},r.removeChild=function(e){var t;for(var r in e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1),this.indexes)(t=this.indexes[r])>=e&&(this.indexes[r]=t-1);return this.markDirty(),this},r.replaceValues=function(e,t,r){return r||(r=t,t={}),this.walkDecls(function(n){t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this},r.some=function(e){return this.nodes.some(e)},r.walk=function(e){return this.each(function(t,r){var n;try{n=e(t,r)}catch(i){throw t.addToError(i)}return!1!==n&&t.walk&&(n=t.walk(e)),n})},r.walkAtRules=function(e,t){return t?ve(e,RegExp)?this.walk(function(r,n){if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk(function(r,n){if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk(function(e,r){if("atrule"===e.type)return t(e,r)}))},r.walkComments=function(e){return this.walk(function(t,r){if("comment"===t.type)return e(t,r)})},r.walkDecls=function(e,t){return t?ve(e,RegExp)?this.walk(function(r,n){if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk(function(r,n){if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk(function(e,r){if("decl"===e.type)return t(e,r)}))},r.walkRules=function(e,t){return t?ve(e,RegExp)?this.walk(function(r,n){if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk(function(r,n){if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk(function(e,r){if("rule"===e.type)return t(e,r)}))},fe(t,[{key:"first",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}},{key:"last",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}]),t}(Zt);Gr.registerParse=function(e){Rr=e},Gr.registerRule=function(e){Lr=e},Gr.registerAtRule=function(e){jr=e},Gr.registerRoot=function(e){Ur=e};var Hr=Gr;Gr.default=Gr,Gr.rebuild=function(e){"atrule"===e.type?Object.setPrototypeOf(e,jr.prototype):"rule"===e.type?Object.setPrototypeOf(e,Lr.prototype):"decl"===e.type?Object.setPrototypeOf(e,zr.prototype):"comment"===e.type?Object.setPrototypeOf(e,qr.prototype):"root"===e.type&&Object.setPrototypeOf(e,Ur.prototype),e[Fr]=!0,e.nodes&&e.nodes.forEach(function(e){Gr.rebuild(e)})};var Vr,Kr,Zr=function(e){function t(t){var r;return(r=e.call(this,me({type:"document"},t))||this).nodes||(r.nodes=[]),r}return ye(t,e),t.prototype.toResult=function(e){return void 0===e&&(e={}),new Vr(new Kr,this,e).stringify()},t}(Hr);Zr.registerLazyResult=function(e){Vr=e},Zr.registerProcessor=function(e){Kr=e};var Yr=Zr;Zr.default=Zr;var Jr=function(){function e(e,t){if(void 0===t&&(t={}),this.type="warning",this.text=e,t.node&&t.node.source){var r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(var n in t)this[n]=t[n]}return e.prototype.toString=function(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text},e}(),Xr=Jr;Jr.default=Jr;var Qr=Xr,en=function(){function e(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}var t=e.prototype;return t.toString=function(){return this.css},t.warn=function(e,t){void 0===t&&(t={}),t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);var r=new Qr(e,t);return this.messages.push(r),r},t.warnings=function(){return this.messages.filter(function(e){return"warning"===e.type})},fe(e,[{key:"content",get:function(){return this.css}}]),e}(),tn=en;en.default=en;var rn="'".charCodeAt(0),nn='"'.charCodeAt(0),on="\\".charCodeAt(0),sn="/".charCodeAt(0),an="\n".charCodeAt(0),cn=" ".charCodeAt(0),ln="\f".charCodeAt(0),un="\t".charCodeAt(0),hn="\r".charCodeAt(0),dn="[".charCodeAt(0),pn="]".charCodeAt(0),fn="(".charCodeAt(0),mn=")".charCodeAt(0),gn="{".charCodeAt(0),yn="}".charCodeAt(0),vn=";".charCodeAt(0),bn="*".charCodeAt(0),wn=":".charCodeAt(0),xn="@".charCodeAt(0),kn=/[\t\n\f\r "#'()/;[\\\]{}]/g,_n=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Sn=/.[\r\n"'(/\\]/,Cn=/[\da-f]/i,In=Hr,En=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="atrule",r}ye(t,e);var r=t.prototype;return r.append=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i;return this.proxyOf.nodes||(this.nodes=[]),(i=e.prototype.append).call.apply(i,[].concat([this],r))},r.prepend=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i;return this.proxyOf.nodes||(this.nodes=[]),(i=e.prototype.prepend).call.apply(i,[].concat([this],r))},t}(In),An=En;En.default=En,In.registerAtRule(En);var Mn,Nn,Pn=Hr,Tn=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="root",r.nodes||(r.nodes=[]),r}ye(t,e);var r=t.prototype;return r.normalize=function(t,r,n){var i=e.prototype.normalize.call(this,t);if(r)if("prepend"===n)this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(var o,s=Se(i);!(o=s()).done;){o.value.raws.before=r.raws.before}return i},r.removeChild=function(t,r){var n=this.index(t);return!r&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),e.prototype.removeChild.call(this,t)},r.toResult=function(e){return void 0===e&&(e={}),new Mn(new Nn,this,e).stringify()},t}(Pn);Tn.registerLazyResult=function(e){Mn=e},Tn.registerProcessor=function(e){Nn=e};var On=Tn;Tn.default=Tn,Pn.registerRoot(Tn);var Bn={comma:function(e){return Bn.split(e,[","],!0)},space:function(e){return Bn.split(e,[" ","\n","\t"])},split:function(e,t,r){for(var n,i=[],o="",s=!1,a=0,c=!1,l="",u=!1,h=Se(e);!(n=h()).done;){var d=n.value;u?u=!1:"\\"===d?u=!0:c?d===l&&(c=!1):'"'===d||"'"===d?(c=!0,l=d):"("===d?a+=1:")"===d?a>0&&(a-=1):0===a&&t.includes(d)&&(s=!0),s?(""!==o&&i.push(o.trim()),o="",s=!1):o+=d}return(r||""!==o)&&i.push(o.trim()),i}},Rn=Bn;Bn.default=Bn;var Ln=Hr,jn=Rn,Un=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="rule",r.nodes||(r.nodes=[]),r}return ye(t,e),fe(t,[{key:"selectors",get:function(){return jn.comma(this.selector)},set:function(e){var t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}]),t}(Ln),Dn=Un;Un.default=Un,Ln.registerRule(Un);var Fn=Jt,zn=function(e,t){void 0===t&&(t={});var r,n,i,o,s,a,c,l,u,h,d=e.css.valueOf(),p=t.ignoreErrors,f=d.length,m=0,g=[],y=[];function v(t){throw e.error("Unclosed "+t,m)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&m>=f},nextToken:function(e){if(y.length)return y.pop();if(!(m>=f)){var t=!!e&&e.ignoreUnclosed;switch(r=d.charCodeAt(m)){case an:case cn:case un:case hn:case ln:n=m;do{n+=1,r=d.charCodeAt(n)}while(r===cn||r===an||r===un||r===hn||r===ln);h=["space",d.slice(m,n)],m=n-1;break;case dn:case pn:case gn:case yn:case wn:case vn:case mn:var b=String.fromCharCode(r);h=[b,b,m];break;case fn:if(l=g.length?g.pop()[1]:"",u=d.charCodeAt(m+1),"url"===l&&u!==rn&&u!==nn&&u!==cn&&u!==an&&u!==un&&u!==ln&&u!==hn){n=m;do{if(a=!1,-1===(n=d.indexOf(")",n+1))){if(p||t){n=m;break}v("bracket")}for(c=n;d.charCodeAt(c-1)===on;)c-=1,a=!a}while(a);h=["brackets",d.slice(m,n+1),m,n],m=n}else n=d.indexOf(")",m+1),o=d.slice(m,n+1),-1===n||Sn.test(o)?h=["(","(",m]:(h=["brackets",o,m,n],m=n);break;case rn:case nn:i=r===rn?"'":'"',n=m;do{if(a=!1,-1===(n=d.indexOf(i,n+1))){if(p||t){n=m+1;break}v("string")}for(c=n;d.charCodeAt(c-1)===on;)c-=1,a=!a}while(a);h=["string",d.slice(m,n+1),m,n],m=n;break;case xn:kn.lastIndex=m+1,kn.test(d),n=0===kn.lastIndex?d.length-1:kn.lastIndex-2,h=["at-word",d.slice(m,n+1),m,n],m=n;break;case on:for(n=m,s=!0;d.charCodeAt(n+1)===on;)n+=1,s=!s;if(r=d.charCodeAt(n+1),s&&r!==sn&&r!==cn&&r!==an&&r!==un&&r!==hn&&r!==ln&&(n+=1,Cn.test(d.charAt(n)))){for(;Cn.test(d.charAt(n+1));)n+=1;d.charCodeAt(n+1)===cn&&(n+=1)}h=["word",d.slice(m,n+1),m,n],m=n;break;default:r===sn&&d.charCodeAt(m+1)===bn?(0===(n=d.indexOf("*/",m+2)+1)&&(p||t?n=d.length:v("comment")),h=["comment",d.slice(m,n+1),m,n],m=n):(_n.lastIndex=m+1,_n.test(d),n=0===_n.lastIndex?d.length-1:_n.lastIndex-2,h=["word",d.slice(m,n+1),m,n],g.push(h),m=n)}return m++,h}},position:function(){return m}}},qn=Br,$n=An,Wn=On,Gn=Dn,Hn={empty:!0,space:!0};var Vn=function(){function e(e){this.input=e,this.root=new Wn,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}var t=e.prototype;return t.atrule=function(e){var t,r,n,i=new $n;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);for(var o=!1,s=!1,a=[],c=[];!this.tokenizer.endOfFile();){if("("===(t=(e=this.tokenizer.nextToken())[0])||"["===t?c.push("("===t?")":"]"):"{"===t&&c.length>0?c.push("}"):t===c[c.length-1]&&c.pop(),0===c.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(r=a[n=a.length-1];r&&"space"===r[0];)r=a[--n];r&&(i.source.end=this.getPosition(r[3]||r[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),o&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),s&&(i.nodes=[],this.current=i)},t.checkMissedSemicolon=function(e){var t=this.colon(e);if(!1!==t){for(var r,n=0,i=t-1;i>=0&&("space"===(r=e[i])[0]||2!==(n+=1));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}},t.colon=function(e){for(var t,r,n,i,o=0,s=Se(e.entries());!(i=s()).done;){var a=i.value,c=a[0];if("("===(r=(t=a[1])[0])&&(o+=1),")"===r&&(o-=1),0===o&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return c}this.doubleColon(t)}n=t}return!1},t.comment=function(e){var t=new qn;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;var r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{var n=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=n[2],t.raws.left=n[1],t.raws.right=n[3]}},t.createTokenizer=function(){this.tokenizer=zn(this.input)},t.decl=function(e,t){var r=new Fn;this.init(r,e[0][2]);var n,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||function(e){for(var t=e.length-1;t>=0;t--){var r=e[t],n=r[3]||r[2];if(n)return n}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){var o=e[0][0];if(":"===o||"space"===o||"comment"===o)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(":"===(n=e.shift())[0]){r.raws.between+=n[1];break}"word"===n[0]&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));for(var s,a=[];e.length&&("space"===(s=e[0][0])||"comment"===s);)a.push(e.shift());this.precheckMissedSemicolon(e);for(var c=e.length-1;c>=0;c--){if("!important"===(n=e[c])[1].toLowerCase()){r.important=!0;var l=this.stringFrom(e,c);" !important"!==(l=this.spacesFromEnd(e)+l)&&(r.raws.important=l);break}if("important"===n[1].toLowerCase()){for(var u=e.slice(0),h="",d=c;d>0;d--){var p=u[d][0];if(0===h.trim().indexOf("!")&&"space"!==p)break;h=u.pop()[1]+h}0===h.trim().indexOf("!")&&(r.important=!0,r.raws.important=h,e=u)}if("space"!==n[0]&&"comment"!==n[0])break}e.some(function(e){return"space"!==e[0]&&"comment"!==e[0]})&&(r.raws.between+=a.map(function(e){return e[1]}).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)},t.doubleColon=function(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})},t.emptyRule=function(e){var t=new Gn;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t},t.end=function(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)},t.endFile=function(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())},t.freeSemicolon=function(e){if(this.spaces+=e[1],this.current.nodes){var t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}},t.getPosition=function(e){var t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}},t.init=function(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)},t.other=function(e){for(var t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],c=e;c;){if(r=c[0],a.push(c),"("===r||"["===r)i||(i=c),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=c),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&("space"===(c=a[a.length-1][0])||"comment"===c);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)},t.parse=function(){for(var e;!this.tokenizer.endOfFile();)switch((e=this.tokenizer.nextToken())[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()},t.precheckMissedSemicolon=function(){},t.raw=function(e,t,r,n){for(var i,o,s,a,c=r.length,l="",u=!0,h=0;h<c;h+=1)"space"!==(o=(i=r[h])[0])||h!==c-1||n?"comment"===o?(a=r[h-1]?r[h-1][0]:"empty",s=r[h+1]?r[h+1][0]:"empty",Hn[a]||Hn[s]||","===l.slice(-1)?u=!1:l+=i[1]):l+=i[1]:u=!1;if(!u){var d=r.reduce(function(e,t){return e+t[1]},"");e.raws[t]={raw:d,value:l}}e[t]=l},t.rule=function(e){e.pop();var t=new Gn;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t},t.spacesAndCommentsFromEnd=function(e){for(var t,r="";e.length&&("space"===(t=e[e.length-1][0])||"comment"===t);)r=e.pop()[1]+r;return r},t.spacesAndCommentsFromStart=function(e){for(var t,r="";e.length&&("space"===(t=e[0][0])||"comment"===t);)r+=e.shift()[1];return r},t.spacesFromEnd=function(e){for(var t="";e.length&&"space"===e[e.length-1][0];)t=e.pop()[1]+t;return t},t.stringFrom=function(e,t){for(var r="",n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r},t.unclosedBlock=function(){var e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)},t.unclosedBracket=function(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})},t.unexpectedClose=function(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})},t.unknownWord=function(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})},t.unnamedAtrule=function(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})},e}(),Kn=Hr,Zn=Vn,Yn=xr;function Jn(e,t){var r=new Yn(e,t),n=new Zn(r);try{n.parse()}catch(i){throw i}return n.root}var Xn=Jn;Jn.default=Jn,Kn.registerParse(Jn);var Qn=Rt.isClean,ei=Rt.my,ti=Tr,ri=zt,ni=Hr,ii=Yr,oi=tn,si=Xn,ai=On,ci={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},li={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},ui={Once:!0,postcssPlugin:!0,prepare:!0};function hi(e){return"object"===(void 0===e?"undefined":xe(e))&&"function"==typeof e.then}function di(e){var t=!1,r=ci[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function pi(e){return{eventIndex:0,events:"document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:di(e),iterator:0,node:e,visitorIndex:0,visitors:[]}}function fi(e){return e[Qn]=!1,e.nodes&&e.nodes.forEach(function(e){return fi(e)}),e}var mi={},gi=function(){function e(t,r,n){var i,o=this;if(this.stringified=!1,this.processed=!1,"object"!==(void 0===r?"undefined":xe(r))||null===r||"root"!==r.type&&"document"!==r.type)if(ve(r,e)||ve(r,oi))i=fi(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{var s=si;n.syntax&&(s=n.syntax.parse),n.parser&&(s=n.parser),s.parse&&(s=s.parse);try{i=s(r,n)}catch(uh){this.processed=!0,this.error=uh}i&&!i[ei]&&ni.rebuild(i)}else i=fi(r);this.result=new oi(t,i,n),this.helpers=me({},mi,{postcss:mi,result:this.result}),this.plugins=this.processor.plugins.map(function(e){return"object"===(void 0===e?"undefined":xe(e))&&e.prepare?me({},e,e.prepare(o.result)):e})}var t=e.prototype;return t.async=function(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)},t.catch=function(e){return this.async().catch(e)},t.finally=function(e){return this.async().then(e,e)},t.getAsyncError=function(){throw new Error("Use process(css).then(cb) to work with async plugins")},t.handleError=function(e,t){var r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion){0}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(n){console&&console.error&&console.error(n)}return e},t.prepareVisitors=function(){var e=this;this.listeners={};for(var t,r=function(t,r,n){e.listeners[r]||(e.listeners[r]=[]),e.listeners[r].push([t,n])},n=Se(this.plugins);!(t=n()).done;){var i=t.value;if("object"===(void 0===i?"undefined":xe(i)))for(var o in i){if(!li[o]&&/^[A-Z]/.test(o))throw new Error("Unknown event "+o+" in "+i.postcssPlugin+". Try to update PostCSS ("+this.processor.version+" now).");if(!ui[o])if("object"===xe(i[o]))for(var s in i[o])r(i,"*"===s?o:o+"-"+s.toLowerCase(),i[o][s]);else"function"==typeof i[o]&&r(i,o,i[o])}}this.hasListener=Object.keys(this.listeners).length>0},t.runAsync=function(){var e=this;return de(function(){var t,r,n,i,o,s,a,c,l,u,h,d;return Ce(this,function(p){switch(p.label){case 0:e.plugin=0,t=0,p.label=1;case 1:if(!(t<e.plugins.length))return[3,6];if(r=e.plugins[t],!hi(n=e.runOnRoot(r)))return[3,5];p.label=2;case 2:return p.trys.push([2,4,,5]),[4,n];case 3:return p.sent(),[3,5];case 4:throw i=p.sent(),e.handleError(i);case 5:return t++,[3,1];case 6:if(e.prepareVisitors(),!e.hasListener)return[3,18];o=e.result.root,p.label=7;case 7:if(o[Qn])return[3,14];o[Qn]=!0,s=[pi(o)],p.label=8;case 8:if(!(s.length>0))return[3,13];if(!hi(a=e.visitTick(s)))return[3,12];p.label=9;case 9:return p.trys.push([9,11,,12]),[4,a];case 10:return p.sent(),[3,12];case 11:throw c=p.sent(),l=s[s.length-1].node,e.handleError(c,l);case 12:return[3,8];case 13:return[3,7];case 14:if(!e.listeners.OnceExit)return[3,18];u=function(){var t,r,n,i,s;return Ce(this,function(a){switch(a.label){case 0:t=d.value,r=t[0],n=t[1],e.result.lastPlugin=r,a.label=1;case 1:return a.trys.push([1,6,,7]),"document"!==o.type?[3,3]:(i=o.nodes.map(function(t){return n(t,e.helpers)}),[4,Promise.all(i)]);case 2:return a.sent(),[3,5];case 3:return[4,n(o,e.helpers)];case 4:a.sent(),a.label=5;case 5:return[3,7];case 6:throw s=a.sent(),e.handleError(s);case 7:return[2]}})},h=Se(e.listeners.OnceExit),p.label=15;case 15:return(d=h()).done?[3,18]:[5,Ie(u())];case 16:p.sent(),p.label=17;case 17:return[3,15];case 18:return e.processed=!0,[2,e.stringify()]}})})()},t.runOnRoot=function(e){var t=this;this.result.lastPlugin=e;try{if("object"===(void 0===e?"undefined":xe(e))&&e.Once){if("document"===this.result.root.type){var r=this.result.root.nodes.map(function(r){return e.Once(r,t.helpers)});return hi(r[0])?Promise.all(r):r}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(uh){throw this.handleError(uh)}},t.stringify=function(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();var e=this.result.opts,t=ri;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);var r=new ti(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[1],this.result},t.sync=function(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(var e,t=Se(this.plugins);!(e=t()).done;){var r=e.value;if(hi(this.runOnRoot(r)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){for(var n=this.result.root;!n[Qn];)n[Qn]=!0,this.walkSync(n);if(this.listeners.OnceExit)if("document"===n.type)for(var i,o=Se(n.nodes);!(i=o()).done;){var s=i.value;this.visitSync(this.listeners.OnceExit,s)}else this.visitSync(this.listeners.OnceExit,n)}return this.result},t.then=function(e,t){return this.async().then(e,t)},t.toString=function(){return this.css},t.visitSync=function(e,t){for(var r,n=Se(e);!(r=n()).done;){var i=r.value,o=i[0],s=i[1];this.result.lastPlugin=o;var a=void 0;try{a=s(t,this.helpers)}catch(c){throw this.handleError(c,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(hi(a))throw this.getAsyncError()}},t.visitTick=function(e){var t=e[e.length-1],r=t.node,n=t.visitors;if("root"===r.type||"document"===r.type||r.parent){if(n.length>0&&t.visitorIndex<n.length){var i=n[t.visitorIndex],o=i[0],s=i[1];t.visitorIndex+=1,t.visitorIndex===n.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return s(r.toProxy(),this.helpers)}catch(h){throw this.handleError(h,r)}}if(0!==t.iterator){for(var a,c=t.iterator;a=r.nodes[r.indexes[c]];)if(r.indexes[c]+=1,!a[Qn])return a[Qn]=!0,void e.push(pi(a));t.iterator=0,delete r.indexes[c]}for(var l=t.events;t.eventIndex<l.length;){var u=l[t.eventIndex];if(t.eventIndex+=1,0===u)return void(r.nodes&&r.nodes.length&&(r[Qn]=!0,t.iterator=r.getIterator()));if(this.listeners[u])return void(t.visitors=this.listeners[u])}e.pop()}else e.pop()},t.walkSync=function(e){var t=this;e[Qn]=!0;for(var r,n=Se(di(e));!(r=n()).done;){var i=r.value;if(0===i)e.nodes&&e.each(function(e){e[Qn]||t.walkSync(e)});else{var o=this.listeners[i];if(o&&this.visitSync(o,e.toProxy()))return}}},t.warnings=function(){return this.sync().warnings()},fe(e,[{key:"content",get:function(){return this.stringify().content}},{key:"css",get:function(){return this.stringify().css}},{key:"map",get:function(){return this.stringify().map}},{key:"messages",get:function(){return this.sync().messages}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){return this.sync().root}},{key:Symbol.toStringTag,get:function(){return"LazyResult"}}]),e}();gi.registerPostcss=function(e){mi=e};var yi=gi;gi.default=gi,ai.registerLazyResult(gi),ii.registerLazyResult(gi);var vi=Tr,bi=zt,wi=Xn,xi=tn,ki=function(){function e(e,t,r){var n;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;var i=bi;this.result=new xi(this._processor,n,this._opts),this.result.css=t;var o=this;Object.defineProperty(this.result,"root",{get:function(){return o.root}});var s=new vi(i,n,this._opts,t);if(s.isMap()){var a=s.generate(),c=a[0],l=a[1];c&&(this.result.css=c),l&&(this.result.map=l)}else s.clearAnnotation(),this.result.css=s.css}var t=e.prototype;return t.async=function(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)},t.catch=function(e){return this.async().catch(e)},t.finally=function(e){return this.async().then(e,e)},t.sync=function(){if(this.error)throw this.error;return this.result},t.then=function(e,t){return this.async().then(e,t)},t.toString=function(){return this._css},t.warnings=function(){return[]},fe(e,[{key:"content",get:function(){return this.result.css}},{key:"css",get:function(){return this.result.css}},{key:"map",get:function(){return this.result.map}},{key:"messages",get:function(){return[]}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){if(this._root)return this._root;var e,t=wi;try{e=t(this._css,this._opts)}catch(uh){this.error=uh}if(this.error)throw this.error;return this._root=e,e}},{key:Symbol.toStringTag,get:function(){return"NoWorkResult"}}]),e}(),_i=ki;ki.default=ki;var Si=_i,Ci=yi,Ii=Yr,Ei=On,Ai=function(){function e(e){void 0===e&&(e=[]),this.version="8.4.38",this.plugins=this.normalize(e)}var t=e.prototype;return t.normalize=function(e){for(var t,r=[],n=Se(e);!(t=n()).done;){var i=t.value;if(!0===i.postcss?i=i():i.postcss&&(i=i.postcss),"object"===(void 0===i?"undefined":xe(i))&&Array.isArray(i.plugins))r=r.concat(i.plugins);else if("object"===(void 0===i?"undefined":xe(i))&&i.postcssPlugin)r.push(i);else if("function"==typeof i)r.push(i);else if("object"!==(void 0===i?"undefined":xe(i))||!i.parse&&!i.stringify)throw new Error(i+" is not a PostCSS plugin")}return r},t.process=function(e,t){return void 0===t&&(t={}),this.plugins.length||t.parser||t.stringifier||t.syntax?new Ci(this,e,t):new Si(this,e,t)},t.use=function(e){return this.plugins=this.plugins.concat(this.normalize([e])),this},e}(),Mi=Ai;Ai.default=Ai,Ei.registerProcessor(Ai),Ii.registerProcessor(Ai);var Ni=Jt,Pi=sr,Ti=Br,Oi=An,Bi=xr,Ri=On,Li=Dn;function ji(e,t){if(Array.isArray(e))return e.map(function(e){return ji(e)});var r=e.inputs,n=be(e,["inputs"]);if(r){t=[];for(var i,o=Se(r);!(i=o()).done;){var s=me({},i.value,{__proto__:Bi.prototype});s.map&&(s.map=me({},s.map,{__proto__:Pi.prototype})),t.push(s)}}if(n.nodes&&(n.nodes=e.nodes.map(function(e){return ji(e,t)})),n.source){var a=n.source,c=a.inputId,l=be(a,["inputId"]);n.source=l,null!=c&&(n.source.input=t[c])}if("root"===n.type)return new Ri(n);if("decl"===n.type)return new Ni(n);if("rule"===n.type)return new Li(n);if("comment"===n.type)return new Ti(n);if("atrule"===n.type)return new Oi(n);throw new Error("Unknown node type: "+e.type)}var Ui=ji;ji.default=ji;var Di=Bt,Fi=Jt,zi=yi,qi=Hr,$i=Mi,Wi=zt,Gi=Ui,Hi=Yr,Vi=Xr,Ki=Br,Zi=An,Yi=tn,Ji=xr,Xi=Xn,Qi=Rn,eo=Dn,to=On,ro=Zt;function no(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 1===t.length&&Array.isArray(t[0])&&(t=t[0]),new $i(t)}no.plugin=function(e,t){var r,n=!1;function i(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),ae.env.LANG&&ae.env.LANG.startsWith("cn")&&console.warn(e+": ้‡Œ้ข postcss.plugin ่ขซๅผƒ็”จ. ่ฟ็งปๆŒ‡ๅ—:\nhttps://www.w3ctech.com/topic/2226"));var s=t.apply(void 0,[].concat(i));return s.postcssPlugin=e,s.postcssVersion=(new $i).version,s}return Object.defineProperty(i,"postcss",{get:function(){return r||(r=i()),r}}),i.process=function(e,t,r){return no([i(r)]).process(e,t)},i},no.stringify=Wi,no.parse=Xi,no.fromJSON=Gi,no.list=Qi,no.comment=function(e){return new Ki(e)},no.atRule=function(e){return new Zi(e)},no.decl=function(e){return new Fi(e)},no.rule=function(e){return new eo(e)},no.root=function(e){return new to(e)},no.document=function(e){return new Hi(e)},no.CssSyntaxError=Di,no.Declaration=Fi,no.Container=qi,no.Processor=$i,no.Document=Hi,no.Comment=Ki,no.Warning=Vi,no.AtRule=Zi,no.Result=Yi,no.Input=Ji,no.Rule=eo,no.Root=to,no.Node=ro,zi.registerPostcss(no);var io=no;no.default=no;var oo=St(io);oo.stringify,oo.fromJSON,oo.plugin,oo.parse,oo.list,oo.document,oo.comment,oo.atRule,oo.rule,oo.decl,oo.root,oo.CssSyntaxError,oo.Declaration,oo.Container,oo.Processor,oo.Document,oo.Comment,oo.Warning,oo.AtRule,oo.Result,oo.Input,oo.Rule,oo.Root,oo.Node;var so=Object.defineProperty,ao=function(e,t,r){return function(e,t,r){return t in e?so(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r}(e,"symbol"!==(void 0===t?"undefined":xe(t))?t+"":t,r)};function co(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function lo(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return ve(this,e)?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var uo={exports:{}},ho=String,po=function(){return{isColorSupported:!1,reset:ho,bold:ho,dim:ho,italic:ho,underline:ho,inverse:ho,hidden:ho,strikethrough:ho,black:ho,red:ho,green:ho,yellow:ho,blue:ho,magenta:ho,cyan:ho,white:ho,gray:ho,bgBlack:ho,bgRed:ho,bgGreen:ho,bgYellow:ho,bgBlue:ho,bgMagenta:ho,bgCyan:ho,bgWhite:ho}};uo.exports=po(),uo.exports.createColors=po;var fo=uo.exports,mo=lo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),go=fo,yo=mo,vo=function(e){function t(r,n,i,o,s,a){var c;return(c=e.call(this,r)||this).name="CssSyntaxError",c.reason=r,s&&(c.file=s),o&&(c.source=o),a&&(c.plugin=a),void 0!==n&&void 0!==i&&("number"==typeof n?(c.line=n,c.column=i):(c.line=n.line,c.column=n.column,c.endLine=i.line,c.endColumn=i.column)),c.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(c,t),c}ye(t,e);var r=t.prototype;return r.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},r.showSourceCode=function(e){var t=this;if(!this.source)return"";var r=this.source;null==e&&(e=go.isColorSupported),yo&&e&&(r=yo(r));var n,i,o=r.split(/\r?\n/),s=Math.max(this.line-3,0),a=Math.min(this.line+2,o.length),c=String(a).length;if(e){var l=go.createColors(!0),u=l.bold,h=l.gray,d=l.red;n=function(e){return u(d(e))},i=function(e){return h(e)}}else n=i=function(e){return e};return o.slice(s,a).map(function(e,r){var o=s+1+r,a=" "+(" "+o).slice(-c)+" | ";if(o===t.line){var l=i(a.replace(/\d/g," "))+e.slice(0,t.column-1).replace(/[^\t]/g," ");return n(">")+i(a)+e+"\n "+l+n("^")}return" "+i(a)+e}).join("\n")},r.toString=function(){var e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e},t}(ke(Error)),bo=vo;vo.default=vo;var wo={};wo.isClean=Symbol("isClean"),wo.my=Symbol("my");var xo={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var ko=function(){function e(e){this.builder=e}var t=e.prototype;return t.atrule=function(e,t){var r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{var i=(e.raws.between||"")+(t?";":"");this.builder(r+n+i,e)}},t.beforeAfter=function(e,t){var r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");for(var n=e.parent,i=0;n&&"root"!==n.type;)i+=1,n=n.parent;if(r.includes("\n")){var o=this.raw(e,null,"indent");if(o.length)for(var s=0;s<i;s++)r+=o}return r},t.block=function(e,t){var r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")},t.body=function(e){for(var t=e.nodes.length-1;t>0&&"comment"===e.nodes[t].type;)t-=1;for(var r=this.raw(e,"semicolon"),n=0;n<e.nodes.length;n++){var i=e.nodes[n],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,t!==n||r)}},t.comment=function(e){var t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)},t.decl=function(e,t){var r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)},t.document=function(e){this.body(e)},t.raw=function(e,t,r){var n;if(r||(r=t),t&&void 0!==(n=e.raws[t]))return n;var i=e.parent;if("before"===r){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return xo[r];var o=e.root();if(o.rawCache||(o.rawCache={}),void 0!==o.rawCache[r])return o.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(e,r);var s,a="raw"+((s=r)[0].toUpperCase()+s.slice(1));return this[a]?n=this[a](o,e):o.walk(function(e){if(void 0!==(n=e.raws[t]))return!1}),void 0===n&&(n=xo[r]),o.rawCache[r]=n,n},t.rawBeforeClose=function(e){var t;return e.walk(function(e){if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return(t=e.raws.after).includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t},t.rawBeforeComment=function(e,t){var r;return e.walkComments(function(e){if(void 0!==e.raws.before)return(r=e.raws.before).includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r},t.rawBeforeDecl=function(e,t){var r;return e.walkDecls(function(e){if(void 0!==e.raws.before)return(r=e.raws.before).includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r},t.rawBeforeOpen=function(e){var t;return e.walk(function(e){if("decl"!==e.type&&void 0!==(t=e.raws.between))return!1}),t},t.rawBeforeRule=function(e){var t;return e.walk(function(r){if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return(t=r.raws.before).includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t},t.rawColon=function(e){var t;return e.walkDecls(function(e){if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t},t.rawEmptyBody=function(e){var t;return e.walk(function(e){if(e.nodes&&0===e.nodes.length&&void 0!==(t=e.raws.after))return!1}),t},t.rawIndent=function(e){return e.raws.indent?e.raws.indent:(e.walk(function(r){var n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){var i=r.raws.before.split("\n");return t=(t=i[i.length-1]).replace(/\S/g,""),!1}}),t);var t},t.rawSemicolon=function(e){var t;return e.walk(function(e){if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&void 0!==(t=e.raws.semicolon))return!1}),t},t.rawValue=function(e,t){var r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r},t.root=function(e){this.body(e),e.raws.after&&this.builder(e.raws.after)},t.rule=function(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")},t.stringify=function(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)},e}(),_o=ko;ko.default=ko;var So=_o;function Co(e,t){new So(t).stringify(e)}var Io=Co;Co.default=Co;var Eo=wo.isClean,Ao=wo.my,Mo=bo,No=_o,Po=Io;function To(e,t){var r=new e.constructor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&"proxyCache"!==n){var i=e[n],o=void 0===i?"undefined":xe(i);"parent"===n&&"object"===o?t&&(r[n]=t):"source"===n?r[n]=i:Array.isArray(i)?r[n]=i.map(function(e){return To(e,r)}):("object"===o&&null!==i&&(i=To(i)),r[n]=i)}return r}var Oo=function(){function e(e){for(var t in void 0===e&&(e={}),this.raws={},this[Eo]=!1,this[Ao]=!0,e)if("nodes"===t){this.nodes=[];for(var r,n=Se(e[t]);!(r=n()).done;){var i=r.value;"function"==typeof i.clone?this.append(i.clone()):this.append(i)}}else this[t]=e[t]}var t=e.prototype;return t.addToError=function(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){var t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,"$&"+t.input.from+":"+t.start.line+":"+t.start.column+"$&")}return e},t.after=function(e){return this.parent.insertAfter(this,e),this},t.assign=function(e){for(var t in void 0===e&&(e={}),e)this[t]=e[t];return this},t.before=function(e){return this.parent.insertBefore(this,e),this},t.cleanRaws=function(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between},t.clone=function(e){void 0===e&&(e={});var t=To(this);for(var r in e)t[r]=e[r];return t},t.cloneAfter=function(e){void 0===e&&(e={});var t=this.clone(e);return this.parent.insertAfter(this,t),t},t.cloneBefore=function(e){void 0===e&&(e={});var t=this.clone(e);return this.parent.insertBefore(this,t),t},t.error=function(e,t){if(void 0===t&&(t={}),this.source){var r=this.rangeBy(t),n=r.end,i=r.start;return this.source.input.error(e,{column:i.column,line:i.line},{column:n.column,line:n.line},t)}return new Mo(e)},t.getProxyProcessor=function(){return{get:function(e,t){return"proxyOf"===t?e:"root"===t?function(){return e.root().toProxy()}:e[t]},set:function(e,t,r){return e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0}}},t.markDirty=function(){if(this[Eo]){this[Eo]=!1;for(var e=this;e=e.parent;)e[Eo]=!1}},t.next=function(){if(this.parent){var e=this.parent.index(this);return this.parent.nodes[e+1]}},t.positionBy=function(e,t){var r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){var n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r},t.positionInside=function(e,t){for(var r=t||this.toString(),n=this.source.start.column,i=this.source.start.line,o=0;o<e;o++)"\n"===r[o]?(n=1,i+=1):n+=1;return{column:n,line:i}},t.prev=function(){if(this.parent){var e=this.parent.index(this);return this.parent.nodes[e-1]}},t.rangeBy=function(e){var t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){var n=this.toString(),i=n.indexOf(e.word);-1!==i&&(t=this.positionInside(i,n),r=this.positionInside(i+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}},t.raw=function(e,t){return(new No).raw(this,e,t)},t.remove=function(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this},t.replaceWith=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(this.parent){for(var n,i=this,o=!1,s=Se(t);!(n=s()).done;){var a=n.value;a===this?o=!0:o?(this.parent.insertAfter(i,a),i=a):this.parent.insertBefore(i,a)}o||this.remove()}return this},t.root=function(){for(var e=this;e.parent&&"document"!==e.parent.type;)e=e.parent;return e},t.toJSON=function(e,t){var r={},n=null==t;t=t||new Map;var i=0;for(var o in this)if(Object.prototype.hasOwnProperty.call(this,o)&&"parent"!==o&&"proxyCache"!==o){var s=this[o];if(Array.isArray(s))r[o]=s.map(function(e){return"object"===(void 0===e?"undefined":xe(e))&&e.toJSON?e.toJSON(null,t):e});else if("object"===(void 0===s?"undefined":xe(s))&&s.toJSON)r[o]=s.toJSON(null,t);else if("source"===o){var a=t.get(s.input);null==a&&(a=i,t.set(s.input,i),i++),r[o]={end:s.end,inputId:a,start:s.start}}else r[o]=s}return n&&(r.inputs=[].concat(t.keys()).map(function(e){return e.toJSON()})),r},t.toProxy=function(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache},t.toString=function(e){void 0===e&&(e=Po),e.stringify&&(e=e.stringify);var t="";return e(this,function(e){t+=e}),t},t.warn=function(e,t,r){var n={node:this};for(var i in r)n[i]=r[i];return e.warn(t,n)},fe(e,[{key:"proxyOf",get:function(){return this}}]),e}(),Bo=Oo;Oo.default=Oo;var Ro=function(e){function t(t){var r;return t&&void 0!==t.value&&"string"!=typeof t.value&&(t=me({},t,{value:String(t.value)})),(r=e.call(this,t)||this).type="decl",r}return ye(t,e),fe(t,[{key:"variable",get:function(){return this.prop.startsWith("--")||"$"===this.prop[0]}}]),t}(Bo),Lo=Ro;Ro.default=Ro;var jo=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},Uo=mo.SourceMapConsumer,Do=mo.SourceMapGenerator,Fo=mo.existsSync,zo=mo.readFileSync,qo=mo.dirname,$o=mo.join;var Wo=function(){function e(e,t){if(!1!==t.map){this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");var r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=qo(this.mapFile)),n&&(this.text=n)}}var t=e.prototype;return t.consumer=function(){return this.consumerCache||(this.consumerCache=new Uo(this.text)),this.consumerCache},t.decodeInline=function(e){var t;if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),I?I.from(t,"base64").toString():window.atob(t);var r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)},t.getAnnotationURL=function(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()},t.isMap=function(e){return"object"===(void 0===e?"undefined":xe(e))&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))},t.loadAnnotation=function(e){var t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(t){var r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}},t.loadFile=function(e){if(this.root=qo(e),Fo(e))return this.mapFile=e,zo(e,"utf-8").toString().trim()},t.loadMap=function(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(ve(t,Uo))return Do.fromSourceMap(t).toString();if(ve(t,Do))return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}var r=t(e);if(r){var n=this.loadFile(r);if(!n)throw new Error("Unable to load previous source map: "+r.toString());return n}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){var i=this.annotation;return e&&(i=$o(qo(e),i)),this.loadFile(i)}}},t.startWith=function(e,t){return!!e&&e.substr(0,t.length)===t},t.withContent=function(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)},e}(),Go=Wo;Wo.default=Wo;var Ho=mo.SourceMapConsumer,Vo=mo.SourceMapGenerator,Ko=mo.fileURLToPath,Zo=mo.pathToFileURL,Yo=mo.isAbsolute,Jo=mo.resolve,Xo=jo,Qo=mo,es=bo,ts=Go,rs=Symbol("fromOffsetCache"),ns=Boolean(Ho&&Vo),is=Boolean(Jo&&Yo),os=function(){function e(e,t){if(void 0===t&&(t={}),null==e||"object"===(void 0===e?"undefined":xe(e))&&!e.toString)throw new Error("PostCSS received "+e+" instead of CSS string");if(this.css=e.toString(),"\ufeff"===this.css[0]||"๏ฟพ"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!is||/^\w+:\/\//.test(t.from)||Yo(t.from)?this.file=t.from:this.file=Jo(t.from)),is&&ns){var r=new ts(this.css,t);if(r.text){this.map=r;var n=r.consumer().file;!this.file&&n&&(this.file=this.mapResolve(n))}}this.file||(this.id="<input css "+Xo(6)+">"),this.map&&(this.map.file=this.from)}var t=e.prototype;return t.error=function(e,t,r,n){var i,o,s;if(void 0===n&&(n={}),t&&"object"===(void 0===t?"undefined":xe(t))){var a=t,c=r;if("number"==typeof a.offset){var l=this.fromOffset(a.offset);t=l.line,r=l.col}else t=a.line,r=a.column;if("number"==typeof c.offset){var u=this.fromOffset(c.offset);o=u.line,s=u.col}else o=c.line,s=c.column}else if(!r){var h=this.fromOffset(t);t=h.line,r=h.col}var d=this.origin(t,r,o,s);return(i=d?new es(e,void 0===d.endLine?d.line:{column:d.column,line:d.line},void 0===d.endLine?d.column:{column:d.endColumn,line:d.endLine},d.source,d.file,n.plugin):new es(e,void 0===o?t:{column:r,line:t},void 0===o?r:{column:s,line:o},this.css,this.file,n.plugin)).input={column:r,endColumn:s,endLine:o,line:t,source:this.css},this.file&&(Zo&&(i.input.url=Zo(this.file).toString()),i.input.file=this.file),i},t.fromOffset=function(e){var t;if(this[rs])t=this[rs];else{var r=this.css.split("\n");t=new Array(r.length);for(var n=0,i=0,o=r.length;i<o;i++)t[i]=n,n+=r[i].length+1;this[rs]=t}var s=0;if(e>=t[t.length-1])s=t.length-1;else for(var a,c=t.length-2;s<c;)if(e<t[a=s+(c-s>>1)])c=a-1;else{if(!(e>=t[a+1])){s=a;break}s=a+1}return{col:e-t[s]+1,line:s+1}},t.mapResolve=function(e){return/^\w+:\/\//.test(e)?e:Jo(this.map.consumer().sourceRoot||this.map.root||".",e)},t.origin=function(e,t,r,n){if(!this.map)return!1;var i,o,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof r&&(i=s.originalPositionFor({column:n,line:r})),o=Yo(a.source)?Zo(a.source):new URL(a.source,this.map.consumer().sourceRoot||Zo(this.map.mapFile));var c={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:o.toString()};if("file:"===o.protocol){if(!Ko)throw new Error("file: protocol is not available in this PostCSS build");c.file=Ko(o)}var l=s.sourceContentFor(a.source);return l&&(c.source=l),c},t.toJSON=function(){for(var e={},t=0,r=["hasBOM","css","file","id"];t<r.length;t++){var n=r[t];null!=this[n]&&(e[n]=this[n])}return this.map&&(e.map=me({},this.map),e.map.consumerCache&&(e.map.consumerCache=void 0)),e},fe(e,[{key:"from",get:function(){return this.file||this.id}}]),e}(),ss=os;os.default=os,Qo&&Qo.registerInput&&Qo.registerInput(os);var as=mo.SourceMapConsumer,cs=mo.SourceMapGenerator,ls=mo.dirname,us=mo.relative,hs=mo.resolve,ds=mo.sep,ps=mo.pathToFileURL,fs=ss,ms=Boolean(as&&cs),gs=Boolean(ls&&hs&&us&&ds),ys=function(){function e(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}var t=e.prototype;return t.addAnnotation=function(){var e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";var t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"},t.applyPrevMaps=function(){for(var e,t=Se(this.previous());!(e=t()).done;){var r=e.value,n=this.toUrl(this.path(r.file)),i=r.root||ls(r.file),o=void 0;!1===this.mapOpts.sourcesContent?(o=new as(r.text)).sourcesContent&&(o.sourcesContent=null):o=r.consumer(),this.map.applySourceMap(o,n,this.toUrl(this.path(i)))}},t.clearAnnotation=function(){if(!1!==this.mapOpts.annotation)if(this.root)for(var e,t=this.root.nodes.length-1;t>=0;t--)"comment"===(e=this.root.nodes[t]).type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t);else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))},t.generate=function(){if(this.clearAnnotation(),gs&&ms&&this.isMap())return this.generateMap();var e="";return this.stringify(this.root,function(t){e+=t}),[e]},t.generateMap=function(){if(this.root)this.generateString();else if(1===this.previous().length){var e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=cs.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new cs({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]},t.generateString=function(){var e=this;this.css="",this.map=new cs({file:this.outputFile(),ignoreInvalidMapping:!0});var t,r,n=1,i=1,o="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,function(a,c,l){if(e.css+=a,c&&"end"!==l&&(s.generated.line=n,s.generated.column=i-1,c.source&&c.source.start?(s.source=e.sourcePath(c),s.original.line=c.source.start.line,s.original.column=c.source.start.column-1,e.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,e.map.addMapping(s))),(t=a.match(/\n/g))?(n+=t.length,r=a.lastIndexOf("\n"),i=a.length-r):i+=a.length,c&&"start"!==l){var u=c.parent||{raws:{}};("decl"===c.type||"atrule"===c.type&&!c.nodes)&&c===u.last&&!u.raws.semicolon||(c.source&&c.source.end?(s.source=e.sourcePath(c),s.original.line=c.source.end.line,s.original.column=c.source.end.column-1,s.generated.line=n,s.generated.column=i-2,e.map.addMapping(s)):(s.source=o,s.original.line=1,s.original.column=0,s.generated.line=n,s.generated.column=i-1,e.map.addMapping(s)))}})},t.isAnnotation=function(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(function(e){return e.annotation}))},t.isInline=function(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;var e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(function(e){return e.inline}))},t.isMap=function(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0},t.isSourcesContent=function(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(function(e){return e.withContent()})},t.outputFile=function(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"},t.path=function(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;var t=this.memoizedPaths.get(e);if(t)return t;var r=this.opts.to?ls(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(r=ls(hs(r,this.mapOpts.annotation)));var n=us(r,e);return this.memoizedPaths.set(e,n),n},t.previous=function(){var e=this;if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(function(t){if(t.source&&t.source.input.map){var r=t.source.input.map;e.previousMaps.includes(r)||e.previousMaps.push(r)}});else{var t=new fs(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps},t.setSourcesContent=function(){var e=this,t={};if(this.root)this.root.walk(function(r){if(r.source){var n=r.source.input.from;if(n&&!t[n]){t[n]=!0;var i=e.usesFileUrls?e.toFileUrl(n):e.toUrl(e.path(n));e.map.setSourceContent(i,r.source.input.css)}}});else if(this.css){var r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}},t.sourcePath=function(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))},t.toBase64=function(e){return I?I.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))},t.toFileUrl=function(e){var t=this.memoizedFileURLs.get(e);if(t)return t;if(ps){var r=ps(e).toString();return this.memoizedFileURLs.set(e,r),r}throw new Error("`map.absolute` option is not available in this PostCSS build")},t.toUrl=function(e){var t=this.memoizedURLs.get(e);if(t)return t;"\\"===ds&&(e=e.replace(/\\/g,"/"));var r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r},e}(),vs=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="comment",r}return ye(t,e),t}(Bo),bs=vs;vs.default=vs;var ws,xs,ks,_s,Ss=wo.isClean,Cs=wo.my,Is=Lo,Es=bs;function As(e){return e.map(function(e){return e.nodes&&(e.nodes=As(e.nodes)),delete e.source,e})}function Ms(e){if(e[Ss]=!1,e.proxyOf.nodes)for(var t,r=Se(e.proxyOf.nodes);!(t=r()).done;){Ms(t.value)}}var Ns=function(e){function t(){return e.apply(this,arguments)||this}ye(t,e);var r=t.prototype;return r.append=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=Se(t);!(n=i()).done;)for(var o,s=n.value,a=Se(this.normalize(s,this.last));!(o=a()).done;){var c=o.value;this.proxyOf.nodes.push(c)}return this.markDirty(),this},r.cleanRaws=function(t){if(e.prototype.cleanRaws.call(this,t),this.nodes)for(var r,n=Se(this.nodes);!(r=n()).done;){r.value.cleanRaws(t)}},r.each=function(e){if(this.proxyOf.nodes){for(var t,r,n=this.getIterator();this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],!1!==(r=e(this.proxyOf.nodes[t],t)));)this.indexes[n]+=1;return delete this.indexes[n],r}},r.every=function(e){return this.nodes.every(e)},r.getIterator=function(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;var e=this.lastEach;return this.indexes[e]=0,e},r.getProxyProcessor=function(){return{get:function(e,t){return"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var o;return(o=e)[t].apply(o,[].concat(n.map(function(e){return"function"==typeof e?function(t,r){return e(t.toProxy(),r)}:e})))}:"every"===t||"some"===t?function(r){return e[t](function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return r.apply(void 0,[].concat([e.toProxy()],n))})}:"root"===t?function(){return e.root().toProxy()}:"nodes"===t?e.nodes.map(function(e){return e.toProxy()}):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t]},set:function(e,t,r){return e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0}}},r.index=function(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))},r.insertAfter=function(e,t){var r,n=this.index(e),i=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(var o,s=Se(i);!(o=s()).done;){var a=o.value;this.proxyOf.nodes.splice(n+1,0,a)}for(var c in this.indexes)n<(r=this.indexes[c])&&(this.indexes[c]=r+i.length);return this.markDirty(),this},r.insertBefore=function(e,t){var r,n=this.index(e),i=0===n&&"prepend",o=this.normalize(t,this.proxyOf.nodes[n],i).reverse();n=this.index(e);for(var s,a=Se(o);!(s=a()).done;){var c=s.value;this.proxyOf.nodes.splice(n,0,c)}for(var l in this.indexes)n<=(r=this.indexes[l])&&(this.indexes[l]=r+o.length);return this.markDirty(),this},r.normalize=function(e,r){var n=this;if("string"==typeof e)e=As(ws(e).nodes);else if(void 0===e)e=[];else if(Array.isArray(e))for(var i,o=Se(e=e.slice(0));!(i=o()).done;){var s=i.value;s.parent&&s.parent.removeChild(s,"ignore")}else if("root"===e.type&&"document"!==this.type)for(var a,c=Se(e=e.nodes.slice(0));!(a=c()).done;){var l=a.value;l.parent&&l.parent.removeChild(l,"ignore")}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error("Value field is missed in node creation");"string"!=typeof e.value&&(e.value=String(e.value)),e=[new Is(e)]}else if(e.selector)e=[new xs(e)];else if(e.name)e=[new ks(e)];else{if(!e.text)throw new Error("Unknown node type in node creation");e=[new Es(e)]}return e.map(function(e){return e[Cs]||t.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[Ss]&&Ms(e),void 0===e.raws.before&&r&&void 0!==r.raws.before&&(e.raws.before=r.raws.before.replace(/\S/g,"")),e.parent=n.proxyOf,e})},r.prepend=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=Se(t=t.reverse());!(n=i()).done;){for(var o,s=n.value,a=this.normalize(s,this.first,"prepend").reverse(),c=Se(a);!(o=c()).done;){var l=o.value;this.proxyOf.nodes.unshift(l)}for(var u in this.indexes)this.indexes[u]=this.indexes[u]+a.length}return this.markDirty(),this},r.push=function(e){return e.parent=this,this.proxyOf.nodes.push(e),this},r.removeAll=function(){for(var e,t=Se(this.proxyOf.nodes);!(e=t()).done;){e.value.parent=void 0}return this.proxyOf.nodes=[],this.markDirty(),this},r.removeChild=function(e){var t;for(var r in e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1),this.indexes)(t=this.indexes[r])>=e&&(this.indexes[r]=t-1);return this.markDirty(),this},r.replaceValues=function(e,t,r){return r||(r=t,t={}),this.walkDecls(function(n){t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this},r.some=function(e){return this.nodes.some(e)},r.walk=function(e){return this.each(function(t,r){var n;try{n=e(t,r)}catch(i){throw t.addToError(i)}return!1!==n&&t.walk&&(n=t.walk(e)),n})},r.walkAtRules=function(e,t){return t?ve(e,RegExp)?this.walk(function(r,n){if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk(function(r,n){if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk(function(e,r){if("atrule"===e.type)return t(e,r)}))},r.walkComments=function(e){return this.walk(function(t,r){if("comment"===t.type)return e(t,r)})},r.walkDecls=function(e,t){return t?ve(e,RegExp)?this.walk(function(r,n){if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk(function(r,n){if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk(function(e,r){if("decl"===e.type)return t(e,r)}))},r.walkRules=function(e,t){return t?ve(e,RegExp)?this.walk(function(r,n){if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk(function(r,n){if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk(function(e,r){if("rule"===e.type)return t(e,r)}))},fe(t,[{key:"first",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}},{key:"last",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}]),t}(Bo);Ns.registerParse=function(e){ws=e},Ns.registerRule=function(e){xs=e},Ns.registerAtRule=function(e){ks=e},Ns.registerRoot=function(e){_s=e};var Ps=Ns;Ns.default=Ns,Ns.rebuild=function(e){"atrule"===e.type?Object.setPrototypeOf(e,ks.prototype):"rule"===e.type?Object.setPrototypeOf(e,xs.prototype):"decl"===e.type?Object.setPrototypeOf(e,Is.prototype):"comment"===e.type?Object.setPrototypeOf(e,Es.prototype):"root"===e.type&&Object.setPrototypeOf(e,_s.prototype),e[Cs]=!0,e.nodes&&e.nodes.forEach(function(e){Ns.rebuild(e)})};var Ts,Os,Bs=function(e){function t(t){var r;return(r=e.call(this,me({type:"document"},t))||this).nodes||(r.nodes=[]),r}return ye(t,e),t.prototype.toResult=function(e){return void 0===e&&(e={}),new Ts(new Os,this,e).stringify()},t}(Ps);Bs.registerLazyResult=function(e){Ts=e},Bs.registerProcessor=function(e){Os=e};var Rs=Bs;Bs.default=Bs;var Ls=function(){function e(e,t){if(void 0===t&&(t={}),this.type="warning",this.text=e,t.node&&t.node.source){var r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(var n in t)this[n]=t[n]}return e.prototype.toString=function(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text},e}(),js=Ls;Ls.default=Ls;var Us=js,Ds=function(){function e(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}var t=e.prototype;return t.toString=function(){return this.css},t.warn=function(e,t){void 0===t&&(t={}),t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);var r=new Us(e,t);return this.messages.push(r),r},t.warnings=function(){return this.messages.filter(function(e){return"warning"===e.type})},fe(e,[{key:"content",get:function(){return this.css}}]),e}(),Fs=Ds;Ds.default=Ds;var zs="'".charCodeAt(0),qs='"'.charCodeAt(0),$s="\\".charCodeAt(0),Ws="/".charCodeAt(0),Gs="\n".charCodeAt(0),Hs=" ".charCodeAt(0),Vs="\f".charCodeAt(0),Ks="\t".charCodeAt(0),Zs="\r".charCodeAt(0),Ys="[".charCodeAt(0),Js="]".charCodeAt(0),Xs="(".charCodeAt(0),Qs=")".charCodeAt(0),ea="{".charCodeAt(0),ta="}".charCodeAt(0),ra=";".charCodeAt(0),na="*".charCodeAt(0),ia=":".charCodeAt(0),oa="@".charCodeAt(0),sa=/[\t\n\f\r "#'()/;[\\\]{}]/g,aa=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,ca=/.[\r\n"'(/\\]/,la=/[\da-f]/i,ua=Ps,ha=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="atrule",r}ye(t,e);var r=t.prototype;return r.append=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i;return this.proxyOf.nodes||(this.nodes=[]),(i=e.prototype.append).call.apply(i,[].concat([this],r))},r.prepend=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i;return this.proxyOf.nodes||(this.nodes=[]),(i=e.prototype.prepend).call.apply(i,[].concat([this],r))},t}(ua),da=ha;ha.default=ha,ua.registerAtRule(ha);var pa,fa,ma=Ps,ga=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="root",r.nodes||(r.nodes=[]),r}ye(t,e);var r=t.prototype;return r.normalize=function(t,r,n){var i=e.prototype.normalize.call(this,t);if(r)if("prepend"===n)this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(var o,s=Se(i);!(o=s()).done;){o.value.raws.before=r.raws.before}return i},r.removeChild=function(t,r){var n=this.index(t);return!r&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),e.prototype.removeChild.call(this,t)},r.toResult=function(e){return void 0===e&&(e={}),new pa(new fa,this,e).stringify()},t}(ma);ga.registerLazyResult=function(e){pa=e},ga.registerProcessor=function(e){fa=e};var ya=ga;ga.default=ga,ma.registerRoot(ga);var va={comma:function(e){return va.split(e,[","],!0)},space:function(e){return va.split(e,[" ","\n","\t"])},split:function(e,t,r){for(var n,i=[],o="",s=!1,a=0,c=!1,l="",u=!1,h=Se(e);!(n=h()).done;){var d=n.value;u?u=!1:"\\"===d?u=!0:c?d===l&&(c=!1):'"'===d||"'"===d?(c=!0,l=d):"("===d?a+=1:")"===d?a>0&&(a-=1):0===a&&t.includes(d)&&(s=!0),s?(""!==o&&i.push(o.trim()),o="",s=!1):o+=d}return(r||""!==o)&&i.push(o.trim()),i}},ba=va;va.default=va;var wa=Ps,xa=ba,ka=function(e){function t(t){var r;return(r=e.call(this,t)||this).type="rule",r.nodes||(r.nodes=[]),r}return ye(t,e),fe(t,[{key:"selectors",get:function(){return xa.comma(this.selector)},set:function(e){var t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}]),t}(wa),_a=ka;ka.default=ka,wa.registerRule(ka);var Sa=Lo,Ca=function(e,t){void 0===t&&(t={});var r,n,i,o,s,a,c,l,u,h,d=e.css.valueOf(),p=t.ignoreErrors,f=d.length,m=0,g=[],y=[];function v(t){throw e.error("Unclosed "+t,m)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&m>=f},nextToken:function(e){if(y.length)return y.pop();if(!(m>=f)){var t=!!e&&e.ignoreUnclosed;switch(r=d.charCodeAt(m)){case Gs:case Hs:case Ks:case Zs:case Vs:n=m;do{n+=1,r=d.charCodeAt(n)}while(r===Hs||r===Gs||r===Ks||r===Zs||r===Vs);h=["space",d.slice(m,n)],m=n-1;break;case Ys:case Js:case ea:case ta:case ia:case ra:case Qs:var b=String.fromCharCode(r);h=[b,b,m];break;case Xs:if(l=g.length?g.pop()[1]:"",u=d.charCodeAt(m+1),"url"===l&&u!==zs&&u!==qs&&u!==Hs&&u!==Gs&&u!==Ks&&u!==Vs&&u!==Zs){n=m;do{if(a=!1,-1===(n=d.indexOf(")",n+1))){if(p||t){n=m;break}v("bracket")}for(c=n;d.charCodeAt(c-1)===$s;)c-=1,a=!a}while(a);h=["brackets",d.slice(m,n+1),m,n],m=n}else n=d.indexOf(")",m+1),o=d.slice(m,n+1),-1===n||ca.test(o)?h=["(","(",m]:(h=["brackets",o,m,n],m=n);break;case zs:case qs:i=r===zs?"'":'"',n=m;do{if(a=!1,-1===(n=d.indexOf(i,n+1))){if(p||t){n=m+1;break}v("string")}for(c=n;d.charCodeAt(c-1)===$s;)c-=1,a=!a}while(a);h=["string",d.slice(m,n+1),m,n],m=n;break;case oa:sa.lastIndex=m+1,sa.test(d),n=0===sa.lastIndex?d.length-1:sa.lastIndex-2,h=["at-word",d.slice(m,n+1),m,n],m=n;break;case $s:for(n=m,s=!0;d.charCodeAt(n+1)===$s;)n+=1,s=!s;if(r=d.charCodeAt(n+1),s&&r!==Ws&&r!==Hs&&r!==Gs&&r!==Ks&&r!==Zs&&r!==Vs&&(n+=1,la.test(d.charAt(n)))){for(;la.test(d.charAt(n+1));)n+=1;d.charCodeAt(n+1)===Hs&&(n+=1)}h=["word",d.slice(m,n+1),m,n],m=n;break;default:r===Ws&&d.charCodeAt(m+1)===na?(0===(n=d.indexOf("*/",m+2)+1)&&(p||t?n=d.length:v("comment")),h=["comment",d.slice(m,n+1),m,n],m=n):(aa.lastIndex=m+1,aa.test(d),n=0===aa.lastIndex?d.length-1:aa.lastIndex-2,h=["word",d.slice(m,n+1),m,n],g.push(h),m=n)}return m++,h}},position:function(){return m}}},Ia=bs,Ea=da,Aa=ya,Ma=_a,Na={empty:!0,space:!0};var Pa=function(){function e(e){this.input=e,this.root=new Aa,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}var t=e.prototype;return t.atrule=function(e){var t,r,n,i=new Ea;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);for(var o=!1,s=!1,a=[],c=[];!this.tokenizer.endOfFile();){if("("===(t=(e=this.tokenizer.nextToken())[0])||"["===t?c.push("("===t?")":"]"):"{"===t&&c.length>0?c.push("}"):t===c[c.length-1]&&c.pop(),0===c.length){if(";"===t){i.source.end=this.getPosition(e[2]),i.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(r=a[n=a.length-1];r&&"space"===r[0];)r=a[--n];r&&(i.source.end=this.getPosition(r[3]||r[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),o&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),s&&(i.nodes=[],this.current=i)},t.checkMissedSemicolon=function(e){var t=this.colon(e);if(!1!==t){for(var r,n=0,i=t-1;i>=0&&("space"===(r=e[i])[0]||2!==(n+=1));i--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}},t.colon=function(e){for(var t,r,n,i,o=0,s=Se(e.entries());!(i=s()).done;){var a=i.value,c=a[0];if("("===(r=(t=a[1])[0])&&(o+=1),")"===r&&(o-=1),0===o&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return c}this.doubleColon(t)}n=t}return!1},t.comment=function(e){var t=new Ia;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;var r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{var n=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=n[2],t.raws.left=n[1],t.raws.right=n[3]}},t.createTokenizer=function(){this.tokenizer=Ca(this.input)},t.decl=function(e,t){var r=new Sa;this.init(r,e[0][2]);var n,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||function(e){for(var t=e.length-1;t>=0;t--){var r=e[t],n=r[3]||r[2];if(n)return n}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){var o=e[0][0];if(":"===o||"space"===o||"comment"===o)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(":"===(n=e.shift())[0]){r.raws.between+=n[1];break}"word"===n[0]&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));for(var s,a=[];e.length&&("space"===(s=e[0][0])||"comment"===s);)a.push(e.shift());this.precheckMissedSemicolon(e);for(var c=e.length-1;c>=0;c--){if("!important"===(n=e[c])[1].toLowerCase()){r.important=!0;var l=this.stringFrom(e,c);" !important"!==(l=this.spacesFromEnd(e)+l)&&(r.raws.important=l);break}if("important"===n[1].toLowerCase()){for(var u=e.slice(0),h="",d=c;d>0;d--){var p=u[d][0];if(0===h.trim().indexOf("!")&&"space"!==p)break;h=u.pop()[1]+h}0===h.trim().indexOf("!")&&(r.important=!0,r.raws.important=h,e=u)}if("space"!==n[0]&&"comment"!==n[0])break}e.some(function(e){return"space"!==e[0]&&"comment"!==e[0]})&&(r.raws.between+=a.map(function(e){return e[1]}).join(""),a=[]),this.raw(r,"value",a.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)},t.doubleColon=function(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})},t.emptyRule=function(e){var t=new Ma;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t},t.end=function(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)},t.endFile=function(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())},t.freeSemicolon=function(e){if(this.spaces+=e[1],this.current.nodes){var t=this.current.nodes[this.current.nodes.length-1];t&&"rule"===t.type&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}},t.getPosition=function(e){var t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}},t.init=function(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)},t.other=function(e){for(var t=!1,r=null,n=!1,i=null,o=[],s=e[1].startsWith("--"),a=[],c=e;c;){if(r=c[0],a.push(c),"("===r||"["===r)i||(i=c),o.push("("===r?")":"]");else if(s&&n&&"{"===r)i||(i=c),o.push("}");else if(0===o.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),t&&n){if(!s)for(;a.length&&("space"===(c=a[a.length-1][0])||"comment"===c);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)},t.parse=function(){for(var e;!this.tokenizer.endOfFile();)switch((e=this.tokenizer.nextToken())[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()},t.precheckMissedSemicolon=function(){},t.raw=function(e,t,r,n){for(var i,o,s,a,c=r.length,l="",u=!0,h=0;h<c;h+=1)"space"!==(o=(i=r[h])[0])||h!==c-1||n?"comment"===o?(a=r[h-1]?r[h-1][0]:"empty",s=r[h+1]?r[h+1][0]:"empty",Na[a]||Na[s]||","===l.slice(-1)?u=!1:l+=i[1]):l+=i[1]:u=!1;if(!u){var d=r.reduce(function(e,t){return e+t[1]},"");e.raws[t]={raw:d,value:l}}e[t]=l},t.rule=function(e){e.pop();var t=new Ma;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t},t.spacesAndCommentsFromEnd=function(e){for(var t,r="";e.length&&("space"===(t=e[e.length-1][0])||"comment"===t);)r=e.pop()[1]+r;return r},t.spacesAndCommentsFromStart=function(e){for(var t,r="";e.length&&("space"===(t=e[0][0])||"comment"===t);)r+=e.shift()[1];return r},t.spacesFromEnd=function(e){for(var t="";e.length&&"space"===e[e.length-1][0];)t=e.pop()[1]+t;return t},t.stringFrom=function(e,t){for(var r="",n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r},t.unclosedBlock=function(){var e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)},t.unclosedBracket=function(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})},t.unexpectedClose=function(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})},t.unknownWord=function(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})},t.unnamedAtrule=function(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})},e}(),Ta=Ps,Oa=Pa,Ba=ss;function Ra(e,t){var r=new Ba(e,t),n=new Oa(r);try{n.parse()}catch(i){throw i}return n.root}var La=Ra;Ra.default=Ra,Ta.registerParse(Ra);var ja=wo.isClean,Ua=wo.my,Da=ys,Fa=Io,za=Ps,qa=Rs,$a=Fs,Wa=La,Ga=ya,Ha={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Va={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Ka={Once:!0,postcssPlugin:!0,prepare:!0};function Za(e){return"object"===(void 0===e?"undefined":xe(e))&&"function"==typeof e.then}function Ya(e){var t=!1,r=Ha[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function Ja(e){return{eventIndex:0,events:"document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Ya(e),iterator:0,node:e,visitorIndex:0,visitors:[]}}function Xa(e){return e[ja]=!1,e.nodes&&e.nodes.forEach(function(e){return Xa(e)}),e}var Qa={},ec=function(){function e(t,r,n){var i,o=this;if(this.stringified=!1,this.processed=!1,"object"!==(void 0===r?"undefined":xe(r))||null===r||"root"!==r.type&&"document"!==r.type)if(ve(r,e)||ve(r,$a))i=Xa(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{var s=Wa;n.syntax&&(s=n.syntax.parse),n.parser&&(s=n.parser),s.parse&&(s=s.parse);try{i=s(r,n)}catch(uh){this.processed=!0,this.error=uh}i&&!i[Ua]&&za.rebuild(i)}else i=Xa(r);this.result=new $a(t,i,n),this.helpers=me({},Qa,{postcss:Qa,result:this.result}),this.plugins=this.processor.plugins.map(function(e){return"object"===(void 0===e?"undefined":xe(e))&&e.prepare?me({},e,e.prepare(o.result)):e})}var t=e.prototype;return t.async=function(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)},t.catch=function(e){return this.async().catch(e)},t.finally=function(e){return this.async().then(e,e)},t.getAsyncError=function(){throw new Error("Use process(css).then(cb) to work with async plugins")},t.handleError=function(e,t){var r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion){0}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(n){console&&console.error&&console.error(n)}return e},t.prepareVisitors=function(){var e=this;this.listeners={};for(var t,r=function(t,r,n){e.listeners[r]||(e.listeners[r]=[]),e.listeners[r].push([t,n])},n=Se(this.plugins);!(t=n()).done;){var i=t.value;if("object"===(void 0===i?"undefined":xe(i)))for(var o in i){if(!Va[o]&&/^[A-Z]/.test(o))throw new Error("Unknown event "+o+" in "+i.postcssPlugin+". Try to update PostCSS ("+this.processor.version+" now).");if(!Ka[o])if("object"===xe(i[o]))for(var s in i[o])r(i,"*"===s?o:o+"-"+s.toLowerCase(),i[o][s]);else"function"==typeof i[o]&&r(i,o,i[o])}}this.hasListener=Object.keys(this.listeners).length>0},t.runAsync=function(){var e=this;return de(function(){var t,r,n,i,o,s,a,c,l,u,h,d;return Ce(this,function(p){switch(p.label){case 0:e.plugin=0,t=0,p.label=1;case 1:if(!(t<e.plugins.length))return[3,6];if(r=e.plugins[t],!Za(n=e.runOnRoot(r)))return[3,5];p.label=2;case 2:return p.trys.push([2,4,,5]),[4,n];case 3:return p.sent(),[3,5];case 4:throw i=p.sent(),e.handleError(i);case 5:return t++,[3,1];case 6:if(e.prepareVisitors(),!e.hasListener)return[3,18];o=e.result.root,p.label=7;case 7:if(o[ja])return[3,14];o[ja]=!0,s=[Ja(o)],p.label=8;case 8:if(!(s.length>0))return[3,13];if(!Za(a=e.visitTick(s)))return[3,12];p.label=9;case 9:return p.trys.push([9,11,,12]),[4,a];case 10:return p.sent(),[3,12];case 11:throw c=p.sent(),l=s[s.length-1].node,e.handleError(c,l);case 12:return[3,8];case 13:return[3,7];case 14:if(!e.listeners.OnceExit)return[3,18];u=function(){var t,r,n,i,s;return Ce(this,function(a){switch(a.label){case 0:t=d.value,r=t[0],n=t[1],e.result.lastPlugin=r,a.label=1;case 1:return a.trys.push([1,6,,7]),"document"!==o.type?[3,3]:(i=o.nodes.map(function(t){return n(t,e.helpers)}),[4,Promise.all(i)]);case 2:return a.sent(),[3,5];case 3:return[4,n(o,e.helpers)];case 4:a.sent(),a.label=5;case 5:return[3,7];case 6:throw s=a.sent(),e.handleError(s);case 7:return[2]}})},h=Se(e.listeners.OnceExit),p.label=15;case 15:return(d=h()).done?[3,18]:[5,Ie(u())];case 16:p.sent(),p.label=17;case 17:return[3,15];case 18:return e.processed=!0,[2,e.stringify()]}})})()},t.runOnRoot=function(e){var t=this;this.result.lastPlugin=e;try{if("object"===(void 0===e?"undefined":xe(e))&&e.Once){if("document"===this.result.root.type){var r=this.result.root.nodes.map(function(r){return e.Once(r,t.helpers)});return Za(r[0])?Promise.all(r):r}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(uh){throw this.handleError(uh)}},t.stringify=function(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();var e=this.result.opts,t=Fa;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);var r=new Da(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[1],this.result},t.sync=function(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(var e,t=Se(this.plugins);!(e=t()).done;){var r=e.value;if(Za(this.runOnRoot(r)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){for(var n=this.result.root;!n[ja];)n[ja]=!0,this.walkSync(n);if(this.listeners.OnceExit)if("document"===n.type)for(var i,o=Se(n.nodes);!(i=o()).done;){var s=i.value;this.visitSync(this.listeners.OnceExit,s)}else this.visitSync(this.listeners.OnceExit,n)}return this.result},t.then=function(e,t){return this.async().then(e,t)},t.toString=function(){return this.css},t.visitSync=function(e,t){for(var r,n=Se(e);!(r=n()).done;){var i=r.value,o=i[0],s=i[1];this.result.lastPlugin=o;var a=void 0;try{a=s(t,this.helpers)}catch(c){throw this.handleError(c,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Za(a))throw this.getAsyncError()}},t.visitTick=function(e){var t=e[e.length-1],r=t.node,n=t.visitors;if("root"===r.type||"document"===r.type||r.parent){if(n.length>0&&t.visitorIndex<n.length){var i=n[t.visitorIndex],o=i[0],s=i[1];t.visitorIndex+=1,t.visitorIndex===n.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return s(r.toProxy(),this.helpers)}catch(h){throw this.handleError(h,r)}}if(0!==t.iterator){for(var a,c=t.iterator;a=r.nodes[r.indexes[c]];)if(r.indexes[c]+=1,!a[ja])return a[ja]=!0,void e.push(Ja(a));t.iterator=0,delete r.indexes[c]}for(var l=t.events;t.eventIndex<l.length;){var u=l[t.eventIndex];if(t.eventIndex+=1,0===u)return void(r.nodes&&r.nodes.length&&(r[ja]=!0,t.iterator=r.getIterator()));if(this.listeners[u])return void(t.visitors=this.listeners[u])}e.pop()}else e.pop()},t.walkSync=function(e){var t=this;e[ja]=!0;for(var r,n=Se(Ya(e));!(r=n()).done;){var i=r.value;if(0===i)e.nodes&&e.each(function(e){e[ja]||t.walkSync(e)});else{var o=this.listeners[i];if(o&&this.visitSync(o,e.toProxy()))return}}},t.warnings=function(){return this.sync().warnings()},fe(e,[{key:"content",get:function(){return this.stringify().content}},{key:"css",get:function(){return this.stringify().css}},{key:"map",get:function(){return this.stringify().map}},{key:"messages",get:function(){return this.sync().messages}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){return this.sync().root}},{key:Symbol.toStringTag,get:function(){return"LazyResult"}}]),e}();ec.registerPostcss=function(e){Qa=e};var tc=ec;ec.default=ec,Ga.registerLazyResult(ec),qa.registerLazyResult(ec);var rc=ys,nc=Io,ic=La,oc=Fs,sc=function(){function e(e,t,r){var n;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;var i=nc;this.result=new oc(this._processor,n,this._opts),this.result.css=t;var o=this;Object.defineProperty(this.result,"root",{get:function(){return o.root}});var s=new rc(i,n,this._opts,t);if(s.isMap()){var a=s.generate(),c=a[0],l=a[1];c&&(this.result.css=c),l&&(this.result.map=l)}else s.clearAnnotation(),this.result.css=s.css}var t=e.prototype;return t.async=function(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)},t.catch=function(e){return this.async().catch(e)},t.finally=function(e){return this.async().then(e,e)},t.sync=function(){if(this.error)throw this.error;return this.result},t.then=function(e,t){return this.async().then(e,t)},t.toString=function(){return this._css},t.warnings=function(){return[]},fe(e,[{key:"content",get:function(){return this.result.css}},{key:"css",get:function(){return this.result.css}},{key:"map",get:function(){return this.result.map}},{key:"messages",get:function(){return[]}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){if(this._root)return this._root;var e,t=ic;try{e=t(this._css,this._opts)}catch(uh){this.error=uh}if(this.error)throw this.error;return this._root=e,e}},{key:Symbol.toStringTag,get:function(){return"NoWorkResult"}}]),e}(),ac=sc;sc.default=sc;var cc=ac,lc=tc,uc=Rs,hc=ya,dc=function(){function e(e){void 0===e&&(e=[]),this.version="8.4.38",this.plugins=this.normalize(e)}var t=e.prototype;return t.normalize=function(e){for(var t,r=[],n=Se(e);!(t=n()).done;){var i=t.value;if(!0===i.postcss?i=i():i.postcss&&(i=i.postcss),"object"===(void 0===i?"undefined":xe(i))&&Array.isArray(i.plugins))r=r.concat(i.plugins);else if("object"===(void 0===i?"undefined":xe(i))&&i.postcssPlugin)r.push(i);else if("function"==typeof i)r.push(i);else if("object"!==(void 0===i?"undefined":xe(i))||!i.parse&&!i.stringify)throw new Error(i+" is not a PostCSS plugin")}return r},t.process=function(e,t){return void 0===t&&(t={}),this.plugins.length||t.parser||t.stringifier||t.syntax?new lc(this,e,t):new cc(this,e,t)},t.use=function(e){return this.plugins=this.plugins.concat(this.normalize([e])),this},e}(),pc=dc;dc.default=dc,hc.registerProcessor(dc),uc.registerProcessor(dc);var fc=Lo,mc=Go,gc=bs,yc=da,vc=ss,bc=ya,wc=_a;function xc(e,t){if(Array.isArray(e))return e.map(function(e){return xc(e)});var r=e.inputs,n=be(e,["inputs"]);if(r){t=[];for(var i,o=Se(r);!(i=o()).done;){var s=me({},i.value,{__proto__:vc.prototype});s.map&&(s.map=me({},s.map,{__proto__:mc.prototype})),t.push(s)}}if(n.nodes&&(n.nodes=e.nodes.map(function(e){return xc(e,t)})),n.source){var a=n.source,c=a.inputId,l=be(a,["inputId"]);n.source=l,null!=c&&(n.source.input=t[c])}if("root"===n.type)return new bc(n);if("decl"===n.type)return new fc(n);if("rule"===n.type)return new wc(n);if("comment"===n.type)return new gc(n);if("atrule"===n.type)return new yc(n);throw new Error("Unknown node type: "+e.type)}var kc=xc;xc.default=xc;var _c=bo,Sc=Lo,Cc=tc,Ic=Ps,Ec=pc,Ac=Io,Mc=kc,Nc=Rs,Pc=js,Tc=bs,Oc=da,Bc=Fs,Rc=ss,Lc=La,jc=ba,Uc=_a,Dc=ya,Fc=Bo;function zc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 1===t.length&&Array.isArray(t[0])&&(t=t[0]),new Ec(t)}zc.plugin=function(e,t){var r,n=!1;function i(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];console&&console.warn&&!n&&(n=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),ae.env.LANG&&ae.env.LANG.startsWith("cn")&&console.warn(e+": ้‡Œ้ข postcss.plugin ่ขซๅผƒ็”จ. ่ฟ็งปๆŒ‡ๅ—:\nhttps://www.w3ctech.com/topic/2226"));var s=t.apply(void 0,[].concat(i));return s.postcssPlugin=e,s.postcssVersion=(new Ec).version,s}return Object.defineProperty(i,"postcss",{get:function(){return r||(r=i()),r}}),i.process=function(e,t,r){return zc([i(r)]).process(e,t)},i},zc.stringify=Ac,zc.parse=Lc,zc.fromJSON=Mc,zc.list=jc,zc.comment=function(e){return new Tc(e)},zc.atRule=function(e){return new Oc(e)},zc.decl=function(e){return new Sc(e)},zc.rule=function(e){return new Uc(e)},zc.root=function(e){return new Dc(e)},zc.document=function(e){return new Nc(e)},zc.CssSyntaxError=_c,zc.Declaration=Sc,zc.Container=Ic,zc.Processor=Ec,zc.Document=Nc,zc.Comment=Tc,zc.Warning=Pc,zc.AtRule=Oc,zc.Result=Bc,zc.Input=Rc,zc.Rule=Uc,zc.Root=Dc,zc.Node=Fc,Cc.registerPostcss(zc);var qc=zc;zc.default=zc;var $c=co(qc);$c.stringify,$c.fromJSON,$c.plugin,$c.parse,$c.list,$c.document,$c.comment,$c.atRule,$c.rule,$c.decl,$c.root,$c.CssSyntaxError,$c.Declaration,$c.Container,$c.Processor,$c.Document,$c.Comment,$c.Warning,$c.AtRule,$c.Result,$c.Input,$c.Rule,$c.Root,$c.Node;var Wc=function(){function e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];ao(this,"parentElement",null),ao(this,"parentNode",null),ao(this,"ownerDocument"),ao(this,"firstChild",null),ao(this,"lastChild",null),ao(this,"previousSibling",null),ao(this,"nextSibling",null),ao(this,"ELEMENT_NODE",1),ao(this,"TEXT_NODE",3),ao(this,"nodeType"),ao(this,"nodeName"),ao(this,"RRNodeType")}var t=e.prototype;return t.contains=function(t){if(!ve(t,e))return!1;if(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},t.appendChild=function(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")},t.insertBefore=function(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")},t.removeChild=function(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")},t.toString=function(){return"RRNode"},fe(e,[{key:"childNodes",get:function(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}}]),e}(),Gc={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Hc={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Vc={};function Kc(e){if(Vc[e])return Vc[e];var t=globalThis[e],r=t.prototype,n=e in Gc?Gc[e]:void 0,i=Boolean(n&&n.every(function(e){var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),o=e in Hc?Hc[e]:void 0,s=Boolean(o&&o.every(function(e){var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s&&!globalThis.Zone)return Vc[e]=t.prototype,t.prototype;try{var a=document.createElement("iframe");document.body.appendChild(a);var c=a.contentWindow;if(!c)return t.prototype;var l=c[e].prototype;return document.body.removeChild(a),l?Vc[e]=l:r}catch(u){return r}}var Zc={};function Yc(e,t,r){var n,i=e+"."+String(r);if(Zc[i])return Zc[i].call(t);var o=Kc(e),s=null==(n=Object.getOwnPropertyDescriptor(o,r))?void 0:n.get;return s?(Zc[i]=s,s.call(t)):t[r]}var Jc={};function Xc(e,t,r){var n=e+"."+String(r);if(Jc[n])return Jc[n].bind(t);var i=Kc(e)[r];return"function"!=typeof i?t[r]:(Jc[n]=i,i.bind(t))}function Qc(){return Kc("MutationObserver").constructor}function el(e,t,r){try{if(!(t in e))return function(){};var n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,function(){e[t]=n}}catch(o){return function(){}}}var tl={childNodes:function(e){return Yc("Node",e,"childNodes")},parentNode:function(e){return Yc("Node",e,"parentNode")},parentElement:function(e){return Yc("Node",e,"parentElement")},textContent:function(e){return Yc("Node",e,"textContent")},contains:function(e,t){return Xc("Node",e,"contains")(t)},getRootNode:function(e){return Xc("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Yc("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Yc("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Yc("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Yc("Element",e,"querySelectorAll")(t)},mutationObserver:Qc,patch:el};function rl(e,t,r){void 0===r&&(r=document);var n={capture:!0,passive:!0};return r.addEventListener(e,t,n),function(){return r.removeEventListener(e,t,n)}}var nl="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",il={map:{},getId:function(){return console.error(nl),-1},getNode:function(){return console.error(nl),null},removeNodeFromMap:function(){console.error(nl)},has:function(){return console.error(nl),!1},reset:function(){console.error(nl)}};function ol(e,t,r){void 0===r&&(r={});var n=null,i=0;return function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var c=Date.now();i||!1!==r.leading||(i=c);var l=t-(c-i),u=this;l<=0||l>t?(n&&(clearTimeout(n),n=null),i=c,e.apply(u,s)):n||!1===r.trailing||(n=setTimeout(function(){i=!1===r.leading?0:Date.now(),n=null,e.apply(u,s)},l))}}function sl(e,t,r,n,i){void 0===i&&(i=window);var o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set:function(e){var t=this;setTimeout(function(){r.set.call(t,e)},0),o&&o.set&&o.set.call(this,e)}}),function(){return sl(e,t,o||{},!0)}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(il=new Proxy(il,{get:function(e,t,r){return"map"===t&&console.error(nl),Reflect.get(e,t,r)}}));var al=Date.now;function cl(e){var t,r,n,i,o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=tl.parentElement(o.body))?void 0:t.scrollLeft)||(null==(r=null==o?void 0:o.body)?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(n=tl.parentElement(o.body))?void 0:n.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function ll(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ul(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function hl(e){return e?e.nodeType===e.ELEMENT_NODE?e:tl.parentElement(e):null}function dl(e,t,r,n){if(!e)return!1;var i=hl(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(bt(i,t,n))return!0}catch(o){}if(r){if(i.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1}function pl(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function fl(e,t){if($e(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var n=tl.parentNode(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||fl(n,t))}function ml(e){return Boolean(e.changedTouches)}function gl(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function yl(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function vl(e){return!!e&&(ve(e,Wc)&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(tl.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(al=function(){return(new Date).getTime()});var bl=function(){function e(){Me(this,"id",1),Me(this,"styleIDMap",new WeakMap),Me(this,"idStyleMap",new Map)}var t=e.prototype;return t.getId=function(e){var t;return null!=(t=this.styleIDMap.get(e))?t:-1},t.has=function(e){return this.styleIDMap.has(e)},t.add=function(e,t){return this.has(e)?this.getId(e):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r},t.getStyle=function(e){return this.idStyleMap.get(e)||null},t.reset=function(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1},t.generateId=function(){return this.id++},e}();function wl(e){var t,r=null;return"getRootNode"in e&&(null==(t=tl.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&tl.host(tl.getRootNode(e))&&(r=tl.host(tl.getRootNode(e))),r}function xl(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=wl(r);)r=t;return r}(e);return tl.contains(t,r)}function kl(e){var t=e.ownerDocument;return!!t&&(tl.contains(t,e)||xl(e))}var _l=function(e){return 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}(_l||{}),Sl=function(e){return 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}(Sl||{}),Cl=function(e){return 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}(Cl||{}),Il=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}(Il||{}),El=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}(El||{}),Al=function(e){return 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}(Al||{}),Ml=function(e){return 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}(Ml||{});function Nl(e){return"__ln"in e}var Pl,Tl=function(){function e(){Me(this,"length",0),Me(this,"head",null),Me(this,"tail",null)}var t=e.prototype;return t.get=function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;r<e;r++)t=(null==t?void 0:t.next)||null;return t},t.addNode=function(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Nl(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Nl(e.nextSibling)&&e.nextSibling.__ln.previous){var 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;null===t.next&&(this.tail=t),this.length++},t.removeNode=function(e){var 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--)},e}(),Ol=function(e,t){return e+"@"+t},Bl=function(){function e(){var e=this;Me(this,"frozen",!1),Me(this,"locked",!1),Me(this,"texts",[]),Me(this,"attributes",[]),Me(this,"attributeMap",new WeakMap),Me(this,"removes",[]),Me(this,"mapRemoves",[]),Me(this,"movedMap",{}),Me(this,"addedSet",new Set),Me(this,"movedSet",new Set),Me(this,"droppedSet",new Set),Me(this,"removesSubTreeCache",new Set),Me(this,"mutationCb"),Me(this,"blockClass"),Me(this,"blockSelector"),Me(this,"maskTextClass"),Me(this,"maskTextSelector"),Me(this,"inlineStylesheet"),Me(this,"maskInputOptions"),Me(this,"maskTextFn"),Me(this,"maskInputFn"),Me(this,"keepIframeSrcFn"),Me(this,"recordCanvas"),Me(this,"inlineImages"),Me(this,"slimDOMOptions"),Me(this,"dataURLOptions"),Me(this,"doc"),Me(this,"mirror"),Me(this,"iframeManager"),Me(this,"stylesheetManager"),Me(this,"shadowDomManager"),Me(this,"canvasManager"),Me(this,"processedNodeManager"),Me(this,"unattachedDoc"),Me(this,"processMutations",function(t){t.forEach(e.processMutation),e.emit()}),Me(this,"emit",function(){if(!e.frozen&&!e.locked){for(var t=[],r=new Set,n=new Tl,i=function(t){for(var r=t,n=-2;-2===n;)n=(r=r&&r.nextSibling)&&e.mirror.getId(r);return n},o=function(o){var s=tl.parentNode(o);if(s&&kl(o)){var a=!1;if(o.nodeType===Node.TEXT_NODE){var c=s.tagName;if("TEXTAREA"===c)return;"STYLE"===c&&e.addedSet.has(s)&&(a=!0)}var l=$e(s)?e.mirror.getId(wl(o)):e.mirror.getId(s),u=i(o);if(-1===l||-1===u)return n.addNode(o);var h=_t(o,{doc:e.doc,mirror:e.mirror,blockClass:e.blockClass,blockSelector:e.blockSelector,maskTextClass:e.maskTextClass,maskTextSelector:e.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:e.inlineStylesheet,maskInputOptions:e.maskInputOptions,maskTextFn:e.maskTextFn,maskInputFn:e.maskInputFn,slimDOMOptions:e.slimDOMOptions,dataURLOptions:e.dataURLOptions,recordCanvas:e.recordCanvas,inlineImages:e.inlineImages,onSerialize:function(t){gl(t,e.mirror)&&e.iframeManager.addIframe(t),yl(t,e.mirror)&&e.stylesheetManager.trackLinkElement(t),vl(o)&&e.shadowDomManager.addShadowRoot(tl.shadowRoot(o),e.doc)},onIframeLoad:function(t,r){e.iframeManager.attachIframe(t,r),e.shadowDomManager.observeAttachShadow(t)},onStylesheetLoad:function(t,r){e.stylesheetManager.attachLinkElement(t,r)},cssCaptured:a});h&&(t.push({parentId:l,nextId:u,node:h}),r.add(h.id))}};e.mapRemoves.length;)e.mirror.removeNodeFromMap(e.mapRemoves.shift());for(var s,a=Se(e.movedSet);!(s=a()).done;){var c=s.value;Ll(e.removesSubTreeCache,c,e.mirror)&&!e.movedSet.has(tl.parentNode(c))||o(c)}for(var l,u=Se(e.addedSet);!(l=u()).done;){var h=l.value;jl(e.droppedSet,h)||Ll(e.removesSubTreeCache,h,e.mirror)?jl(e.movedSet,h)?o(h):e.droppedSet.add(h):o(h)}for(var d=null;n.length;){var p=null;if(d){var f=e.mirror.getId(tl.parentNode(d.value)),m=i(d.value);-1!==f&&-1!==m&&(p=d)}if(!p)for(var g=n.tail;g;){var y=g;if(g=g.previous,y){var v=e.mirror.getId(tl.parentNode(y.value));if(-1===i(y.value))continue;if(-1!==v){p=y;break}var b=y.value,w=tl.parentNode(b);if(w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var x=tl.host(w);if(-1!==e.mirror.getId(x)){p=y;break}}}}if(!p){for(;n.head;)n.removeNode(n.head.value);break}d=p.previous,n.removeNode(p.value),o(p.value)}var k={texts:e.texts.map(function(t){var r=t.node,n=tl.parentNode(r);return n&&"TEXTAREA"===n.tagName&&e.genTextAreaValueMutation(n),{id:e.mirror.getId(r),value:t.value}}).filter(function(e){return!r.has(e.id)}).filter(function(t){return e.mirror.has(t.id)}),attributes:e.attributes.map(function(t){var r=t.attributes;if("string"==typeof r.style){var n=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);n.length<r.style.length&&(n+i).split("var(").length===r.style.split("var(").length&&(r.style=t.styleDiff)}return{id:e.mirror.getId(t.node),attributes:r}}).filter(function(e){return!r.has(e.id)}).filter(function(t){return e.mirror.has(t.id)}),removes:e.removes,adds:t};(k.texts.length||k.attributes.length||k.removes.length||k.adds.length)&&(e.texts=[],e.attributes=[],e.attributeMap=new WeakMap,e.removes=[],e.addedSet=new Set,e.movedSet=new Set,e.droppedSet=new Set,e.removesSubTreeCache=new Set,e.movedMap={},e.mutationCb(k))}}),Me(this,"genTextAreaValueMutation",function(t){var r=e.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},e.attributes.push(r),e.attributeMap.set(t,r));var n=Array.from(tl.childNodes(t),function(e){return tl.textContent(e)||""}).join("");r.attributes.value=Ke({element:t,maskInputOptions:e.maskInputOptions,tagName:t.tagName,type:Je(t),value:n,maskInputFn:e.maskInputFn})}),Me(this,"processMutation",function(t){if(!pl(t.target,e.mirror,e.slimDOMOptions))switch(t.type){case"characterData":var r=tl.textContent(t.target);dl(t.target,e.blockClass,e.blockSelector,!1)||r===t.oldValue||e.texts.push({value:wt(t.target,e.maskTextClass,e.maskTextSelector,!0)&&r?e.maskTextFn?e.maskTextFn(r,hl(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break;case"attributes":var n=t.target,i=t.attributeName,o=t.target.getAttribute(i);if("value"===i){var s=Je(n);o=Ke({element:n,maskInputOptions:e.maskInputOptions,tagName:n.tagName,type:s,value:o,maskInputFn:e.maskInputFn})}if(dl(t.target,e.blockClass,e.blockSelector,!1)||o===t.oldValue)return;var a=e.attributeMap.get(t.target);if("IFRAME"===n.tagName&&"src"===i&&!e.keepIframeSrcFn(o)){if(n.contentDocument)return;i="rr_src"}if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},e.attributes.push(a),e.attributeMap.set(t.target,a)),"type"===i&&"INPUT"===n.tagName&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!vt(n.tagName,i))if(a.attributes[i]=yt(e.doc,Ze(n.tagName),Ze(i),o),"style"===i){if(!e.unattachedDoc)try{e.unattachedDoc=document.implementation.createHTMLDocument()}catch(y){e.unattachedDoc=e.doc}var c=e.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(var l,u=Se(Array.from(n.style));!(l=u()).done;){var h=l.value,d=n.style.getPropertyValue(h),p=n.style.getPropertyPriority(h);d!==c.style.getPropertyValue(h)||p!==c.style.getPropertyPriority(h)?a.styleDiff[h]=""===p?d:[d,p]:a._unchangedStyles[h]=[d,p]}for(var f,m=Se(Array.from(c.style));!(f=m()).done;){var g=f.value;""===n.style.getPropertyValue(g)&&(a.styleDiff[g]=!1)}}else"open"===i&&"DIALOG"===n.tagName&&(n.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break;case"childList":if(dl(t.target,e.blockClass,e.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void e.genTextAreaValueMutation(t.target);t.addedNodes.forEach(function(r){return e.genAdds(r,t.target)}),t.removedNodes.forEach(function(r){var n=e.mirror.getId(r),i=$e(t.target)?e.mirror.getId(tl.host(t.target)):e.mirror.getId(t.target);dl(t.target,e.blockClass,e.blockSelector,!1)||pl(r,e.mirror,e.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(r,e.mirror)||(e.addedSet.has(r)?(Rl(e.addedSet,r),e.droppedSet.add(r)):e.addedSet.has(t.target)&&-1===n||fl(t.target,e.mirror)||(e.movedSet.has(r)&&e.movedMap[Ol(n,i)]?Rl(e.movedSet,r):(e.removes.push({parentId:i,id:n,isShadow:!(!$e(t.target)||!We(t.target))||void 0}),function(e,t){var r=[e];for(;r.length;){var n=r.pop();t.has(n)||(t.add(n),tl.childNodes(n).forEach(function(e){return r.push(e)}))}}(r,e.removesSubTreeCache))),e.mapRemoves.push(r))})}}),Me(this,"genAdds",function(t,r){if(!e.processedNodeManager.inOtherBuffer(t,e)&&!e.addedSet.has(t)&&!e.movedSet.has(t)){if(e.mirror.hasNode(t)){if(pl(t,e.mirror,e.slimDOMOptions))return;e.movedSet.add(t);var n=null;r&&e.mirror.hasNode(r)&&(n=e.mirror.getId(r)),n&&-1!==n&&(e.movedMap[Ol(e.mirror.getId(t),n)]=!0)}else e.addedSet.add(t),e.droppedSet.delete(t);dl(t,e.blockClass,e.blockSelector,!1)||(tl.childNodes(t).forEach(function(t){return e.genAdds(t)}),vl(t)&&tl.childNodes(tl.shadowRoot(t)).forEach(function(r){e.processedNodeManager.add(r,e),e.genAdds(r,t)}))}})}var t=e.prototype;return t.init=function(e){var t=this;["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(function(r){t[r]=e[r]})},t.freeze=function(){this.frozen=!0,this.canvasManager.freeze()},t.unfreeze=function(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()},t.isFrozen=function(){return this.frozen},t.lock=function(){this.locked=!0,this.canvasManager.lock()},t.unlock=function(){this.locked=!1,this.canvasManager.unlock(),this.emit()},t.reset=function(){this.shadowDomManager.reset(),this.canvasManager.reset()},e}();function Rl(e,t){e.delete(t),tl.childNodes(t).forEach(function(t){return Rl(e,t)})}function Ll(e,t,r){return 0!==e.size&&function(e,t){var r=tl.parentNode(t);return!!r&&e.has(r)}(e,t)}function jl(e,t){return 0!==e.size&&Ul(e,t)}function Ul(e,t){var r=tl.parentNode(t);return!!r&&(!!e.has(r)||Ul(e,r))}var Dl=function(e){if(!Pl)return e;return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];try{return e.apply(void 0,[].concat(r))}catch(uh){if(Pl&&!0===Pl(uh))return;throw uh}}},Fl=[];function zl(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(r){}return e&&e.target}function ql(e,t){var r=new Bl;Fl.push(r),r.init(e);var n=new(Qc())(Dl(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function $l(e){var t=e.mouseInteractionCb,r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.sampling;if(!1===s.mouseInteraction)return function(){};var a=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,c=[],l=null;return Object.keys(Cl).filter(function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e]}).forEach(function(e){var s=Ze(e),a=function(e){return function(r){var s=zl(r);if(!dl(s,i,o,!0)){var a=null,c=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Il.Mouse;break;case"touch":a=Il.Touch;break;case"pen":a=Il.Pen}a===Il.Touch?Cl[e]===Cl.MouseDown?c="TouchStart":Cl[e]===Cl.MouseUp&&(c="TouchEnd"):Il.Pen}else ml(r)&&(a=Il.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===Il.Touch||c.startsWith("Mouse")&&a===Il.Mouse)&&(a=null)):Cl[e]===Cl.Click&&(a=l,l=null);var u=ml(r)?r.changedTouches[0]:r;if(u){var h=n.getId(s),d=u.clientX,p=u.clientY;Dl(t)(me({type:Cl[c],id:h,x:d,y:p},null!==a&&{pointerType:a}))}}}}(e);if(window.PointerEvent)switch(Cl[e]){case Cl.MouseDown:case Cl.MouseUp:s=s.replace("mouse","pointer");break;case Cl.TouchStart:case Cl.TouchEnd:return}c.push(rl(s,a,r))}),Dl(function(){c.forEach(function(e){return e()})})}function Wl(e){var t=e.scrollCb,r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.sampling;return rl("scroll",Dl(ol(Dl(function(e){var s=zl(e);if(s&&!dl(s,i,o,!0)){var a=n.getId(s);if(s===r&&r.defaultView){var c=cl(r.defaultView);t({id:a,x:c.left,y:c.top})}else t({id:a,x:s.scrollLeft,y:s.scrollTop})}}),s.scroll||100)),r)}var Gl=["INPUT","TEXTAREA","SELECT"],Hl=new WeakMap;function Vl(e){return function(e,t){if(Jl("CSSGroupingRule")&&ve(e.parentRule,CSSGroupingRule)||Jl("CSSMediaRule")&&ve(e.parentRule,CSSMediaRule)||Jl("CSSSupportsRule")&&ve(e.parentRule,CSSSupportsRule)||Jl("CSSConditionRule")&&ve(e.parentRule,CSSConditionRule)){var r=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(r)}else if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Kl(e,t,r){var n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Zl(e,t){var r,n,i,o=e.mirror,s=e.stylesheetManager,a=null;a="#document"===t.nodeName?o.getId(t):o.getId(tl.host(t));var c="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(i=null==(n=t.ownerDocument)?void 0:n.defaultView)?void 0:i.ShadowRoot,l=(null==c?void 0:c.prototype)?Object.getOwnPropertyDescriptor(null==c?void 0:c.prototype,"adoptedStyleSheets"):void 0;return null!==a&&-1!==a&&c&&l?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:function(){var e;return null==(e=l.get)?void 0:e.call(this)},set:function(e){var t,r=null==(t=l.set)?void 0:t.call(this,e);if(null!==a&&-1!==a)try{s.adoptStyleSheets(e,a)}catch(n){}return r}}),Dl(function(){Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):function(){}}function Yl(e,t){void 0===t&&(t={});var r,n=e.doc.defaultView;if(!n)return function(){};!function(e,t){var r=e.mutationCb,n=e.mousemoveCb,i=e.mouseInteractionCb,o=e.scrollCb,s=e.viewportResizeCb,a=e.inputCb,c=e.mediaInteractionCb,l=e.styleSheetRuleCb,u=e.styleDeclarationCb,h=e.canvasMutationCb,d=e.fontCb,p=e.selectionCb,f=e.customElementCb;e.mutationCb=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var o;t.mutation&&(o=t).mutation.apply(o,[].concat(n)),r.apply(void 0,[].concat(n))},e.mousemoveCb=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var o;t.mousemove&&(o=t).mousemove.apply(o,[].concat(r)),n.apply(void 0,[].concat(r))},e.mouseInteractionCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o;t.mouseInteraction&&(o=t).mouseInteraction.apply(o,[].concat(r)),i.apply(void 0,[].concat(r))},e.scrollCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.scroll&&(i=t).scroll.apply(i,[].concat(r)),o.apply(void 0,[].concat(r))},e.viewportResizeCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.viewportResize&&(i=t).viewportResize.apply(i,[].concat(r)),s.apply(void 0,[].concat(r))},e.inputCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.input&&(i=t).input.apply(i,[].concat(r)),a.apply(void 0,[].concat(r))},e.mediaInteractionCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.mediaInteaction&&(i=t).mediaInteaction.apply(i,[].concat(r)),c.apply(void 0,[].concat(r))},e.styleSheetRuleCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.styleSheetRule&&(i=t).styleSheetRule.apply(i,[].concat(r)),l.apply(void 0,[].concat(r))},e.styleDeclarationCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.styleDeclaration&&(i=t).styleDeclaration.apply(i,[].concat(r)),u.apply(void 0,[].concat(r))},e.canvasMutationCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.canvasMutation&&(i=t).canvasMutation.apply(i,[].concat(r)),h.apply(void 0,[].concat(r))},e.fontCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.font&&(i=t).font.apply(i,[].concat(r)),d.apply(void 0,[].concat(r))},e.selectionCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.selection&&(i=t).selection.apply(i,[].concat(r)),p.apply(void 0,[].concat(r))},e.customElementCb=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i;t.customElement&&(i=t).customElement.apply(i,[].concat(r)),f.apply(void 0,[].concat(r))}}(e,t),e.recordDOM&&(r=ql(e,e.doc));var i,o,s,a,c,l=function(e){var t=e.mousemoveCb,r=e.sampling,n=e.doc,i=e.mirror;if(!1===r.mousemove)return function(){};var o,s="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,c=[],l=ol(Dl(function(e){var r=Date.now()-o;t(c.map(function(e){return e.timeOffset-=r,e}),e),c=[],o=null}),a),u=Dl(ol(Dl(function(e){var t=zl(e),r=ml(e)?e.changedTouches[0]:e,n=r.clientX,s=r.clientY;o||(o=al()),c.push({x:n,y:s,id:i.getId(t),timeOffset:al()-o}),l("undefined"!=typeof DragEvent&&ve(e,DragEvent)?Sl.Drag:ve(e,MouseEvent)?Sl.MouseMove:Sl.TouchMove)}),s,{trailing:!1})),h=[rl("mousemove",u,n),rl("touchmove",u,n),rl("drag",u,n)];return Dl(function(){h.forEach(function(e){return e()})})}(e),u=$l(e),h=Wl(e),d=(i={win:n},o=e.viewportResizeCb,s=i.win,a=-1,c=-1,rl("resize",Dl(ol(Dl(function(){var e=ll(),t=ul();a===e&&c===t||(o({width:Number(t),height:Number(e)}),a=e,c=t)}),200)),s)),p=function(e){var t=e.inputCb,r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.ignoreClass,a=e.ignoreSelector,c=e.maskInputOptions,l=e.maskInputFn,u=e.sampling,h=e.userTriggeredOnInput;function d(e){var t=zl(e),n=e.isTrusted,u=t&&t.tagName;if(t&&"OPTION"===u&&(t=tl.parentElement(t)),t&&u&&!(Gl.indexOf(u)<0)&&!dl(t,i,o,!0)&&!(t.classList.contains(s)||a&&t.matches(a))){var d=t.value,f=!1,m=Je(t)||"";"radio"===m||"checkbox"===m?f=t.checked:(c[u.toLowerCase()]||c[m])&&(d=Ke({element:t,maskInputOptions:c,tagName:u,type:m,value:d,maskInputFn:l})),p(t,h?{text:d,isChecked:f,userTriggered:n}:{text:d,isChecked:f});var g=t.name;"radio"===m&&g&&f&&r.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach(function(e){if(e!==t){var r=e.value;p(e,h?{text:r,isChecked:!f,userTriggered:!1}:{text:r,isChecked:!f})}})}}function p(e,r){var i=Hl.get(e);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Hl.set(e,r);var o=n.getId(e);Dl(t)(me({},r,{id:o}))}}var f=("last"===u.input?["change"]:["input","change"]).map(function(e){return rl(e,Dl(d),r)}),m=r.defaultView;if(!m)return function(){f.forEach(function(e){return e()})};var g,y=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),v=[[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 y&&y.set&&(g=f).push.apply(g,[].concat(v.map(function(e){return sl(e[0],e[1],{set:function(){Dl(d)({target:this,isTrusted:!1})}},!1,m)}))),Dl(function(){f.forEach(function(e){return e()})})}(e),f=function(e){var t=e.mediaInteractionCb,r=e.blockClass,n=e.blockSelector,i=e.mirror,o=e.sampling,s=e.doc,a=Dl(function(e){return ol(Dl(function(o){var s=zl(o);if(s&&!dl(s,r,n,!0)){var a=s.currentTime,c=s.volume,l=s.muted,u=s.playbackRate,h=s.loop;t({type:e,id:i.getId(s),currentTime:a,volume:c,muted:l,playbackRate:u,loop:h})}}),o.media||500)}),c=[rl("play",a(Al.Play),s),rl("pause",a(Al.Pause),s),rl("seeked",a(Al.Seeked),s),rl("volumechange",a(Al.VolumeChange),s),rl("ratechange",a(Al.RateChange),s)];return Dl(function(){c.forEach(function(e){return e()})})}(e),m=function(){},g=function(){},y=function(){},v=function(){};e.recordDOM&&(m=function(e,t){var r=e.styleSheetRuleCb,n=e.mirror,i=e.stylesheetManager,o=t.win;if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return function(){};var s=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Dl(function(e,t,o){var s=o[0],a=o[1],c=Kl(t,n,i.styleMirror),l=c.id,u=c.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:s,index:a}]}),e.apply(t,o)})}),o.CSSStyleSheet.prototype.addRule=function(e,t,r){void 0===r&&(r=this.cssRules.length);var n=e+" { "+t+" }";return o.CSSStyleSheet.prototype.insertRule.apply(this,[n,r])};var a,c,l=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:Dl(function(e,t,o){var s=o[0],a=Kl(t,n,i.styleMirror),c=a.id,l=a.styleId;return(c&&-1!==c||l&&-1!==l)&&r({id:c,styleId:l,removes:[{index:s}]}),e.apply(t,o)})}),o.CSSStyleSheet.prototype.removeRule=function(e){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},o.CSSStyleSheet.prototype.replace&&(a=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Dl(function(e,t,o){var s=o[0],a=Kl(t,n,i.styleMirror),c=a.id,l=a.styleId;return(c&&-1!==c||l&&-1!==l)&&r({id:c,styleId:l,replace:s}),e.apply(t,o)})})),o.CSSStyleSheet.prototype.replaceSync&&(c=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:Dl(function(e,t,o){var s=o[0],a=Kl(t,n,i.styleMirror),c=a.id,l=a.styleId;return(c&&-1!==c||l&&-1!==l)&&r({id:c,styleId:l,replaceSync:s}),e.apply(t,o)})}));var u={};Xl("CSSGroupingRule")?u.CSSGroupingRule=o.CSSGroupingRule:(Xl("CSSMediaRule")&&(u.CSSMediaRule=o.CSSMediaRule),Xl("CSSConditionRule")&&(u.CSSConditionRule=o.CSSConditionRule),Xl("CSSSupportsRule")&&(u.CSSSupportsRule=o.CSSSupportsRule));var h={};return Object.entries(u).forEach(function(e){var t=e[0],o=e[1];h[t]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(h[t].insertRule,{apply:Dl(function(e,t,o){var s=o[0],a=o[1],c=Kl(t.parentStyleSheet,n,i.styleMirror),l=c.id,u=c.styleId;return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:s,index:[].concat(Vl(t),[a||0])}]}),e.apply(t,o)})}),o.prototype.deleteRule=new Proxy(h[t].deleteRule,{apply:Dl(function(e,t,o){var s=o[0],a=Kl(t.parentStyleSheet,n,i.styleMirror),c=a.id,l=a.styleId;return(c&&-1!==c||l&&-1!==l)&&r({id:c,styleId:l,removes:[{index:[].concat(Vl(t),[s])}]}),e.apply(t,o)})})}),Dl(function(){o.CSSStyleSheet.prototype.insertRule=s,o.CSSStyleSheet.prototype.deleteRule=l,a&&(o.CSSStyleSheet.prototype.replace=a),c&&(o.CSSStyleSheet.prototype.replaceSync=c),Object.entries(u).forEach(function(e){var t=e[0],r=e[1];r.prototype.insertRule=h[t].insertRule,r.prototype.deleteRule=h[t].deleteRule})})}(e,{win:n}),g=Zl(e,e.doc),y=function(e,t){var r=e.styleDeclarationCb,n=e.mirror,i=e.ignoreCSSAttributes,o=e.stylesheetManager,s=t.win,a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Dl(function(e,t,s){var c,l=s[0],u=s[1],h=s[2];if(i.has(l))return a.apply(t,[l,u,h]);var d=Kl(null==(c=t.parentRule)?void 0:c.parentStyleSheet,n,o.styleMirror),p=d.id,f=d.styleId;return(p&&-1!==p||f&&-1!==f)&&r({id:p,styleId:f,set:{property:l,value:u,priority:h},index:Vl(t.parentRule)}),e.apply(t,s)})});var c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:Dl(function(e,t,s){var a,l=s[0];if(i.has(l))return c.apply(t,[l]);var u=Kl(null==(a=t.parentRule)?void 0:a.parentStyleSheet,n,o.styleMirror),h=u.id,d=u.styleId;return(h&&-1!==h||d&&-1!==d)&&r({id:h,styleId:d,remove:{property:l},index:Vl(t.parentRule)}),e.apply(t,s)})}),Dl(function(){s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c})}(e,{win:n}),e.collectFonts&&(v=function(e){var t=e.fontCb,r=e.doc,n=r.defaultView;if(!n)return function(){};var i=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,r){var n=new s(e,t,r);return o.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};var a=el(r.fonts,"add",function(e){return function(r){return setTimeout(Dl(function(){var e=o.get(r);e&&(t(e),o.delete(r))}),0),e.apply(this,[r])}});return i.push(function(){n.FontFace=s}),i.push(a),Dl(function(){i.forEach(function(e){return e()})})}(e)));for(var b,w=function(e){var t=e.doc,r=e.mirror,n=e.blockClass,i=e.blockSelector,o=e.selectionCb,s=!0,a=Dl(function(){var e=t.getSelection();if(!(!e||s&&(null==e?void 0:e.isCollapsed))){s=e.isCollapsed||!1;for(var a=[],c=e.rangeCount||0,l=0;l<c;l++){var u=e.getRangeAt(l),h=u.startContainer,d=u.startOffset,p=u.endContainer,f=u.endOffset;dl(h,n,i,!0)||dl(p,n,i,!0)||a.push({start:r.getId(h),startOffset:d,end:r.getId(p),endOffset:f})}o({ranges:a})}});return a(),rl("selectionchange",a)}(e),x=function(e){var t=e.doc,r=e.customElementCb,n=t.defaultView;return n&&n.customElements?el(n.customElements,"define",function(e){return function(t,n,i){try{r({define:{name:t}})}catch(o){console.warn("Custom element callback failed for "+t)}return e.apply(this,[t,n,i])}}):function(){}}(e),k=[],_=Se(e.plugins);!(b=_()).done;){var S=b.value;k.push(S.observer(S.callback,n,S.options))}return Dl(function(){Fl.forEach(function(e){return e.reset()}),null==r||r.disconnect(),l(),u(),h(),d(),p(),f(),m(),g(),y(),v(),w(),x(),k.forEach(function(e){return e()})})}function Jl(e){return void 0!==window[e]}function Xl(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var Ql=function(){function e(e){Me(this,"iframeIdToRemoteIdMap",new WeakMap),Me(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}var t=e.prototype;return t.getId=function(e,t,r,n){var i=r||this.getIdToRemoteIdMap(e),o=n||this.getRemoteIdToIdMap(e),s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),o.set(s,t)),s},t.getIds=function(e,t){var r=this,n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(function(t){return r.getId(e,t,n,i)})},t.getRemoteId=function(e,t,r){var n=r||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;var i=n.get(t);return i||-1},t.getRemoteIds=function(e,t){var r=this,n=this.getRemoteIdToIdMap(e);return t.map(function(t){return r.getRemoteId(e,t,n)})},t.reset=function(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)},t.getIdToRemoteIdMap=function(e){var t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t},t.getRemoteIdToIdMap=function(e){var t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t},e}(),eu=function(){function e(e){Me(this,"iframes",new WeakMap),Me(this,"crossOriginIframeMap",new WeakMap),Me(this,"crossOriginIframeMirror",new Ql(ut)),Me(this,"crossOriginIframeStyleMirror"),Me(this,"crossOriginIframeRootIdMap",new WeakMap),Me(this,"mirror"),Me(this,"mutationCb"),Me(this,"wrappedEmit"),Me(this,"loadListener"),Me(this,"stylesheetManager"),Me(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ql(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}var t=e.prototype;return t.addIframe=function(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)},t.addLoadListener=function(e){this.loadListener=e},t.attachIframe=function(e,t){var r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(r=e.contentWindow)||r.addEventListener("message",this.handleMessage.bind(this))),null==(n=this.loadListener)||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))},t.handleMessage=function(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var r=this.crossOriginIframeMap.get(e.source);if(r){var n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}}},t.transformCrossOriginEvent=function(e,t){var r,n=this;switch(t.type){case _l.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:_l.IncrementalSnapshot,data:{source:Sl.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case _l.Meta:case _l.Load:case _l.DomContentLoaded:return!1;case _l.Plugin:return t;case _l.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case _l.IncrementalSnapshot:switch(t.data.source){case Sl.Mutation:return t.data.adds.forEach(function(t){n.replaceIds(t,e,["parentId","nextId","previousId"]),n.replaceIdOnNode(t.node,e);var r=n.crossOriginIframeRootIdMap.get(e);r&&n.patchRootIdOnNode(t.node,r)}),t.data.removes.forEach(function(t){n.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(function(t){n.replaceIds(t,e,["id"])}),t.data.texts.forEach(function(t){n.replaceIds(t,e,["id"])}),t;case Sl.Drag:case Sl.TouchMove:case Sl.MouseMove:return t.data.positions.forEach(function(t){n.replaceIds(t,e,["id"])}),t;case Sl.ViewportResize:return!1;case Sl.MediaInteraction:case Sl.MouseInteraction:case Sl.Scroll:case Sl.CanvasMutation:case Sl.Input:return this.replaceIds(t.data,e,["id"]),t;case Sl.StyleSheetRule:case Sl.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Sl.Font:return t;case Sl.Selection:return t.data.ranges.forEach(function(t){n.replaceIds(t,e,["start","end"])}),t;case Sl.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach(function(t){n.replaceStyleIds(t,e,["styleId"])}),t}}return!1},t.replace=function(e,t,r,n){for(var i,o=Se(n);!(i=o()).done;){var s=i.value;(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(r,t[s]):t[s]=e.getId(r,t[s]))}return t},t.replaceIds=function(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)},t.replaceStyleIds=function(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)},t.replaceIdOnNode=function(e,t){var r=this;this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(function(e){r.replaceIdOnNode(e,t)})},t.patchRootIdOnNode=function(e,t){var r=this;e.type===Ml.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(function(e){r.patchRootIdOnNode(e,t)})},e}(),tu=function(){function e(e){Me(this,"shadowDoms",new WeakSet),Me(this,"mutationCb"),Me(this,"scrollCb"),Me(this,"bypassOptions"),Me(this,"mirror"),Me(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}var t=e.prototype;return t.init=function(){this.reset(),this.patchAttachShadow(Element,document)},t.addShadowRoot=function(e,t){var r=this;if(We(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var n=ql(me({},this.bypassOptions,{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(function(){return n.disconnect()}),this.restoreHandlers.push(Wl(me({},this.bypassOptions,{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(function(){e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&r.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,r.mirror.getId(tl.host(e))),r.restoreHandlers.push(Zl({mirror:r.mirror,stylesheetManager:r.bypassOptions.stylesheetManager},e))},0)}},t.observeAttachShadow=function(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)},t.patchAttachShadow=function(e,t){var r=this;this.restoreHandlers.push(el(e.prototype,"attachShadow",function(e){return function(n){var i=e.call(this,n),o=tl.shadowRoot(this);return o&&kl(this)&&r.addShadowRoot(o,t),i}}))},t.reset=function(){this.restoreHandlers.forEach(function(e){try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet},e}(),ru="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nu="undefined"==typeof Uint8Array?[]:new Uint8Array(256),iu=0;iu<64;iu++)nu[ru.charCodeAt(iu)]=iu;var ou=new Map;var su=function(e,t,r){if(e&&(lu(e,t)||"object"===(void 0===e?"undefined":xe(e)))){var n=function(e,t){var r=ou.get(e);return r||(r=new Map,ou.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),i=n.indexOf(e);return-1===i&&(i=n.length,n.push(e)),i}};function au(e,t,r){if(ve(e,Array))return e.map(function(e){return au(e,t,r)});if(null===e)return e;if(ve(e,Float32Array)||ve(e,Float64Array)||ve(e,Int32Array)||ve(e,Uint32Array)||ve(e,Uint8Array)||ve(e,Uint16Array)||ve(e,Int16Array)||ve(e,Int8Array)||ve(e,Uint8ClampedArray))return{rr_type:e.constructor.name,args:[Object.values(e)]};if(ve(e,ArrayBuffer))return{rr_type:e.constructor.name,base64:function(e){var t,r=new Uint8Array(e),n=r.length,i="";for(t=0;t<n;t+=3)i+=ru[r[t]>>2],i+=ru[(3&r[t])<<4|r[t+1]>>4],i+=ru[(15&r[t+1])<<2|r[t+2]>>6],i+=ru[63&r[t+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)};if(ve(e,DataView))return{rr_type:e.constructor.name,args:[au(e.buffer,t,r),e.byteOffset,e.byteLength]};if(ve(e,HTMLImageElement))return{rr_type:e.constructor.name,src:e.src};if(ve(e,HTMLCanvasElement)){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}return ve(e,ImageData)?{rr_type:e.constructor.name,args:[au(e.data,t,r),e.width,e.height]}:lu(e,t)||"object"===(void 0===e?"undefined":xe(e))?{rr_type:e.constructor.name,index:su(e,t,r)}:e}var cu=function(e,t,r){return e.map(function(e){return au(e,t,r)})},lu=function(e,t){var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(function(e){return"function"==typeof t[e]});return Boolean(r.find(function(r){return ve(e,t[r])}))};function uu(e,t,r,n){var i=[];try{var o=el(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i){for(var o=arguments.length,s=new Array(o>1?o-1:0),a=1;a<o;a++)s[a-1]=arguments[a];if(!dl(this,t,r,!0)){var c=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(s[0]&&"object"===xe(s[0])){var l=s[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[].concat([i],s))}});i.push(o)}catch(s){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return function(){i.forEach(function(e){return e()})}}function hu(e,t,r,n,i,o){for(var s,a=function(){var a=s.value;if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))return"continue";try{if("function"!=typeof e[a])return"continue";var l=el(e,a,function(e){return function(){for(var s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];var u=e.apply(this,c);if(su(u,o,this),"tagName"in this.canvas&&!dl(this.canvas,n,i,!0)){var h=cu(c,o,this),d={type:t,property:a,args:h};r(this.canvas,d)}return u}});c.push(l)}catch(h){var u=sl(e,a,{set:function(e){r(this.canvas,{type:t,property:a,args:[e],setter:!0})}});c.push(u)}},c=[],l=Se(Object.getOwnPropertyNames(e));!(s=l()).done;)a();return c}var du,pu="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",fu="undefined"!=typeof window&&window.Blob&&new Blob([(du=pu,Uint8Array.from(atob(du),function(e){return e.charCodeAt(0)}))],{type:"text/javascript;charset=utf-8"});function mu(e){var t;try{if(!(t=fu&&(window.URL||window.webkitURL).createObjectURL(fu)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",function(){(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch(n){return new Worker("data:text/javascript;base64,"+pu,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var gu,yu,vu,bu=function(){function e(e){var t=this;Me(this,"pendingCanvasMutations",new Map),Me(this,"rafStamps",{latestId:0,invokeId:null}),Me(this,"mirror"),Me(this,"mutationCb"),Me(this,"resetObservers"),Me(this,"frozen",!1),Me(this,"locked",!1),Me(this,"processMutation",function(e,r){!(t.rafStamps.invokeId&&t.rafStamps.latestId!==t.rafStamps.invokeId)&&t.rafStamps.invokeId||(t.rafStamps.invokeId=t.rafStamps.latestId),t.pendingCanvasMutations.has(e)||t.pendingCanvasMutations.set(e,[]),t.pendingCanvasMutations.get(e).push(r)});var r=e.sampling,n=void 0===r?"all":r,i=e.win,o=e.blockClass,s=e.blockSelector,a=e.recordCanvas,c=e.dataURLOptions;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===n&&this.initCanvasMutationObserver(i,o,s),a&&"number"==typeof n&&this.initCanvasFPSObserver(n,i,o,s,{dataURLOptions:c})}var t=e.prototype;return t.reset=function(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()},t.freeze=function(){this.frozen=!0},t.unfreeze=function(){this.frozen=!1},t.lock=function(){this.locked=!0},t.unlock=function(){this.locked=!1},t.initCanvasFPSObserver=function(e,t,r,n,i){var o=this,s=uu(t,r,n,!0),a=new Map,c=new mu;c.onmessage=function(e){var t=e.data.id;if(a.set(t,!1),"base64"in e.data){var r=e.data,n=r.base64,i=r.type,s=r.width,c=r.height;o.mutationCb({id:t,type:El["2D"],commands:[{property:"clearRect",args:[0,0,s,c]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})}};var l,u=1e3/e,h=0,d=function(e){if(h&&e-h<u)l=requestAnimationFrame(d);else{h=e;var s,p=o;(s=[],t.document.querySelectorAll("canvas").forEach(function(e){dl(e,r,n,!0)||s.push(e)}),s).forEach(de(function(e){var t,r,n,o;return Ce(this,function(s){switch(s.label){case 0:return r=p.mirror.getId(e),a.get(r)?[2]:0===e.width||0===e.height?[2]:(a.set(r,!0),["webgl","webgl2"].includes(e.__context)&&(n=e.getContext(e.__context),!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)),[4,createImageBitmap(e)]);case 1:return o=s.sent(),c.postMessage({id:r,bitmap:o,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[o]),[2]}})})),l=requestAnimationFrame(d)}};l=requestAnimationFrame(d),this.resetObservers=function(){s(),cancelAnimationFrame(l)}},t.initCanvasMutationObserver=function(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=uu(e,t,r,!1),i=function(e,t,r,n){for(var i,o=function(){var o=i.value;try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return"continue";var a=el(t.CanvasRenderingContext2D.prototype,o,function(i){return function(){for(var s=this,a=arguments.length,c=new Array(a),l=0;l<a;l++)c[l]=arguments[l];return dl(this.canvas,r,n,!0)||setTimeout(function(){var r=cu(c,t,s);e(s.canvas,{type:El["2D"],property:o,args:r})},0),i.apply(this,c)}});s.push(a)}catch(l){var c=sl(t.CanvasRenderingContext2D.prototype,o,{set:function(t){e(this.canvas,{type:El["2D"],property:o,args:[t],setter:!0})}});s.push(c)}},s=[],a=Se(Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype));!(i=a()).done;)o();return function(){s.forEach(function(e){return e()})}}(this.processMutation.bind(this),e,t,r),o=function(e,t,r,n){var i,o,s=[];return(i=s).push.apply(i,[].concat(hu(t.WebGLRenderingContext.prototype,El.WebGL,e,r,n,t))),void 0!==t.WebGL2RenderingContext&&(o=s).push.apply(o,[].concat(hu(t.WebGL2RenderingContext.prototype,El.WebGL2,e,r,n,t))),function(){s.forEach(function(e){return e()})}}(this.processMutation.bind(this),e,t,r);this.resetObservers=function(){n(),i(),o()}},t.startPendingCanvasMutationFlusher=function(){var e=this;requestAnimationFrame(function(){return e.flushPendingCanvasMutations()})},t.startRAFTimestamping=function(){var e=this,t=function(r){e.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)},t.flushPendingCanvasMutations=function(){var e=this;this.pendingCanvasMutations.forEach(function(t,r){var n=e.mirror.getId(r);e.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(function(){return e.flushPendingCanvasMutations()})},t.flushPendingCanvasMutationFor=function(e,t){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(e);if(r&&-1!==t){var n=r.map(function(e){return e.type,be(e,["type"])}),i=r[0].type;this.mutationCb({id:t,type:i,commands:n}),this.pendingCanvasMutations.delete(e)}}},e}(),wu=function(){function e(e){Me(this,"trackedLinkElements",new WeakSet),Me(this,"mutationCb"),Me(this,"adoptedStyleSheetCb"),Me(this,"styleMirror",new bl),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}var t=e.prototype;return t.attachLinkElement=function(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)},t.trackLinkElement=function(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))},t.adoptStyleSheets=function(e,t){var r,n=function(){var e=i.value,t=void 0;r.styleMirror.has(e)?t=r.styleMirror.getId(e):(t=r.styleMirror.add(e),s.push({styleId:t,rules:Array.from(e.rules||CSSRule,function(t,r){return{rule:He(t,e.href),index:r}})})),o.styleIds.push(t)};if(0!==e.length){for(var i,o={id:t,styleIds:[]},s=[],a=Se(e);!(i=a()).done;)r=this,n();s.length>0&&(o.styles=s),this.adoptedStyleSheetCb(o)}},t.reset=function(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet},t.trackStylesheetInLinkElement=function(e){},e}(),xu=function(){function e(){Me(this,"nodeMap",new WeakMap),Me(this,"active",!1)}var t=e.prototype;return t.inOtherBuffer=function(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).some(function(e){return e!==t})},t.add=function(e,t){var r=this;this.active||(this.active=!0,requestAnimationFrame(function(){r.nodeMap=new WeakMap,r.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))},t.destroy=function(){},e}(),ku=!1;try{if(2!==Array.from([1],function(e){return 2*e})[0]){var _u=document.createElement("iframe");document.body.appendChild(_u),Array.from=(null==(Ee=_u.contentWindow)?void 0:Ee.Array.from)||Array.from,document.body.removeChild(_u)}}catch(oA){}var Su,Cu,Iu=new Ve;function Eu(e){void 0===e&&(e={});var t=e.emit,r=e.checkoutEveryNms,n=e.checkoutEveryNth,i=e.blockClass,o=void 0===i?"rr-block":i,s=e.blockSelector,a=void 0===s?null:s,c=e.ignoreClass,l=void 0===c?"rr-ignore":c,u=e.ignoreSelector,h=void 0===u?null:u,d=e.maskTextClass,p=void 0===d?"rr-mask":d,f=e.maskTextSelector,m=void 0===f?null:f,g=e.inlineStylesheet,y=void 0===g||g,v=e.maskAllInputs,b=e.maskInputOptions,w=e.slimDOMOptions,x=e.maskInputFn,k=e.maskTextFn,_=e.hooks,S=e.packFn,C=e.sampling,I=void 0===C?{}:C,E=e.dataURLOptions,A=void 0===E?{}:E,M=e.mousemoveWait,N=e.recordDOM,P=void 0===N||N,T=e.recordCanvas,O=void 0!==T&&T,B=e.recordCrossOriginIframes,R=void 0!==B&&B,L=e.recordAfter,j=void 0===L?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":L,U=e.userTriggeredOnInput,D=void 0!==U&&U,F=e.collectFonts,z=void 0!==F&&F,q=e.inlineImages,$=void 0!==q&&q,W=e.plugins,G=e.keepIframeSrcFn,H=void 0===G?function(){return!1}:G,V=e.ignoreCSSAttributes,K=void 0===V?new Set([]):V,Z=e.errorHandler;Pl=Z;var Y=!R||window.parent===window,J=!1;if(!Y)try{window.parent.document&&(J=!1)}catch(ve){J=!0}if(Y&&!t)throw new Error("emit function is required");if(!Y&&!J)return function(){};void 0!==M&&void 0===I.mousemove&&(I.mousemove=M),Iu.reset();var X,Q,ee=!0===v?{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,hidden:!0}:void 0!==b?b:{password:!0},te=!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===w,headMetaDescKeywords:"all"===w,headTitleMutations:"all"===w}:w||{};void 0===X&&(X=window),"NodeList"in X&&!X.NodeList.prototype.forEach&&(X.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in X&&!X.DOMTokenList.prototype.forEach&&(X.DOMTokenList.prototype.forEach=Array.prototype.forEach);var re=0,ne=function(e){for(var t,r=Se(W||[]);!(t=r()).done;){var n=t.value;n.eventProcessor&&(e=n.eventProcessor(e))}return S&&!J&&(e=S(e)),e};gu=function(e,i){var o,s=e;if(s.timestamp=al(),!(null==(o=Fl[0])?void 0:o.isFrozen())||s.type===_l.FullSnapshot||s.type===_l.IncrementalSnapshot&&s.data.source===Sl.Mutation||Fl.forEach(function(e){return e.unfreeze()}),Y)null==t||t(ne(s),i);else if(J){var a={type:"rrweb",event:ne(s),origin:window.location.origin,isCheckout:i};window.parent.postMessage(a,"*")}if(s.type===_l.FullSnapshot)Q=s,re=0;else if(s.type===_l.IncrementalSnapshot){if(s.data.source===Sl.Mutation&&s.data.isAttachIframe)return;re++;var c=n&&re>=n,l=r&&s.timestamp-Q.timestamp>r;(c||l)&&yu(!0)}};for(var ie,oe=function(e){gu({type:_l.IncrementalSnapshot,data:me({source:Sl.Mutation},e)})},se=function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.Scroll},e)})},ae=function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.CanvasMutation},e)})},ce=new wu({mutationCb:oe,adoptedStyleSheetCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.AdoptedStyleSheet},e)})}}),le=new eu({mirror:Iu,mutationCb:oe,stylesheetManager:ce,recordCrossOriginIframes:R,wrappedEmit:gu}),ue=Se(W||[]);!(ie=ue()).done;){var he=ie.value;he.getMirror&&he.getMirror({nodeMirror:Iu,crossOriginIframeMirror:le.crossOriginIframeMirror,crossOriginIframeStyleMirror:le.crossOriginIframeStyleMirror})}var de=new xu;vu=new bu({recordCanvas:O,mutationCb:ae,win:window,blockClass:o,blockSelector:a,mirror:Iu,sampling:I.canvas,dataURLOptions:A});var pe=new tu({mutationCb:oe,scrollCb:se,bypassOptions:{blockClass:o,blockSelector:a,maskTextClass:p,maskTextSelector:m,inlineStylesheet:y,maskInputOptions:ee,dataURLOptions:A,maskTextFn:k,maskInputFn:x,recordCanvas:O,inlineImages:$,sampling:I,slimDOMOptions:te,iframeManager:le,stylesheetManager:ce,canvasManager:vu,keepIframeSrcFn:H,processedNodeManager:de},mirror:Iu});yu=function(e){if(void 0===e&&(e=!1),P){gu({type:_l.Meta,data:{href:window.location.href,width:ul(),height:ll()}},e),ce.reset(),pe.init(),Fl.forEach(function(e){return e.lock()});var t=function(e,t){var r=t||{},n=r.mirror,i=void 0===n?new Ve:n,o=r.blockClass,s=void 0===o?"rr-block":o,a=r.blockSelector,c=void 0===a?null:a,l=r.maskTextClass,u=void 0===l?"rr-mask":l,h=r.maskTextSelector,d=void 0===h?null:h,p=r.inlineStylesheet,f=void 0===p||p,m=r.inlineImages,g=void 0!==m&&m,y=r.recordCanvas,v=void 0!==y&&y,b=r.maskAllInputs,w=void 0!==b&&b,x=r.maskTextFn,k=r.maskInputFn,_=r.slimDOM,S=void 0!==_&&_,C=r.dataURLOptions,I=r.preserveWhiteSpace,E=r.onSerialize,A=r.onIframeLoad,M=r.iframeLoadTimeout,N=r.onStylesheetLoad,P=r.stylesheetLoadTimeout,T=r.keepIframeSrcFn;return _t(e,{doc:e,mirror:i,blockClass:s,blockSelector:c,maskTextClass:u,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===w?{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,hidden:!0}:!1===w?{password:!0}:w,maskTextFn:x,maskInputFn:k,slimDOMOptions:!0===S||"all"===S?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===S,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===S?{}:S,dataURLOptions:C,inlineImages:g,recordCanvas:v,preserveWhiteSpace:I,onSerialize:E,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:N,stylesheetLoadTimeout:P,keepIframeSrcFn:void 0===T?function(){return!1}:T,newlyAddedElement:!1})}(document,{mirror:Iu,blockClass:o,blockSelector:a,maskTextClass:p,maskTextSelector:m,inlineStylesheet:y,maskAllInputs:ee,maskTextFn:k,maskInputFn:x,slimDOM:te,dataURLOptions:A,recordCanvas:O,inlineImages:$,onSerialize:function(e){gl(e,Iu)&&le.addIframe(e),yl(e,Iu)&&ce.trackLinkElement(e),vl(e)&&pe.addShadowRoot(tl.shadowRoot(e),document)},onIframeLoad:function(e,t){le.attachIframe(e,t),pe.observeAttachShadow(e)},onStylesheetLoad:function(e,t){ce.attachLinkElement(e,t)},keepIframeSrcFn:H});if(!t)return console.warn("Failed to snapshot the document");gu({type:_l.FullSnapshot,data:{node:t,initialOffset:cl(window)}},e),Fl.forEach(function(e){return e.unlock()}),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ce.adoptStyleSheets(document.adoptedStyleSheets,Iu.getId(document))}};try{var fe=[],ge=function(e){var t;return Dl(Yl)({mutationCb:oe,mousemoveCb:function(e,t){return gu({type:_l.IncrementalSnapshot,data:{source:t,positions:e}})},mouseInteractionCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.MouseInteraction},e)})},scrollCb:se,viewportResizeCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.ViewportResize},e)})},inputCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.Input},e)})},mediaInteractionCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.MediaInteraction},e)})},styleSheetRuleCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.StyleSheetRule},e)})},styleDeclarationCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.StyleDeclaration},e)})},canvasMutationCb:ae,fontCb:function(e){return gu({type:_l.IncrementalSnapshot,data:me({source:Sl.Font},e)})},selectionCb:function(e){gu({type:_l.IncrementalSnapshot,data:me({source:Sl.Selection},e)})},customElementCb:function(e){gu({type:_l.IncrementalSnapshot,data:me({source:Sl.CustomElement},e)})},blockClass:o,ignoreClass:l,ignoreSelector:h,maskTextClass:p,maskTextSelector:m,maskInputOptions:ee,inlineStylesheet:y,sampling:I,recordDOM:P,recordCanvas:O,inlineImages:$,userTriggeredOnInput:D,collectFonts:z,doc:e,maskInputFn:x,maskTextFn:k,keepIframeSrcFn:H,blockSelector:a,slimDOMOptions:te,dataURLOptions:A,mirror:Iu,iframeManager:le,stylesheetManager:ce,shadowDomManager:pe,processedNodeManager:de,canvasManager:vu,ignoreCSSAttributes:K,plugins:(null==(t=null==W?void 0:W.filter(function(e){return e.observer}))?void 0:t.map(function(e){return{observer:e.observer,options:e.options,callback:function(t){return gu({type:_l.Plugin,data:{plugin:e.name,payload:t}})}}}))||[]},_)};le.addLoadListener(function(e){try{fe.push(ge(e.contentDocument))}catch(uh){console.warn(uh)}});var ye=function(){yu(),fe.push(ge(document)),ku=!0};return"interactive"===document.readyState||"complete"===document.readyState?ye():(fe.push(rl("DOMContentLoaded",function(){gu({type:_l.DomContentLoaded,data:{}}),"DOMContentLoaded"===j&&ye()})),fe.push(rl("load",function(){gu({type:_l.Load,data:{}}),"load"===j&&ye()},window))),function(){fe.forEach(function(e){try{e()}catch(uh){String(uh).toLowerCase().includes("cross-origin")||console.warn(uh)}}),de.destroy(),ku=!1,Pl=void 0}}catch(uh){console.warn(uh)}}Eu.addCustomEvent=function(e,t){if(!ku)throw new Error("please add custom event after start recording");gu({type:_l.Custom,data:{tag:e,payload:t}})},Eu.freezePage=function(){Fl.forEach(function(e){return e.freeze()})},Eu.takeFullSnapshot=function(e){if(!ku)throw new Error("please take full snapshot after start recording");yu(e)},Eu.mirror=Iu,(Cu=Su||(Su={}))[Cu.NotStarted=0]="NotStarted",Cu[Cu.Running=1]="Running",Cu[Cu.Stopped=2]="Stopped",Eu.addCustomEvent,Eu.freezePage,Eu.takeFullSnapshot;var Au=Object.defineProperty,Mu=function(e,t,r){return function(e,t,r){return t in e?Au(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r}(e,"symbol"!==(void 0===t?"undefined":xe(t))?t+"":t,r)};var Nu=function(){function e(e){Mu(this,"fileName"),Mu(this,"functionName"),Mu(this,"lineNumber"),Mu(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}return e.prototype.toString=function(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t},e}(),Pu=/(^|@)\S+:\d+/,Tu=/^\s*at .*(\S+:\d+|\(native\))/m,Ou=/^(eval@)?(\[native code])?$/,Bu={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Tu)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: "+e);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(Tu)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),i=this.extractLocation(r?r[1]:n.pop()),o=n.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Nu({functionName:o,fileName:s,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(Ou)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Nu({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Nu({functionName:n,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[],i=2,o=r.length;i<o;i+=2){var s=t.exec(r[i]);s&&n.push(new Nu({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[],i=0,o=r.length;i<o;i+=2){var s=t.exec(r[i]);s&&n.push(new Nu({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11:function(e){return e.stack.split("\n").filter(function(e){return!!e.match(Pu)&&!e.match(/^Error created at/)},this).map(function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),n=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Nu({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function Ru(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(var o=0;o<n.children.length;o++){var s=n.children[o];s.localName&&s.localName.toLowerCase&&s.localName.toLowerCase()===r&&i.push(s)}i.length>1&&(r+=":eq("+i.indexOf(e)+")"),t=r+(t?">"+t:""),e=n}return t}function Lu(e){return"[object Object]"===Object.prototype.toString.call(e)}function ju(e,t){if(0===t)return!0;for(var r,n=Se(Object.keys(e));!(r=n()).done;){var i=r.value;if(Lu(e[i])&&ju(e[i],t-1))return!0}return!1}function Uu(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var n=[],i=[];return JSON.stringify(e,function(e,t){if(n.length>0){var o=n.indexOf(this);~o?n.splice(o+1):n.push(this),~o?i.splice(o,1/0,e):i.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(Lu(e)&&Object.keys(e).length>r.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(Lu(e)&&ju(e,r.depthOfLimit))return!0;return!1}(t))return function(e){var t=e.toString();r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=t.slice(0,r.stringLengthLimit)+"...");return t}(t);if("bigint"===(void 0===t?"undefined":xe(t)))return t.toString()+"n";if(ve(t,Event)){var s={};for(var a in t){var c=t[a];Array.isArray(c)?s[a]=Ru(c.length?c[0]:null):s[a]=c}return s}return ve(t,Node)?ve(t,HTMLElement)?t?t.outerHTML:"":t.nodeName:ve(t,Error)?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var Du={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Fu(e,t,r){var n,i=r?Object.assign({},Du,r):Du,o=i.logger;if(!o)return function(){};n="string"==typeof o?t[o]:o;var s=0,a=!1,c=[];if(i.level.includes("error")){var l=function(t){var r=t.message,n=t.error,o=Bu.parse(n).map(function(e){return e.toString()}),s=[Uu(r,i.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",l),c.push(function(){t.removeEventListener("error",l)});var u=function(t){var r,n;ve(t.reason,Error)?n=[Uu("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,i.stringifyOptions)]:(r=new Error,n=[Uu("Uncaught (in promise)",i.stringifyOptions),Uu(t.reason,i.stringifyOptions)]);var o=Bu.parse(r).map(function(e){return e.toString()});e({level:"error",trace:o,payload:n})};t.addEventListener("unhandledrejection",u),c.push(function(){t.removeEventListener("unhandledrejection",u)})}for(var h,d=Se(i.level);!(h=d()).done;){var p=h.value;c.push(f(n,p))}return function(){c.forEach(function(e){return e()})};function f(t,r){var n=this;return t[r]?function(e,t,r){try{if(!(t in e))return function(){};var n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,function(){e[t]=n}}catch(o){return function(){}}}(t,r,function(t){var o=n;return function(){for(var n=arguments.length,c=new Array(n),l=0;l<n;l++)c[l]=arguments[l];if(t.apply(o,c),!("assert"===r&&c[0]||a)){a=!0;try{var u=Bu.parse(new Error).map(function(e){return e.toString()}).splice(1),h=("assert"===r?c.slice(1):c).map(function(e){return Uu(e,i.stringifyOptions)});++s<i.lengthThreshold?e({level:r,trace:u,payload:h}):s===i.lengthThreshold&&e({level:"warn",trace:[],payload:[Uu("The number of log records reached the threshold.")]})}catch(uh){t.apply(void 0,[].concat(["rrweb logger error:",uh],c))}finally{a=!1}}}}):function(){}}}var zu,qu,$u,Wu=ce.setImmediate,Gu=Object.prototype.toString,Hu=void 0!==Wu?function(e){return Wu(e)}:setTimeout;try{Object.defineProperty({},"x",{}),zu=function(e,t,r,n){return Object.defineProperty(e,t,{value:r,writable:!0,configurable:!1!==n})}}catch(oA){zu=function(e,t,r){return e[t]=r,e}}function Vu(e,t){$u.add(e,t),qu||(qu=Hu($u.drain))}function Ku(e){var t,r=typeof e;return null===e||"object"!==r&&"function"!==r||(t=e.then),"function"==typeof t&&t}function Zu(){for(var e=0;e<this.chain.length;e++)Yu(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function Yu(e,t,r){var n,i;try{!1===t?r.reject(e.msg):(n=!0===t?e.msg:t.call(void 0,e.msg))===r.promise?r.reject(TypeError("Promise-chain cycle")):(i=Ku(n))?i.call(n,r.resolve,r.reject):r.resolve(n)}catch(oA){r.reject(oA)}}function Ju(e){var t,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(t=Ku(e))?Vu(function(){var n=new eh(r);try{t.call(e,function(){Ju.apply(n,arguments)},function(){Xu.apply(n,arguments)})}catch(oA){Xu.call(n,oA)}}):(r.msg=e,r.state=1,r.chain.length>0&&Vu(Zu,r))}catch(oA){Xu.call(new eh(r),oA)}}}function Xu(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&Vu(Zu,t))}function Qu(e,t,r,n){for(var i=0;i<t.length;i++)(function(i){e.resolve(t[i]).then(function(e){r(i,e)},n)})(i)}function eh(e){this.def=e,this.triggered=!1}function th(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function rh(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var t=new th(this);this.then=function(e,r){var n={success:"function"!=typeof e||e,failure:"function"==typeof r&&r};return n.promise=new this.constructor(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");n.resolve=e,n.reject=t}),t.chain.push(n),0!==t.state&&Vu(Zu,t),n.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){Ju.call(t,e)},function(e){Xu.call(t,e)})}catch(oA){Xu.call(t,oA)}}$u=function(){var e,t,r;function n(e,t){this.fn=e,this.self=t,this.next=void 0}return{add:function(i,o){r=new n(i,o),t?t.next=r:e=r,t=r,r=void 0},drain:function(){var r=e;for(e=t=qu=void 0;r;)r.fn.call(r.self),r=r.next}}}();var nh,ih=zu({},"constructor",rh,!1);rh.prototype=ih,zu(ih,"__NPO__",0,!1),zu(rh,"resolve",function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this(function(t,r){if("function"!=typeof t||"function"!=typeof r)throw TypeError("Not a function");t(e)})}),zu(rh,"reject",function(e){return new this(function(t,r){if("function"!=typeof t||"function"!=typeof r)throw TypeError("Not a function");r(e)})}),zu(rh,"all",function(e){var t=this;return"[object Array]"!==Gu.call(e)?t.reject(TypeError("Not an array")):0===e.length?t.resolve([]):new t(function(r,n){if("function"!=typeof r||"function"!=typeof n)throw TypeError("Not a function");var i=e.length,o=Array(i),s=0;Qu(t,e,function(e,t){o[e]=t,++s===i&&r(o)},n)})}),zu(rh,"race",function(e){var t=this;return"[object Array]"!==Gu.call(e)?t.reject(TypeError("Not an array")):new t(function(r,n){if("function"!=typeof r||"function"!=typeof n)throw TypeError("Not a function");Qu(t,e,function(e,t){r(t)},n)})}),nh="undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]")?Promise:rh;var oh,sh,ah,ch,lh,uh,hh,dh,ph,fh,mh={DEBUG:!1,LIB_VERSION:"2.73.0"},gh=864e5,yh=8e3,vh=Array.prototype,bh=Function.prototype,wh=Object.prototype,xh=vh.slice,kh=wh.toString,_h=wh.hasOwnProperty,Sh=ce.console,Ch=ce.navigator,Ih=ce.document,Eh=ce.opera,Ah=ce.screen,Mh=Ch.userAgent,Nh=bh.bind,Ph=vh.forEach,Th=vh.indexOf,Oh=vh.map,Bh=Array.isArray,Rh={},Lh={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},jh={log:function(){if(mh.DEBUG&&!Lh.isUndefined(Sh)&&Sh)try{Sh.log.apply(Sh,arguments)}catch(oA){Lh.each(arguments,function(e){Sh.log(e)})}},warn:function(){if(mh.DEBUG&&!Lh.isUndefined(Sh)&&Sh){var e=["Mixpanel warning:"].concat(Lh.toArray(arguments));try{Sh.warn.apply(Sh,e)}catch(oA){Lh.each(e,function(e){Sh.warn(e)})}}},error:function(){if(mh.DEBUG&&!Lh.isUndefined(Sh)&&Sh){var e=["Mixpanel error:"].concat(Lh.toArray(arguments));try{Sh.error.apply(Sh,e)}catch(oA){Lh.each(e,function(e){Sh.error(e)})}}},critical:function(){if(!Lh.isUndefined(Sh)&&Sh){var e=["Mixpanel error:"].concat(Lh.toArray(arguments));try{Sh.error.apply(Sh,e)}catch(oA){Lh.each(e,function(e){Sh.error(e)})}}}},Uh=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(jh,arguments)}},Dh=function(e){return{log:Uh(jh.log,e),error:Uh(jh.error,e),critical:Uh(jh.critical,e)}},Fh=function(e){return function(){try{return e.apply(this,arguments)}catch(t){jh.critical("Implementation error. Please turn on debug and contact support@mixpanel.com."),mh.DEBUG&&jh.critical(t)}}},zh=function(e){var t=e.prototype;for(var r in t)"function"==typeof t[r]&&(t[r]=Fh(t[r]))};Lh.bind=function(e,t){var r,n;if(Nh&&e.bind===Nh)return Nh.apply(e,xh.call(arguments,1));if(!Lh.isFunction(e))throw new TypeError;return r=xh.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,r.concat(xh.call(arguments)));var i={};i.prototype=e.prototype;var o=new i;i.prototype=null;var s=e.apply(o,r.concat(xh.call(arguments)));return Object(s)===s?s:o},n},Lh.each=function(e,t,r){if(null!=e)if(Ph&&e.forEach===Ph)e.forEach(t,r);else if(e.length===+e.length){for(var n=0,i=e.length;n<i;n++)if(n in e&&t.call(r,e[n],n,e)===Rh)return}else for(var o in e)if(_h.call(e,o)&&t.call(r,e[o],o,e)===Rh)return},Lh.extend=function(e){return Lh.each(xh.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&(e[r]=t[r])}),e},Lh.isArray=Bh||function(e){return"[object Array]"===kh.call(e)},Lh.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},Lh.isArguments=function(e){return!(!e||!_h.call(e,"callee"))},Lh.toArray=function(e){return e?e.toArray?e.toArray():Lh.isArray(e)||Lh.isArguments(e)?xh.call(e):Lh.values(e):[]},Lh.map=function(e,t,r){if(Oh&&e.map===Oh)return e.map(t,r);var n=[];return Lh.each(e,function(e){n.push(t.call(r,e))}),n},Lh.keys=function(e){var t=[];return null===e||Lh.each(e,function(e,r){t[t.length]=r}),t},Lh.values=function(e){var t=[];return null===e||Lh.each(e,function(e){t[t.length]=e}),t},Lh.include=function(e,t){var r=!1;return null===e?r:Th&&e.indexOf===Th?-1!=e.indexOf(t):(Lh.each(e,function(e){if(r||(r=e===t))return Rh}),r)},Lh.includes=function(e,t){return-1!==e.indexOf(t)},Lh.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},Lh.isObject=function(e){return e===Object(e)&&!Lh.isArray(e)},Lh.isEmptyObject=function(e){if(Lh.isObject(e)){for(var t in e)if(_h.call(e,t))return!1;return!0}return!1},Lh.isUndefined=function(e){return void 0===e},Lh.isString=function(e){return"[object String]"==kh.call(e)},Lh.isDate=function(e){return"[object Date]"==kh.call(e)},Lh.isNumber=function(e){return"[object Number]"==kh.call(e)},Lh.isElement=function(e){return!(!e||1!==e.nodeType)},Lh.encodeDates=function(e){return Lh.each(e,function(t,r){Lh.isDate(t)?e[r]=Lh.formatDate(t):Lh.isObject(t)&&(e[r]=Lh.encodeDates(t))}),e},Lh.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Lh.formatDate=function(e){function t(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())},Lh.strip_empty_properties=function(e){var t={};return Lh.each(e,function(e,r){Lh.isString(e)&&e.length>0&&(t[r]=e)}),t},Lh.truncate=function(e,t){var r;return"string"==typeof e?r=e.slice(0,t):Lh.isArray(e)?(r=[],Lh.each(e,function(e){r.push(Lh.truncate(e,t))})):Lh.isObject(e)?(r={},Lh.each(e,function(e,n){r[n]=Lh.truncate(e,t)})):r=e,r},Lh.JSONEncode=function(){return function(e){var t=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,function(e){var t=r[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'},r=function(e,n){var i="",o=0,s="",a="",c=0,l=i,u=[],h=n[e];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(e)),typeof h){case"string":return t(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(i+=" ",u=[],"[object Array]"===kh.apply(h)){for(c=h.length,o=0;o<c;o+=1)u[o]=r(o,h)||"null";return a=0===u.length?"[]":i?"[\n"+i+u.join(",\n"+i)+"\n"+l+"]":"["+u.join(",")+"]",i=l,a}for(s in h)_h.call(h,s)&&(a=r(s,h))&&u.push(t(s)+(i?": ":":")+a);return a=0===u.length?"{}":i?"{"+u.join(",")+l+"}":"{"+u.join(",")+"}",i=l,a}};return r("",{"":e})}}(),Lh.JSONDecode=(lh={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},uh=function(e){var t=new SyntaxError(e);throw t.at=oh,t.text=ah,t},hh=function(e){return e&&e!==sh&&uh("Expected '"+e+"' instead of '"+sh+"'"),sh=ah.charAt(oh),oh+=1,sh},dh=function(){var e,t="";for("-"===sh&&(t="-",hh("-"));sh>="0"&&sh<="9";)t+=sh,hh();if("."===sh)for(t+=".";hh()&&sh>="0"&&sh<="9";)t+=sh;if("e"===sh||"E"===sh)for(t+=sh,hh(),"-"!==sh&&"+"!==sh||(t+=sh,hh());sh>="0"&&sh<="9";)t+=sh,hh();if(e=+t,isFinite(e))return e;uh("Bad number")},ph=function(){var e,t,r,n="";if('"'===sh)for(;hh();){if('"'===sh)return hh(),n;if("\\"===sh)if(hh(),"u"===sh){for(r=0,t=0;t<4&&(e=parseInt(hh(),16),isFinite(e));t+=1)r=16*r+e;n+=String.fromCharCode(r)}else{if("string"!=typeof lh[sh])break;n+=lh[sh]}else n+=sh}uh("Bad string")},fh=function(){for(;sh&&sh<=" ";)hh()},ch=function(){switch(fh(),sh){case"{":return function(){var e,t={};if("{"===sh){if(hh("{"),fh(),"}"===sh)return hh("}"),t;for(;sh;){if(e=ph(),fh(),hh(":"),Object.hasOwnProperty.call(t,e)&&uh('Duplicate key "'+e+'"'),t[e]=ch(),fh(),"}"===sh)return hh("}"),t;hh(","),fh()}}uh("Bad object")}();case"[":return function(){var e=[];if("["===sh){if(hh("["),fh(),"]"===sh)return hh("]"),e;for(;sh;){if(e.push(ch()),fh(),"]"===sh)return hh("]"),e;hh(","),fh()}}uh("Bad array")}();case'"':return ph();case"-":return dh();default:return sh>="0"&&sh<="9"?dh():function(){switch(sh){case"t":return hh("t"),hh("r"),hh("u"),hh("e"),!0;case"f":return hh("f"),hh("a"),hh("l"),hh("s"),hh("e"),!1;case"n":return hh("n"),hh("u"),hh("l"),hh("l"),null}uh('Unexpected "'+sh+'"')}()}},function(e){var t;return ah=e,oh=0,sh=" ",t=ch(),fh(),sh&&uh("Syntax error"),t}),Lh.base64Encode=function(e){var t,r,n,i,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,c=0,l="",u=[];if(!e)return e;e=Lh.utf8Encode(e);do{t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,r=o>>12&63,n=o>>6&63,i=63&o,u[c++]=s.charAt(t)+s.charAt(r)+s.charAt(n)+s.charAt(i)}while(a<e.length);switch(l=u.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},Lh.utf8Encode=function(e){var t,r,n,i,o="";for(t=r=0,n=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i<n;i++){var s=e.charCodeAt(i),a=null;s<128?r++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),null!==a&&(r>t&&(o+=e.substring(t,r)),o+=a,t=r=i+1)}return r>t&&(o+=e.substring(t,e.length)),o},Lh.UUID=function(){try{return ce.crypto.randomUUID()}catch(oA){for(var e=new Array(36),t=0;t<36;t++)e[t]=Math.floor(16*Math.random());return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",Lh.map(e,function(e){return e.toString(16)}).join("")}};var qh=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];Lh.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<qh.length;t++)if(-1!==e.indexOf(qh[t]))return!0;return!1},Lh.HTTPBuildQuery=function(e,t){var r,n,i=[];return Lh.isUndefined(t)&&(t="&"),Lh.each(e,function(e,t){r=encodeURIComponent(e.toString()),n=encodeURIComponent(t),i[i.length]=n+"="+r}),i.join(t)},Lh.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var r=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===r||r&&"string"!=typeof r[1]&&r[1].length)return"";var n=r[1];try{n=decodeURIComponent(n)}catch(oA){jh.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")},Lh.cookie={get:function(e){for(var t=e+"=",r=Ih.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=Lh.JSONDecode(Lh.cookie.get(e))||{}}catch(oA){}return t},set_seconds:function(e,t,r,n,i,o,s){var a="",c="",l="";if(s)a="; domain="+s;else if(n){var u=ed(Ih.location.hostname);a=u?"; domain=."+u:""}if(r){var h=new Date;h.setTime(h.getTime()+1e3*r),c="; expires="+h.toGMTString()}o&&(i=!0,l="; SameSite=None"),i&&(l+="; secure"),Ih.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+a+l},set:function(e,t,r,n,i,o,s){var a="",c="",l="";if(s)a="; domain="+s;else if(n){var u=ed(Ih.location.hostname);a=u?"; domain=."+u:""}if(r){var h=new Date;h.setTime(h.getTime()+24*r*60*60*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,l="; SameSite=None"),i&&(l+="; secure");var d=e+"="+encodeURIComponent(t)+c+"; path=/"+a+l;return Ih.cookie=d,d},remove:function(e,t,r){Lh.cookie.set(e,"",-1,t,!1,!1,r)}};var $h=function(e){var t=!0;try{var r="__mplss_"+Jh(8);e.setItem(r,"xyz"),"xyz"!==e.getItem(r)&&(t=!1),e.removeItem(r)}catch(oA){t=!1}return t},Wh=null,Gh=function(e,t){return null===Wh||t?Wh=$h(e||ce.localStorage):Wh},Hh=null;function Vh(e,t,r){var n=function(e){jh.error(t+" error: "+e)};return{is_supported:function(n){var i=r(e,n);return i||jh.error(t+" unsupported"),i},error:n,get:function(t){try{return e.getItem(t)}catch(oA){n(oA)}return null},parse:function(t){try{return Lh.JSONDecode(e.getItem(t))||{}}catch(oA){}return null},set:function(t,r){try{e.setItem(t,r)}catch(oA){n(oA)}},remove:function(t){try{e.removeItem(t)}catch(oA){n(oA)}}}}Lh.localStorage=Vh(ce.localStorage,"localStorage",Gh),Lh.sessionStorage=Vh(ce.sessionStorage,"sessionStorage",function(e,t){return null===Hh||t?Hh=$h(e||ce.sessionStorage):Hh}),Lh.register_event=function(){function e(t){return t&&(t.preventDefault=e.preventDefault,t.stopPropagation=e.stopPropagation),t}return e.preventDefault=function(){this.returnValue=!1},e.stopPropagation=function(){this.cancelBubble=!0},function(t,r,n,i,o){if(t)if(t.addEventListener&&!i)t.addEventListener(r,n,!!o);else{var s="on"+r,a=t[s];t[s]=function(t,r,n){var i=function(i){if(i=i||e(ce.event)){var o,s,a=!0;return Lh.isFunction(n)&&(o=n(i)),s=r.call(t,i),!1!==o&&!1!==s||(a=!1),a}};return i}(t,n,a)}else jh.error("No valid element provided to register_event")}}();var Kh=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Lh.dom_query=function(){function e(e){return e.all?e.all:e.getElementsByTagName("*")}var t=/[\t\r\n]/g;function r(e,r){var n=" "+r+" ";return(" "+e.className+" ").replace(t," ").indexOf(n)>=0}function n(t){if(!Ih.getElementsByTagName)return[];var n,i,o,s,a,c,l,u,h,d,p=t.split(" "),f=[Ih];for(c=0;c<p.length;c++)if((n=p[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){o=(i=n.split("#"))[0];var m=i[1],g=Ih.getElementById(m);if(!g||o&&g.nodeName.toLowerCase()!=o)return[];f=[g]}else if(n.indexOf(".")>-1){o=(i=n.split("."))[0];var y=i[1];for(o||(o="*"),s=[],a=0,l=0;l<f.length;l++)for(h="*"==o?e(f[l]):f[l].getElementsByTagName(o),u=0;u<h.length;u++)s[a++]=h[u];for(f=[],d=0,l=0;l<s.length;l++)s[l].className&&Lh.isString(s[l].className)&&r(s[l],y)&&(f[d++]=s[l])}else{var v=n.match(Kh);if(v){o=v[1];var b,w=v[2],x=v[3],k=v[4];for(o||(o="*"),s=[],a=0,l=0;l<f.length;l++)for(h="*"==o?e(f[l]):f[l].getElementsByTagName(o),u=0;u<h.length;u++)s[a++]=h[u];switch(f=[],d=0,x){case"=":b=function(e){return e.getAttribute(w)==k};break;case"~":b=function(e){return e.getAttribute(w).match(new RegExp("\\b"+k+"\\b"))};break;case"|":b=function(e){return e.getAttribute(w).match(new RegExp("^"+k+"-?"))};break;case"^":b=function(e){return 0===e.getAttribute(w).indexOf(k)};break;case"$":b=function(e){return e.getAttribute(w).lastIndexOf(k)==e.getAttribute(w).length-k.length};break;case"*":b=function(e){return e.getAttribute(w).indexOf(k)>-1};break;default:b=function(e){return e.getAttribute(w)}}for(f=[],d=0,l=0;l<s.length;l++)b(s[l])&&(f[d++]=s[l])}else{for(o=n,s=[],a=0,l=0;l<f.length;l++)for(h=f[l].getElementsByTagName(o),u=0;u<h.length;u++)s[a++]=h[u];f=s}}return f}return function(e){return Lh.isElement(e)?[e]:Lh.isObject(e)&&!Lh.isUndefined(e.length)?e:n.call(this,e)}}();var Zh=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Yh=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Lh.info={campaignParams:function(e){var t="",r={};return Lh.each(Zh,function(n){(t=Lh.getQueryParam(Ih.URL,n)).length?r[n]=t:void 0!==e&&(r[n]=e)}),r},clickParams:function(){var e="",t={};return Lh.each(Yh,function(r){(e=Lh.getQueryParam(Ih.URL,r)).length&&(t[r]=e)}),t},marketingParams:function(){return Lh.extend(Lh.info.campaignParams(),Lh.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var t=Lh.info.searchEngine(e),r="yahoo"!=t?"q":"p",n={};if(null!==t){n.$search_engine=t;var i=Lh.getQueryParam(e,r);i.length&&(n.mp_keyword=i)}return n},browser:function(e,t,r){return t=t||"",r||Lh.includes(e," OPR/")?Lh.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Lh.includes(e,"IEMobile")||Lh.includes(e,"WPDesktop")?"Internet Explorer Mobile":Lh.includes(e,"SamsungBrowser/")?"Samsung Internet":Lh.includes(e,"Edge")||Lh.includes(e,"Edg/")?"Microsoft Edge":Lh.includes(e,"FBIOS")?"Facebook Mobile":Lh.includes(e,"Whale/")?"Whale Browser":Lh.includes(e,"Chrome")?"Chrome":Lh.includes(e,"CriOS")?"Chrome iOS":Lh.includes(e,"UCWEB")||Lh.includes(e,"UCBrowser")?"UC Browser":Lh.includes(e,"FxiOS")?"Firefox iOS":Lh.includes(t,"Apple")?Lh.includes(e,"Mobile")?"Mobile Safari":"Safari":Lh.includes(e,"Android")?"Android Mobile":Lh.includes(e,"Konqueror")?"Konqueror":Lh.includes(e,"Firefox")?"Firefox":Lh.includes(e,"MSIE")||Lh.includes(e,"Trident/")?"Internet Explorer":Lh.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,r){var n={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/}[Lh.info.browser(e,t,r)];if(void 0===n)return null;var i=e.match(n);return i?parseFloat(i[i.length-2]):null},os:function(){var e=Mh;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return ce.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Lh.extend(Lh.strip_empty_properties({$os:Lh.info.os(),$browser:Lh.info.browser(Mh,Ch.vendor,Eh),$referrer:Ih.referrer,$referring_domain:Lh.info.referringDomain(Ih.referrer),$device:Lh.info.device(Mh)}),{$current_url:Lh.info.currentUrl(),$browser_version:Lh.info.browserVersion(Mh,Ch.vendor,Eh),$screen_height:Ah.height,$screen_width:Ah.width,mp_lib:"web",$lib_version:mh.LIB_VERSION,$insert_id:Jh(),time:Lh.timestamp()/1e3},Lh.strip_empty_properties(e))},people_properties:function(){return Lh.extend(Lh.strip_empty_properties({$os:Lh.info.os(),$browser:Lh.info.browser(Mh,Ch.vendor,Eh)}),{$browser_version:Lh.info.browserVersion(Mh,Ch.vendor,Eh)})},mpPageViewProperties:function(){return Lh.strip_empty_properties({current_page_title:Ih.title,current_domain:ce.location.hostname,current_url_path:ce.location.pathname,current_url_protocol:ce.location.protocol,current_url_search:ce.location.search})}};var Jh=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},Xh=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Qh=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,ed=function(e){var t=Qh,r=e.split("."),n=r[r.length-1];(n.length>4||"com"===n||"org"===n)&&(t=Xh);var i=e.match(t);return i?i[0]:""},td=function(){},rd=null,nd=null;"undefined"!=typeof JSON&&(rd=JSON.stringify,nd=JSON.parse),rd=rd||Lh.JSONEncode,nd=nd||Lh.JSONDecode;Lh.info=Lh.info,Lh.info.browser=Lh.info.browser,Lh.info.browserVersion=Lh.info.browserVersion,Lh.info.device=Lh.info.device,Lh.info.properties=Lh.info.properties,Lh.isBlockedUA=Lh.isBlockedUA,Lh.isEmptyObject=Lh.isEmptyObject,Lh.isObject=Lh.isObject,Lh.JSONDecode=Lh.JSONDecode,Lh.JSONEncode=Lh.JSONEncode,Lh.toArray=Lh.toArray,Lh.NPO=rh;var id="mixpanelRecordingEvents",od="mixpanelRecordingRegistry",sd=[id,od],ad=function(e){this.dbPromise=null,this.storeName=e};ad.prototype._openDb=function(){return new nh(function(e,t){var r=ce.indexedDB.open("mixpanelBrowserDb",1);r.onerror=function(){t(r.error)},r.onsuccess=function(){e(r.result)},r.onupgradeneeded=function(e){var t=e.target.result;sd.forEach(function(e){t.createObjectStore(e)})}})},ad.prototype.init=function(){return ce.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof ce.IDBDatabase?nh.resolve():nh.reject(e)})):nh.reject("indexedDB is not supported in this browser")},ad.prototype.isInitialized=function(){return!!this.dbPromise},ad.prototype.makeTransaction=function(e,t){var r=this.storeName,n=function(n){return new nh(function(i,o){var s=n.transaction(r,e);s.oncomplete=function(){i(s)},s.onabort=s.onerror=function(){o(s.error)},t(s.objectStore(r))})};return this.dbPromise.then(n).catch(function(e){return e&&"InvalidStateError"===e.name?(this.dbPromise=this._openDb(),this.dbPromise.then(n)):nh.reject(e)}.bind(this))},ad.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(r){r.put(t,e)})},ad.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(r){t=r.get(e)}).then(function(){return t.result})},ad.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},ad.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};function cd(e,t){bd(!0,e,t)}function ld(e,t){bd(!1,e,t)}function ud(e,t){return"1"===vd(e,t)}function hd(e,t){if(function(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||ce,r=t.navigator||{},n=!1;return Lh.each([r.doNotTrack,r.msDoNotTrack,t.doNotTrack],function(e){Lh.includes([!0,1,"1","yes"],e)&&(n=!0)}),n}(t))return jh.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var r="0"===vd(e,t);return r&&jh.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),r}function dd(e){return wd(e,function(e){return this.get_config(e)})}function pd(e){return wd(e,function(e){return this._get_config(e)})}function fd(e){return wd(e,function(e){return this._get_config(e)})}function md(e,t){gd(t=t||{}).remove(yd(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function gd(e){return"localStorage"===(e=e||{}).persistenceType?Lh.localStorage:Lh.cookie}function yd(e,t){return((t=t||{}).persistencePrefix||"__mp_opt_in_out_")+e}function vd(e,t){return gd(t).get(yd(e,t))}function bd(e,t,r){Lh.isString(t)&&t.length?(gd(r=r||{}).set(yd(t,r),e?1:0,Lh.isNumber(r.cookieExpiration)?r.cookieExpiration:null,!!r.crossSubdomainCookie,!!r.secureCookie,!!r.crossSiteCookie,r.cookieDomain),r.track&&e&&r.track(r.trackEventName||"$opt_in",r.trackProperties,{send_immediately:!0})):jh.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function wd(e,t){return function(){var r=!1;try{var n=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),s=t.call(this,"opt_out_tracking_cookie_prefix"),a=t.call(this,"window");n&&(r=hd(n,{ignoreDnt:i,persistenceType:o,persistencePrefix:s,window:a}))}catch(oA){jh.error("Unexpected error when checking tracking opt-out status: "+oA)}if(!r)return e.apply(this,arguments);var c=arguments[arguments.length-1];"function"==typeof c&&c(0)}}var xd=Dh("lock"),kd=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||ce.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||nh};kd.prototype.withLock=function(e,t){return new(0,this.promiseImpl)(Lh.bind(function(r,n){var i=t||(new Date).getTime()+"|"+Math.random(),o=(new Date).getTime(),s=this.storageKey,a=this.pollIntervalMS,c=this.timeoutMS,l=this.storage,u=s+":X",h=s+":Y",d=s+":Z",p=function(e){if((new Date).getTime()-o>c)return xd.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+i+"]"),l.removeItem(d),l.removeItem(h),void g();setTimeout(function(){try{e()}catch(oA){n(oA)}},a*(Math.random()+.1))},f=function(e,t){e()?t():p(function(){f(e,t)})},m=function(){var e=l.getItem(h);return(!e||e===i)&&(l.setItem(h,i),l.getItem(h)===i||(Gh(l,!0)||n(new Error("localStorage support dropped while acquiring lock")),!1))},g=function(){l.setItem(u,i),f(m,function(){l.getItem(u)!==i?p(function(){l.getItem(h)===i?f(function(){return!l.getItem(d)},y):g()}):y()})},y=function(){l.setItem(d,"1");var t=function(){l.removeItem(d),l.getItem(h)===i&&l.removeItem(h),l.getItem(u)===i&&l.removeItem(u)};e().then(function(e){t(),r(e)}).catch(function(e){t(),n(e)})};try{if(!Gh(l,!0))throw new Error("localStorage support check failed");g()}catch(oA){n(oA)}},this))};var _d=function(e){this.storage=e||ce.localStorage};_d.prototype.init=function(){return nh.resolve()},_d.prototype.isInitialized=function(){return!0},_d.prototype.setItem=function(e,t){return new nh(Lh.bind(function(r,n){try{this.storage.setItem(e,rd(t))}catch(i){n(i)}r()},this))},_d.prototype.getItem=function(e){return new nh(Lh.bind(function(t,r){var n;try{n=nd(this.storage.getItem(e))}catch(i){r(i)}t(n)},this))},_d.prototype.removeItem=function(e){return new nh(Lh.bind(function(t,r){try{this.storage.removeItem(e)}catch(n){r(n)}t()},this))};var Sd=Dh("batch"),Cd=function(e,t){var r,n,i,o;t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new _d,this.lock=new kd(e,{storage:t.sharedLockStorage||ce.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||Lh.bind(Sd.error,Sd),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=(r=Lh.bind(this._enqueuePersisted,this),n=t.enqueueThrottleMs,i=null,o=[],function(e){var t=this;return o.push(e),i||(i=new nh(function(e){setTimeout(function(){var n=r.apply(t,[o]);i=null,o=[],e(n)},n)})),i}):this.enqueuePersisted=Lh.bind(function(e){return this._enqueuePersisted([e])},this)};Cd.prototype.ensureInit=function(){return this.initialized||!this.usePersistence?nh.resolve():this.queueStorage.init().then(Lh.bind(function(){this.initialized=!0},this)).catch(Lh.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},Cd.prototype.enqueue=function(e,t){var r={id:Jh(),flushAfter:(new Date).getTime()+2*t,payload:e};return this.usePersistence?this.enqueuePersisted(r):(this.memQueue.push(r),nh.resolve(!0))},Cd.prototype._enqueuePersisted=function(e){var t=Lh.bind(function(){return this.ensureInit().then(Lh.bind(function(){return this.readFromStorage()},this)).then(Lh.bind(function(t){return this.saveToStorage(t.concat(e))},this)).then(Lh.bind(function(t){return t&&(this.memQueue=this.memQueue.concat(e)),t},this)).catch(Lh.bind(function(t){return this.reportError("Error enqueueing items",t,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(Lh.bind(function(e){return this.reportError("Error acquiring storage lock",e),!1},this))},Cd.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(Lh.bind(function(){return this.readFromStorage()},this)).then(Lh.bind(function(r){if(r.length){var n={};Lh.each(t,function(e){n[e.id]=!0});for(var i=0;i<r.length;i++){var o=r[i];if((new Date).getTime()>o.flushAfter&&!n[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):nh.resolve(t)};var Id=function(e,t){var r=[];return Lh.each(e,function(e){e.id&&!t[e.id]&&r.push(e)}),r};Cd.prototype.removeItemsByID=function(e){var t={};if(Lh.each(e,function(e){t[e]=!0}),this.memQueue=Id(this.memQueue,t),this.usePersistence){var r=Lh.bind(function(){return this.ensureInit().then(Lh.bind(function(){return this.readFromStorage()},this)).then(Lh.bind(function(e){return e=Id(e,t),this.saveToStorage(e)},this)).then(Lh.bind(function(){return this.readFromStorage()},this)).then(Lh.bind(function(e){for(var r=0;r<e.length;r++){var n=e[r];if(n.id&&t[n.id])throw new Error("Item not removed from storage")}return!0},this)).catch(Lh.bind(function(t){return this.reportError("Error removing items",t,e),!1},this))},this);return this.lock.withLock(r,this.pid).catch(Lh.bind(function(e){return this.reportError("Error acquiring storage lock",e),!Gh(this.lock.storage,!0)&&r().then(Lh.bind(function(e){return e||this.queueStorage.removeItem(this.storageKey).then(function(){return e})},this)).catch(Lh.bind(function(e){return this.reportError("Error clearing queue",e),!1},this))},this))}return nh.resolve(!0)};var Ed=function(e,t){var r=[];return Lh.each(e,function(e){var n=e.id;if(n in t){var i=t[n];null!==i&&(e.payload=i,r.push(e))}else r.push(e)}),r};Cd.prototype.updatePayloads=function(e){return this.memQueue=Ed(this.memQueue,e),this.usePersistence?this.lock.withLock(Lh.bind(function(){return this.ensureInit().then(Lh.bind(function(){return this.readFromStorage()},this)).then(Lh.bind(function(t){return t=Ed(t,e),this.saveToStorage(t)},this)).catch(Lh.bind(function(t){return this.reportError("Error updating items",e,t),!1},this))},this),this.pid).catch(Lh.bind(function(e){return this.reportError("Error acquiring storage lock",e),!1},this)):nh.resolve(!0)},Cd.prototype.readFromStorage=function(){return this.ensureInit().then(Lh.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(Lh.bind(function(e){return e&&(Lh.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(Lh.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},Cd.prototype.saveToStorage=function(e){return this.ensureInit().then(Lh.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(Lh.bind(function(e){return this.reportError("Error saving queue",e),!1},this))},Cd.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(Lh.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):nh.resolve()};var Ad=Dh("batch"),Md=function(e,t){this.errorReporter=t.errorReporter,this.queue=new Cd(e,{errorReporter:Lh.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1,this._flushPromise=null};Md.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},Md.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},Md.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},Md.prototype.clear=function(){return this.queue.clear()},Md.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},Md.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},Md.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(Lh.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},Md.prototype.sendRequestPromise=function(e,t){return new nh(Lh.bind(function(r){this.sendRequest(e,t,r)},this))},Md.prototype.flush=function(e){if(this.requestInProgress)return Ad.log("Flush: Request already in progress"),nh.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,r=(new Date).getTime(),n=this.batchSize;return this.queue.fillBatch(n).then(Lh.bind(function(i){var o=i.length===n,s=[],a={};if(Lh.each(i,function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=Lh.extend({},t.properties,{mp_sent_by_lib_version:mh.LIB_VERSION}));var r=!0,n=e.id;n?(this.itemIdsSentSuccessfully[n]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[n]}),r=!1):this.reportError("[dupe] found item with no ID",{item:e}),r&&s.push(t)}a[e.id]=t},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),nh.resolve();var c=Lh.bind(function(){return this.queue.removeItemsByID(Lh.map(i,function(e){return e.id})).then(Lh.bind(function(e){return Lh.each(i,Lh.bind(function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})},this)),e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),nh.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),nh.resolve())},this))},this),l=Lh.bind(function(o){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(a);if(Lh.isObject(o)&&"timeout"===o.error&&(new Date).getTime()-r>=t)return this.reportError("Network timeout; retrying"),this.flush();if(Lh.isObject(o)&&(o.httpStatusCode>=500||429===o.httpStatusCode||o.httpStatusCode<=0&&(u=ce.navigator.onLine,!Lh.isUndefined(u)&&!u)||"timeout"===o.error)){var s=2*this.flushInterval;return o.retryAfter&&(s=1e3*parseInt(o.retryAfter,10)||s),s=Math.min(6e5,s),this.reportError("Error; retry in "+s+" ms"),this.scheduleFlush(s),nh.resolve()}if(Lh.isObject(o)&&413===o.httpStatusCode){if(i.length>1){var l=Math.max(1,Math.floor(n/2));return this.batchSize=Math.min(this.batchSize,l,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),nh.resolve()}return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),c()}return c()}catch(oA){this.reportError("Error handling API response",oA),this.resetFlush()}var u},this),u={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(u.transport="sendBeacon"),Ad.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,u).then(l)},this)).catch(Lh.bind(function(e){this.reportError("Error flushing request queue",e),this.resetFlush()},this))},Md.prototype.reportError=function(e,t){if(Ad.error.apply(Ad.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(r){Ad.error(r)}};var Nd=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},Pd=Dh("recorder"),Td=ce.CompressionStream,Od={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},Bd=new Set([Sl.MouseMove,Sl.MouseInteraction,Sl.Scroll,Sl.ViewportResize,Sl.Input,Sl.TouchMove,Sl.MediaInteraction,Sl.Drag,Sl.Selection]);var Rd=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||td,this._onMaxLengthReached=e.onMaxLengthReached||td,this._onBatchSent=e.onBatchSent||td,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.lastEventTimestamp=e.lastEventTimestamp||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=gh,this.recordMinMs=0;var t=Gh(e.sharedLockStorage,!0)&&!this.getConfig("disable_persistence");this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new ad(id),this.batcher=new Md(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:Od,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:250,sharedLockTimeoutMS:1e4})};Rd.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var e={distinct_id:String(this._mixpanel.get_distinct_id())},t=this._mixpanel.get_property("$device_id");t&&(e.$device_id=t);var r=this._mixpanel.get_property("$user_id");return r&&(e.$user_id=r),e},Rd.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.queueStorage.init().catch(function(){this.reportError("Error initializing IndexedDB storage for unloading persisted data.")}.bind(this)).then(function(){return this.getDurationMs()<this._getRecordMinMs()?this.queueStorage.removeItem(this.batcherKey):this.batcher.flush().then(function(){return this.queueStorage.removeItem(this.batcherKey)}.bind(this))}.bind(this))},Rd.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},Rd.prototype.get_config=function(e){return this.getConfig(e)},Rd.prototype.startRecording=function(e){if(null!==this._rrwebRecord)if(null===this._stopRecording){this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>gh&&(this.recordMaxMs=gh,Pd.critical("record_max_ms cannot be greater than "+gh+"ms. Capping value.")),this.maxExpires||(this.maxExpires=(new Date).getTime()+this.recordMaxMs),this.recordMinMs=this._getRecordMinMs(),this.replayStartTime||(this.replayStartTime=(new Date).getTime(),this.batchStartUrl=Lh.info.currentUrl(),this.replayStartUrl=Lh.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=function(){clearTimeout(this.idleTimeoutId);var e=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,e),this.idleExpires=(new Date).getTime()+e}.bind(this);t();var r,n=this.getConfig("record_block_selector");""!==n&&null!==n||(n=void 0);try{this._stopRecording=this._rrwebRecord({emit:function(e){this.idleExpires&&this.idleExpires<e.timestamp?this._onIdleTimeout():(function(e){return e.type===_l.IncrementalSnapshot&&Bd.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(e),(null===this.lastEventTimestamp||e.timestamp>this.lastEventTimestamp)&&(this.lastEventTimestamp=e.timestamp))}.bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:n,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15},plugins:this.getConfig("record_console")?[(r={stringifyOptions:{stringLengthLimit:1e3,numOfKeysLimit:50,depthOfLimit:2}},{name:"rrweb/console@1",observer:Fu,options:r})]:[]})}catch(oA){this.reportError("Unexpected error when starting rrweb recording.",oA)}if("function"!=typeof this._stopRecording)return this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,void this.stopRecording();var i=this.maxExpires-(new Date).getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),i)}else Pd.log("Recording already in progress, skipping startRecording.");else this.reportError("rrweb record function not provided. ")},Rd.prototype.stopRecording=function(e){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(oA){this.reportError("Error with rrweb stopRecording",oA)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t},Rd.prototype.isRrwebStopped=function(){return null===this._stopRecording},Rd.prototype.flushEventsWithOptOut=function(e,t,r){var n=function(e){0===e&&(this.stopRecording(),r({error:"Tracking has been opted out, stopping recording."}))}.bind(this);this._flushEvents(e,t,r,n)},Rd.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,lastEventTimestamp:this.lastEventTimestamp,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}},Rd.deserialize=function(e,t){return new Rd(Lh.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,lastEventTimestamp:e.lastEventTimestamp,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}))},Rd.prototype._sendRequest=function(e,t,r,n){var i=function(t,r){200===t.status&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=Lh.info.currentUrl()),this._onBatchSent(),n({status:0,httpStatusCode:t.status,responseBody:r,retryAfter:t.headers.get("Retry-After")})}.bind(this),o=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");ce.fetch(o+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:r}).then(function(e){e.json().then(function(t){i(e,t)}).catch(function(e){n({error:e})})}).catch(function(e){n({error:e,httpStatusCode:0})})},Rd.prototype._flushEvents=dd(function(e,t,r){var n=e.length;if(n>0){for(var i=this.replayId,o=1/0,s=-1/0,a=!1,c=0;c<n;c++)o=Math.min(o,e[c].timestamp),s=Math.max(s,e[c].timestamp),e[c].type===_l.FullSnapshot&&(a=!0);if(0===this.seqNo){if(!a)return r({error:"First batch does not contain a full snapshot. Aborting recording."}),void this.stopRecording(!0);this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var l=s-this.replayStartTime,u={$current_url:this.batchStartUrl,$lib_version:mh.LIB_VERSION,batch_start_time:o/1e3,mp_lib:"web",replay_id:i,replay_length_ms:l,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},h=JSON.stringify(e);if(Object.assign(u,this.getUserIdInfo()),function(e,t,r){if(!ce.CompressionStream)return!1;var n=Lh.info.browser(e,t,r),i=Lh.info.browserVersion(e,t,r);return!(("Safari"===n||"Mobile Safari"===n)&&i>=16.4&&i<16.6)}(Mh,Ch.vendor,Eh)){var d=new Blob([h],{type:"application/json"}).stream().pipeThrough(new Td("gzip"));new Response(d).blob().then(function(e){u.format="gzip",this._sendRequest(i,u,e,r)}.bind(this))}else u.format="body",this._sendRequest(i,u,h,r)}}),Rd.prototype.reportError=function(e,t){Pd.error.apply(Pd.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(r){Pd.error(r)}},Rd.prototype.getDurationMs=function(){return null===this.replayStartTime?0:null===this.lastEventTimestamp?(new Date).getTime()-this.replayStartTime:this.lastEventTimestamp-this.replayStartTime},Rd.prototype._getRecordMinMs=function(){var e=this.getConfig("record_min_ms");return e>yh?(Pd.critical("record_min_ms cannot be greater than 8000ms. Capping value."),yh):e};var Ld=function(e){this.idb=new ad(od),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Ld.prototype.isPersistenceEnabled=function(){return!this.mixpanelInstance.get_config("disable_persistence")},Ld.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Ld.prototype.setActiveRecording=function(e){if(!this.isPersistenceEnabled())return nh.resolve();var t=e.tabId;return t?this.idb.init().then(function(){return this.idb.setItem(t,e)}.bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),nh.resolve())},Ld.prototype.getActiveRecording=function(){return this.isPersistenceEnabled()?this.idb.init().then(function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}.bind(this)).then(function(e){return Nd(e)?null:e}.bind(this)).catch(this.handleError.bind(this)):nh.resolve(null)},Ld.prototype.clearActiveRecording=function(){return this.isPersistenceEnabled()?this.markActiveRecordingExpired():this.deleteActiveRecording()},Ld.prototype.markActiveRecordingExpired=function(){return this.getActiveRecording().then(function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}.bind(this)).catch(this.handleError.bind(this))},Ld.prototype.deleteActiveRecording=function(){return this.idb.isInitialized()?this.idb.removeItem(this.mixpanelInstance.get_tab_id()).catch(this.handleError.bind(this)):nh.resolve()},Ld.prototype.flushInactiveRecordings=function(){return this.isPersistenceEnabled()?this.idb.init().then(function(){return this.idb.getAll()}.bind(this)).then(function(e){var t=e.filter(function(e){return Nd(e)}).map(function(e){return Rd.deserialize(e,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage}).unloadPersistedData().then(function(){return this.idb.removeItem(e.tabId)}.bind(this)).catch(this.handleError.bind(this))}.bind(this));return nh.all(t)}.bind(this)).catch(this.handleError.bind(this)):nh.resolve([])};var jd=Dh("recorder"),Ud=function(e,t,r){this.mixpanelInstance=e,this.rrwebRecord=t||Eu,this.sharedLockStorage=r,this.recordingRegistry=new Ld({mixpanelInstance:this.mixpanelInstance,errorReporter:jd.error,sharedLockStorage:r}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};Ud.prototype.startRecording=function(e){if(e=e||{},!this.activeRecording||this.activeRecording.isRrwebStopped()){var t=function(){jd.log("Idle timeout reached, restarting recording."),this.resetRecording()}.bind(this),r=function(){jd.log("Max recording length reached, stopping recording."),this.resetRecording()}.bind(this),n=function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}.bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:n,onIdleTimeout:t,onMaxLengthReached:r,replayId:Lh.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=Rd.deserialize(e.activeSerializedRecording,i):this.activeRecording=new Rd(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())}jd.log("Recording already in progress, skipping startRecording.")},Ud.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then(function(){return this.recordingRegistry.clearActiveRecording()}.bind(this)).then(function(){this.stopRecordingInProgress=!1}.bind(this))},Ud.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},Ud.prototype._stopCurrentRecording=function(e,t){if(this.activeRecording){var r=this.activeRecording.stopRecording(e);return t&&(this.activeRecording=null),r}return nh.resolve()},Ud.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),nh.resolve(null)):this.recordingRegistry.getActiveRecording().then(function(t){return t&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(jd.log("No resumable recording found."),null)}.bind(this))},Ud.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},Ud.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(Ud.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),ce.__mp_recorder=Ud;var Dd="change",Fd="click",zd="hashchange",qd="load",$d="mp_locationchange",Wd="popstate",Gd="scrollend",Hd="scroll",Vd="submit",Kd="visibilitychange",Zd=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],Yd=["mp-include"],Jd=["mp-no-track"],Xd=Jd.concat(["mp-sensitive"]),Qd=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],ep={button:!0,checkbox:!0,combobox:!0,grid:!0,link:!0,listbox:!0,menu:!0,menubar:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,navigation:!0,option:!0,radio:!0,radiogroup:!0,searchbox:!0,slider:!0,spinbutton:!0,switch:!0,tab:!0,tablist:!0,textbox:!0,tree:!0,treegrid:!0,treeitem:!0},tp={base:!0,head:!0,html:!0,link:!0,meta:!0,script:!0,style:!0,title:!0,br:!0,hr:!0,wbr:!0,noscript:!0,picture:!0,source:!0,template:!0,track:!0},rp={article:!0,div:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,p:!0,section:!0,span:!0},np=["onclick","onmousedown","onmouseup","onpointerdown","onpointerup","ontouchend","ontouchstart"],ip=Dh("autocapture");function op(e){for(var t={},r=sp(e).split(" "),n=0;n<r.length;n++){var i=r[n];i&&(t[i]=!0)}return t}function sp(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function ap(e){if(e.previousElementSibling)return e.previousElementSibling;do{e=e.previousSibling}while(e&&!pp(e));return e}function cp(e,t,r,n,i,o){var s={$classes:sp(e).split(" "),$tag_name:e.tagName.toLowerCase()},a=e.id;a&&(s.$id=a),gp(e,t,i,o)&&Lh.each(Qd.concat(n),function(t){if(e.hasAttribute(t)&&!r[t]){var n=e.getAttribute(t);yp(n)&&(s["$attr-"+t]=n)}});for(var c=1,l=1,u=e;u=ap(u);)c++,u.tagName===e.tagName&&l++;return s.$nth_child=c,s.$nth_of_type=l,s}function lp(e,t){var r=t.allowElementCallback,n=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,s=t.blockSelectors||[],a=t.captureTextContent||!1,c=t.captureExtraAttrs||[],l=t.capturedForHeatMap||!1,u={};Lh.each(i,function(e){u[e]=!0});var h=null,d=void 0===e.target?e.srcElement:e.target;if(mp(d)&&(d=d.parentNode),function(e,t){if(!e||fp(e,"html")||!pp(e))return!1;switch(e.tagName.toLowerCase()){case"form":return t.type===Vd;case"input":return-1===["button","submit"].indexOf(e.getAttribute("type"))?t.type===Dd:t.type===Fd;case"select":case"textarea":return t.type===Dd;default:return t.type===Fd}}(d,e)&&hp(d,e,r,n)&&!dp(d,e,o,s)){for(var p=[d],f=d;f.parentNode&&!fp(f,"body");)p.push(f.parentNode),f=f.parentNode;var m,g=[],y=!1;if(Lh.each(p,function(t){var i=gp(t,e,r,n);u.href||"a"!==t.tagName.toLowerCase()||(m=t.getAttribute("href"),m=i&&yp(m)&&m),dp(t,e,o,s)&&(y=!0),g.push(cp(t,e,u,c,r,n))},this),!y){var v=Ih.documentElement;if(h={$event_type:e.type,$host:ce.location.host,$pathname:ce.location.pathname,$elements:g,$el_attr__href:m,$viewportHeight:Math.max(v.clientHeight,ce.innerHeight||0),$viewportWidth:Math.max(v.clientWidth,ce.innerWidth||0),$pageHeight:Ih.body.offsetHeight||0,$pageWidth:Ih.body.offsetWidth||0},Lh.each(c,function(e){if(!u[e]&&d.hasAttribute(e)){var t=d.getAttribute(e);yp(t)&&(h["$el_attr__"+e]=t)}}),a&&(b=up(d,e,r,n))&&b.length&&(h.$el_text=b),e.type===Fd&&(Lh.each(Zd,function(t){t in e&&(h["$"+t]=e[t])}),l&&(h.$captured_for_heatmap=!0),d=function(e){for(var t=e.target,r=e.composedPath(),n=0;n<r.length;n++){var i=r[n];if(fp(i,"a")||fp(i,"button")||fp(i,"input")||fp(i,"select")||i.getAttribute&&"button"===i.getAttribute("role")){t=i;break}if(i===t)break}return t}(e)),a){var b=up(d,e,r,n);b&&b.length&&(h.$el_text=b)}if(d){if(!hp(d,e,r,n)||dp(d,e,o,s))return null;var w=cp(d,e,u,c,r,n);h.$target=w,h.$el_classes=w.$classes,Lh.extend(h,Lh.strip_empty_properties({$el_id:w.$id,$el_tag_name:w.$tag_name}))}}}return h}function up(e,t,r,n){var i="";return gp(e,t,r,n)&&e.childNodes&&e.childNodes.length&&Lh.each(e.childNodes,function(e){mp(e)&&e.textContent&&(i+=Lh.trim(e.textContent).split(/(\s+)/).filter(yp).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),Lh.trim(i)}function hp(e,t,r,n){if(r)try{if(!r(e,t))return!1}catch(oA){return ip.critical("Error while checking element in allowElementCallback",oA),!1}if(!n.length)return!0;for(var i=0;i<n.length;i++){var o=n[i];try{if(e.matches(o))return!0}catch(oA){ip.critical("Error while checking selector: "+o,oA)}}return!1}function dp(e,t,r,n){var i;if(r)try{if(r(e,t))return!0}catch(oA){return ip.critical("Error while checking element in blockElementCallback",oA),!0}if(n&&n.length)for(i=0;i<n.length;i++){var o=n[i];try{if(e.matches(o))return!0}catch(oA){ip.critical("Error while checking selector: "+o,oA)}}var s=op(e);for(i=0;i<Jd.length;i++)if(s[Jd[i]])return!0;return!1}function pp(e){return e&&1===e.nodeType}function fp(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function mp(e){return e&&3===e.nodeType}function gp(e,t,r,n){var i;if(!hp(e,t,r,n))return!1;for(var o=e;o.parentNode&&!fp(o,"body");o=o.parentNode){var s=op(o);for(i=0;i<Xd.length;i++)if(s[Xd[i]])return!1}var a=op(e);for(i=0;i<Yd.length;i++)if(a[Yd[i]])return!0;if(fp(e,"input")||fp(e,"select")||fp(e,"textarea")||"true"===e.getAttribute("contenteditable"))return!1;var c=e.type||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}var l=e.name||e.id||"";if("string"==typeof l){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function yp(e){if(null===e||Lh.isUndefined(e))return!1;if("string"==typeof e){e=Lh.trim(e);if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0}function vp(e){var t="onscrollend"in ce,r=Fh(e),n=Gd;if(!t){var i=null;r=Fh(function(){clearTimeout(i),i=setTimeout(e,100)}),n=Hd}return{listener:r,eventType:n}}function bp(e){var t=e.tagName.toLowerCase();return"button"===t||"input"===t||"select"===t||"textarea"===t||"details"===t||"dialog"===t||(!!e.isContentEditable||(!!(e.onclick||e.onmousedown||e.onmouseup||e.ontouchstart||e.ontouchend)||(!!function(e){for(var t=0;t<np.length;t++)if(e.hasAttribute(np[t]))return!0;return!1}(e)||(!!function(e){var t=e.getAttribute("role");if(!t)return!1;var r=t.trim().split(/\s+/)[0].toLowerCase();return ep[r]}(e)||(!("a"!==t||!e.hasAttribute("href"))||!!e.hasAttribute("tabindex"))))))}function wp(e){if(!e||!e.tagName)return!0;var t=e.tagName.toLowerCase();if(tp[t])return!0;if(bp(e))return!1;for(var r=e.parentElement,n=0;r&&n<5;){if(bp(r))return!1;if(r.getRootNode&&r.getRootNode()!==Ih){var i=r.getRootNode();if(i.host&&bp(i.host))return!1}r=r.parentElement,n++}return!!rp[t]}function xp(e){return"composedPath"in e?e.composedPath():[]}function kp(e){var t=xp(e);return t&&t.length>0?t[0]:e.target||e.srcElement}function _p(){this.clicks=[]}function Sp(e,t){this.changeCallback=e||function(){},this.observerConfig=t,this.observedShadowRoots=null,this.shadowObservers=[]}_p.prototype.isRageClick=function(e,t){var r=(t=t||{}).threshold_px||30,n=t.timeout_ms||1e3,i=t.click_count||4;if(t.interactive_elements_only||false){var o=kp(e);if(!o||wp(o))return!1}var s=Date.now(),a=e.pageX,c=e.pageY,l=this.clicks[this.clicks.length-1];if(l&&s-l.timestamp<n&&Math.sqrt(Math.pow(a-l.x,2)+Math.pow(c-l.y,2))<r){if(this.clicks.push({x:a,y:c,timestamp:s}),this.clicks.length>=i)return this.clicks=[],!0}else this.clicks=[{x:a,y:c,timestamp:s}];return!1},Sp.prototype.getEventTarget=function(e){if(this.observedShadowRoots)return kp(e)},Sp.prototype.observeFromEvent=function(e){if(this.observedShadowRoots)for(var t=xp(e),r=0;r<t.length;r++){var n=t[r];n&&n.shadowRoot&&this.observeShadowRoot(n.shadowRoot)}},Sp.prototype.observeShadowRoot=function(e){if(this.observedShadowRoots&&!this.observedShadowRoots.has(e)){var t=this;try{this.observedShadowRoots.add(e);var r=new window.MutationObserver(function(){t.changeCallback()});r.observe(e,this.observerConfig),this.shadowObservers.push(r)}catch(n){ip.critical("Error while observing shadow root",n)}}},Sp.prototype.start=function(){this.observedShadowRoots||("undefined"!=typeof WeakSet?this.observedShadowRoots=new WeakSet:ip.critical("Shadow DOM observation unavailable: WeakSet not supported"))},Sp.prototype.stop=function(){if(this.observedShadowRoots){for(var e=0;e<this.shadowObservers.length;e++)try{this.shadowObservers[e].disconnect()}catch(t){ip.critical("Error while disconnecting shadow DOM observer",t)}this.shadowObservers=[],this.observedShadowRoots=null}};var Cp=[Dd,"input",Vd,"select","toggle"],Ip=[Gd],Ep=[zd],Ap={characterData:!0,childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden","checked","selected","value","display","visibility"]};function Mp(e){this.eventListeners=[],this.mutationObserver=null,this.shadowDOMObserver=null,this.isTracking=!1,this.lastChangeEventTimestamp=0,this.pendingClicks=[],this.onDeadClickCallback=e,this.processingActive=!1,this.processingTimeout=null}Mp.prototype.addClick=function(e){var t=this.shadowDOMObserver&&this.shadowDOMObserver.getEventTarget(e);return t||(t=e.target||e.srcElement),!(!t||wp(t))&&(this.shadowDOMObserver&&this.shadowDOMObserver.observeFromEvent(e),this.pendingClicks.push({element:t,event:e,timestamp:Date.now()}),!0)},Mp.prototype.trackClick=function(e,t){if(!this.isTracking)return!1;var r=this.addClick(e);return r&&this.triggerProcessing(t),r},Mp.prototype.getDeadClicks=function(e){if(0===this.pendingClicks.length)return[];var t=e.timeout_ms,r=Date.now(),n=this.pendingClicks.slice();this.pendingClicks=[];for(var i=[],o=0;o<n.length;o++){var s=n[o];r-s.timestamp>=t?this.hasChangesAfter(s.timestamp)||i.push(s):this.pendingClicks.push(s)}return i},Mp.prototype.hasChangesAfter=function(e){return this.lastChangeEventTimestamp>=e-100},Mp.prototype.recordChangeEvent=function(){this.lastChangeEventTimestamp=Date.now()},Mp.prototype.triggerProcessing=function(e){this.processingActive||(this.processingActive=!0,this.processRecursively(e))},Mp.prototype.processRecursively=function(e){if(this.isTracking&&this.onDeadClickCallback){var t=e.timeout_ms,r=this;this.processingTimeout=setTimeout(function(){if(r.processingActive){for(var t=r.getDeadClicks(e),n=0;n<t.length;n++)r.onDeadClickCallback(t[n].event);r.pendingClicks.length>0?r.processRecursively(e):r.processingActive=!1}},t)}else this.processingActive=!1},Mp.prototype.startTracking=function(){if(!this.isTracking){this.isTracking=!0;var e=this;Cp.forEach(function(t){var r=function(){e.recordChangeEvent()};document.addEventListener(t,r,{capture:!0,passive:!0}),e.eventListeners.push({target:document,event:t,handler:r,options:{capture:!0,passive:!0}})}),Ep.forEach(function(t){var r=function(){e.recordChangeEvent()};window.addEventListener(t,r),e.eventListeners.push({target:window,event:t,handler:r})}),Ip.forEach(function(t){var r=function(){e.recordChangeEvent()};window.addEventListener(t,r,{passive:!0}),e.eventListeners.push({target:window,event:t,handler:r,options:{passive:!0}})});var t=function(){e.recordChangeEvent()};if(document.addEventListener("selectionchange",t),e.eventListeners.push({target:document,event:"selectionchange",handler:t}),window.MutationObserver)try{this.mutationObserver=new window.MutationObserver(function(){e.recordChangeEvent()}),this.mutationObserver.observe(document.body||document.documentElement,Ap)}catch(r){ip.critical("Error while setting up mutation observer",r)}if(window.customElements)try{this.shadowDOMObserver=new Sp(function(){e.recordChangeEvent()},Ap),this.shadowDOMObserver.start()}catch(r){ip.critical("Error while setting up shadow DOM observer",r),this.shadowDOMObserver=null}}},Mp.prototype.stopTracking=function(){if(this.isTracking){this.isTracking=!1,this.pendingClicks=[],this.lastChangeEventTimestamp=0,this.processingActive=!1,this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null);for(var e=0;e<this.eventListeners.length;e++){var t=this.eventListeners[e];try{t.target.removeEventListener(t.event,t.handler,t.options)}catch(r){ip.critical("Error while removing event listener",r)}}if(this.eventListeners=[],this.mutationObserver){try{this.mutationObserver.disconnect()}catch(r){ip.critical("Error while disconnecting mutation observer",r)}this.mutationObserver=null}if(this.shadowDOMObserver){try{this.shadowDOMObserver.stop()}catch(r){ip.critical("Error while stopping shadow DOM observer",r)}this.shadowDOMObserver=null}}};var Np="autocapture",Pp="full-url",Tp="allow_selectors",Op="allow_url_regexes",Bp="block_attrs",Rp="block_element_callback",Lp="block_selectors",jp="block_url_regexes",Up="capture_extra_attrs",Dp="capture_text_content",Fp="scroll_capture_all",zp="scroll_depth_percent_checkpoints",qp="click",$p="dead_click",Wp="input",Gp="pageview",Hp="rage_click",Vp="scroll",Kp="page_leave",Zp="submit",Yp={};Yp[Tp]=[],Yp[Op]=[],Yp[Bp]=[],Yp[Rp]=null,Yp[Lp]=[],Yp[jp]=[],Yp[Up]=[],Yp[Dp]=!1,Yp[Fp]=!1,Yp[zp]=[25,50,75,100],Yp[qp]=!0,Yp[$p]=!0,Yp[Wp]=!0,Yp[Gp]=Pp,Yp[Hp]=!0,Yp[Vp]=!0,Yp[Kp]=!1,Yp[Zp]=!0;var Jp={$mp_autocapture:!0},Xp="$mp_click",Qp="$mp_dead_click",ef="$mp_rage_click",tf=function(e){this.mp=e,this.maxScrollViewDepth=0,this.hasTrackedScrollSession=!1,this.previousScrollHeight=0};tf.prototype.init=function(){!function(){try{return!!Ih.createElement("div").matches}catch(oA){return!1}}()?ip.critical("Autocapture unavailable: missing required DOM APIs"):(this.initPageListeners(),this.initPageviewTracking(),this.initClickTracking(),this.initDeadClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking(),this.initPageLeaveTracking())},tf.prototype.getFullConfig=function(){var e=this.mp.get_config(Np);return e?Lh.isObject(e)?Lh.extend({},Yp,e):Yp:{}},tf.prototype.getConfig=function(e){return this.getFullConfig()[e]},tf.prototype.currentUrlBlocked=function(){var e,t=Lh.info.currentUrl(),r=this.getConfig(Op)||[];if(r.length){var n=!1;for(e=0;e<r.length;e++){var i=r[e];try{if(t.match(i)){n=!0;break}}catch(oA){return ip.critical("Error while checking block URL regex: "+i,oA),!0}}if(!n)return!0}var o=this.getConfig(jp)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(oA){return ip.critical("Error while checking block URL regex: "+o[e],oA),!0}return!1},tf.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(Np)?this.getConfig(Gp):this.mp.get_config("track_pageview")},tf.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var r=this.mp.is_recording_heatmap_data()&&(t===Xp&&!this.getConfig(qp)||t===ef&&!this._getClickTrackingConfig(Hp)||t===Qp&&!this._getClickTrackingConfig($p)),n=lp(e,{allowElementCallback:this.getConfig("allow_element_callback"),allowSelectors:this.getConfig(Tp),blockAttrs:this.getConfig(Bp),blockElementCallback:this.getConfig(Rp),blockSelectors:this.getConfig(Lp),captureExtraAttrs:this.getConfig(Up),captureTextContent:this.getConfig(Dp),capturedForHeatMap:r});n&&(Lh.extend(n,Jp),this.mp.track(t,n))}},tf.prototype.initPageListeners=function(){if(ce.removeEventListener(Wd,this.listenerPopstate),ce.removeEventListener(zd,this.listenerHashchange),this.pageviewTrackingConfig()||this.getConfig(Kp)||this.mp.get_config("record_heatmap_data")){this.listenerPopstate=function(){ce.dispatchEvent(new Event($d))},this.listenerHashchange=function(){ce.dispatchEvent(new Event($d))},ce.addEventListener(Wd,this.listenerPopstate),ce.addEventListener(zd,this.listenerHashchange);var e=ce.history.pushState;"function"==typeof e&&(ce.history.pushState=function(t,r,n){e.call(ce.history,t,r,n),ce.dispatchEvent(new Event($d))});var t=ce.history.replaceState;"function"==typeof t&&(ce.history.replaceState=function(e,r,n){t.call(ce.history,e,r,n),ce.dispatchEvent(new Event($d))})}},tf.prototype._getClickTrackingConfig=function(e){var t=this.getConfig(e);return t?!0===t?{}:"object"==typeof t?t:{}:null},tf.prototype._trackPageLeave=function(e,t,r){if(!this.hasTrackedScrollSession&&(this.getConfig(Kp)||this.mp.is_recording_heatmap_data())){this.hasTrackedScrollSession=!0;var n=Math.max(Ih.documentElement.clientHeight,ce.innerHeight||0),i=Math.round(Math.max(this.maxScrollViewDepth-n,0)/(r-n)*100),o=Math.round(n/r*100);r<=n&&(i=100,o=100);var s=Lh.extend({$max_scroll_view_depth:this.maxScrollViewDepth,$max_scroll_percentage:i,$fold_line_percentage:o,$scroll_height:r,$event_type:e.type,$current_url:t||Lh.info.currentUrl(),$viewportHeight:n,$viewportWidth:Math.max(Ih.documentElement.clientWidth,ce.innerWidth||0),$captured_for_heatmap:this.mp.is_recording_heatmap_data()},Jp);this.mp.track("$mp_page_leave",s,{transport:"sendBeacon"})}},tf.prototype._initScrollDepthTracking=function(){if(ce.removeEventListener(Hd,this.listenerScrollDepth),ce.removeEventListener(Gd,this.listenerScrollDepth),this.mp.get_config("record_heatmap_data")){ip.log("Initializing scroll depth tracking"),this.maxScrollViewDepth=Math.max(Ih.documentElement.clientHeight,ce.innerHeight||0);var e=vp(function(){if(!this.currentUrlBlocked()){var e=Math.max(Ih.documentElement.clientHeight,ce.innerHeight||0)+ce.scrollY;e>this.maxScrollViewDepth&&(this.maxScrollViewDepth=e),this.previousScrollHeight=Ih.body.scrollHeight}}.bind(this));this.listenerScrollDepth=e.listener,ce.addEventListener(e.eventType,this.listenerScrollDepth)}},tf.prototype.initClickTracking=function(){ce.removeEventListener(Fd,this.listenerClick),(this.getConfig(qp)||this.mp.get_config("record_heatmap_data"))&&(ip.log("Initializing click tracking"),this.listenerClick=function(e){(this.getConfig(qp)||this.mp.is_recording_heatmap_data())&&this.trackDomEvent(e,Xp)}.bind(this),ce.addEventListener(Fd,this.listenerClick))},tf.prototype.initDeadClickTracking=function(){this._getClickTrackingConfig($p)||this.mp.get_config("record_heatmap_data")?(ip.log("Initializing dead click tracking"),this._deadClickTracker||(this._deadClickTracker=new Mp(function(e){this.trackDomEvent(e,Qp)}.bind(this)),this._deadClickTracker.startTracking()),this.listenerDeadClick||(this.listenerDeadClick=function(e){var t=this._getClickTrackingConfig($p);if((t||this.mp.is_recording_heatmap_data())&&!this.currentUrlBlocked()){var r=t||{};r.timeout_ms||(r.timeout_ms=500),this._deadClickTracker.trackClick(e,r)}}.bind(this),ce.addEventListener(Fd,this.listenerDeadClick))):this.stopDeadClickTracking()},tf.prototype.initInputTracking=function(){ce.removeEventListener(Dd,this.listenerChange),this.getConfig(Wp)&&(ip.log("Initializing input tracking"),this.listenerChange=function(e){this.getConfig(Wp)&&this.trackDomEvent(e,"$mp_input_change")}.bind(this),ce.addEventListener(Dd,this.listenerChange))},tf.prototype.initPageviewTracking=function(){if(ce.removeEventListener($d,this.listenerLocationchange),this.pageviewTrackingConfig()){ip.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(Jp)),t&&(e=Lh.info.currentUrl()),this.listenerLocationchange=Fh(function(){if(!this.currentUrlBlocked()){var t=Lh.info.currentUrl(),r=!1,n=t.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],i=this.pageviewTrackingConfig();if(i===Pp?r=t!==e:"url-with-path-and-query-string"===i?r=t.split("#")[0]!==e.split("#")[0]:"url-with-path"===i&&(r=n),r)this.mp.track_pageview(Jp)&&(e=t),n&&(this.lastScrollCheckpoint=0,ip.log("Path change: re-initializing scroll depth checkpoints"))}}.bind(this)),ce.addEventListener($d,this.listenerLocationchange)}},tf.prototype.initRageClickTracking=function(){ce.removeEventListener(Fd,this.listenerRageClick),(this._getClickTrackingConfig(Hp)||this.mp.get_config("record_heatmap_data"))&&(ip.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new _p),this.listenerRageClick=function(e){var t=this._getClickTrackingConfig(Hp);(t||this.mp.is_recording_heatmap_data())&&(this.currentUrlBlocked()||this._rageClickTracker.isRageClick(e,t)&&this.trackDomEvent(e,ef))}.bind(this),ce.addEventListener(Fd,this.listenerRageClick))},tf.prototype.initScrollTracking=function(){if(ce.removeEventListener(Gd,this.listenerScroll),ce.removeEventListener(Hd,this.listenerScroll),this.getConfig(Vp)){ip.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0;var e=vp(function(){if(this.getConfig(Vp)&&!this.currentUrlBlocked()){var e=this.getConfig(Fp),t=(this.getConfig(zp)||[]).slice().sort(function(e,t){return e-t}),r=ce.scrollY,n=Lh.extend({$scroll_top:r},Jp);try{var i=Ih.body.scrollHeight,o=Math.round(r/(i-ce.innerHeight)*100);if(n.$scroll_height=i,n.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var s=0;s<t.length;s++){var a=t[s];o>=a&&this.lastScrollCheckpoint<a&&(n.$scroll_checkpoint=a,this.lastScrollCheckpoint=a,e=!0)}}catch(oA){ip.critical("Error while calculating scroll percentage",oA)}e&&this.mp.track("$mp_scroll",n)}}.bind(this));this.listenerScroll=e.listener,ce.addEventListener(e.eventType,this.listenerScroll)}},tf.prototype.initSubmitTracking=function(){ce.removeEventListener(Vd,this.listenerSubmit),this.getConfig(Zp)&&(ip.log("Initializing submit tracking"),this.listenerSubmit=function(e){this.getConfig(Zp)&&this.trackDomEvent(e,"$mp_submit")}.bind(this),ce.addEventListener(Vd,this.listenerSubmit))},tf.prototype.initPageLeaveTracking=function(){if(Ih.removeEventListener(Kd,this.listenerPageLeaveVisibilitychange),ce.removeEventListener($d,this.listenerPageLeaveLocationchange),ce.removeEventListener(qd,this.listenerPageLoad),this.getConfig(Kp)||this.mp.get_config("record_heatmap_data")){ip.log("Initializing page visibility tracking."),this._initScrollDepthTracking();var e=Lh.info.currentUrl();this.listenerPageLoad=function(){this.previousScrollHeight=Ih.body.scrollHeight}.bind(this),ce.addEventListener(qd,this.listenerPageLoad),this.listenerPageLeaveLocationchange=Fh(function(t){if(!this.currentUrlBlocked()){var r=Lh.info.currentUrl();r!==e&&(this._trackPageLeave(t,e,this.previousScrollHeight),e=r,this.maxScrollViewDepth=Math.max(Ih.documentElement.clientHeight,ce.innerHeight||0),this.previousScrollHeight=Ih.body.scrollHeight,this.hasTrackedScrollSession=!1)}}.bind(this)),ce.addEventListener($d,this.listenerPageLeaveLocationchange),this.listenerPageLeaveVisibilitychange=function(t){Ih.hidden&&this._trackPageLeave(t,e,this.previousScrollHeight)}.bind(this),Ih.addEventListener(Kd,this.listenerPageLeaveVisibilitychange)}},tf.prototype.stopDeadClickTracking=function(){this.listenerDeadClick&&(ce.removeEventListener(Fd,this.listenerDeadClick),this.listenerDeadClick=null),this._deadClickTracker&&(this._deadClickTracker.stopTracking(),this._deadClickTracker=null)},zh(tf);var rf=Dh("flags"),nf="flags",of="context",sf={};sf[of]={};var af=function(e){this.fetch=ce.fetch,this.getFullApiRoute=e.getFullApiRoute,this.getMpConfig=e.getConfigFunc,this.setMpConfig=e.setConfigFunc,this.getMpProperty=e.getPropertyFunc,this.track=e.trackingFunc};af.prototype.init=function(){this.minApisSupported()?(this.flags=null,this.fetchFlags(),this.trackedFeatures=new Set):rf.critical("Feature Flags unavailable: missing minimum required APIs")},af.prototype.getFullConfig=function(){var e=this.getMpConfig(nf);return e?Lh.isObject(e)?Lh.extend({},sf,e):sf:{}},af.prototype.getConfig=function(e){return this.getFullConfig()[e]},af.prototype.isSystemEnabled=function(){return!!this.getMpConfig(nf)},af.prototype.updateContext=function(e,t){if(!this.isSystemEnabled())return rf.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var r=this.getMpConfig(nf);Lh.isObject(r)||(r={});var n=t&&t.replace?{}:this.getConfig(of);return r[of]=Lh.extend({},n,e),this.setMpConfig(nf,r),this.fetchFlags()},af.prototype.areFlagsReady=function(){return this.isSystemEnabled()||rf.error("Feature Flags not enabled"),!!this.flags},af.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var e=this.getMpProperty("distinct_id"),t=this.getMpProperty("$device_id"),r="00-"+Lh.UUID().replace(/-/g,"")+"-"+Lh.UUID().replace(/-/g,"").substring(0,16)+"-01";rf.log("Fetching flags for distinct ID: "+e);var n=Lh.extend({distinct_id:e,device_id:t},this.getConfig(of)),i=new URLSearchParams;i.set("context",JSON.stringify(n)),i.set("token",this.getMpConfig("token")),i.set("mp_lib","web"),i.set("$lib_version",mh.LIB_VERSION);var o=this.getFullApiRoute()+"?"+i.toString();return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=this.fetch.call(ce,o,{method:"GET",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),traceparent:r}}).then(function(e){return this.markFetchComplete(),e.json().then(function(e){var t=e.flags;if(!t)throw new Error("No flags in API response");var n=new Map;Lh.each(t,function(e,t){n.set(t,{key:e.variant_key,value:e.variant_value,experiment_id:e.experiment_id,is_experiment_active:e.is_experiment_active,is_qa_tester:e.is_qa_tester})}),this.flags=n,this._traceparent=r}.bind(this)).catch(function(e){this.markFetchComplete(),rf.error(e)}.bind(this))}.bind(this)).catch(function(e){this.markFetchComplete(),rf.error(e)}.bind(this)),this.fetchPromise},af.prototype.markFetchComplete=function(){this._fetchInProgressStartTime?(this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null):rf.error("Fetch in progress started time not set, cannot mark fetch complete")},af.prototype.getVariant=function(e,t){return this.fetchPromise?this.fetchPromise.then(function(){return this.getVariantSync(e,t)}.bind(this)).catch(function(e){return rf.error(e),t}):new Promise(function(e){rf.critical("Feature Flags not initialized"),e(t)})},af.prototype.getVariantSync=function(e,t){if(!this.areFlagsReady())return rf.log("Flags not loaded yet"),t;var r=this.flags.get(e);return r?(this.trackFeatureCheck(e,r),r):(rf.log('No flag found: "'+e+'"'),t)},af.prototype.getVariantValue=function(e,t){return this.getVariant(e,{value:t}).then(function(e){return e.value}).catch(function(e){return rf.error(e),t})},af.prototype.getFeatureData=function(e,t){return rf.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(e,t)},af.prototype.getVariantValueSync=function(e,t){return this.getVariantSync(e,{value:t}).value},af.prototype.isEnabled=function(e,t){return this.getVariantValue(e).then(function(){return this.isEnabledSync(e,t)}.bind(this)).catch(function(e){return rf.error(e),t})},af.prototype.isEnabledSync=function(e,t){t=t||!1;var r=this.getVariantValueSync(e,t);return!0!==r&&!1!==r&&(rf.error('Feature flag "'+e+'" value: '+r+" is not a boolean; returning fallback value: "+t),r=t),r},af.prototype.trackFeatureCheck=function(e,t){if(!this.trackedFeatures.has(e)){this.trackedFeatures.add(e);var r={"Experiment name":e,"Variant name":t.key,$experiment_type:"feature_flag","Variant fetch start time":new Date(this._fetchStartTime).toISOString(),"Variant fetch complete time":new Date(this._fetchCompleteTime).toISOString(),"Variant fetch latency (ms)":this._fetchLatency,"Variant fetch traceparent":this._traceparent};"undefined"!==t.experiment_id&&(r.$experiment_id=t.experiment_id),"undefined"!==t.is_experiment_active&&(r.$is_experiment_active=t.is_experiment_active),"undefined"!==t.is_qa_tester&&(r.$is_qa_tester=t.is_qa_tester),this.track("$experiment_started",r)}},af.prototype.minApisSupported=function(){return!!this.fetch&&"undefined"!=typeof Promise&&"undefined"!=typeof Map&&"undefined"!=typeof Set},zh(af),af.prototype.are_flags_ready=af.prototype.areFlagsReady,af.prototype.get_variant=af.prototype.getVariant,af.prototype.get_variant_sync=af.prototype.getVariantSync,af.prototype.get_variant_value=af.prototype.getVariantValue,af.prototype.get_variant_value_sync=af.prototype.getVariantValueSync,af.prototype.is_enabled=af.prototype.isEnabled,af.prototype.is_enabled_sync=af.prototype.isEnabledSync,af.prototype.update_context=af.prototype.updateContext,af.prototype.get_feature_data=af.prototype.getFeatureData;var cf=function(){};cf.prototype.create_properties=function(){},cf.prototype.event_handler=function(){},cf.prototype.after_track_handler=function(){},cf.prototype.init=function(e){return this.mp=e,this},cf.prototype.track=function(e,t,r,n){var i=this,o=Lh.dom_query(e);if(0!==o.length)return Lh.each(o,function(e){Lh.register_event(e,this.override_event,function(e){var o={},s=i.create_properties(r,this),a=i.mp.get_config("track_links_timeout");i.event_handler(e,this,o),window.setTimeout(i.track_callback(n,s,o,!0),a),i.mp.track(t,s,i.track_callback(n,s,o))})},this),!0;jh.error("The DOM query ("+e+") returned 0 elements")},cf.prototype.track_callback=function(e,t,r,n){n=n||!1;var i=this;return function(){r.callback_fired||(r.callback_fired=!0,e&&!1===e(n,t)||i.after_track_handler(t,r,n))}},cf.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):Lh.extend({},e)};var lf=function(){this.override_event="click"};Lh.inherit(lf,cf),lf.prototype.create_properties=function(e,t){var r=lf.superclass.create_properties.apply(this,arguments);return t.href&&(r.url=t.href),r},lf.prototype.event_handler=function(e,t,r){r.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,r.href=t.href,r.new_tab||e.preventDefault()},lf.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var uf=function(){this.override_event="submit"};Lh.inherit(uf,cf),uf.prototype.event_handler=function(e,t,r){r.element=t,e.preventDefault()},uf.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var hf="$set",df="$set_once",pf="$unset",ff="$add",mf="$append",gf="$union",yf="$remove",vf={set_action:function(e,t){var r={},n={};return Lh.isObject(e)?Lh.each(e,function(e,t){this._is_reserved_property(t)||(n[t]=e)},this):n[e]=t,r[hf]=n,r},unset_action:function(e){var t={},r=[];return Lh.isArray(e)||(e=[e]),Lh.each(e,function(e){this._is_reserved_property(e)||r.push(e)},this),t[pf]=r,t},set_once_action:function(e,t){var r={},n={};return Lh.isObject(e)?Lh.each(e,function(e,t){this._is_reserved_property(t)||(n[t]=e)},this):n[e]=t,r[df]=n,r},union_action:function(e,t){var r={},n={};return Lh.isObject(e)?Lh.each(e,function(e,t){this._is_reserved_property(t)||(n[t]=Lh.isArray(e)?e:[e])},this):n[e]=Lh.isArray(t)?t:[t],r[gf]=n,r},append_action:function(e,t){var r={},n={};return Lh.isObject(e)?Lh.each(e,function(e,t){this._is_reserved_property(t)||(n[t]=e)},this):n[e]=t,r[mf]=n,r},remove_action:function(e,t){var r={},n={};return Lh.isObject(e)?Lh.each(e,function(e,t){this._is_reserved_property(t)||(n[t]=e)},this):n[e]=t,r[yf]=n,r},delete_action:function(){var e={$delete:""};return e}},bf=function(){};Lh.extend(bf.prototype,vf),bf.prototype._init=function(e,t,r){this._mixpanel=e,this._group_key=t,this._group_id=r},bf.prototype.set=fd(function(e,t,r){var n=this.set_action(e,t);return Lh.isObject(e)&&(r=t),this._send_request(n,r)}),bf.prototype.set_once=fd(function(e,t,r){var n=this.set_once_action(e,t);return Lh.isObject(e)&&(r=t),this._send_request(n,r)}),bf.prototype.unset=fd(function(e,t){var r=this.unset_action(e);return this._send_request(r,t)}),bf.prototype.union=fd(function(e,t,r){Lh.isObject(e)&&(r=t);var n=this.union_action(e,t);return this._send_request(n,r)}),bf.prototype.delete=fd(function(e){var t=this.delete_action();return this._send_request(t,e)}),bf.prototype.remove=fd(function(e,t,r){var n=this.remove_action(e,t);return this._send_request(n,r)}),bf.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var r=Lh.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:r,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},bf.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},bf.prototype._get_config=function(e){return this._mixpanel.get_config(e)},bf.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},bf.prototype.remove=bf.prototype.remove,bf.prototype.set=bf.prototype.set,bf.prototype.set_once=bf.prototype.set_once,bf.prototype.union=bf.prototype.union,bf.prototype.unset=bf.prototype.unset,bf.prototype.toString=bf.prototype.toString;var wf=function(){};Lh.extend(wf.prototype,vf),wf.prototype._init=function(e){this._mixpanel=e},wf.prototype.set=pd(function(e,t,r){var n=this.set_action(e,t);return Lh.isObject(e)&&(r=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),n[hf]=Lh.extend({},Lh.info.people_properties(),n[hf]),this._send_request(n,r)}),wf.prototype.set_once=pd(function(e,t,r){var n=this.set_once_action(e,t);return Lh.isObject(e)&&(r=t),this._send_request(n,r)}),wf.prototype.unset=pd(function(e,t){var r=this.unset_action(e);return this._send_request(r,t)}),wf.prototype.increment=pd(function(e,t,r){var n={},i={};return Lh.isObject(e)?(Lh.each(e,function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void jh.error("Invalid increment value passed to mixpanel.people.increment - must be a number");i[t]=e}},this),r=t):(Lh.isUndefined(t)&&(t=1),i[e]=t),n[ff]=i,this._send_request(n,r)}),wf.prototype.append=pd(function(e,t,r){Lh.isObject(e)&&(r=t);var n=this.append_action(e,t);return this._send_request(n,r)}),wf.prototype.remove=pd(function(e,t,r){Lh.isObject(e)&&(r=t);var n=this.remove_action(e,t);return this._send_request(n,r)}),wf.prototype.union=pd(function(e,t,r){Lh.isObject(e)&&(r=t);var n=this.union_action(e,t);return this._send_request(n,r)}),wf.prototype.track_charge=pd(function(){jh.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")}),wf.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},wf.prototype.delete_user=function(){if(this._identify_called()){var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)}jh.error("mixpanel.people.delete_user() requires you to call identify() first")},wf.prototype.toString=function(){return this._mixpanel.toString()+".people"},wf.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var r=this._mixpanel.get_property("$device_id"),n=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");r&&(e.$device_id=r),n&&(e.$user_id=n),i&&(e.$had_persisted_distinct_id=i);var o=Lh.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),Lh.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),Lh.truncate(o,255))},wf.prototype._get_config=function(e){return this._mixpanel.get_config(e)},wf.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},wf.prototype._enqueue=function(e){hf in e?this._mixpanel.persistence._add_to_people_queue(hf,e):df in e?this._mixpanel.persistence._add_to_people_queue(df,e):pf in e?this._mixpanel.persistence._add_to_people_queue(pf,e):ff in e?this._mixpanel.persistence._add_to_people_queue(ff,e):mf in e?this._mixpanel.persistence._add_to_people_queue(mf,e):yf in e?this._mixpanel.persistence._add_to_people_queue(yf,e):gf in e?this._mixpanel.persistence._add_to_people_queue(gf,e):jh.error("Invalid call to _enqueue():",e)},wf.prototype._flush_one_queue=function(e,t,r,n){var i=this,o=Lh.extend({},this._mixpanel.persistence.load_queue(e)),s=o;Lh.isUndefined(o)||!Lh.isObject(o)||Lh.isEmptyObject(o)||(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),n&&(s=n(o)),t.call(i,s,function(t,n){0===t&&i._mixpanel.persistence._add_to_people_queue(e,o),Lh.isUndefined(r)||r(t,n)}))},wf.prototype._flush=function(e,t,r,n,i,o,s){var a=this;this._flush_one_queue(hf,this.set,e),this._flush_one_queue(df,this.set_once,n),this._flush_one_queue(pf,this.unset,o,function(e){return Lh.keys(e)}),this._flush_one_queue(ff,this.increment,t),this._flush_one_queue(gf,this.union,i);var c=this._mixpanel.persistence.load_queue(mf);if(!Lh.isUndefined(c)&&Lh.isArray(c)&&c.length)for(var l,u=function(e,t){0===e&&a._mixpanel.persistence._add_to_people_queue(mf,l),Lh.isUndefined(r)||r(e,t)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(mf),l=c.pop(),a._mixpanel.persistence.save(),Lh.isEmptyObject(l)||a.append(l,u);var d=this._mixpanel.persistence.load_queue(yf);if(!Lh.isUndefined(d)&&Lh.isArray(d)&&d.length)for(var p,f=function(e,t){0===e&&a._mixpanel.persistence._add_to_people_queue(yf,p),Lh.isUndefined(s)||s(e,t)},m=d.length-1;m>=0;m--)d=this._mixpanel.persistence.load_queue(yf),p=d.pop(),a._mixpanel.persistence.save(),Lh.isEmptyObject(p)||a.remove(p,f)},wf.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},wf.prototype.set=wf.prototype.set,wf.prototype.set_once=wf.prototype.set_once,wf.prototype.unset=wf.prototype.unset,wf.prototype.increment=wf.prototype.increment,wf.prototype.append=wf.prototype.append,wf.prototype.remove=wf.prototype.remove,wf.prototype.union=wf.prototype.union,wf.prototype.track_charge=wf.prototype.track_charge,wf.prototype.clear_charges=wf.prototype.clear_charges,wf.prototype.delete_user=wf.prototype.delete_user,wf.prototype.toString=wf.prototype.toString;var xf,kf="__mps",_f="__mpso",Sf="__mpus",Cf="__mpa",If="__mpap",Ef="__mpr",Af="__mpu",Mf="$people_distinct_id",Nf="__alias",Pf="__timers",Tf=[kf,_f,Sf,Cf,If,Ef,Af,Mf,Nf,Pf],Of=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(jh.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&Lh.localStorage.is_supported()?this.storage=Lh.localStorage:this.storage=Lh.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};Of.prototype.properties=function(){var e={};return this.load(),Lh.each(this.props,function(t,r){Lh.include(Tf,r)||(e[r]=t)}),e},Of.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Lh.extend({},e))}},Of.prototype.upgrade=function(){var e,t;this.storage===Lh.localStorage?(e=Lh.cookie.parse(this.name),Lh.cookie.remove(this.name),Lh.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Lh.cookie&&(t=Lh.localStorage.parse(this.name),Lh.localStorage.remove(this.name),t&&this.register_once(t))},Of.prototype.save=function(){this.disabled||this.storage.set(this.name,rd(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},Of.prototype.load_prop=function(e){return this.load(),this.props[e]},Of.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},Of.prototype.clear=function(){this.remove(),this.props={}},Of.prototype.register_once=function(e,t,r){return!!Lh.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===r?this.default_expiry:r,this.load(),Lh.each(e,function(e,r){this.props.hasOwnProperty(r)&&this.props[r]!==t||(this.props[r]=e)},this),this.save(),!0)},Of.prototype.register=function(e,t){return!!Lh.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),Lh.extend(this.props,e),this.save(),!0)},Of.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},Of.prototype.update_search_keyword=function(e){this.register(Lh.info.searchInfo(e))},Of.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Lh.info.referringDomain(e)||"$direct"},"")},Of.prototype.get_referrer_info=function(){return Lh.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},Of.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},Of.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},Of.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},Of.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},Of.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},Of.prototype.get_cross_subdomain=function(){return this.cross_subdomain},Of.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},Of.prototype._add_to_people_queue=function(e,t){var r=this._get_queue_key(e),n=t[e],i=this._get_or_create_queue(hf),o=this._get_or_create_queue(df),s=this._get_or_create_queue(pf),a=this._get_or_create_queue(ff),c=this._get_or_create_queue(gf),l=this._get_or_create_queue(yf,[]),u=this._get_or_create_queue(mf,[]);r===kf?(Lh.extend(i,n),this._pop_from_people_queue(ff,n),this._pop_from_people_queue(gf,n),this._pop_from_people_queue(pf,n)):r===_f?(Lh.each(n,function(e,t){t in o||(o[t]=e)}),this._pop_from_people_queue(pf,n)):r===Sf?Lh.each(n,function(e){Lh.each([i,o,a,c],function(t){e in t&&delete t[e]}),Lh.each(u,function(t){e in t&&delete t[e]}),s[e]=!0}):r===Cf?(Lh.each(n,function(e,t){t in i?i[t]+=e:(t in a||(a[t]=0),a[t]+=e)},this),this._pop_from_people_queue(pf,n)):r===Af?(Lh.each(n,function(e,t){Lh.isArray(e)&&(t in c||(c[t]=[]),Lh.each(e,function(e){Lh.include(c[t],e)||c[t].push(e)}))}),this._pop_from_people_queue(pf,n)):r===Ef?(l.push(n),this._pop_from_people_queue(mf,n)):r===If&&(u.push(n),this._pop_from_people_queue(pf,n)),jh.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),jh.log(t),this.save()},Of.prototype._pop_from_people_queue=function(e,t){var r=this.props[this._get_queue_key(e)];Lh.isUndefined(r)||Lh.each(t,function(t,n){e===mf||e===yf?Lh.each(r,function(e){e[n]===t&&delete e[n]}):delete r[n]},this)},Of.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},Of.prototype._get_queue_key=function(e){return e===hf?kf:e===df?_f:e===pf?Sf:e===ff?Cf:e===mf?If:e===yf?Ef:e===gf?Af:void jh.error("Invalid queue:",e)},Of.prototype._get_or_create_queue=function(e,t){var r=this._get_queue_key(e);return t=Lh.isUndefined(t)?{}:t,this.props[r]||(this.props[r]=t)},Of.prototype.set_event_timer=function(e,t){var r=this.load_prop(Pf)||{};r[e]=t,this.props[Pf]=r,this.save()},Of.prototype.remove_event_timer=function(e){var t=(this.load_prop(Pf)||{})[e];return Lh.isUndefined(t)||(delete this.props[Pf][e],this.save()),t};var Bf,Rf=function(e,t){throw new Error(e+" not available in this build.")},Lf="mixpanel",jf="base64",Uf="$device:",Df=ce.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Ff=!Df&&-1===Mh.indexOf("MSIE")&&-1===Mh.indexOf("Mozilla"),zf=null;Ch.sendBeacon&&(zf=function(){return Ch.sendBeacon.apply(Ch,arguments)});var qf={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/"},$f={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:qf,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:jf,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:td,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:td,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_console:!0,record_heatmap_data:!1,record_idle_timeout_ms:18e5,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:gh,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Wf=!1,Gf=function(){},Hf=function(e,t,r){var n,i=r===Lf?Bf:Bf[r];if(i&&0===xf)n=i;else{if(i&&!Lh.isArray(i))return void jh.error("You have already initialized "+r);n=new Gf}if(n._cached_groups={},n._init(e,t,r),n.people=new wf,n.people._init(n),!n.get_config("skip_first_touch_marketing")){var o=Lh.info.campaignParams(null),s={},a=!1;Lh.each(o,function(e,t){s["initial_"+t]=e,e&&(a=!0)}),a&&n.people.set_once(s)}mh.DEBUG=mh.DEBUG||n.get_config("debug");var c=0===xf?"module":"snippet";return ce.dispatchEvent(new ce.CustomEvent("$mp_sdk_to_extension_event",{detail:{instance:n,source:c,token:e,name:r,info:Lh.info}})),!Lh.isUndefined(i)&&Lh.isArray(i)&&(n._execute_array.call(n.people,i.people),n._execute_array(i)),n};Gf.prototype.init=function(e,t,r){if(Lh.isUndefined(r))this.report_error("You must name your new library: init(token, config, name)");else{if(r!==Lf){var n=Hf(e,t,r);return Bf[r]=n,n._loaded(),n}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},Gf.prototype._init=function(e,t,r){t=t||{},this.__loaded=!0,this.config={};var n={};"api_payload_format"in t||(t.api_host||$f.api_host).match(/\.mixpanel\.com/)&&(n.api_payload_format="json");if(this.hooks={},this.set_config(Lh.extend({},$f,n,t,{name:r,token:e,callback_fn:(r===Lf?r:Lf+"."+r)+"._jsc"})),this._jsc=td,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(Lh.localStorage.is_supported(!0)&&Df){if(this.init_batchers(),zf&&ce.addEventListener){var i=Lh.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);ce.addEventListener("pagehide",function(e){e.persisted&&i()}),ce.addEventListener("visibilitychange",function(){"hidden"===Ih.visibilityState&&i()})}}else this._batch_requests=!1,jh.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Lh.each(this.get_batcher_configs(),function(e){jh.log("Clearing batch queue "+e.queue_key),Lh.localStorage.remove(e.queue_key)});this.persistence=this.cookie=new Of(this.config),this.unpersisted_superprops={},this._gdpr_init();var o=Lh.UUID();this.get_distinct_id()||this.register_once({distinct_id:Uf+o,$device_id:o},""),this.flags=new af({getFullApiRoute:Lh.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:Lh.bind(this.get_config,this),setConfigFunc:Lh.bind(this.set_config,this),getPropertyFunc:Lh.bind(this.get_property,this),trackingFunc:Lh.bind(this.track,this)}),this.flags.init(),this.flags=this.flags,this.autocapture=new tf(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},Gf.prototype._init_tab_id=function(){if(this.get_config("disable_persistence"))jh.log("Tab ID initialization skipped due to disable_persistence config");else if(Lh.sessionStorage.is_supported())try{var e=this.get_config("name")+"_"+this.get_config("token"),t="mp_tab_id_"+e,r="mp_gen_new_tab_id_"+e;!Lh.sessionStorage.get(r)&&Lh.sessionStorage.get(t)||Lh.sessionStorage.set(t,"$tab-"+Lh.UUID()),Lh.sessionStorage.set(r,"1"),this.tab_id=Lh.sessionStorage.get(t),ce.addEventListener("beforeunload",function(){Lh.sessionStorage.remove(r)})}catch(oA){this.report_error("Error initializing tab id",oA)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},Gf.prototype.get_tab_id=function(){return this.tab_id||null},Gf.prototype._should_load_recorder=function(){if(this.get_config("disable_persistence"))return jh.log("Load recorder check skipped due to disable_persistence config"),Promise.resolve(!1);var e=new ad(od),t=this.get_tab_id();return e.init().then(function(){return e.getAll()}).then(function(e){for(var r=0;r<e.length;r++)if(Nd(e[r])||e[r].tabId===t)return!0;return!1}).catch(Lh.bind(function(e){this.report_error("Error checking recording registry",e)},this))},Gf.prototype._check_and_start_session_recording=dd(function(e){if(ce.MutationObserver){var t=Lh.bind(function(e){var t=Lh.bind(function(){this._recorder=this._recorder||new ce.__mp_recorder(this),this._recorder.resumeRecording(e)},this);Lh.isUndefined(ce.__mp_recorder)?Rf(this.get_config("recorder_src"),t):t()},this),r=this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent");e||r?t(!0):this._should_load_recorder().then(function(e){e&&t(!1)})}else jh.critical("Browser does not support MutationObserver; skipping session recording")}),Gf.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},Gf.prototype.stop_session_recording=function(){return this._recorder?this._recorder.stopRecording():Promise.resolve()},Gf.prototype.pause_session_recording=function(){return this._recorder?this._recorder.pauseRecording():Promise.resolve()},Gf.prototype.resume_session_recording=function(){return this._recorder?this._recorder.resumeRecording():Promise.resolve()},Gf.prototype.is_recording_heatmap_data=function(){return this._get_session_replay_id()&&this.get_config("record_heatmap_data")},Gf.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},Gf.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();t&&(e="https://mixpanel.com/projects/replay-redirect?"+Lh.HTTPBuildQuery({replay_id:t,distinct_id:this.get_distinct_id(),token:this.get_config("token")}));return e},Gf.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},Gf.prototype.__get_recorder=function(){return this._recorder},Gf.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=Lh.info.campaignParams(null);Lh.each(e,function(e,t){this.unregister(t)}.bind(this))}},Gf.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Ih.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Lh.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Ih.referrer)},Gf.prototype._dom_loaded=function(){Lh.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||Lh.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue},Gf.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Wf)return this.__dom_loaded_queue.push([e,t]),!1;var r=(new e).init(this);return r.track.apply(r,t)},Gf.prototype._prepare_callback=function(e,t){if(Lh.isUndefined(e))return null;if(Df){return function(r){e(r,t)}}var r=this._jsc,n=""+Math.floor(1e8*Math.random()),i=this.get_config("callback_fn")+"["+n+"]";return r[n]=function(i){delete r[n],e(i,t)},i},Gf.prototype._send_request=function(e,t,r,n){var i=!0;if(Ff)return this.__request_queue.push(arguments),i;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},s=null;n||!Lh.isFunction(r)&&"string"!=typeof r||(n=r,r=null),r=Lh.extend(o,r||{}),Df||(r.method="GET");var a="POST"===r.method,c=zf&&a&&"sendbeacon"===r.transport.toLowerCase(),l=r.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),Df||(n?t.callback=n:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),a&&(s="data="+encodeURIComponent(t.data),delete t.data),Lh.extend(t,this.get_config("api_extra_query_params")),e+="?"+Lh.HTTPBuildQuery(t);var u=this;if("img"in t){var h=Ih.createElement("img");h.src=e,Ih.body.appendChild(h)}else if(c){try{i=zf(e,s)}catch(y){u.report_error(y),i=!1}try{n&&n(i?1:0)}catch(y){u.report_error(y)}}else if(Df)try{var d=new XMLHttpRequest;d.open(r.method,e,!0);var p=this.get_config("xhr_headers");if(a&&(p["Content-Type"]="application/x-www-form-urlencoded"),Lh.each(p,function(e,t){d.setRequestHeader(t,e)}),r.timeout_ms&&void 0!==d.timeout){d.timeout=r.timeout_ms;var f=(new Date).getTime()}d.withCredentials=!0,d.onreadystatechange=function(){var e;if(4===d.readyState)if(200===d.status){if(n)if(l){var t;try{t=Lh.JSONDecode(d.responseText)}catch(y){if(u.report_error(y),!r.ignore_json_errors)return;t=d.responseText}n(t)}else n(Number(d.responseText))}else if(e=d.timeout&&!d.status&&(new Date).getTime()-f>=d.timeout?"timeout":"Bad HTTP status: "+d.status+" "+d.statusText,u.report_error(e),n)if(l){var i=d.responseHeaders||{};n({status:0,httpStatusCode:d.status,error:e,retryAfter:i["Retry-After"]})}else n(0)},d.send(s)}catch(y){u.report_error(y),i=!1}else{var m=Ih.createElement("script");m.type="text/javascript",m.async=!0,m.defer=!0,m.src=e;var g=Ih.getElementsByTagName("script")[0];g.parentNode.insertBefore(m,g)}return i},Gf.prototype._execute_array=function(e){var t,r=[],n=[],i=[];Lh.each(e,function(e){e&&(t=e[0],Lh.isArray(t)?i.push(e):"function"==typeof e?e.call(this):Lh.isArray(e)&&"alias"===t?r.push(e):Lh.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?i.push(e):n.push(e))},this);var o=function(e,t){Lh.each(e,function(e){if(Lh.isArray(e[0])){var r=t;Lh.each(e,function(e){r=r[e[0]].apply(r,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};o(r,this),o(n,this),o(i,this)},Gf.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},Gf.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:e+"_ev"},people:{type:"people",api_name:"engage",queue_key:e+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:e+"_gr"}},this._batcher_configs},Gf.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=Lh.bind(function(e){return new Md(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Lh.bind(function(t,r,n){var i=this.get_config("api_routes");this._send_request(this.get_api_host(e.api_name)+"/"+i[e.api_name],this._encode_data_for_request(t),r,this._prepare_callback(n,t))},this),beforeSendHook:Lh.bind(function(t){var r=this._run_hook("before_send_"+e.type,t);return r?r[0]:null},this),stopAllBatchingFunc:Lh.bind(this.stop_batch_senders,this),usePersistence:!0})},this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},Gf.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,Lh.each(this.request_batchers,function(e){e.start()}))},Gf.prototype.stop_batch_senders=function(){this._batch_requests=!1,Lh.each(this.request_batchers,function(e){e.stop(),e.clear()})},Gf.prototype.push=function(e){this._execute_array([e])},Gf.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},Gf.prototype._encode_data_for_request=function(e){var t=rd(e);return this.get_config("api_payload_format")===jf&&(t=Lh.base64Encode(t)),{data:t}},Gf.prototype._track_or_batch=function(e,t){var r=Lh.truncate(e.data,255),n=e.endpoint,i=e.batcher,o=e.should_send_immediately,s=e.send_request_options||{};t=t||td;var a=!0,c=Lh.bind(function(){return s.skip_hooks||(r=this._run_hook("before_send_"+e.type,r))&&(r=r[0]),r?(jh.log("MIXPANEL REQUEST:"),jh.log(r),this._send_request(n,this._encode_data_for_request(r),s,this._prepare_callback(t,r))):null},this);return this._batch_requests&&!o?i.enqueue(r).then(function(e){e?t(1,r):c()}):a=c(),a&&r},Gf.prototype.track=dd(function(e,t,r,n){var i;if(!r||!r.skip_hooks){if(null===(i=this._run_hook("before_track",e,t)))return;e=i[0],t=i[1]}n||"function"!=typeof r||(n=r,r=null);var o=(r=r||{}).transport;o&&(r.transport=o);var s=r.send_immediately;if("function"!=typeof n&&(n=td),Lh.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=Lh.extend({},t)).token=this.get_config("token");var a=this.persistence.remove_event_timer(e);if(!Lh.isUndefined(a)){var c=(new Date).getTime()-a;t.$duration=parseFloat((c/1e3).toFixed(3))}this._set_default_superprops();var l=this.get_config("track_marketing")?Lh.info.marketingParams():{};t=Lh.extend({},Lh.info.properties({mp_loader:this.get_config("mp_loader")}),l,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var u=this.get_config("property_blacklist");Lh.isArray(u)?Lh.each(u,function(e){delete t[e]}):this.report_error("Invalid value for property_blacklist config: "+u);var h={event:e,properties:t};return i=this._track_or_batch({type:"events",data:h,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:r},n)}n(0)}}),Gf.prototype.set_group=dd(function(e,t,r){Lh.isArray(t)||(t=[t]);var n={};return n[e]=t,this.register(n),this.people.set(e,t,r)}),Gf.prototype.add_group=dd(function(e,t,r){var n=this.get_property(e),i={};return void 0===n?(i[e]=[t],this.register(i)):-1===n.indexOf(t)&&(n.push(t),i[e]=n,this.register(i)),this.people.union(e,t,r)}),Gf.prototype.remove_group=dd(function(e,t,r){var n=this.get_property(e);if(void 0!==n){var i=n.indexOf(t);i>-1&&(n.splice(i,1),this.register({group_key:n})),0===n.length&&this.unregister(e)}return this.people.remove(e,t,r)}),Gf.prototype.track_with_groups=dd(function(e,t,r,n){var i=Lh.extend({},t||{});return Lh.each(r,function(e,t){null!=e&&(i[t]=e)}),this.track(e,i,n)}),Gf.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},Gf.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},Gf.prototype.get_group=function(e,t){var r=this._create_map_key(e,t),n=this._cached_groups[r];return void 0!==n&&n._group_key===e&&n._group_id===t||((n=new bf)._init(this,e,t),this._cached_groups[r]=n),n},Gf.prototype.track_pageview=dd(function(e,t){"object"!=typeof e&&(e={});var r=(t=t||{}).event_name||"$mp_web_page_view",n=Lh.extend(Lh.info.mpPageViewProperties(),Lh.info.campaignParams(),Lh.info.clickParams()),i=Lh.extend({},n,e);return this.track(r,i)}),Gf.prototype.track_links=function(){return this._track_dom.call(this,lf,arguments)},Gf.prototype.track_forms=function(){return this._track_dom.call(this,uf,arguments)},Gf.prototype.time_event=function(e){Lh.isUndefined(e)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(e)||this.persistence.set_event_timer(e,(new Date).getTime())};var Vf={persistent:!0},Kf=function(e){var t;return t=Lh.isObject(e)?e:Lh.isUndefined(e)?{}:{days:e},Lh.extend({},Vf,t)};Gf.prototype.register=function(e,t){var r=this._run_hook("before_register",e,t);if(null!==r){e=r[0],t=r[1];var n=Kf(t);n.persistent?this.persistence.register(e,n.days):Lh.extend(this.unpersisted_superprops,e)}},Gf.prototype.register_once=function(e,t,r){var n=this._run_hook("before_register_once",e,t,r);if(null!==n){e=n[0],t=n[1],r=n[2];var i=Kf(r);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),Lh.each(e,function(e,r){this.unpersisted_superprops.hasOwnProperty(r)&&this.unpersisted_superprops[r]!==t||(this.unpersisted_superprops[r]=e)},this))}},Gf.prototype.unregister=function(e,t){var r=this._run_hook("before_unregister",e,t);null!==r&&(e=r[0],t=r[1],(t=Kf(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e])},Gf.prototype._register_single=function(e,t){var r={};r[e]=t,this.register(r)},Gf.prototype.identify=function(e,t,r,n,i,o,s,a){var c=this._run_hook("before_identify",e);if(null===c)return-1;e=c[0];var l=this.get_distinct_id();if(e&&l!==e){if("string"==typeof e&&0===e.indexOf(Uf))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var u=l;this.register_once({$had_persisted_distinct_id:!0,$device_id:u},"")}e!==l&&e!==this.get_property(Nf)&&(this.unregister(Nf),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,r,n,i,o,s,a),e!==l&&this.track("$identify",{distinct_id:e,$anon_distinct_id:l},{skip_hooks:!0}),e!==l&&this.flags.fetchFlags()},Gf.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var e=Lh.UUID();this.register_once({distinct_id:Uf+e,$device_id:e},""),this._check_and_start_session_recording()},Gf.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},Gf.prototype.alias=function(e,t){if(e===this.get_property(Mf))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var r=this;return Lh.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Nf,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},function(){r.identify(e)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},Gf.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},Gf.prototype.set_config=function(e){Lh.isObject(e)&&(Lh.extend(this.config,e),e.batch_size&&Lh.each(this.request_batchers,function(e){e.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),mh.DEBUG=mh.DEBUG||this.get_config("debug"),("autocapture"in e||"record_heatmap_data"in e)&&this.autocapture&&this.autocapture.init(),Lh.isObject(e.hooks)&&(this.hooks={},Lh.each(e.hooks,function(e,t){if(Lh.isFunction(e))this.hooks[t]=[e];else if(Lh.isArray(e)){this.hooks[t]=[];for(var r=0;r<e.length;r++)Lh.isFunction(e[r])||jh.critical("Invalid hook added. Hook is not a function"),this.hooks[t].push(e[r])}else jh.critical("Invalid hooks added. Ensure that the hook values passed into config.hooks are functions or arrays of functions.")},this)))},Gf.prototype.get_config=function(e){return this.config[e]},Gf.prototype._run_hook=function(e){var t=xh.call(arguments,1);return Lh.each(this.hooks[e],function(r){if(null===t)return null;var n=r.apply(this,t);void 0===n?(this.report_error(e+" hook did not return a valid value"),t=null):(Lh.isArray(n)||(n=[n]),t.splice.apply(t,[0,n.length].concat(n)))},this),t},Gf.prototype.get_property=function(e){return this.persistence.load_prop([e])},Gf.prototype.get_api_host=function(e){return this.get_config("api_hosts")[e]||this.get_config("api_host")},Gf.prototype.toString=function(){var e=this.get_config("name");return e!==Lf&&(e=Lf+"."+e),e},Gf.prototype._event_is_disabled=function(e){return Lh.isBlockedUA(Mh)||this._flags.disable_all_events||Lh.include(this.__disabled_events,e)},Gf.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Lh.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_tracking()||!this.get_config("opt_out_tracking_by_default")&&!Lh.cookie.get("mp_optout")||(Lh.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},Gf.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},Gf.prototype._gdpr_call_func=function(e,t){return t=Lh.extend({track:Lh.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),Lh.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},Gf.prototype.opt_in_tracking=function(e){e=Lh.extend({enable_persistence:!0},e),this._gdpr_call_func(cd,e),this._gdpr_update_persistence(e)},Gf.prototype.opt_out_tracking=function(e){(e=Lh.extend({clear_persistence:!0,delete_user:!0},e)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(ld,e),this._gdpr_update_persistence(e)},Gf.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(ud,e)},Gf.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(hd,e)},Gf.prototype.clear_opt_in_out_tracking=function(e){e=Lh.extend({enable_persistence:!0},e),this._gdpr_call_func(md,e),this._gdpr_update_persistence(e)},Gf.prototype.report_error=function(e,t){jh.error.apply(jh.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(r){jh.error(r)}},Gf.prototype.add_hook=function(e,t){this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(t)},Gf.prototype.remove_hook=function(e,t){var r;this.hooks[e]&&(-1!==(r=this.hooks[e].indexOf(t))?this.hooks[e].splice(r,1):jh.log("remove_hook failed. Matching hook was not found"))},Gf.prototype.init=Gf.prototype.init,Gf.prototype.reset=Gf.prototype.reset,Gf.prototype.disable=Gf.prototype.disable,Gf.prototype.time_event=Gf.prototype.time_event,Gf.prototype.track=Gf.prototype.track,Gf.prototype.track_links=Gf.prototype.track_links,Gf.prototype.track_forms=Gf.prototype.track_forms,Gf.prototype.track_pageview=Gf.prototype.track_pageview,Gf.prototype.register=Gf.prototype.register,Gf.prototype.register_once=Gf.prototype.register_once,Gf.prototype.unregister=Gf.prototype.unregister,Gf.prototype.identify=Gf.prototype.identify,Gf.prototype.alias=Gf.prototype.alias,Gf.prototype.name_tag=Gf.prototype.name_tag,Gf.prototype.set_config=Gf.prototype.set_config,Gf.prototype.get_config=Gf.prototype.get_config,Gf.prototype.get_api_host=Gf.prototype.get_api_host,Gf.prototype.get_property=Gf.prototype.get_property,Gf.prototype.get_distinct_id=Gf.prototype.get_distinct_id,Gf.prototype.toString=Gf.prototype.toString,Gf.prototype.opt_out_tracking=Gf.prototype.opt_out_tracking,Gf.prototype.opt_in_tracking=Gf.prototype.opt_in_tracking,Gf.prototype.has_opted_out_tracking=Gf.prototype.has_opted_out_tracking,Gf.prototype.has_opted_in_tracking=Gf.prototype.has_opted_in_tracking,Gf.prototype.clear_opt_in_out_tracking=Gf.prototype.clear_opt_in_out_tracking,Gf.prototype.get_group=Gf.prototype.get_group,Gf.prototype.set_group=Gf.prototype.set_group,Gf.prototype.add_group=Gf.prototype.add_group,Gf.prototype.remove_group=Gf.prototype.remove_group,Gf.prototype.add_hook=Gf.prototype.add_hook,Gf.prototype.remove_hook=Gf.prototype.remove_hook,Gf.prototype.track_with_groups=Gf.prototype.track_with_groups,Gf.prototype.start_batch_senders=Gf.prototype.start_batch_senders,Gf.prototype.stop_batch_senders=Gf.prototype.stop_batch_senders,Gf.prototype.start_session_recording=Gf.prototype.start_session_recording,Gf.prototype.stop_session_recording=Gf.prototype.stop_session_recording,Gf.prototype.pause_session_recording=Gf.prototype.pause_session_recording,Gf.prototype.resume_session_recording=Gf.prototype.resume_session_recording,Gf.prototype.get_session_recording_properties=Gf.prototype.get_session_recording_properties,Gf.prototype.get_session_replay_url=Gf.prototype.get_session_replay_url,Gf.prototype.get_tab_id=Gf.prototype.get_tab_id,Gf.prototype.DEFAULT_API_ROUTES=qf,Gf.prototype.__get_recorder=Gf.prototype.__get_recorder,Of.prototype.properties=Of.prototype.properties,Of.prototype.update_search_keyword=Of.prototype.update_search_keyword,Of.prototype.update_referrer_info=Of.prototype.update_referrer_info,Of.prototype.get_cross_subdomain=Of.prototype.get_cross_subdomain,Of.prototype.clear=Of.prototype.clear;var Zf={},Yf=function(){Bf.init=function(e,t,r){if(r)return Bf[r]||(Bf[r]=Zf[r]=Hf(e,t,r),Bf[r]._loaded()),Bf[r];var n=Bf;Zf[Lf]?n=Zf[Lf]:e&&((n=Hf(e,t,Lf))._loaded(),Zf[Lf]=n),Bf=n,1===xf&&(ce[Lf]=Bf),Lh.each(Zf,function(e,t){t!==Lf&&(Bf[t]=e)}),Bf._=Lh}};var Jf=(Rf=function(e,t){t()},xf=0,Bf=new Gf,Yf(),Bf.init(),function(){function e(){e.done||(e.done=!0,Wf=!0,Ff=!1,Lh.each(Zf,function(e){e._dom_loaded()}))}if(Ih.addEventListener)"complete"===Ih.readyState?e():Ih.addEventListener("DOMContentLoaded",e,!1);else if(Ih.attachEvent){Ih.attachEvent("onreadystatechange",e);var t=!1;try{t=null===ce.frameElement}catch(r){}Ih.documentElement.doScroll&&t&&function t(){try{Ih.documentElement.doScroll("left")}catch(r){return void setTimeout(t,1)}e()}()}Lh.register_event(ce,"load",e,!0)}(),Bf);let Xf=!1;const Qf=()=>{Xf||(Jf.init("c9fdb235976ef567b15bcb07bad264f3",{debug:!1,track_pageview:!1,persistence:"localStorage"}),Xf=!0)},em={init:()=>{Qf()},track:(e,t={})=>{Xf||Qf(),Jf.track(e,{source:"coinley-sdk",...t,timestamp:(new Date).toISOString()})},trackModalOpened:(e,t)=>{em.track("SDK Modal Opened",{merchant_name:e,amount:t})},trackModalClosed:(e="user_closed")=>{em.track("SDK Modal Closed",{reason:e})},trackNetworkSelected:(e,t)=>{em.track("Network Selected",{network:e,merchant_name:t})},trackTokenSelected:(e,t,r)=>{em.track("Token Selected",{token:e,network:t,merchant_name:r})},trackWalletConnectStarted:e=>{em.track("Wallet Connect Started",{wallet_type:e})},trackWalletConnected:(e,t,r)=>{em.track("Wallet Connected",{wallet_type:e,wallet_address:(null==t?void 0:t.slice(0,10))+"...",network:r})},trackWalletConnectionFailed:(e,t)=>{em.track("Wallet Connection Failed",{wallet_type:e,error:(null==t?void 0:t.message)||t})},trackWalletDisconnected:()=>{em.track("Wallet Disconnected")},trackPaymentCreated:(e,t,r,n)=>{em.track("Payment Created",{payment_id:e,amount:t,network:r,token:n})},trackPaymentApprovalStarted:(e,t)=>{em.track("Payment Approval Started",{payment_id:e,amount:t})},trackPaymentApproved:(e,t)=>{em.track("Payment Approved",{payment_id:e,amount:t})},trackPaymentExecutionStarted:(e,t)=>{em.track("Payment Execution Started",{payment_id:e,amount:t})},trackPaymentSuccess:(e,t,r,n,i)=>{em.track("Payment Success",{payment_id:e,amount:t,network:r,token:n,transaction_hash:i})},trackPaymentFailed:(e,t,r,n,i)=>{em.track("Payment Failed",{payment_id:e,amount:t,network:r,token:n,error:(null==i?void 0:i.message)||i})},trackPaymentCancelled:(e,t)=>{em.track("Payment Cancelled",{payment_id:e,stage:t})},trackError:(e,t,r={})=>{em.track("SDK Error",{error_type:e,error_message:t,...r})},trackNetworkSwitchRequested:(e,t)=>{em.track("Network Switch Requested",{from_network:e,to_network:t})},trackNetworkSwitchSuccess:e=>{em.track("Network Switch Success",{network:e})},trackNetworkSwitchFailed:(e,t)=>{em.track("Network Switch Failed",{network:e,error:(null==t?void 0:t.message)||t})}},tm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABxCAYAAAAj+QZ8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAzrSURBVHgB7V3dcRs5Em4MtXWPq41gZ1+v7mwrgh3rArAUgagITNcFYDmAK9ERSBuBfQGsxY3Aku26V/MiOO7j1nqAQwMgRQ4xQONnhqOfr8q2TA4H1HzoRqO70c1g4JhUH/dhNKqgrhfT2cEMOoQaqxidyx+P5J8F8PpYjnkNPYLBgPGq+vxSFOJM/rhvXpp39ZAkGaUk40r+WK69jKT8JMdbQE8oYKDAByTJmMItGQj10OR7zyA3itFr2CQD1NhFMYYeMVhCHA8C1co7pV4yYXL4aSz/GVvfFFBBjxguIcCeOt4szYxOhiG2/V7M+T2yY7iEMOaTgIl8mBWkoth7Cduqah2u97JjuIQIUXqvYWlSohZyUEaDE/88/M+P0BMGrLIIYFAZ/R+HTGovJ+42IRqvYxZ485kKBob7QEgZZZoWoyMgrg//+vDX/0JPuA+ESLCXEApG/kxvm0LEkK2secDVZYjFpRZzIWibSyHm0COGSwjnYWoiyOIqjujXskcJUWCBqgItLuriPipOgAombqBH7EEGTKovUvz/xIdxnc8Rx8IdiHpxn7ouCVJXGnPIBD1h9p5BIU6kS6ZkBXt//uvf365fk0SIcvJJv5LUL6Wcdvq1w09z+c9MeknfSHLmEAteX8t7B30EBHsBHkLkPSsI+h482bOs3froERAT+UdLMcPlSch91M0P0w9Pz5bXpqksRcaW6Yj/H8v3vkpyLvRuOBzGxd6F2voZwpBEyKT6XMln8dF4BCzfjW2oz2hCjAu89FxmiPkctyNmMWprdOS5J11dSQsrVgXjxJAT8lyqp2aMpTnGxv1TJCRgdyzO5Jf7Giwtgv8GwWhfH5T0hK0fUQu6UeUf8UfvxY1Jl0LIHMJQBksL5zMIhXCqpLDAFpNrYSAwymnIKEkf4PUv6/+NJsQs2BHirKTlHUVaTAw9cB1xqaQijJDACYGTzUQ5adAqcbb+UuI+RPwCcTgyodjSe6UQ/4ZAtLrLi4DYhn5Y5DVscvjlguLK3xyDvWm+lEYI5+8hHiWJFMEvIRA1/3ZgfYMV9OgfYzPKZWrxfv5JLtx8DCFQhD+5bL6cRIgSN+IXb4GXlCi1VbQEt0IWdA40yRztXaG5DaEQ/Nj2crrrpP72BtJAkJRg1bhlAZr9Cc0y1LPXK/1KTYVZbcsB3rapw2RC1AwW0WvJEktS7A8sWDWyH61jkD/ul3q1xwhVUwj0HnN+1vZ2Huei4Ghvp/qwSumxfWd7I4NqRND3TdLt43rbmO7+PYYNgj93bTazEKIG4PUppELHyM+t76WrRhoEzFw+uMk/Ph0FW1O3N3/l8+9lc7/Lgd6jboR0TF5VNyeW++eQEj8EtKpf7SmGC4i78VvpRPTuUfLGQ1A3CpHkjEOIgk2ti3zXUtJiiq6gc38DXEar+15LMkgqLishSnWhOZce9tyX68mF5f4pUjL3XmHZqC1hVGkJocBnIdcN6uXZI4ZKR2obO22Rx/VE6esG6m+n/nsLW/jX/Rnp5GuTDpP7Fb6IGzJCPMadhHCVjc1rnBVppAg4b5rCinBeHzs/x7fd9uqhuNz59TfrPY3qDA8f3JIxD/lYZzH1TKRgztXEcu8ZWiztH6vtD17wlt23w/qxH1NwI5IMNRx0iDyk2POntMUiLDpftIeOOZ9ufxd5fYv1Y6RjDCFIIAPRywkq9YuxQvp8WAkxkKS2HWdT+VgFpvWw7zG24Dv2Jq8/kv6nl3rH7L4eQ9AQQojcw4BQJ7yiJ2AvhCAMKe+CQqgrKBs+bmecAIxyAlldKUk7g0R4s070ovpdadJ8DL6TM+DPoHizEeGDyeHNmZwHYYukiDA3E0HMGUAsD4fOIAP2LF/EnKtjGAqtQG2EOCzTfDT0/+UM0jFhte8QN+rnur526U+cRXIMuZ8oLgJUWG/nM9bg3wBqFXWalO7UwEplbeYORexGN+6qSLp26Wijws7ktf4sQvQvXT0hb65ywOw92twk0oSG0+mvfhd9KBQhLUeCc2EOjsQ5EjFc/vIul0YHUBOUFR8bUrxQ/jpprXV1VFoTcvgJ3d5H0D0uncRgEvSoeCGlqzIvL1xmaddYfScFft114QIEM9LxFfrFZXKq6T0FbgzT1os4YEbjR2lx9W7KDh3M1Pf4H+wKHVgqdxmFdpknx8TjgRkb1BytBwDtyxIq6N6J1UBEKd0Z7+ARmhDj0k53l6dAiGd6F/+wsfL2rjyzPR9y3ARhk3jPseF+V6RguHF3a0rZZxmLIaLV26uca9o7W0Kf4PUP0x4Lhg0NXve78ukI8boXYnbgsxoayPEQRQz6m27dGnmRGGm7LwgOUK38OwxO4oJNFjxuDldIihiazdwzGT+p1NkLnQlOdcUsVFY75+/7cNrdFWQP4Zq0nRI0MeiW2SSIq4yQxaM0POJOoCsJ0VJSjMqtC3g9x5j8dPa35Bzg+4hkQnSlAv7MxOCpiQGIOeQowXHPEEWIJkFgXZEx5ImnPAasDOj7kJxJEHagg/PgIe/SEbS8rGYlm26Aaw5meRzDA4ZTQizF8LvHA/dlWSVEp+aMLgTryE3iwKj4y/ew22DZTmHJXFQLNkbvdpH8ADX/43d4wNiIh7yqvpyY+k47IUPi8qEv6itCMP4hivC6IlnhOR/+EKAIMalAO04y8J/hfgjQEhJQdrsb7C5ddGjQi7oOPMFuICXjkYwVstTtjYKOEGJQarY6FKR8YsvSSgx37rOHpsZM9vvNNKqgfRxWKf2mqDCOW0G7ZTedfnjyCnYAU8zyRE6Mt31NDL2GpFWGo0IdLcA2dMCLmar8o01sXL9cZvaktSBN1xjt4bgTU4P4nFATOBnLzMWZ/YhxFqwRIc1q9FchEWFV2CZ9PIwtbJapnaiM/Rx9rxy4zVzUJ0hPM2UuGrVUP5fqRpXSZrB3Ysqnxh0M6rmfoML2uXZdaC22MDQBVueiOV+H8Y4K/Lv2hfkjg03YSYDPmuXrjMqZQBouJbnpNbkCoc612/Zo6oDrt+Pca4s/UW4zaWEdc/zLWexL9bHdu4qrS7gFJyE4VojbBR2o1IfpMHqyt4LtrHBABwdJrYTcdmhQ43iDXJbrvQ+05QDoGvLtpTqpddLNqV7xe8s46x0arMVqNrB1vf+w0KoOWGtYgJ3nWleyE2LUlK2NRRpsprmNdKHWvrbvZkvCsBZLa0JLkcsSxRLq6aTklxAsZ5RnzbiFpUa6+eXLrWtdSeGjkf29tmJpDZgKRI66kumkZCUkqXyqC42yfqZlats47VahcL5H2vipIjjOMoOq2UBkocyMhFD7ykahGSfRRcVaH177oR9nf13/+rMEVp9zF/scx5KST0K0Ps+PRh3dqKJiZLCXJCmhFfscx6ivLIS06vMcEFbp6Ar7VCkxxT49ZzLD15RkQjz6PA1aOmabY/mlo713LaV7KE1KEF2Qki4hHn2eBNEoX95Pu+39EL8ZlRRbtW4bkggxMzbOWeiFtZhl5f+YY7FVmfeUodkLCACFFFOt27sdSO1jWEEX0oH7jkb9QrNPKP0fdvaunQMFuh9iBQEgkLJP8QqkEcI6OOjfVprbsQPfgLt3Ldn5qI7pBSKAlNZJnEZI7h25uidvO/xJU428fdNmnI5zICEupL1GSpvqbO2Tgkjt9JlXXalSftsHQI36II7lXSeorvL92OjgihSA99YLVJ8Uu+XVU6dPAlx1FQty//OFNzbBxW9ARYTaWgKlUYYLjtsdkuLMRng8IUWLoy4UusL0gbPIJSt+Btq9CA87oPuzYLRxHdDGSUudep1EsYF4QqgmpAuqYICq3tD6kIL619JapdIJoXWf9kJ5iTHJo7nYW0pSpaislLDlQkXZrp74S2mMlGlNA6FVqmlb4b1uDVkMl7XFvlFpadMzkNILN/QX0xDq5O0BOeRJlY6QVqkhXaiLIgshCCRlevV0DJvZPUjGaow0sxe73VDThjQRz0lSsQ7q+hEyOYKaDjN6u1Yi5GJ/KScFtoc9bVqWGc6pOytTL1Lrmci4AlZM9etxDseU7pzB98WGXldPD6AnJCdbm9k+lsScgSpEY2qb6JomQR0Umghqlwr1DEKAXagpnoY+6oStIVv2uyFmDnlB1d/hR+GwCzUbUVw/+6E5XynotOVROogLKrWz8yZQgkkP2ZwM7gXDJoTSkJ7Y2bkJPeNpxT5r/sdP0BMGLiHMX6FUQHy7V+oxjFxeCcpQMGQwRljQ48+29NZfNwADlxAvLpOzz/vqQk3E3SYkw7n2oUnJsAkRwmEFiXzn/gYkJQOXEGFP51Eue07zhREwJCkZupVldxYWLH/VB1cXat5fdaJhE8JriwUl3nTRrk4T3Bbdq1NCDUEYNCFm87Z8SAtzUukMOoK94bHo7Yw6orMjbTmxDOD05U/SBz2l2wab3ncgjS78H0eagrHjdQciAAAAAElFTkSuQmCC",rm="YWG990wOlIikc1tU7-WWTepfU8d1f4dp",nm="qtIcCe_-8t4rIWktnWJm0",im=o.createConfig({chains:[s.mainnet,s.bsc,s.polygon,s.arbitrum,s.optimism,s.avalanche,s.celo,s.base],connectors:[a.injected(),a.metaMask({dappMetadata:{name:"Coinley Payment",icon:tm}}),a.coinbaseWallet({appName:"Coinley Payment",appLogoUrl:tm})],transports:{[s.mainnet.id]:o.fallback([o.http(`https://eth-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://eth-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://cloudflare-eth.com",{timeout:1e4,retryCount:1}),o.http("https://eth.llamarpc.com",{timeout:1e4,retryCount:1}),o.http("https://ethereum.publicnode.com",{timeout:1e4,retryCount:1})]),[s.bsc.id]:o.fallback([o.http(`https://bnb-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://bnb-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://bsc-dataseed.bnbchain.org",{timeout:1e4,retryCount:1}),o.http("https://bsc-dataseed-public.bnbchain.org",{timeout:1e4,retryCount:1}),o.http("https://bsc.nodereal.io",{timeout:1e4,retryCount:1})]),[s.polygon.id]:o.fallback([o.http(`https://polygon-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://polygon-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://polygon.llamarpc.com",{timeout:1e4,retryCount:1}),o.http("https://polygon-rpc.com",{timeout:1e4,retryCount:1}),o.http("https://polygon.drpc.org",{timeout:1e4,retryCount:1})]),[s.arbitrum.id]:o.fallback([o.http(`https://arb-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://arb-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://arb1.arbitrum.io/rpc",{timeout:1e4,retryCount:1}),o.http("https://arbitrum.llamarpc.com",{timeout:1e4,retryCount:1})]),[s.optimism.id]:o.fallback([o.http(`https://opt-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://opt-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://mainnet.optimism.io",{timeout:1e4,retryCount:1}),o.http("https://optimism.llamarpc.com",{timeout:1e4,retryCount:1})]),[s.avalanche.id]:o.fallback([o.http(`https://avax-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://avax-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://api.avax.network/ext/bc/C/rpc",{timeout:1e4,retryCount:1}),o.http("https://avalanche.public-rpc.com",{timeout:1e4,retryCount:1})]),[s.celo.id]:o.fallback([o.http(`https://celo-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://celo-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://forno.celo.org",{timeout:1e4,retryCount:1}),o.http("https://celo.drpc.org",{timeout:1e4,retryCount:1})]),[s.base.id]:o.fallback([o.http(`https://base-mainnet.g.alchemy.com/v2/${rm}`,{timeout:1e4,retryCount:1}),o.http(`https://base-mainnet.g.alchemy.com/v2/${nm}`,{timeout:1e4,retryCount:1}),o.http("https://mainnet.base.org",{timeout:1e4,retryCount:1}),o.http("https://base.llamarpc.com",{timeout:1e4,retryCount:1}),o.http("https://base.meowrpc.com",{timeout:1e4,retryCount:1})])}});let om=class{constructor(e,t,r=null){this.baseURL=e.endsWith("/")?e.slice(0,-1):e,t&&t.startsWith("pk_")?(this.publicKey=t,this.apiKey=null,this.apiSecret=null):(this.publicKey=null,this.apiKey=t,this.apiSecret=r)}async request(e,t={}){const r=`${this.baseURL}${e}`,n={"Content-Type":"application/json",...t.headers};this.publicKey?n["X-Public-Key"]=this.publicKey:(n["X-API-Key"]=this.apiKey,n["X-API-Secret"]=this.apiSecret);const i=t.timeout||6e4,o=new AbortController,s=setTimeout(()=>o.abort(),i);try{const e=await fetch(r,{...t,headers:n,signal:o.signal});if(clearTimeout(s),!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error||`HTTP ${e.status}`)}return e.json()}catch(uh){if(clearTimeout(s),"AbortError"===uh.name)throw new Error(`Request timeout after ${i/1e3}s: ${e}`);throw uh}}async getNetworks(){try{return await this.request("/api/networks")}catch(uh){return{networks:[{id:"1",name:"Ethereum",shortName:"ethereum",chainId:"0x1",type:"ethereum"},{id:"56",name:"BSC",shortName:"bsc",chainId:"0x38",type:"bsc"},{id:"137",name:"Polygon",shortName:"polygon",chainId:"0x89",type:"polygon"},{id:"42161",name:"Arbitrum",shortName:"arbitrum",chainId:"0xa4b1",type:"arbitrum"},{id:"10",name:"Optimism",shortName:"optimism",chainId:"0xa",type:"optimism"},{id:"43114",name:"Avalanche",shortName:"avalanche",chainId:"0xa86a",type:"avalanche"}]}}}async getTokens(){try{return await this.request("/api/networks/stablecoins")}catch(uh){return{stablecoins:[{id:"1",name:"Tether USD",symbol:"USDT",contractAddress:"0xdAC17F958D2ee523a2206206994597C13D831ec7",decimals:6,networkId:"1",Network:{shortName:"ethereum",name:"Ethereum"}},{id:"2",name:"USD Coin",symbol:"USDC",contractAddress:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",decimals:6,networkId:"1",Network:{shortName:"ethereum",name:"Ethereum"}},{id:"3",name:"Tether USD",symbol:"USDT",contractAddress:"0x55d398326f99059fF775485246999027B3197955",decimals:18,networkId:"56",Network:{shortName:"bsc",name:"BSC"}},{id:"4",name:"USD Coin",symbol:"USDC",contractAddress:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",decimals:18,networkId:"56",Network:{shortName:"bsc",name:"BSC"}},{id:"5",name:"Tether USD",symbol:"USDT",contractAddress:"0xc2132D05D31c914a87c6611C10748AEb04B58e8F",decimals:6,networkId:"137",Network:{shortName:"polygon",name:"Polygon"}},{id:"6",name:"USD Coin",symbol:"USDC",contractAddress:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",decimals:6,networkId:"137",Network:{shortName:"polygon",name:"Polygon"}},{id:"7",name:"Tether USD",symbol:"USDT",contractAddress:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",decimals:6,networkId:"42161",Network:{shortName:"arbitrum",name:"Arbitrum"}},{id:"8",name:"USD Coin",symbol:"USDC",contractAddress:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",decimals:6,networkId:"42161",Network:{shortName:"arbitrum",name:"Arbitrum"}},{id:"9",name:"Tether USD",symbol:"USDT",contractAddress:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",decimals:6,networkId:"10",Network:{shortName:"optimism",name:"Optimism"}},{id:"10",name:"USD Coin",symbol:"USDC",contractAddress:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",decimals:6,networkId:"10",Network:{shortName:"optimism",name:"Optimism"}},{id:"11",name:"Tether USD",symbol:"USDT",contractAddress:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",decimals:6,networkId:"43114",Network:{shortName:"avalanche",name:"Avalanche"}},{id:"12",name:"USD Coin",symbol:"USDC",contractAddress:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",decimals:6,networkId:"43114",Network:{shortName:"avalanche",name:"Avalanche"}},{id:"13",name:"Tether USD",symbol:"USDT",contractAddress:"0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e",decimals:6,networkId:"42220",Network:{shortName:"celo",name:"Celo"}},{id:"14",name:"USD Coin",symbol:"USDC",contractAddress:"0xcebA9300f2b948710d2653dD7B07f33A8B32118C",decimals:6,networkId:"42220",Network:{shortName:"celo",name:"Celo"}},{id:"15",name:"Tether USD",symbol:"USDT",contractAddress:"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",decimals:6,networkId:"8453",Network:{shortName:"base",name:"Base"}},{id:"16",name:"USD Coin",symbol:"USDC",contractAddress:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",decimals:6,networkId:"8453",Network:{shortName:"base",name:"Base"}}]}}}async createPayment(e){return await this.request("/api/payments/create",{method:"POST",body:JSON.stringify(e)})}async verifyQRPayment(e){return await this.request("/api/payments/verify-qr",{method:"POST",body:JSON.stringify({paymentId:e})})}async checkPaymentStatus(e){return await this.request(`/api/payments/status/${e}`)}async getContractInfo(e){try{const t=await this.request(`/api/payments/contract/${e}`);if(!t.success)throw new Error("Contract not supported on this network");return t.contractInfo}catch(uh){throw new Error(uh.message||"Failed to get contract information")}}async processPayment(e,t,r,n){try{return await this.request("/api/payments/process",{method:"POST",body:JSON.stringify({paymentId:e,transactionHash:t,network:r,senderAddress:n}),timeout:9e4})}catch(uh){throw uh}}async failPayment(e,t="Payment cancelled by user"){return await this.request("/api/payments/fail",{method:"POST",body:JSON.stringify({paymentId:e,reason:t,status:"failed"})})}async getSupportedDepositChains(){try{return await this.request("/api/deposits/supported-chains")}catch(uh){return console.warn("Failed to get supported deposit chains:",uh.message),{success:!0,chains:[{chainId:8453,name:"Base",confirmations:20},{chainId:56,name:"BSC",confirmations:20},{chainId:42161,name:"Arbitrum",confirmations:20}]}}}async createDepositPayment(e){return await this.request("/api/deposits/create",{method:"POST",body:JSON.stringify(e)})}async getDepositStatus(e){return await this.request(`/api/deposits/status/${e}`)}async getDepositBalance(e){return await this.request(`/api/deposits/balance/${e}`)}isDepositSupported(e){return[8453,56,42161,137,10,43114].includes(parseInt(e))}};const sm=["https://solana-mainnet.g.alchemy.com/v2/YWG990wOlIikc1tU7-WWTepfU8d1f4dp","https://solana-mainnet.g.alchemy.com/v2/qtIcCe_-8t4rIWktnWJm0","https://api.mainnet-beta.solana.com","https://solana-api.projectserum.com","https://rpc.ankr.com/solana"],am="solana-mainnet",cm="Solana",lm={SOL:{symbol:"SOL",name:"Solana",decimals:9,isNative:!0,address:null,logo:"sol",isStablecoin:!1},USDC:{symbol:"USDC",name:"USD Coin",decimals:6,isNative:!1,address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",logo:"usdc",isStablecoin:!0},USDT:{symbol:"USDT",name:"Tether USD",decimals:6,isNative:!1,address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",logo:"usdt",isStablecoin:!0},EURC:{symbol:"EURC",name:"Euro Coin",decimals:6,isNative:!1,address:"HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",logo:"eurc",isStablecoin:!0}},um={PHANTOM:{name:"Phantom",id:"phantom",icon:"phantom",downloadUrl:"https://phantom.app/",deepLink:"https://phantom.app/ul/browse/",installUrl:{chrome:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",firefox:"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/",ios:"https://apps.apple.com/us/app/phantom-solana-wallet/id1598432977",android:"https://play.google.com/store/apps/details?id=app.phantom"}},SOLFLARE:{name:"Solflare",id:"solflare",icon:"solflare",downloadUrl:"https://solflare.com/",deepLink:"https://solflare.com/ul/",installUrl:{chrome:"https://chrome.google.com/webstore/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",firefox:"https://addons.mozilla.org/en-US/firefox/addon/solflare-wallet/",ios:"https://apps.apple.com/us/app/solflare/id1580902717",android:"https://play.google.com/store/apps/details?id=com.solflare.mobile"}},BACKPACK:{name:"Backpack",id:"backpack",icon:"backpack",downloadUrl:"https://backpack.app/",deepLink:"https://backpack.app/",installUrl:{chrome:"https://chrome.google.com/webstore/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",ios:"https://apps.apple.com/us/app/backpack-crypto-wallet/id6448811949"}},TRUST_WALLET:{name:"Trust Wallet",id:"trust",icon:"trust",downloadUrl:"https://trustwallet.com/",deepLink:"https://link.trustwallet.com/",installUrl:{chrome:"https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph",ios:"https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409",android:"https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp"}},MAGIC_EDEN:{name:"Magic Eden",id:"magiceden",icon:"magiceden",downloadUrl:"https://wallet.magiceden.io/",deepLink:"https://wallet.magiceden.io/",installUrl:{chrome:"https://chrome.google.com/webstore/detail/magic-eden-wallet/mkpegjkblkkefacfnmkajcjmabijhclg",ios:"https://apps.apple.com/app/magic-eden-wallet/id6449729293",android:"https://play.google.com/store/apps/details?id=io.magiceden.wallet"}}},hm=lm,dm="evm",pm="solana",fm={ethereum:1,bsc:56,polygon:137,arbitrum:42161,optimism:10,avalanche:43114,celo:42220,base:8453},mm=e=>"number"==typeof e?e:"string"==typeof e?e.startsWith("0x")?parseInt(e,16):parseInt(e,10):1,gm=e=>fm[e]||1,ym=e=>(e=>{var t;if(!e)return!1;const r=e.toString().toLowerCase();return["solana","solana-mainnet","103"].includes(r)||r===am||(null==(t=cm)?void 0:t.toLowerCase())===r})(e)?pm:dm;function vm(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};return Object.assign(t,{extend:function e(t){return r=>{const n="function"==typeof r?r(t):r,i={...t,...n};return Object.assign(i,{extend:e(i)})}}(t)})}const bm="2.43.3";let wm={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${bm}`};class xm extends Error{constructor(e,t={}){var r;const n=t.cause instanceof xm?t.cause.details:(null==(i=t.cause)?void 0:i.message)?t.cause.message:t.details;var i;const o=t.cause instanceof xm&&t.cause.docsPath||t.docsPath,s=null==(r=wm.getDocsUrl)?void 0:r.call(wm,{...t,docsPath:o});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...wm.version?[`Version: ${wm.version}`]:[]].join("\n"),t.cause?{cause:t.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=n,this.docsPath=o,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=bm}walk(e){return km(this,e)}}function km(e,t){return(null==t?void 0:t(e))?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?km(e.cause,t):t?null:e}class _m extends xm{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class Sm extends xm{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Cm(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function Im(e){return Cm(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Em(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let i=0;i<r.length-1&&"0"===r["left"===t?i:r.length-i-1].toString();i++)n++;return r="left"===t?r.slice(n):r.slice(0,r.length-n),"string"==typeof e?(1===r.length&&"right"===t&&(r=`${r}0`),`0x${r.length%2==1?`0${r}`:r}`):r}class Am extends xm{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class Mm extends xm{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function Nm(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;const n=e.replace("0x","");if(n.length>2*r)throw new Mm({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new Mm({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i<r;i++){const o="right"===t;n[o?i:r-i-1]=e[o?i:e.length-i-1]}return n}(e,{dir:t,size:r})}const Pm=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Tm(e,t={}){return"number"==typeof e||"bigint"==typeof e?Bm(e,t):"string"==typeof e?function(e,t={}){const r=Rm.encode(e);return Om(r,t)}(e,t):"boolean"==typeof e?function(e,t={}){const r=`0x${Number(e)}`;if("number"==typeof t.size)return qm(r,{size:t.size}),Nm(r,{size:t.size});return r}(e,t):Om(e,t)}function Om(e,t={}){let r="";for(let i=0;i<e.length;i++)r+=Pm[e[i]];const n=`0x${r}`;return"number"==typeof t.size?(qm(n,{size:t.size}),Nm(n,{dir:"right",size:t.size})):n}function Bm(e,t={}){const{signed:r,size:n}=t,i=BigInt(e);let o;n?o=r?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(o=BigInt(Number.MAX_SAFE_INTEGER));const s="bigint"==typeof o&&r?-o-1n:0;if(o&&i>o||i<s){const t="bigint"==typeof e?"n":"";throw new _m({max:o?`${o}${t}`:void 0,min:`${s}${t}`,signed:r,size:n,value:`${e}${t}`})}const a=`0x${(r&&i<0?(1n<<BigInt(8*n))+BigInt(i):i).toString(16)}`;return n?Nm(a,{size:n}):a}const Rm=new TextEncoder;const Lm=new TextEncoder;function jm(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){const r=Bm(e,t);return Fm(r)}(e,t):"boolean"==typeof e?function(e,t={}){const r=new Uint8Array(1);if(r[0]=Number(e),"number"==typeof t.size)return qm(r,{size:t.size}),Nm(r,{size:t.size});return r}(e,t):Cm(e)?Fm(e,t):zm(e,t)}const Um={zero:48,nine:57,A:65,F:70,a:97,f:102};function Dm(e){return e>=Um.zero&&e<=Um.nine?e-Um.zero:e>=Um.A&&e<=Um.F?e-(Um.A-10):e>=Um.a&&e<=Um.f?e-(Um.a-10):void 0}function Fm(e,t={}){let r=e;t.size&&(qm(r,{size:t.size}),r=Nm(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,o=new Uint8Array(i);for(let s=0,a=0;s<i;s++){const e=Dm(n.charCodeAt(a++)),t=Dm(n.charCodeAt(a++));if(void 0===e||void 0===t)throw new xm(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);o[s]=16*e+t}return o}function zm(e,t={}){const r=Lm.encode(e);return"number"==typeof t.size?(qm(r,{size:t.size}),Nm(r,{dir:"right",size:t.size})):r}function qm(e,{size:t}){if(Im(e)>t)throw new Sm({givenSize:Im(e),maxSize:t})}function $m(e,t={}){const{signed:r}=t;t.size&&qm(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function Wm(e,t={}){return Number($m(e,t))}function Gm(e,t){return({exclude:r,format:n})=>({exclude:r,format:(e,i)=>{const o=t(e,i);if(r)for(const t of r)delete o[t];return{...o,...n(e,i)}},type:e})}const Hm={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Vm(e,t){const r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Wm(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Wm(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Hm[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(r.authorizationList=e.authorizationList.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))),r.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof r.v){if(0n===r.v||27n===r.v)return 0;if(1n===r.v||28n===r.v)return 1;if(r.v>=35n)return r.v%2n==0n?1:0}})(),"legacy"===r.type&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),"eip2930"===r.type&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),"eip1559"===r.type&&delete r.maxFeePerBlobGas,r}const Km=Gm("transaction",Vm);function Zm(e,t){const r=(e.transactions??[]).map(e=>"string"==typeof e?e:Vm(e));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:r,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const Ym=Gm("block",Zm);const Jm={"0x0":"reverted","0x1":"success"};function Xm(e,t){const r={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(e=>function(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):null===e.blockTimestamp?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}(e)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Wm(e.transactionIndex):null,status:e.status?Jm[e.status]:null,type:e.type?Hm[e.type]||e.type:null};return e.blobGasPrice&&(r.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(r.blobGasUsed=BigInt(e.blobGasUsed)),r}const Qm=Gm("transactionReceipt",Xm),eg={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function tg(e,t){const r={};return void 0!==e.authorizationList&&(r.authorizationList=e.authorizationList.map(e=>({address:e.address,r:e.r?Bm(BigInt(e.r)):e.r,s:e.s?Bm(BigInt(e.s)):e.s,chainId:Bm(e.chainId),nonce:Bm(e.nonce),...void 0!==e.yParity?{yParity:Bm(e.yParity)}:{},...void 0!==e.v&&void 0===e.yParity?{v:Bm(e.v)}:{}}))),void 0!==e.accessList&&(r.accessList=e.accessList),void 0!==e.blobVersionedHashes&&(r.blobVersionedHashes=e.blobVersionedHashes),void 0!==e.blobs&&("string"!=typeof e.blobs[0]?r.blobs=e.blobs.map(e=>Om(e)):r.blobs=e.blobs),void 0!==e.data&&(r.data=e.data),e.account&&(r.from=e.account.address),void 0!==e.from&&(r.from=e.from),void 0!==e.gas&&(r.gas=Bm(e.gas)),void 0!==e.gasPrice&&(r.gasPrice=Bm(e.gasPrice)),void 0!==e.maxFeePerBlobGas&&(r.maxFeePerBlobGas=Bm(e.maxFeePerBlobGas)),void 0!==e.maxFeePerGas&&(r.maxFeePerGas=Bm(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=Bm(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(r.nonce=Bm(e.nonce)),void 0!==e.to&&(r.to=e.to),void 0!==e.type&&(r.type=eg[e.type]),void 0!==e.value&&(r.value=Bm(e.value)),r}const rg=Gm("transactionRequest",tg);const ng=2n**256n-1n;function ig(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}class og extends xm{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class sg extends xm{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class ag extends xm{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const cg={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new ag({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new sg({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new og({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new og({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function lg(e,{recursiveReadLimit:t=8192}={}){const r=Object.create(cg);return r.bytes=e,r.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}function ug(e,t="hex"){const r=hg(e),n=lg(new Uint8Array(r.length));return r.encode(n),"hex"===t?Om(n.bytes):n.bytes}function hg(e){return Array.isArray(e)?function(e){const t=e.reduce((e,t)=>e+t.length,0),r=dg(t);return{length:t<=55?1+t:1+r+t,encode(n){t<=55?n.pushByte(192+t):(n.pushByte(247+r),1===r?n.pushUint8(t):2===r?n.pushUint16(t):3===r?n.pushUint24(t):n.pushUint32(t));for(const{encode:t}of e)t(n)}}}(e.map(e=>hg(e))):function(e){const t="string"==typeof e?Fm(e):e,r=dg(t.length),n=1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length;return{length:n,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+r),1===r?e.pushUint8(t.length):2===r?e.pushUint16(t.length):3===r?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function dg(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new xm("Length is too large.")}const pg={ether:-9,wei:9};function fg(e,t="wei"){return function(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,o]=[r.slice(0,r.length-t),r.slice(r.length-t)];return o=o.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${o?`.${o}`:""}`}(e,pg[t])}function mg(e){const t=Object.entries(e).map(([e,t])=>void 0===t||!1===t?null:[e,t]).filter(Boolean),r=t.reduce((e,[t])=>Math.max(e,t.length),0);return t.map(([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`).join("\n")}class gg extends xm{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class yg extends xm{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",mg(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class vg extends xm{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}function bg(e){const{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),n="string"==typeof e.blobs[0]?e.blobs.map(e=>Fm(e)):e.blobs,i=[];for(const o of n)i.push(Uint8Array.from(t.blobToKzgCommitment(o)));return"bytes"===r?i:i.map(e=>Om(e))}function wg(e){const{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),n="string"==typeof e.blobs[0]?e.blobs.map(e=>Fm(e)):e.blobs,i="string"==typeof e.commitments[0]?e.commitments.map(e=>Fm(e)):e.commitments,o=[];for(let s=0;s<n.length;s++){const e=n[s],r=i[s];o.push(Uint8Array.from(t.computeBlobKzgProof(e,r)))}return"bytes"===r?o:o.map(e=>Om(e))}const xg="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
11
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function kg(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function _g(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Sg(e,...t){if(!kg(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Cg(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");_g(e.outputLen),_g(e.blockLen)}function Ig(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Eg(e,t){Sg(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function Ag(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Mg(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ng(e,t){return e<<32-t|e>>>t}function Pg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const Tg=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])()?e=>e:function(e){for(let t=0;t<e.length;t++)e[t]=Pg(e[t]);return e},Og=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),Bg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Rg(e){if(Sg(e),Og)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=Bg[e[r]];return t}const Lg=48,jg=57,Ug=65,Dg=70,Fg=97,zg=102;function qg(e){return e>=Lg&&e<=jg?e-Lg:e>=Ug&&e<=Dg?e-(Ug-10):e>=Fg&&e<=zg?e-(Fg-10):void 0}function $g(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(Og)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){const t=qg(e.charCodeAt(o)),r=qg(e.charCodeAt(o+1));if(void 0===t||void 0===r){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}n[i]=16*t+r}return n}function Wg(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e)),Sg(e),e}function Gg(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];Sg(r),t+=r.length}const r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){const t=e[n];r.set(t,i),i+=t.length}return r}class Hg{}function Vg(e){const t=t=>e().update(Wg(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Kg(e=32){if(xg&&"function"==typeof xg.getRandomValues)return xg.getRandomValues(new Uint8Array(e));if(xg&&"function"==typeof xg.randomBytes)return Uint8Array.from(xg.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}function Zg(e,t,r){return e&t^~e&r}function Yg(e,t,r){return e&t^e&r^t&r}class Jg extends Hg{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=Mg(this.buffer)}update(e){Ig(this),Sg(e=Wg(e));const{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const t=Mg(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ig(this),Eg(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,Ag(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let u=o;u<n;u++)t[u]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,l=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+l,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Mg(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Xg=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Qg=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ey=BigInt(2**32-1),ty=BigInt(32);function ry(e,t=!1){return t?{h:Number(e&ey),l:Number(e>>ty&ey)}:{h:0|Number(e>>ty&ey),l:0|Number(e&ey)}}function ny(e,t=!1){const r=e.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){const{h:r,l:s}=ry(e[o],t);[n[o],i[o]]=[r,s]}return[n,i]}const iy=(e,t,r)=>e>>>r,oy=(e,t,r)=>e<<32-r|t>>>r,sy=(e,t,r)=>e>>>r|t<<32-r,ay=(e,t,r)=>e<<32-r|t>>>r,cy=(e,t,r)=>e<<64-r|t>>>r-32,ly=(e,t,r)=>e>>>r-32|t<<64-r;function uy(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}const hy=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),dy=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,py=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),fy=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,my=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),gy=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,yy=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),vy=new Uint32Array(64);class by extends Jg{constructor(e=32){super(64,e,8,!1),this.A=0|Xg[0],this.B=0|Xg[1],this.C=0|Xg[2],this.D=0|Xg[3],this.E=0|Xg[4],this.F=0|Xg[5],this.G=0|Xg[6],this.H=0|Xg[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)vy[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=vy[u-15],t=vy[u-2],r=Ng(e,7)^Ng(e,18)^e>>>3,n=Ng(t,17)^Ng(t,19)^t>>>10;vy[u]=n+vy[u-7]+r+vy[u-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const e=l+(Ng(s,6)^Ng(s,11)^Ng(s,25))+Zg(s,a,c)+yy[u]+vy[u]|0,t=(Ng(r,2)^Ng(r,13)^Ng(r,22))+Yg(r,n,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+t|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,o,s,a,c,l)}roundClean(){Ag(vy)}destroy(){this.set(0,0,0,0,0,0,0,0),Ag(this.buffer)}}const wy=(()=>ny(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),xy=(()=>wy[0])(),ky=(()=>wy[1])(),_y=new Uint32Array(80),Sy=new Uint32Array(80);class Cy extends Jg{constructor(e=64){super(128,e,16,!1),this.Ah=0|Qg[0],this.Al=0|Qg[1],this.Bh=0|Qg[2],this.Bl=0|Qg[3],this.Ch=0|Qg[4],this.Cl=0|Qg[5],this.Dh=0|Qg[6],this.Dl=0|Qg[7],this.Eh=0|Qg[8],this.El=0|Qg[9],this.Fh=0|Qg[10],this.Fl=0|Qg[11],this.Gh=0|Qg[12],this.Gl=0|Qg[13],this.Hh=0|Qg[14],this.Hl=0|Qg[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:l,Fh:u,Fl:h,Gh:d,Gl:p,Hh:f,Hl:m}=this;return[e,t,r,n,i,o,s,a,c,l,u,h,d,p,f,m]}set(e,t,r,n,i,o,s,a,c,l,u,h,d,p,f,m){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|h,this.Gh=0|d,this.Gl=0|p,this.Hh=0|f,this.Hl=0|m}process(e,t){for(let v=0;v<16;v++,t+=4)_y[v]=e.getUint32(t),Sy[v]=e.getUint32(t+=4);for(let v=16;v<80;v++){const e=0|_y[v-15],t=0|Sy[v-15],r=sy(e,t,1)^sy(e,t,8)^iy(e,0,7),n=ay(e,t,1)^ay(e,t,8)^oy(e,t,7),i=0|_y[v-2],o=0|Sy[v-2],s=sy(i,o,19)^cy(i,o,61)^iy(i,0,6),a=ay(i,o,19)^ly(i,o,61)^oy(i,o,6),c=py(n,a,Sy[v-7],Sy[v-16]),l=fy(c,r,s,_y[v-7],_y[v-16]);_y[v]=0|l,Sy[v]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:p,Gh:f,Gl:m,Hh:g,Hl:y}=this;for(let v=0;v<80;v++){const e=sy(u,h,14)^sy(u,h,18)^cy(u,h,41),t=ay(u,h,14)^ay(u,h,18)^ly(u,h,41),b=u&d^~u&f,w=my(y,t,h&p^~h&m,ky[v],Sy[v]),x=gy(w,g,e,b,xy[v],_y[v]),k=0|w,_=sy(r,n,28)^cy(r,n,34)^cy(r,n,39),S=ay(r,n,28)^ly(r,n,34)^ly(r,n,39),C=r&i^r&s^i&s,I=n&o^n&a^o&a;g=0|f,y=0|m,f=0|d,m=0|p,d=0|u,p=0|h,({h:u,l:h}=uy(0|c,0|l,0|x,0|k)),c=0|s,l=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const E=hy(k,S,I);r=dy(E,x,_,C),n=0|E}({h:r,l:n}=uy(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=uy(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=uy(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:l}=uy(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:h}=uy(0|this.Eh,0|this.El,0|u,0|h)),({h:d,l:p}=uy(0|this.Fh,0|this.Fl,0|d,0|p)),({h:f,l:m}=uy(0|this.Gh,0|this.Gl,0|f,0|m)),({h:g,l:y}=uy(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(r,n,i,o,s,a,c,l,u,h,d,p,f,m,g,y)}roundClean(){Ag(_y,Sy)}destroy(){Ag(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Iy=Vg(()=>new by),Ey=Vg(()=>new Cy),Ay=Iy;function My(e){const{commitment:t,version:r=1}=e,n=e.to??("string"==typeof t?"hex":"bytes"),i=function(e){return Ay(Cm(e,{strict:!1})?jm(e):e)}(t);return i.set([r],0),"bytes"===n?i:Om(i)}const Ny=4096,Py=131072,Ty=761855;class Oy extends xm{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`],name:"BlobSizeTooLargeError"})}}class By extends xm{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class Ry extends xm{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`],name:"InvalidVersionedHashSizeError"})}}class Ly extends xm{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:["Expected: 1",`Received: ${t}`],name:"InvalidVersionedHashVersionError"})}}function jy(e){const{data:t,kzg:r,to:n}=e,i=e.blobs??function(e){const t=e.to??("string"==typeof e.data?"hex":"bytes"),r="string"==typeof e.data?Fm(e.data):e.data,n=Im(r);if(!n)throw new By;if(n>Ty)throw new Oy({maxSize:Ty,size:n});const i=[];let o=!0,s=0;for(;o;){const e=lg(new Uint8Array(Py));let t=0;for(;t<Ny;){const n=r.slice(s,s+31);if(e.pushByte(0),e.pushBytes(n),n.length<31){e.pushByte(128),o=!1;break}t++,s+=31}i.push(e)}return"bytes"===t?i.map(e=>e.bytes):i.map(e=>Om(e.bytes))}({data:t,to:n}),o=e.commitments??bg({blobs:i,kzg:r,to:n}),s=e.proofs??wg({blobs:i,commitments:o,kzg:r,to:n}),a=[];for(let c=0;c<i.length;c++)a.push({blob:i[c],commitment:o[c],proof:s[c]});return a}class Uy extends xm{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"})}}class Dy extends xm{constructor({chainId:e}){super("number"==typeof e?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}class Fy extends xm{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${fg(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Fy,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class zy extends xm{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${fg(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${fg(r)} gwei`:""}).`].join("\n"),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(zy,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class qy extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}const $y=BigInt(0),Wy=BigInt(1),Gy=BigInt(2),Hy=BigInt(7),Vy=BigInt(256),Ky=BigInt(113),Zy=[],Yy=[],Jy=[];for(let sA=0,aA=Wy,cA=1,lA=0;sA<24;sA++){[cA,lA]=[lA,(2*cA+3*lA)%5],Zy.push(2*(5*lA+cA)),Yy.push((sA+1)*(sA+2)/2%64);let e=$y;for(let t=0;t<7;t++)aA=(aA<<Wy^(aA>>Hy)*Ky)%Vy,aA&Gy&&(e^=Wy<<(Wy<<BigInt(t))-Wy);Jy.push(e)}const Xy=ny(Jy,!0),Qy=Xy[0],ev=Xy[1],tv=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),rv=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class nv extends Hg{constructor(e,t,r,n=!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=r,this.enableXOF=n,this.rounds=i,_g(r),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}clone(){return this._cloneInto()}keccak(){Tg(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let n=0;n<10;n++)r[n]=e[n]^e[n+10]^e[n+20]^e[n+30]^e[n+40];for(let n=0;n<10;n+=2){const t=(n+8)%10,i=(n+2)%10,o=r[i],s=r[i+1],a=tv(o,s,1)^r[t],c=rv(o,s,1)^r[t+1];for(let r=0;r<50;r+=10)e[n+r]^=a,e[n+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Yy[r],o=tv(t,i,n),s=rv(t,i,n),a=Zy[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let n=0;n<50;n+=10){for(let t=0;t<10;t++)r[t]=e[n+t];for(let t=0;t<10;t++)e[n+t]^=~r[(t+2)%10]&r[(t+4)%10]}e[0]^=Qy[n],e[1]^=ev[n]}Ag(r)}(this.state32,this.rounds),Tg(this.state32),this.posOut=0,this.pos=0}update(e){Ig(this),Sg(e=Wg(e));const{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){const o=Math.min(t-this.pos,n-i);for(let t=0;t<o;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){Ig(this,!1),Sg(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return _g(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Eg(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Ag(this.state)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new nv(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}const iv=(()=>{return e=1,t=136,r=32,Vg(()=>new nv(t,e,r));var e,t,r})();const ov=new qy(8192);function sv(e,t){if(ov.has(`${e}.${t}`))return ov.get(`${e}.${t}`);const r=e.substring(2).toLowerCase(),n=function(e){return iv(Cm(e,{strict:!1})?jm(e):e)}(zm(r)),i=r.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&i[s]&&(i[s]=i[s].toUpperCase()),(15&n[s>>1])>=8&&i[s+1]&&(i[s+1]=i[s+1].toUpperCase());const o=`0x${i.join("")}`;return ov.set(`${e}.${t}`,o),o}const av=/^0x[a-fA-F0-9]{40}$/,cv=new qy(8192);function lv(e,t){const{strict:r=!0}=t??{},n=`${e}.${r}`;if(cv.has(n))return cv.get(n);const i=!(!av.test(e)||e.toLowerCase()!==e&&r&&sv(e)!==e);return cv.set(n,i),i}function uv(e,t,r,{strict:n}={}){return Cm(e,{strict:!1})?function(e,t,r,{strict:n}={}){const i=`0x${e.replace("0x","").slice(2*t,2*r)}`;n&&hv(i,t,r);return i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){const i=e.slice(t,r);n&&hv(i,t,r);return i}(e,t,r,{strict:n})}function hv(e,t,r){if(Im(e)!==r-t)throw new Am({offset:r,position:"end",size:Im(e)})}function dv(e){const{chainId:t,maxPriorityFeePerGas:r,maxFeePerGas:n,to:i}=e;if(t<=0)throw new Dy({chainId:t});if(i&&!lv(i))throw new Uy({address:i});if(n&&n>ng)throw new Fy({maxFeePerGas:n});if(r&&n&&r>n)throw new zy({maxFeePerGas:n,maxPriorityFeePerGas:r})}function pv(e){if(!e||0===e.length)return[];const t=[];for(let r=0;r<e.length;r++){const{address:n,storageKeys:i}=e[r];for(let e=0;e<i.length;e++)if(i[e].length-2!=64)throw new vg({storageKey:i[e]});if(!lv(n,{strict:!1}))throw new Uy({address:n});t.push([n,i])}return t}function fv(e,t){const r=function(e){if(e.type)return e.type;if(void 0!==e.authorizationList)return"eip7702";if(void 0!==e.blobs||void 0!==e.blobVersionedHashes||void 0!==e.maxFeePerBlobGas||void 0!==e.sidecars)return"eip4844";if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new yg({transaction:e})}(e);return"eip1559"===r?function(e,t){const{chainId:r,gas:n,nonce:i,to:o,value:s,maxFeePerGas:a,maxPriorityFeePerGas:c,accessList:l,data:u}=e;dv(e);const h=pv(l),d=[Bm(r),i?Bm(i):"0x",c?Bm(c):"0x",a?Bm(a):"0x",n?Bm(n):"0x",o??"0x",s?Bm(s):"0x",u??"0x",h,...mv(e,t)];return ig(["0x02",ug(d)])}(e,t):"eip2930"===r?function(e,t){const{chainId:r,gas:n,data:i,nonce:o,to:s,value:a,accessList:c,gasPrice:l}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o}=e;if(t<=0)throw new Dy({chainId:t});if(o&&!lv(o))throw new Uy({address:o});if(r||i)throw new xm("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>ng)throw new Fy({maxFeePerGas:n})}(e);const u=pv(c),h=[Bm(r),o?Bm(o):"0x",l?Bm(l):"0x",n?Bm(n):"0x",s??"0x",a?Bm(a):"0x",i??"0x",u,...mv(e,t)];return ig(["0x01",ug(h)])}(e,t):"eip4844"===r?function(e,t){const{chainId:r,gas:n,nonce:i,to:o,value:s,maxFeePerBlobGas:a,maxFeePerGas:c,maxPriorityFeePerGas:l,accessList:u,data:h}=e;!function(e){const{blobVersionedHashes:t}=e;if(t){if(0===t.length)throw new By;for(const e of t){const t=Im(e),r=Wm(uv(e,0,1));if(32!==t)throw new Ry({hash:e,size:t});if(1!==r)throw new Ly({hash:e,version:r})}}dv(e)}(e);let d=e.blobVersionedHashes,p=e.sidecars;if(e.blobs&&(void 0===d||void 0===p)){const t="string"==typeof e.blobs[0]?e.blobs:e.blobs.map(e=>Om(e)),r=e.kzg,n=bg({blobs:t,kzg:r});if(void 0===d&&(d=function(e){const{commitments:t,version:r}=e,n=e.to??("string"==typeof t[0]?"hex":"bytes"),i=[];for(const o of t)i.push(My({commitment:o,to:n,version:r}));return i}({commitments:n})),void 0===p){p=jy({blobs:t,commitments:n,proofs:wg({blobs:t,commitments:n,kzg:r})})}}const f=pv(u),m=[Bm(r),i?Bm(i):"0x",l?Bm(l):"0x",c?Bm(c):"0x",n?Bm(n):"0x",o??"0x",s?Bm(s):"0x",h??"0x",f,a?Bm(a):"0x",d??[],...mv(e,t)],g=[],y=[],v=[];if(p)for(let b=0;b<p.length;b++){const{blob:e,commitment:t,proof:r}=p[b];g.push(e),y.push(t),v.push(r)}return ig(["0x03",ug(p?[m,g,y,v]:m)])}(e,t):"eip7702"===r?function(e,t){const{authorizationList:r,chainId:n,gas:i,nonce:o,to:s,value:a,maxFeePerGas:c,maxPriorityFeePerGas:l,accessList:u,data:h}=e;!function(e){const{authorizationList:t}=e;if(t)for(const r of t){const{chainId:e}=r,t=r.address;if(!lv(t))throw new Uy({address:t});if(e<0)throw new Dy({chainId:e})}dv(e)}(e);const d=pv(u),p=function(e){if(!e||0===e.length)return[];const t=[];for(const r of e){const{chainId:e,nonce:n,...i}=r,o=r.address;t.push([e?Tm(e):"0x",o,n?Tm(n):"0x",...mv({},i)])}return t}(r);return ig(["0x04",ug([Bm(n),o?Bm(o):"0x",l?Bm(l):"0x",c?Bm(c):"0x",i?Bm(i):"0x",s??"0x",a?Bm(a):"0x",h??"0x",d,p,...mv(e,t)])])}(e,t):function(e,t){const{chainId:r=0,gas:n,data:i,nonce:o,to:s,value:a,gasPrice:c}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o}=e;if(o&&!lv(o))throw new Uy({address:o});if(void 0!==t&&t<=0)throw new Dy({chainId:t});if(r||i)throw new xm("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>ng)throw new Fy({maxFeePerGas:n})}(e);let l=[o?Bm(o):"0x",c?Bm(c):"0x",n?Bm(n):"0x",s??"0x",a?Bm(a):"0x",i??"0x"];if(t){const e=(()=>{if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}if(r>0)return BigInt(2*r)+BigInt(35n+t.v-27n);const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new gg({v:t.v});return e})(),n=Em(t.r),i=Em(t.s);l=[...l,Bm(e),"0x00"===n?"0x":n,"0x00"===i?"0x":i]}else r>0&&(l=[...l,Bm(r),"0x","0x"]);return ug(l)}(e,t)}function mv(e,t){const r=t??e,{v:n,yParity:i}=r;if(void 0===r.r)return[];if(void 0===r.s)return[];if(void 0===n&&void 0===i)return[];const o=Em(r.r),s=Em(r.s);return["number"==typeof i?i?Bm(1):"0x":0n===n?"0x":1n===n?Bm(1):27n===n?"0x":Bm(1),"0x00"===o?"0x":o,"0x00"===s?"0x":s]}const gv={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}};function yv(e,t){return function(e){return"deposit"===e.type||void 0!==e.sourceHash}(e)?function(e){!function(e){const{from:t,to:r}=e;if(t&&!lv(t))throw new Uy({address:t});if(r&&!lv(r))throw new Uy({address:r})}(e);const{sourceHash:t,data:r,from:n,gas:i,isSystemTx:o,mint:s,to:a,value:c}=e,l=[t,n,a??"0x",s?Tm(s):"0x",c?Tm(c):"0x",i?Tm(i):"0x",o?"0x1":"0x",r??"0x"];return ig(["0x7e",ug(l)])}(e):fv(e,t)}const vv={blockTime:2e3,contracts:gv,formatters:{block:Ym({format(e){var t;return{transactions:null==(t=e.transactions)?void 0:t.map(e=>{if("string"==typeof e)return e;const t=Vm(e);return"0x7e"===t.typeHex&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?$m(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}),stateRoot:e.stateRoot}}}),transaction:Km({format(e){const t={};return"0x7e"===e.type&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?$m(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:Qm({format:e=>({l1GasPrice:e.l1GasPrice?$m(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?$m(e.l1GasUsed):null,l1Fee:e.l1Fee?$m(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null})})},serializers:{transaction:yv}},bv=vm({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),wv=vm({id:43114,name:"Avalanche",blockTime:1700,nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://snowtrace.io",apiUrl:"https://api.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),xv=1,kv=vm({...vv,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...vv.contracts,disputeGameFactory:{[xv]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[xv]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[xv]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[xv]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:1}),_v=vm({id:56,name:"BNB Smart Chain",blockTime:750,nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}}),Sv={estimateFeesPerGas:async e=>{var t;if(!(null==(t=e.request)?void 0:t.feeCurrency))return null;const[r,n]=await Promise.all([Cv(e.client,e.request.feeCurrency),Iv(e.client,e.request.feeCurrency)]);return{maxFeePerGas:e.multiply(r-n)+n,maxPriorityFeePerGas:n}}};async function Cv(e,t){const r=await e.request({method:"eth_gasPrice",params:[t]});return BigInt(r)}async function Iv(e,t){const r=await e.request({method:"eth_maxPriorityFeePerGas",params:[t]});return BigInt(r)}function Ev(e){return 0===e||0n===e||null==e||"0"===e||""===e||"string"==typeof e&&("0x"===Em(e).toLowerCase()||"0x00"===Em(e).toLowerCase())}function Av(e){return!Ev(e)}function Mv(e){return"cip64"===e.type||function(e){return void 0!==e.maxFeePerGas&&void 0!==e.maxPriorityFeePerGas}(e)&&Av(e.feeCurrency)}const Nv={transaction:function(e,t){return Mv(e)?function(e,t){!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o,feeCurrency:s}=e;if(t<=0)throw new Dy({chainId:t});if(o&&!lv(o))throw new Uy({address:o});if(n)throw new xm("`gasPrice` is not a valid CIP-64 Transaction attribute.");if(Av(i)&&i>Pv)throw new Fy({maxFeePerGas:i});if(Av(r)&&Av(i)&&r>i)throw new zy({maxFeePerGas:i,maxPriorityFeePerGas:r});if(Av(s)&&!lv(s))throw new xm("`feeCurrency` MUST be a token address for CIP-64 transactions.");if(Ev(s))throw new xm("`feeCurrency` must be provided for CIP-64 transactions.")}(e);const{chainId:r,gas:n,nonce:i,to:o,value:s,maxFeePerGas:a,maxPriorityFeePerGas:c,accessList:l,feeCurrency:u,data:h}=e,d=[Tm(r),i?Tm(i):"0x",c?Tm(c):"0x",a?Tm(a):"0x",n?Tm(n):"0x",o??"0x",s?Tm(s):"0x",h??"0x",pv(l),u,...mv(e,t)];return ig(["0x7b",ug(d)])}(e,t):yv(e,t)}};const Pv=ng;const Tv=vm({...{blockTime:1e3,contracts:gv,formatters:{block:Ym({format(e){var t;return{transactions:null==(t=e.transactions)?void 0:t.map(e=>{if("string"==typeof e)return e;return{...Vm(e),...e.gatewayFee?{gatewayFee:$m(e.gatewayFee),gatewayFeeRecipient:e.gatewayFeeRecipient}:{},feeCurrency:e.feeCurrency}})}}}),transaction:Km({format(e){if("0x7e"===e.type)return{isSystemTx:e.isSystemTx,mint:e.mint?$m(e.mint):void 0,sourceHash:e.sourceHash,type:"deposit"};const t={feeCurrency:e.feeCurrency};return"0x7b"===e.type?t.type="cip64":("0x7c"===e.type&&(t.type="cip42"),t.gatewayFee=e.gatewayFee?$m(e.gatewayFee):null,t.gatewayFeeRecipient=e.gatewayFeeRecipient),t}}),transactionRequest:rg({format(e){const t={};return e.feeCurrency&&(t.feeCurrency=e.feeCurrency),Mv(e)&&(t.type="0x7b"),t}})},serializers:Nv,fees:Sv},id:42220,name:"Celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://celoscan.io",apiUrl:"https://api.celoscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:13112599}},testnet:!1}),Ov=vm({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),Bv=1,Rv=vm({...vv,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...vv.contracts,disputeGameFactory:{[Bv]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[Bv]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[Bv]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[Bv]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:1}),Lv=vm({id:137,name:"Polygon",blockTime:2e3,nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});class jv extends Hg{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Cg(e);const r=Wg(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),Ag(i)}update(e){return Ig(this),this.iHash.update(e),this}digestInto(e){Ig(this),Sg(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Uv=(e,t,r)=>new jv(e,t).update(r).digest();Uv.create=(e,t)=>new jv(e,t);const Dv=(e,t,r=!1)=>{if(!e||"string"!=typeof e)throw new Error(`Missing ${t} address`);if(!e.startsWith("0x"))throw new Error(`Invalid ${t} address format: must start with 0x`);if(42!==e.length)throw new Error(`Invalid ${t} address length: expected 42 characters, got ${e.length}`);if("0x0000000000000000000000000000000000000000"===e&&!r)throw new Error(`Invalid ${t} address: cannot be zero address`)},Fv=e=>{const t=(e=>{Dv(e.token,"token"),Dv(e.recipient1,"recipient1"),Dv(e.recipient2,"recipient2");const t=0n===BigInt(e.recipient3Percentage||0);if(Dv(e.recipient3,"recipient3",t),!e.paymentId||"string"!=typeof e.paymentId||0===e.paymentId.length)throw new Error("Invalid payment ID: must be a non-empty string");let r,n,i,o;try{r=BigInt(e.amount||0),n=BigInt(e.recipient1Percentage||0),i=BigInt(e.recipient2Percentage||0),o=BigInt(e.recipient3Percentage||0)}catch(a){throw new Error("Invalid numeric values: cannot convert to BigInt")}if(r<=0n)throw new Error(`Invalid amount: ${e.amount} (must be greater than 0)`);const s=n+i+o;if(10000n!==s)throw new Error(`Invalid percentages: total is ${s} but must equal 10000 basis points (100%). Individual: ${n}, ${i}, ${o}`);return{amount:r,percentage1:n,percentage2:i,percentage3:o}})(e);return{token:e.token,amount:t.amount,paymentId:e.paymentId,recipient1:e.recipient1,recipient2:e.recipient2,recipient3:e.recipient3,recipient1Percentage:t.percentage1,recipient2Percentage:t.percentage2,recipient3Percentage:t.percentage3}},zv=[{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"}],qv=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],$v=e=>{var t,r;const n=(null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())||(null==(r=null==e?void 0:e.toString())?void 0:r.toLowerCase())||"",i=(null==e?void 0:e.code)||(null==e?void 0:e.reason)||"";return n.includes("user rejected")||n.includes("user denied")||n.includes("user cancelled")||n.includes("rejected by user")||4001===i||"ACTION_REJECTED"===i?{type:"user_rejected",title:"Transaction Cancelled",message:"You cancelled the transaction. No charges were made.",suggestion:'Click "Pay Now" to try again when you\'re ready.'}:n.includes("insufficient funds")||n.includes("insufficient balance")||n.includes("insufficient eth")||n.includes("insufficient matic")||n.includes("insufficient bnb")||-32e3===i?{type:"insufficient_funds",title:"Insufficient Funds",message:"You don't have enough tokens or gas fees in your wallet.",suggestion:"Add more funds to your wallet and try again."}:n.includes("network error")||n.includes("rpc error")||n.includes("connection failed")||n.includes("timeout")||n.includes("request failed")?{type:"network_error",title:"Network Error",message:"Unable to connect to the blockchain network.",suggestion:"Check your internet connection and try again."}:n.includes("wrong network")||n.includes("unsupported network")||n.includes("chain mismatch")||4902===i?{type:"wrong_network",title:"Wrong Network",message:"Please switch to the correct network in your wallet.",suggestion:"Your wallet should prompt you to switch networks."}:n.includes("wallet not connected")||n.includes("no provider")||n.includes("wallet disconnected")||4900===i?{type:"wallet_disconnected",title:"Wallet Disconnected",message:"Your wallet is not connected.",suggestion:"Please reconnect your wallet and try again."}:n.includes("gas estimation failed")||n.includes("execution reverted")||n.includes("out of gas")?{type:"gas_error",title:"Transaction Failed",message:"The transaction couldn't be processed.",suggestion:"This might be a temporary issue. Please try again."}:n.includes("approve")&&n.includes("failed")?{type:"approval_failed",title:"Token Approval Failed",message:"Failed to approve token spending.",suggestion:"Please try the approval step again."}:n.includes("transaction failed")||n.includes("revert")||n.includes("contract call failed")?{type:"transaction_failed",title:"Transaction Failed",message:"The blockchain transaction was unsuccessful.",suggestion:"Please check your wallet and try again."}:n.includes("popup")||n.includes("blocked")?{type:"popup_blocked",title:"Wallet Popup Blocked",message:"Your browser blocked the wallet popup.",suggestion:"Please allow popups for this site and try again."}:n.includes("rate limit")||n.includes("too many requests")?{type:"rate_limited",title:"Too Many Requests",message:"Please wait a moment before trying again.",suggestion:"Wait 30 seconds and retry your transaction."}:n.includes("payment not yet confirmed")||n.includes("not yet confirmed on-chain")||n.includes("payment not found on-chain")||n.includes("please complete the payment")?{type:"payment_pending",title:"Payment Pending",message:"Your payment is still being confirmed on the blockchain.",suggestion:"Please wait a moment and try again, or check if your transaction completed successfully."}:n.includes("deep link")||n.includes("app not installed")||n.includes("wallet app")?{type:"mobile_wallet_error",title:"Wallet App Issue",message:"Unable to open or connect to your wallet app.",suggestion:"Make sure your wallet app is installed and try again."}:{type:"unknown_error",title:"Something Went Wrong",message:"An unexpected error occurred.",suggestion:"Please try again or contact support if the problem persists."}},Wv=(e,t="")=>({timestamp:(new Date).toISOString(),context:t,userFriendly:$v(e),technical:{message:(null==e?void 0:e.message)||"Unknown error",code:null==e?void 0:e.code,reason:null==e?void 0:e.reason,stack:null==e?void 0:e.stack,name:null==e?void 0:e.name}}),Gv=async(e,t)=>{try{const r=await o.estimateFeesPerGas(e,{chainId:t}),n=120n,i=100n;return{maxFeePerGas:r.maxFeePerGas?r.maxFeePerGas*n/i:void 0,maxPriorityFeePerGas:r.maxPriorityFeePerGas?r.maxPriorityFeePerGas*n/i:void 0}}catch(uh){return{}}},Hv="YWG990wOlIikc1tU7-WWTepfU8d1f4dp",Vv=(e,t,i,s,a,l)=>{const[u,h]=r.useState("idle"),[d,p]=r.useState(""),[f,m]=r.useState(null),{data:g,isPending:y,error:v,sendTransaction:b}=n.useSendTransaction(),{isLoading:w,isSuccess:x}=n.useWaitForTransactionReceipt({hash:g}),k=async()=>{var e,t,r,n,i,s,c;try{h("splitPayment");const d=window.coinleyPendingSplitPayment;if(!d)throw new Error("Missing split payment data");const{contractCall:p,selectedToken:f,paymentData:g,selectedNetwork:y}=d,v=y.chainId||10,b=await a.getContractInfo(v),{abi:w}=b,x=Fv(p.params),k=mm(v),_=1===k,S=_||43114===k;try{const{request:e}=await o.simulateContract(im,{address:p.contractAddress,abi:w,functionName:"splitPayment",args:[x]})}catch(l){const i=l.data||(null==(e=l.cause)?void 0:e.data);i&&("string"==typeof i&&i.startsWith("0x08c379a0")||"string"==typeof i&&i.startsWith("0x4e487b71"));l.reason||(null==(t=l.cause)?void 0:t.reason)||(null==(r=l.cause)?void 0:r.shortMessage)||(null==(n=l.data)||n.message);if(!S){const{userFriendlyMessage:e}=(e=>{if(!e.message)return{revertReason:"Transaction will revert",userFriendlyMessage:"Transaction simulation failed"};const t=e.message.toLowerCase();return t.includes("abi encoding params/values length mismatch")?{revertReason:"Smart contract parameter mismatch. This is likely a technical issue.",userFriendlyMessage:"Technical error: Contract parameters mismatch. Please try again or contact support."}:t.includes("payment id already used")?{revertReason:"This payment ID has already been used.",userFriendlyMessage:"This payment has already been processed. Please check your transaction history."}:t.includes("percentages must equal 100")?{revertReason:"Payment split percentages are incorrect.",userFriendlyMessage:"Internal error: Payment split configuration is invalid. Please contact support."}:t.includes("token transfer failed")||t.includes("transfer amount exceeds")?{revertReason:"Insufficient token balance or approval.",userFriendlyMessage:"Insufficient balance or token approval. Please check your wallet balance."}:t.includes("amount must be greater than 0")?{revertReason:"Payment amount is invalid.",userFriendlyMessage:"Invalid payment amount. Please try again."}:t.includes("invalid recipient")||t.includes("zero address")?{revertReason:"One of the payment recipients has an invalid address.",userFriendlyMessage:"Payment configuration error: Invalid recipient address. Please contact support."}:t.includes("insufficient gas")||t.includes("out of gas")?{revertReason:"Insufficient gas for transaction.",userFriendlyMessage:"Not enough gas to process transaction. Please increase gas limit or check ETH balance."}:t.includes("nonce")?{revertReason:"Transaction nonce conflict.",userFriendlyMessage:"Transaction ordering conflict. Please try again in a moment."}:{revertReason:e.message,userFriendlyMessage:`Transaction simulation failed: ${e.message.substring(0,100)}${e.message.length>100?"...":""}`}})(l);throw new Error(e)}}const C=await Gv(im,v),I="arbitrum"===y.shortName,E=I?2:0;let A;for(let e=0;e<=E;e++)try{if(e>0){const t=2e3*e;await new Promise(e=>setTimeout(e,t))}A=await o.writeContract(im,{address:p.contractAddress,abi:w,functionName:"splitPayment",args:[x],...C});break}catch(u){const t=(null==(i=u.message)?void 0:i.includes("Internal JSON-RPC error"))||(null==(s=u.message)?void 0:s.includes("-32603"))||(null==(c=u.message)?void 0:c.includes("nonce"));if(e===E||!t&&!I)throw u}return m(A),h("processing"),window.coinleyPendingSplitPayment=null,A}catch(uh){Wv(uh,"split_payment_transaction");const t=$v(uh);throw p(t),h("idle"),window.coinleyPendingSplitPayment=null,m(null),uh}},_=async r=>{try{if(h("processing"),!a||!a.processPayment)throw new Error("API instance not available or missing processPayment method");await new Promise(e=>setTimeout(e,8e3));const n=await a.processPayment(e.id,r,i.shortName,s);return h("success"),em.trackPaymentSuccess(e.id,e.amount,null==i?void 0:i.shortName,null==t?void 0:t.symbol,r),n}catch(uh){Wv(uh,"final_payment_processing");const n=$v(uh);throw p(n),h("error"),em.trackPaymentFailed(null==e?void 0:e.id,null==e?void 0:e.amount,null==i?void 0:i.shortName,null==t?void 0:t.symbol,n),uh}};return{transactionStep:u,transactionError:d,currentTransactionHash:f,txPending:y,isConfirming:w,isConfirmed:x,executePaymentTransaction:async()=>{var r,n;if(!s||!(null==e?void 0:e.contractCall))throw new Error("Missing wallet connection or payment data");const a=e.contractCall;if(!a.contractAddress)throw new Error("PaymentSplitter contract data missing from payment response");if((null==l?void 0:l.ensureCorrectNetwork)&&i){if(!(await l.ensureCorrectNetwork(i)))throw new Error("Network verification failed. Please ensure you are on the correct network.")}if(!t.contractAddress)throw new Error("Native token transactions not yet supported with PaymentSplitter. Please use ERC-20 tokens.");{const l=t.decimals||6,b=a.approvalAmount||Math.floor(e.totalAmount*Math.pow(10,l));try{let e,r="unknown";try{e=await o.readContract(im,{address:a.tokenAddress,abi:qv,functionName:"balanceOf",args:[s]}),r="wallet-rpc"}catch(u){const t=(null==i?void 0:i.chainId)||(null==i?void 0:i.id);if(!t)throw u;{const n=(e=>{const t={1:Ov,56:_v,137:Lv,42161:bv,10:Rv,43114:wv,42220:Tv,8453:kv}[e],r={1:[`https://eth-mainnet.g.alchemy.com/v2/${Hv}`,"https://cloudflare-eth.com","https://eth.llamarpc.com","https://ethereum.publicnode.com"],56:[`https://bnb-mainnet.g.alchemy.com/v2/${Hv}`,"https://bsc-dataseed.bnbchain.org","https://bsc-dataseed-public.bnbchain.org","https://bsc.nodereal.io"],137:[`https://polygon-mainnet.g.alchemy.com/v2/${Hv}`,"https://polygon.llamarpc.com","https://polygon-rpc.com","https://polygon.drpc.org"],42161:[`https://arb-mainnet.g.alchemy.com/v2/${Hv}`,"https://arb1.arbitrum.io/rpc","https://arbitrum.llamarpc.com"],10:[`https://opt-mainnet.g.alchemy.com/v2/${Hv}`,"https://mainnet.optimism.io","https://optimism.llamarpc.com"],43114:[`https://avax-mainnet.g.alchemy.com/v2/${Hv}`,"https://api.avax.network/ext/bc/C/rpc","https://avalanche.public-rpc.com"],42220:[`https://celo-mainnet.g.alchemy.com/v2/${Hv}`,"https://forno.celo.org","https://celo.drpc.org"],8453:[`https://base-mainnet.g.alchemy.com/v2/${Hv}`,"https://mainnet.base.org","https://base.llamarpc.com","https://base.meowrpc.com"]}[e];if(!t||!r)return null;const n=r.map(e=>c.http(e,{timeout:1e4,retryCount:1}));return c.createPublicClient({chain:t,transport:c.fallback(n)})})(mm(t));if(!n)throw u;try{e=await n.readContract({address:a.tokenAddress,abi:qv,functionName:"balanceOf",args:[s]}),r="fallback-rpc"}catch(d){throw u}}}const n=BigInt(b);if(e<n){const r=`Insufficient ${t.symbol} balance. You have ${(Number(e)/Math.pow(10,l)).toFixed(6)} ${t.symbol} but need ${(Number(n)/Math.pow(10,l)).toFixed(6)} ${t.symbol}`;throw new Error(r)}}catch(f){if(f.message.includes("Insufficient"))throw f}h("approve"),window.coinleyPendingSplitPayment={contractCall:a,selectedToken:t,paymentData:e,selectedNetwork:i};try{const e="0xdac17f958d2ee523a2206206994597c13d831ec7"===a.tokenAddress.toLowerCase()||"USDT"===t.symbol.toUpperCase();let r,n=c.erc20Abi;e&&(n=zv);try{r=BigInt(b)}catch(g){throw new Error(`Invalid amount value: ${b}`)}let l=0n,u=0;const d=3;for(;u<d;)try{l=await o.readContract(im,{address:a.tokenAddress,abi:c.erc20Abi,functionName:"allowance",args:[s,a.contractAddress]});break}catch(y){u++,u<d?await new Promise(e=>setTimeout(e,2e3)):l=0n}if(l>=r){h("splitPayment");const e=await k();return e&&await _(e),e}if(e&&l>0n){const e=await Gv(im,i.chainId),t=await o.writeContract(im,{address:a.tokenAddress,abi:c.erc20Abi,functionName:"approve",args:[a.contractAddress,0n],...e});await o.waitForTransactionReceipt(im,{hash:t,confirmations:1,timeout:12e4})}const p=await Gv(im,i.chainId),f=await o.writeContract(im,{address:a.tokenAddress,abi:c.erc20Abi,functionName:"approve",args:[a.contractAddress,r],...p});m(f);await o.waitForTransactionReceipt(im,{hash:f,confirmations:1,timeout:12e4});await new Promise(e=>setTimeout(e,3e3));let w=0;const x=3;let S=!1;for(;w<x&&!S;){try{if(await o.readContract(im,{address:a.tokenAddress,abi:c.erc20Abi,functionName:"allowance",args:[s,a.contractAddress]})>=r){S=!0;break}w<x-1&&await new Promise(e=>setTimeout(e,2e3))}catch(v){w<x-1&&await new Promise(e=>setTimeout(e,2e3))}w++}const C=await k();return C&&await _(C),C}catch(uh){Wv(uh,"approve_transaction");const t=$v(uh);if(p(t),h("idle"),window.coinleyPendingSplitPayment=null,m(null),(null==(r=uh.message)?void 0:r.includes("User rejected"))||(null==(n=uh.message)?void 0:n.includes("User denied"))||4001===uh.code)throw new Error("Transaction was cancelled by user");throw new Error(`Approve failed: ${uh.message}`)}}},executeSplitPayment:k,processFinalPayment:_,resetTransaction:()=>{h("idle"),p(""),m(null),window.coinleyPendingSplitPayment=null},setTransactionError:p,setTransactionStep:h}},Kv=BigInt(0),Zv=BigInt(1);function Yv(e,t=""){if("boolean"!=typeof e){throw new Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e)}return e}function Jv(e,t,r=""){const n=kg(e),i=null==e?void 0:e.length,o=void 0!==t;if(!n||o&&i!==t){throw new Error((r&&`"${r}" `)+"expected Uint8Array"+(o?` of length ${t}`:"")+", got "+(n?`length=${i}`:"type="+typeof e))}return e}function Xv(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function Qv(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?Kv:BigInt("0x"+e)}function eb(e){return Qv(Rg(e))}function tb(e){return Sg(e),Qv(Rg(Uint8Array.from(e).reverse()))}function rb(e,t){return $g(e.toString(16).padStart(2*t,"0"))}function nb(e,t){return rb(e,t).reverse()}function ib(e,t,r){let n;if("string"==typeof t)try{n=$g(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else{if(!kg(t))throw new Error(e+" must be hex string or Uint8Array");n=Uint8Array.from(t)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(e+" of length "+r+" expected, got "+i);return n}function ob(e){return Uint8Array.from(e)}const sb=e=>"bigint"==typeof e&&Kv<=e;function ab(e,t,r,n){if(!function(e,t,r){return sb(e)&&sb(t)&&sb(r)&&t<=e&&e<r}(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function cb(e){let t;for(t=0;e>Kv;e>>=Zv,t+=1);return t}const lb=e=>(Zv<<BigInt(e))-Zv;function ub(e,t,r={}){if(!e||"object"!=typeof e)throw new Error("expected valid options object");function n(t,r,n){const i=e[t];if(n&&void 0===i)return;const o=typeof i;if(o!==r||null===i)throw new Error(`param "${t}" is invalid: expected ${r}, got ${o}`)}Object.entries(t).forEach(([e,t])=>n(e,t,!1)),Object.entries(r).forEach(([e,t])=>n(e,t,!0))}function hb(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const o=e(r,...n);return t.set(r,o),o}}
12
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const db=BigInt(0),pb=BigInt(1),fb=BigInt(2),mb=BigInt(3),gb=BigInt(4),yb=BigInt(5),vb=BigInt(7),bb=BigInt(8),wb=BigInt(9),xb=BigInt(16);function kb(e,t){const r=e%t;return r>=db?r:t+r}function _b(e,t,r){let n=e;for(;t-- >db;)n*=n,n%=r;return n}function Sb(e,t){if(e===db)throw new Error("invert: expected non-zero number");if(t<=db)throw new Error("invert: expected positive modulus, got "+t);let r=kb(e,t),n=t,i=db,o=pb;for(;r!==db;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==pb)throw new Error("invert: does not exist");return kb(i,t)}function Cb(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function Ib(e,t){const r=(e.ORDER+pb)/gb,n=e.pow(t,r);return Cb(e,n,t),n}function Eb(e,t){const r=(e.ORDER-yb)/bb,n=e.mul(t,fb),i=e.pow(n,r),o=e.mul(t,i),s=e.mul(e.mul(o,fb),i),a=e.mul(o,e.sub(s,e.ONE));return Cb(e,a,t),a}function Ab(e){if(e<mb)throw new Error("sqrt is not defined for small field");let t=e-pb,r=0;for(;t%fb===db;)t/=fb,r++;let n=fb;const i=Bb(e);for(;1===Tb(i,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return Ib;let o=i.pow(n,t);const s=(t+pb)/fb;return function(e,n){if(e.is0(n))return n;if(1!==Tb(e,n))throw new Error("Cannot find square root");let i=r,a=e.mul(e.ONE,o),c=e.pow(n,t),l=e.pow(n,s);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,r=e.sqr(c);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw new Error("Cannot find square root");const n=pb<<BigInt(i-t-1),o=e.pow(a,n);i=t,a=e.sqr(o),c=e.mul(c,a),l=e.mul(l,o)}return l}}function Mb(e){return e%gb===mb?Ib:e%bb===yb?Eb:e%xb===wb?function(e){const t=Bb(e),r=Ab(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+vb)/xb;return(e,t)=>{let r=e.pow(t,s),a=e.mul(r,n);const c=e.mul(r,i),l=e.mul(r,o),u=e.eql(e.sqr(a),t),h=e.eql(e.sqr(c),t);r=e.cmov(r,a,u),a=e.cmov(l,c,h);const d=e.eql(e.sqr(a),t),p=e.cmov(r,a,d);return Cb(e,p,t),p}}(e):Ab(e)}const Nb=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Pb(e,t,r=!1){const n=new Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),o=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),o),n}function Tb(e,t){const r=(e.ORDER-pb)/fb,n=e.pow(t,r),i=e.eql(n,e.ONE),o=e.eql(n,e.ZERO),s=e.eql(n,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function Ob(e,t){void 0!==t&&_g(t);const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function Bb(e,t,r=!1,n={}){if(e<=db)throw new Error("invalid field: expected ORDER > 0, got "+e);let i,o,s,a=!1;if("object"==typeof t&&null!=t){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const e=t;e.BITS&&(i=e.BITS),e.sqrt&&(o=e.sqrt),"boolean"==typeof e.isLE&&(r=e.isLE),"boolean"==typeof e.modFromBytes&&(a=e.modFromBytes),s=e.allowedLengths}else"number"==typeof t&&(i=t),n.sqrt&&(o=n.sqrt);const{nBitLength:c,nByteLength:l}=Ob(e,i);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const h=Object.freeze({ORDER:e,isLE:r,BITS:c,BYTES:l,MASK:lb(c),ZERO:db,ONE:pb,allowedLengths:s,create:t=>kb(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return db<=t&&t<e},is0:e=>e===db,isValidNot0:e=>!h.is0(e)&&h.isValid(e),isOdd:e=>(e&pb)===pb,neg:t=>kb(-t,e),eql:(e,t)=>e===t,sqr:t=>kb(t*t,e),add:(t,r)=>kb(t+r,e),sub:(t,r)=>kb(t-r,e),mul:(t,r)=>kb(t*r,e),pow:(e,t)=>function(e,t,r){if(r<db)throw new Error("invalid exponent, negatives unsupported");if(r===db)return e.ONE;if(r===pb)return t;let n=e.ONE,i=t;for(;r>db;)r&pb&&(n=e.mul(n,i)),i=e.sqr(i),r>>=pb;return n}(h,e,t),div:(t,r)=>kb(t*Sb(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Sb(t,e),sqrt:o||(t=>(u||(u=Mb(e)),u(h,t))),toBytes:e=>r?nb(e,l):rb(e,l),fromBytes:(t,n=!0)=>{if(s){if(!s.includes(t.length)||t.length>l)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+t.length);const e=new Uint8Array(l);e.set(t,r?0:e.length-t.length),t=e}if(t.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+t.length);let i=r?tb(t):eb(t);if(a&&(i=kb(i,e)),!n&&!h.isValid(i))throw new Error("invalid field element: outside of range 0..ORDER");return i},invertBatch:e=>Pb(h,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(h)}function Rb(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Lb(e){const t=Rb(e);return t+Math.ceil(t/2)}
13
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
14
+ const jb=BigInt(0),Ub=BigInt(1);function Db(e,t){const r=t.negate();return e?r:t}function Fb(e,t){const r=Pb(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function zb(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function qb(e,t){zb(e,t);const r=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:lb(e),maxNumber:r,shiftBy:BigInt(e)}}function $b(e,t,r){const{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r;let a=Number(e&i),c=e>>s;a>n&&(a-=o,c+=Ub);const l=t*n;return{nextN:c,offset:l+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:t%2!=0,offsetF:l}}const Wb=new WeakMap,Gb=new WeakMap;function Hb(e){return Gb.get(e)||1}function Vb(e){if(e!==jb)throw new Error("invalid wNAF")}class Kb{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>jb;)t&Ub&&(r=r.add(n)),n=n.double(),t>>=Ub;return r}precomputeWindow(e,t){const{windows:r,windowSize:n}=qb(t,this.bits),i=[];let o=e,s=o;for(let a=0;a<r;a++){s=o,i.push(s);for(let e=1;e<n;e++)s=s.add(o),i.push(s);o=s.double()}return i}wNAF(e,t,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let n=this.ZERO,i=this.BASE;const o=qb(e,this.bits);for(let s=0;s<o.windows;s++){const{nextN:e,offset:a,isZero:c,isNeg:l,isNegF:u,offsetF:h}=$b(r,s,o);r=e,c?i=i.add(Db(u,t[h])):n=n.add(Db(l,t[a]))}return Vb(r),{p:n,f:i}}wNAFUnsafe(e,t,r,n=this.ZERO){const i=qb(e,this.bits);for(let o=0;o<i.windows&&r!==jb;o++){const{nextN:e,offset:s,isZero:a,isNeg:c}=$b(r,o,i);if(r=e,!a){const e=t[s];n=n.add(c?e.negate():e)}}return Vb(r),n}getPrecomputes(e,t,r){let n=Wb.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),Wb.set(t,n))),n}cached(e,t,r){const n=Hb(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){const i=Hb(e);return 1===i?this._unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)}createCache(e,t){zb(t,this.bits),Gb.set(e,t),Wb.delete(e)}hasCache(e){return 1!==Hb(e)}}function Zb(e,t,r,n){!function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}(n,t);const i=r.length,o=n.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,a=cb(BigInt(i));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=lb(c),u=new Array(Number(l)+1).fill(s);let h=s;for(let d=Math.floor((t.BITS-1)/c)*c;d>=0;d-=c){u.fill(s);for(let t=0;t<o;t++){const e=n[t],i=Number(e>>BigInt(d)&l);u[i]=u[i].add(r[t])}let e=s;for(let t=u.length-1,r=s;t>0;t--)r=r.add(u[t]),e=e.add(r);if(h=h.add(e),0!==d)for(let t=0;t<c;t++)h=h.double()}return h}function Yb(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(e){ub(e,Nb.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"}))}(t),t}return Bb(e,{isLE:r})}function Jb(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const e=t[a];if(!("bigint"==typeof e&&e>jb))throw new Error(`CURVE.${a} must be positive bigint`)}const i=Yb(t.p,r.Fp,n),o=Yb(t.n,r.Fn,n),s=["Gx","Gy","a","weierstrass"===e?"b":"d"];for(const a of s)if(!i.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}
15
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xb=BigInt(0),Qb=BigInt(1),ew=BigInt(2),tw=BigInt(8);function rw(e,t,r={}){if("function"!=typeof t)throw new Error('"hash" function param is required');ub(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:n}=r,{BASE:i,Fp:o,Fn:s}=e,a=r.randomBytes||Kg,c=r.adjustScalarBytes||(e=>e),l=r.domain||((e,t,r)=>{if(Yv(r,"phflag"),t.length||r)throw new Error("Contexts/pre-hash are not supported");return e});function u(e){return s.create(tb(e))}function h(e){const{head:r,prefix:n,scalar:o}=function(e){const r=g.secretKey;e=ib("private key",e,r);const n=ib("hashed private key",t(e),2*r),i=c(n.slice(0,r));return{head:i,prefix:n.slice(r,2*r),scalar:u(i)}}(e),s=i.multiply(o),a=s.toBytes();return{head:r,prefix:n,scalar:o,point:s,pointBytes:a}}function d(e){return h(e).pointBytes}function p(e=Uint8Array.of(),...r){const i=Gg(...r);return u(t(l(i,ib("context",e),!!n)))}const f={zip215:!0};const m=o.BYTES,g={secretKey:m,publicKey:m,signature:2*m,seed:m};function y(e=a(g.seed)){return Jv(e,g.seed,"seed")}const v={getExtendedPublicKey:h,randomSecretKey:y,isValidSecretKey:function(e){return kg(e)&&e.length===s.BYTES},isValidPublicKey:function(t,r){try{return!!e.fromBytes(t,r)}catch(uh){return!1}},toMontgomery(t){const{y:r}=e.fromBytes(t),n=g.publicKey,i=32===n;if(!i&&57!==n)throw new Error("only defined for 25519 and 448");const s=i?o.div(Qb+r,Qb-r):o.div(r-Qb,r+Qb);return o.toBytes(s)},toMontgomerySecret(e){const r=g.secretKey;Jv(e,r);const n=t(e.subarray(0,r));return c(n).subarray(0,r)},randomPrivateKey:y,precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({keygen:function(e){const t=v.randomSecretKey(e);return{secretKey:t,publicKey:d(t)}},getPublicKey:d,sign:function(e,t,r={}){e=ib("message",e),n&&(e=n(e));const{prefix:o,scalar:a,pointBytes:c}=h(t),l=p(r.context,o,e),u=i.multiply(l).toBytes(),d=p(r.context,u,c,e),f=s.create(l+d*a);if(!s.isValid(f))throw new Error("sign failed: invalid s");return Jv(Gg(u,s.toBytes(f)),g.signature,"result")},verify:function(t,r,o,s=f){const{context:a,zip215:c}=s,l=g.signature;t=ib("signature",t,l),r=ib("message",r),o=ib("publicKey",o,g.publicKey),void 0!==c&&Yv(c,"zip215"),n&&(r=n(r));const u=l/2,h=t.subarray(0,u),d=tb(t.subarray(u,l));let m,y,v;try{m=e.fromBytes(o,c),y=e.fromBytes(h,c),v=i.multiplyUnsafe(d)}catch(uh){return!1}if(!c&&m.isSmallOrder())return!1;const b=p(a,y.toBytes(),m.toBytes(),r);return y.add(m.multiplyUnsafe(b)).subtract(v).clearCofactor().is0()},utils:v,Point:e,lengths:g})}function nw(e){const{CURVE:t,curveOpts:r,hash:n,eddsaOpts:i}=function(e){const t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r={Fp:e.Fp,Fn:Bb(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},n={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:r,hash:e.hash,eddsaOpts:n}}(e),o=function(e,t={}){const r=Jb("edwards",e,t,t.FpFnLE),{Fp:n,Fn:i}=r;let o=r.CURVE;const{h:s}=o;ub(t,{},{uvRatio:"function"});const a=ew<<BigInt(8*i.BYTES)-Qb,c=e=>n.create(e),l=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(n.div(e,t))}}catch(r){return{isValid:!1,value:Xb}}});if(!function(e,t,r,n){const i=e.sqr(r),o=e.sqr(n),s=e.add(e.mul(t.a,i),o),a=e.add(e.ONE,e.mul(t.d,e.mul(i,o)));return e.eql(s,a)}(n,o,o.Gx,o.Gy))throw new Error("bad curve params: generator point");function u(e,t,r=!1){return ab("coordinate "+e,t,r?Qb:Xb,a),t}function h(e){if(!(e instanceof f))throw new Error("ExtendedPoint expected")}const d=hb((e,t)=>{const{X:r,Y:i,Z:o}=e,s=e.is0();null==t&&(t=s?tw:n.inv(o));const a=c(r*t),l=c(i*t),u=n.mul(o,t);if(s)return{x:Xb,y:Qb};if(u!==Qb)throw new Error("invZ was invalid");return{x:a,y:l}}),p=hb(e=>{const{a:t,d:r}=o;if(e.is0())throw new Error("bad point: ZERO");const{X:n,Y:i,Z:s,T:a}=e,l=c(n*n),u=c(i*i),h=c(s*s),d=c(h*h),p=c(l*t);if(c(h*c(p+u))!==c(d+c(r*c(l*u))))throw new Error("bad point: equation left != right (1)");if(c(n*i)!==c(s*a))throw new Error("bad point: equation left != right (2)");return!0});class f{constructor(e,t,r,n){this.X=u("x",e),this.Y=u("y",t),this.Z=u("z",r,!0),this.T=u("t",n),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){if(e instanceof f)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};return u("x",t),u("y",r),new f(t,r,Qb,c(t*r))}static fromBytes(e,t=!1){const r=n.BYTES,{a:i,d:s}=o;e=ob(Jv(e,r,"point")),Yv(t,"zip215");const u=ob(e),h=e[r-1];u[r-1]=-129&h;const d=tb(u),p=t?a:n.ORDER;ab("point.y",d,Xb,p);const m=c(d*d),g=c(m-Qb),y=c(s*m-i);let{isValid:v,value:b}=l(g,y);if(!v)throw new Error("bad point: invalid y coordinate");const w=(b&Qb)===Qb,x=!!(128&h);if(!t&&b===Xb&&x)throw new Error("bad point: x=0 and x_0=1");return x!==w&&(b=c(-b)),f.fromAffine({x:b,y:d})}static fromHex(e,t=!1){return f.fromBytes(ib("point",e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return m.createCache(this,e),t||this.multiply(ew),this}assertValidity(){p(this)}equals(e){h(e);const{X:t,Y:r,Z:n}=this,{X:i,Y:o,Z:s}=e,a=c(t*s),l=c(i*n),u=c(r*s),d=c(o*n);return a===l&&u===d}is0(){return this.equals(f.ZERO)}negate(){return new f(c(-this.X),this.Y,this.Z,c(-this.T))}double(){const{a:e}=o,{X:t,Y:r,Z:n}=this,i=c(t*t),s=c(r*r),a=c(ew*c(n*n)),l=c(e*i),u=t+r,h=c(c(u*u)-i-s),d=l+s,p=d-a,m=l-s,g=c(h*p),y=c(d*m),v=c(h*m),b=c(p*d);return new f(g,y,b,v)}add(e){h(e);const{a:t,d:r}=o,{X:n,Y:i,Z:s,T:a}=this,{X:l,Y:u,Z:d,T:p}=e,m=c(n*l),g=c(i*u),y=c(a*r*p),v=c(s*d),b=c((n+i)*(l+u)-m-g),w=v-y,x=v+y,k=c(g-t*m),_=c(b*w),S=c(x*k),C=c(b*k),I=c(w*x);return new f(_,S,I,C)}subtract(e){return this.add(e.negate())}multiply(e){if(!i.isValidNot0(e))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:t,f:r}=m.cached(this,e,e=>Fb(f,e));return Fb(f,[t,r])[0]}multiplyUnsafe(e,t=f.ZERO){if(!i.isValid(e))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return e===Xb?f.ZERO:this.is0()||e===Qb?this:m.unsafe(this,e,e=>Fb(f,e),t)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}isTorsionFree(){return m.unsafe(this,o.n).is0()}toAffine(e){return d(this,e)}clearCofactor(){return s===Qb?this:this.multiplyUnsafe(s)}toBytes(){const{x:e,y:t}=this.toAffine(),r=n.toBytes(t);return r[r.length-1]|=e&Qb?128:0,r}toHex(){return Rg(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(e){return Fb(f,e)}static msm(e,t){return Zb(f,i,e,t)}_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}f.BASE=new f(o.Gx,o.Gy,Qb,c(o.Gx*o.Gy)),f.ZERO=new f(Xb,Qb,Qb,Xb),f.Fp=n,f.Fn=i;const m=new Kb(f,i.BITS);return f.BASE.precompute(8),f}(t,r);return function(e,t){const r=t.Point;return Object.assign({},t,{ExtendedPoint:r,CURVE:e,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}(e,rw(o,n,i))}
16
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const iw=BigInt(1),ow=BigInt(2);BigInt(3);const sw=BigInt(5),aw=BigInt(8),cw=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),lw=(()=>({p:cw,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:aw,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function uw(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const hw=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function dw(e,t){const r=cw,n=kb(t*t*t,r),i=function(e){const t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=cw,s=e*e%o*e%o,a=_b(s,ow,o)*s%o,c=_b(a,iw,o)*e%o,l=_b(c,sw,o)*c%o,u=_b(l,t,o)*l%o,h=_b(u,r,o)*u%o,d=_b(h,n,o)*h%o,p=_b(d,i,o)*d%o,f=_b(p,i,o)*d%o,m=_b(f,t,o)*l%o;return{pow_p_5_8:_b(m,ow,o)*e%o,b2:s}}(e*kb(n*n*t,r)).pow_p_5_8;let o=kb(e*n*i,r);const s=kb(t*o*o,r),a=o,c=kb(o*hw,r),l=s===e,u=s===kb(-e,r),h=s===kb(-e*hw,r);return l&&(o=a),(u||h)&&(o=c),(kb(o,r)&pb)===pb&&(o=kb(-o,r)),{isValid:l||u,value:o}}const pw=(()=>Bb(lw.p,{isLE:!0}))(),fw=(()=>({...lw,Fp:pw,hash:Ey,adjustScalarBytes:uw,uvRatio:dw}))(),mw=(()=>nw(fw))();var gw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function yw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vw(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var bw={exports:{}};const ww=vw(W);(function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ww.Buffer}catch(I){}function s(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function a(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function c(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),c=t;c<a;c++){var l=e.charCodeAt(c)-48;o*=i,s=l>=49?l-49+10:l>=17?l-17+10:l,r(l>=0&&s<i,"Invalid character"),o+=s}return o}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,l=0,u=r;u<a;u+=n)l=c(e,u,u+n,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==s){var h=1;for(l=c(e,u,e.length,t),u=0;u<s;u++)h*=t;this.imuln(h),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch(I){i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var l=1;l<n;l++){for(var u=c>>>26,h=67108863&c,d=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=d;p++){var f=l-p|0;u+=(s=(i=0|e.words[f])*(o=0|t.words[p])+h)/67108864|0,h=67108863&s}r.words[l]=0|h,c=0|u}return 0!==c?r.words[l]=0|c:r.length--,r._strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?h[6-c.length]+c+n:c+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var l=d[e],u=p[e];n="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(u).toString(e);n=(f=f.idivn(u)).isZero()?m+n:h[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;e[r++]=255&s,r<e.length&&(e[r++]=s>>8&255),r<e.length&&(e[r++]=s>>16&255),6===o?(r<e.length&&(e[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;e[r--]=255&s,r>=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0===(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0===(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0===(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s<n.length;s++)o=(t=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<r.length;s++)o=(t=(0|r.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,o,s=e.words,a=t.words,c=r.words,l=0,u=0|s[0],h=8191&u,d=u>>>13,p=0|s[1],f=8191&p,m=p>>>13,g=0|s[2],y=8191&g,v=g>>>13,b=0|s[3],w=8191&b,x=b>>>13,k=0|s[4],_=8191&k,S=k>>>13,C=0|s[5],I=8191&C,E=C>>>13,A=0|s[6],M=8191&A,N=A>>>13,P=0|s[7],T=8191&P,O=P>>>13,B=0|s[8],R=8191&B,L=B>>>13,j=0|s[9],U=8191&j,D=j>>>13,F=0|a[0],z=8191&F,q=F>>>13,$=0|a[1],W=8191&$,G=$>>>13,H=0|a[2],V=8191&H,K=H>>>13,Z=0|a[3],Y=8191&Z,J=Z>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,le=ae>>>13,ue=0|a[8],he=8191&ue,de=ue>>>13,pe=0|a[9],fe=8191&pe,me=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(l+(n=Math.imul(h,z))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(d,z)|0))<<13)|0;l=((o=Math.imul(d,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(f,z),i=(i=Math.imul(f,q))+Math.imul(m,z)|0,o=Math.imul(m,q);var ye=(l+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,W)|0))<<13)|0;l=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,q))+Math.imul(v,z)|0,o=Math.imul(v,q),n=n+Math.imul(f,W)|0,i=(i=i+Math.imul(f,G)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,G)|0;var ve=(l+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,V)|0))<<13)|0;l=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(f,V)|0,i=(i=i+Math.imul(f,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var be=(l+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,Y)|0))<<13)|0;l=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(_,z),i=(i=Math.imul(_,q))+Math.imul(S,z)|0,o=Math.imul(S,q),n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,K)|0,n=n+Math.imul(f,Y)|0,i=(i=i+Math.imul(f,J)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,J)|0;var we=(l+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;l=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,z),i=(i=Math.imul(I,q))+Math.imul(E,z)|0,o=Math.imul(E,q),n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,J)|0,n=n+Math.imul(f,Q)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var xe=(l+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;l=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(M,z),i=(i=Math.imul(M,q))+Math.imul(N,z)|0,o=Math.imul(N,q),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,G)|0,n=n+Math.imul(_,V)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(f,re)|0,i=(i=i+Math.imul(f,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var ke=(l+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;l=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,q))+Math.imul(O,z)|0,o=Math.imul(O,q),n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(N,W)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,K)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var _e=(l+(n=n+Math.imul(h,ce)|0)|0)+((8191&(i=(i=i+Math.imul(h,le)|0)+Math.imul(d,ce)|0))<<13)|0;l=((o=o+Math.imul(d,le)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(f,ce)|0,i=(i=i+Math.imul(f,le)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,le)|0;var Se=(l+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;l=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,q))+Math.imul(D,z)|0,o=Math.imul(D,q),n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,G)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,n=n+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,le)|0)+Math.imul(v,ce)|0,o=o+Math.imul(v,le)|0,n=n+Math.imul(f,he)|0,i=(i=i+Math.imul(f,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var Ce=(l+(n=n+Math.imul(h,fe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,fe)|0))<<13)|0;l=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,W),i=(i=Math.imul(U,G))+Math.imul(D,W)|0,o=Math.imul(D,G),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,se)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,le)|0,n=n+Math.imul(y,he)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ie=(l+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,K))+Math.imul(D,V)|0,o=Math.imul(D,K),n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,le)|0)+Math.imul(S,ce)|0,o=o+Math.imul(S,le)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Ee=(l+(n=n+Math.imul(y,fe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(v,fe)|0))<<13)|0;l=((o=o+Math.imul(v,me)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(D,Y)|0,o=Math.imul(D,J),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,le)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,le)|0,n=n+Math.imul(_,he)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Ae=(l+(n=n+Math.imul(w,fe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(x,fe)|0))<<13)|0;l=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,ee))+Math.imul(D,Q)|0,o=Math.imul(D,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,n=n+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(N,ce)|0,o=o+Math.imul(N,le)|0,n=n+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(E,he)|0,o=o+Math.imul(E,de)|0;var Me=(l+(n=n+Math.imul(_,fe)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(S,fe)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(D,re)|0,o=Math.imul(D,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,le)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Ne=(l+(n=n+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(E,fe)|0))<<13)|0;l=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(D,oe)|0,o=Math.imul(D,se),n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,le)|0,n=n+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Pe=(l+(n=n+Math.imul(M,fe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(N,fe)|0))<<13)|0;l=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,le))+Math.imul(D,ce)|0,o=Math.imul(D,le),n=n+Math.imul(R,he)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(L,he)|0,o=o+Math.imul(L,de)|0;var Te=(l+(n=n+Math.imul(T,fe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,fe)|0))<<13)|0;l=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,he),i=(i=Math.imul(U,de))+Math.imul(D,he)|0,o=Math.imul(D,de);var Oe=(l+(n=n+Math.imul(R,fe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(L,fe)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var Be=(l+(n=Math.imul(U,fe))|0)+((8191&(i=(i=Math.imul(U,me))+Math.imul(D,fe)|0))<<13)|0;return l=((o=Math.imul(D,me))+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,c[0]=ge,c[1]=ye,c[2]=ve,c[3]=be,c[4]=we,c[5]=xe,c[6]=ke,c[7]=_e,c[8]=Se,c[9]=Ce,c[10]=Ie,c[11]=Ee,c[12]=Ae,c[13]=Me,c[14]=Ne,c[15]=Pe,c[16]=Te,c[17]=Oe,c[18]=Be,0!==l&&(c[19]=l,r.length++),r};function g(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,c=Math.min(o,t.length-1),l=Math.max(0,o-e.length+1);l<=c;l++){var u=o-l,h=(0|e.words[u])*(0|t.words[l]),d=67108863&h;a=67108863&(d=d+a|0),i+=(s=(s=s+(h/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(e,t,r){return g(e,t,r)}Math.imul||(m=f),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?f(this,e,t):r<1024?g(this,e,t):y(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,c=(0|this.words[t])-a<<n;this.words[t]=c|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,c=n;if(i-=s,i=Math.max(0,i),c){for(var l=0;l<s;l++)c.words[l]=this.words[l];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,l=0;l<this.length;l++)this.words[l]=this.words[l+s];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(0!==u||l>=i);l--){var h=0|this.words[l];this.words[l]=u<<26-o|h>>>o,u=h&a}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,o,s=e.length+n;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+a;var c=(0|e.words[i])*t;a=((o-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,c=n.length-o.length;if("mod"!==t){(a=new i(null)).length=c+1,a.words=new Array(a.length);for(var l=0;l<a.length;l++)a.words[l]=0}var u=n.clone()._ishlnsubmul(o,1,c);0===u.negative&&(n=u,a&&(a.words[c]=1));for(var h=c-1;h>=0;h--){var d=67108864*(0|n.words[o.length+h])+(0|n.words[o.length+h-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(o,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),c=new i(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var u=n.clone(),h=t.clone();!t.isZero();){for(var d=0,p=1;0===(t.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(u),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var f=0,m=1;0===(n.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(n.iushrn(f);f-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a),s.isub(c)):(n.isub(t),a.isub(o),c.isub(s))}return{a:a,b:c,gcd:n.iushln(l)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;0===(t.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(t.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var h=0,d=1;0===(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new S(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},n(w,b),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&r,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(x,b),n(k,b),n(_,b),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new x;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return v[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),c=a.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var h=this.pow(u,o),d=this.pow(e,o.addn(1).iushrn(1)),p=this.pow(e,o),f=s;0!==p.cmp(a);){for(var m=p,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<f);var y=this.pow(h,new i(1).iushln(f-g-1));d=d.redMul(y),h=y.redSqr(),p=p.redMul(h),f=g}return d},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],s=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var l=t.words[n],u=c-1;u>=0;u--){var h=l>>u&1;o!==r[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===u)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}c=26}return o},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new C(e)},n(C,S),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(bw,gw);var xw=bw.exports;const kw=yw(xw);var _w={exports:{}};
17
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */!function(e,t){var r=ww,n=r.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(_w,_w.exports);var Sw=_w.exports.Buffer;var Cw=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=n}var s=e.length,a=e.charAt(0),c=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function u(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return Sw.alloc(0);for(var r=0,n=0,i=0;e[r]===a;)n++,r++;for(var o=(e.length-r)*c+1>>>0,l=new Uint8Array(o);r<e.length;){var u=e.charCodeAt(r);if(u>255)return;var h=t[u];if(255===h)return;for(var d=0,p=o-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=s*l[p]>>>0,l[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,r++}for(var f=o-i;f!==o&&0===l[f];)f++;var m=Sw.allocUnsafe(n+(o-f));m.fill(0,0,n);for(var g=n;f!==o;)m[g++]=l[f++];return m}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=Sw.from(t)),!Sw.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var c=(o-i)*l+1>>>0,u=new Uint8Array(c);i!==o;){for(var h=t[i],d=0,p=c-1;(0!==h||d<n)&&-1!==p;p--,d++)h+=256*u[p]>>>0,u[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var f=c-n;f!==c&&0===u[f];)f++;for(var m=a.repeat(r);f<c;++f)m+=e.charAt(u[f]);return m},decodeUnsafe:u,decode:function(e){var t=u(e);if(t)return t;throw new Error("Non-base"+s+" character")}}},Iw=Cw("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");const Ew=yw(Iw);var Aw={};function Mw(e,t,r){return t<=e&&e<=r}function Nw(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function Pw(e){this.tokens=[].slice.call(e)}Pw.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var Tw=-1;function Ow(e,t){if(e)throw TypeError("Decoder error");return t||65533}var Bw="utf-8";function Rw(e,t){if(!(this instanceof Rw))return new Rw(e,t);if((e=void 0!==e?String(e).toLowerCase():Bw)!==Bw)throw new Error("Encoding not supported. Only utf-8 is supported");t=Nw(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(t.fatal),this._ignoreBOM=Boolean(t.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function Lw(e,t){if(!(this instanceof Lw))return new Lw(e,t);if((e=void 0!==e?String(e).toLowerCase():Bw)!==Bw)throw new Error("Encoding not supported. Only utf-8 is supported");t=Nw(t),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(t.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function jw(e){var t=e.fatal,r=0,n=0,i=0,o=128,s=191;this.handler=function(e,a){if(-1===a&&0!==i)return i=0,Ow(t);if(-1===a)return Tw;if(0===i){if(Mw(a,0,127))return a;if(Mw(a,194,223))i=1,r=a-192;else if(Mw(a,224,239))224===a&&(o=160),237===a&&(s=159),i=2,r=a-224;else{if(!Mw(a,240,244))return Ow(t);240===a&&(o=144),244===a&&(s=143),i=3,r=a-240}return r<<=6*i,null}if(!Mw(a,o,s))return r=i=n=0,o=128,s=191,e.prepend(a),Ow(t);if(o=128,s=191,r+=a-128<<6*(i-(n+=1)),n!==i)return null;var c=r;return r=i=n=0,c}}function Uw(e){e.fatal,this.handler=function(e,t){if(-1===t)return Tw;if(Mw(t,0,127))return t;var r,n;Mw(t,128,2047)?(r=1,n=192):Mw(t,2048,65535)?(r=2,n=224):Mw(t,65536,1114111)&&(r=3,n=240);for(var i=[(t>>6*r)+n];r>0;){var o=t>>6*(r-1);i.push(128|63&o),r-=1}return i}}Rw.prototype={decode:function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=Nw(t),this._streaming||(this._decoder=new jw({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(t.stream);for(var n,i=new Pw(r),o=[];!i.endOfStream()&&(n=this._decoder.handler(i,i.read()))!==Tw;)null!==n&&(Array.isArray(n)?o.push.apply(o,n):o.push(n));if(!this._streaming){do{if((n=this._decoder.handler(i,i.read()))===Tw)break;null!==n&&(Array.isArray(n)?o.push.apply(o,n):o.push(n))}while(!i.endOfStream());this._decoder=null}return o.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===o[0]?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return t}(o)}},Lw.prototype={encode:function(e,t){e=e?String(e):"",t=Nw(t),this._streaming||(this._encoder=new Uw(this._options)),this._streaming=Boolean(t.stream);for(var r,n=[],i=new Pw(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var o=t.charCodeAt(n);if(o<55296||o>57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(n===r-1)i.push(65533);else{var s=e.charCodeAt(n+1);if(56320<=s&&s<=57343){var a=1023&o,c=1023&s;i.push(65536+(a<<10)+c),n+=1}else i.push(65533)}n+=1}return i}(e));!i.endOfStream()&&(r=this._encoder.handler(i,i.read()))!==Tw;)Array.isArray(r)?n.push.apply(n,r):n.push(r);if(!this._streaming){for(;(r=this._encoder.handler(i,i.read()))!==Tw;)Array.isArray(r)?n.push.apply(n,r):n.push(r);this._encoder=null}return new Uint8Array(n)}};const Dw=vw(Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:Rw,TextEncoder:Lw},Symbol.toStringTag,{value:"Module"})));var Fw=gw&&gw.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),zw=gw&&gw.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qw=gw&&gw.__decorate||function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},$w=gw&&gw.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&Fw(t,e,r);return zw(t,e),t},Ww=gw&&gw.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Aw,"__esModule",{value:!0});var Gw=Aw.deserializeUnchecked=ax=Aw.deserialize=ix=Aw.serialize=Aw.BinaryReader=Aw.BinaryWriter=Aw.BorshError=Aw.baseDecode=Aw.baseEncode=void 0;const Hw=Ww(xw),Vw=Ww(Iw),Kw=$w(Dw),Zw=new("function"!=typeof TextDecoder?Kw.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Aw.baseEncode=function(e){return"string"==typeof e&&(e=I.from(e,"utf8")),Vw.default.encode(I.from(e))},Aw.baseDecode=function(e){return I.from(Vw.default.decode(e))};const Yw=1024;class Jw extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Aw.BorshError=Jw;class Xw{constructor(){this.buf=I.alloc(Yw),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=I.concat([this.buf,I.alloc(Yw)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(I.from(new Hw.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(I.from(new Hw.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(I.from(new Hw.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(I.from(new Hw.default(e).toArray("le",64)))}writeBuffer(e){this.buf=I.concat([I.from(this.buf.subarray(0,this.length)),e,I.alloc(Yw)]),this.length+=e.length}writeString(e){this.maybeResize();const t=I.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(I.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const r of e)this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}}function Qw(e,t,r){const n=r.value;r.value=function(...e){try{return n.apply(this,e)}catch(t){if(t instanceof RangeError){const e=t.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e)>=0)throw new Jw("Reached the end of buffer when deserializing")}throw t}}}Aw.BinaryWriter=Xw;class ex{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new Hw.default(e,"le")}readU128(){const e=this.readBuffer(16);return new Hw.default(e,"le")}readU256(){const e=this.readBuffer(32);return new Hw.default(e,"le")}readU512(){const e=this.readBuffer(64);return new Hw.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new Jw(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return Zw.decode(t)}catch(r){throw new Jw(`Error decoding UTF-8 string: ${r}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),r=Array();for(let n=0;n<t;++n)r.push(e());return r}}function tx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function rx(e,t,r,n,i){try{if("string"==typeof n)i[`write${tx(n)}`](r);else if(n instanceof Array)if("number"==typeof n[0]){if(r.length!==n[0])throw new Jw(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(2===n.length&&"number"==typeof n[1]){if(r.length!==n[1])throw new Jw(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let t=0;t<n[1];t++)rx(e,null,r[t],n[0],i)}else i.writeArray(r,r=>{rx(e,t,r,n[0],i)});else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),rx(e,t,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach((r,o)=>{rx(e,t,o,n.key,i),rx(e,t,r,n.value,i)});break;default:throw new Jw(`FieldType ${n} unrecognized`)}else nx(e,r,i)}catch(uh){throw uh instanceof Jw&&uh.addToFieldPath(t),uh}}function nx(e,t,r){if("function"==typeof t.borshSerialize)return void t.borshSerialize(r);const n=e.get(t.constructor);if(!n)throw new Jw(`Class ${t.constructor.name} is missing in schema`);if("struct"===n.kind)n.fields.map(([n,i])=>{rx(e,n,t[n],i,r)});else{if("enum"!==n.kind)throw new Jw(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const i=t[n.field];for(let o=0;o<n.values.length;++o){const[s,a]=n.values[o];if(s===i){r.writeU8(o),rx(e,s,t[s],a,r);break}}}}}qw([Qw],ex.prototype,"readU8",null),qw([Qw],ex.prototype,"readU16",null),qw([Qw],ex.prototype,"readU32",null),qw([Qw],ex.prototype,"readU64",null),qw([Qw],ex.prototype,"readU128",null),qw([Qw],ex.prototype,"readU256",null),qw([Qw],ex.prototype,"readU512",null),qw([Qw],ex.prototype,"readString",null),qw([Qw],ex.prototype,"readFixedArray",null),qw([Qw],ex.prototype,"readArray",null),Aw.BinaryReader=ex;var ix=Aw.serialize=function(e,t,r=Xw){const n=new r;return nx(e,t,n),n.toArray()};function ox(e,t,r,n){try{if("string"==typeof r)return n[`read${tx(r)}`]();if(r instanceof Array){if("number"==typeof r[0])return n.readFixedArray(r[0]);if("number"==typeof r[1]){const t=[];for(let i=0;i<r[1];i++)t.push(ox(e,null,r[0],n));return t}return n.readArray(()=>ox(e,t,r[0],n))}if("option"===r.kind){return n.readU8()?ox(e,t,r.type,n):void 0}if("map"===r.kind){let i=new Map;const o=n.readU32();for(let s=0;s<o;s++){const o=ox(e,t,r.key,n),s=ox(e,t,r.value,n);i.set(o,s)}return i}return sx(e,r,n)}catch(uh){throw uh instanceof Jw&&uh.addToFieldPath(t),uh}}function sx(e,t,r){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(r);const n=e.get(t);if(!n)throw new Jw(`Class ${t.name} is missing in schema`);if("struct"===n.kind){const n={};for(const[i,o]of e.get(t).fields)n[i]=ox(e,i,o,r);return new t(n)}if("enum"===n.kind){const i=r.readU8();if(i>=n.values.length)throw new Jw(`Enum index: ${i} is out of range`);const[o,s]=n.values[i],a=ox(e,o,s,r);return new t({[o]:a})}throw new Jw(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}var ax=Aw.deserialize=function(e,t,r,n=ex){const i=new n(r),o=sx(e,t,i);if(i.offset<r.length)throw new Jw(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return o};Gw=Aw.deserializeUnchecked=function(e,t,r,n=ex){return sx(e,t,new n(r))};var cx={};Object.defineProperty(cx,"__esModule",{value:!0}),cx.s16=cx.s8=cx.nu64be=cx.u48be=cx.u40be=cx.u32be=cx.u24be=cx.u16be=Yx=cx.nu64=cx.u48=cx.u40=Zx=cx.u32=cx.u24=Kx=cx.u16=Vx=cx.u8=Hx=cx.offset=cx.greedy=cx.Constant=cx.UTF8=cx.CString=cx.Blob=cx.Boolean=cx.BitField=cx.BitStructure=cx.VariantLayout=cx.Union=cx.UnionLayoutDiscriminator=cx.UnionDiscriminator=cx.Structure=cx.Sequence=cx.DoubleBE=cx.Double=cx.FloatBE=cx.Float=cx.NearInt64BE=cx.NearInt64=cx.NearUInt64BE=cx.NearUInt64=cx.IntBE=cx.Int=cx.UIntBE=cx.UInt=cx.OffsetLayout=cx.GreedyCount=cx.ExternalLayout=cx.bindConstructorLayout=cx.nameWithProperty=cx.Layout=cx.uint8ArrayToBuffer=cx.checkUint8Array=void 0,cx.constant=cx.utf8=cx.cstr=ek=cx.blob=cx.unionLayoutDiscriminator=cx.union=Qx=cx.seq=cx.bits=Xx=cx.struct=cx.f64be=cx.f64=cx.f32be=cx.f32=cx.ns64be=cx.s48be=cx.s40be=cx.s32be=cx.s24be=cx.s16be=Jx=cx.ns64=cx.s48=cx.s40=cx.s32=cx.s24=void 0;const lx=ww;function ux(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function hx(e){return ux(e),lx.Buffer.from(e.buffer,e.byteOffset,e.length)}cx.checkUint8Array=ux,cx.uint8ArrayToBuffer=hx;class dx{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function px(e,t){return t.property?e+"["+t.property+"]":e}cx.Layout=dx,cx.nameWithProperty=px,cx.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof dx))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(e,"decode",{value:(e,r)=>t.decode(e,r),writable:!0})};class fx extends dx{isCount(){throw new Error("ExternalLayout is abstract")}}cx.ExternalLayout=fx;class mx extends fx{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){ux(e);const r=e.length-t;return Math.floor(r/this.elementSpan)}encode(e,t,r){return 0}}cx.GreedyCount=mx;class gx extends fx{constructor(e,t=0,r){if(!(e instanceof dx))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof yx||this.layout instanceof vx}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}cx.OffsetLayout=gx;class yx extends dx{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return hx(e).readUIntLE(t,this.span)}encode(e,t,r=0){return hx(t).writeUIntLE(e,r,this.span),this.span}}cx.UInt=yx;class vx extends dx{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return hx(e).readUIntBE(t,this.span)}encode(e,t,r=0){return hx(t).writeUIntBE(e,r,this.span),this.span}}cx.UIntBE=vx;class bx extends dx{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return hx(e).readIntLE(t,this.span)}encode(e,t,r=0){return hx(t).writeIntLE(e,r,this.span),this.span}}cx.Int=bx;class wx extends dx{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return hx(e).readIntBE(t,this.span)}encode(e,t,r=0){return hx(t).writeIntBE(e,r,this.span),this.span}}cx.IntBE=wx;const xx=Math.pow(2,32);function kx(e){const t=Math.floor(e/xx);return{hi32:t,lo32:e-t*xx}}function _x(e,t){return e*xx+t}class Sx extends dx{constructor(e){super(8,e)}decode(e,t=0){const r=hx(e),n=r.readUInt32LE(t);return _x(r.readUInt32LE(t+4),n)}encode(e,t,r=0){const n=kx(e),i=hx(t);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}cx.NearUInt64=Sx;class Cx extends dx{constructor(e){super(8,e)}decode(e,t=0){const r=hx(e);return _x(r.readUInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){const n=kx(e),i=hx(t);return i.writeUInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}cx.NearUInt64BE=Cx;class Ix extends dx{constructor(e){super(8,e)}decode(e,t=0){const r=hx(e),n=r.readUInt32LE(t);return _x(r.readInt32LE(t+4),n)}encode(e,t,r=0){const n=kx(e),i=hx(t);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}cx.NearInt64=Ix;class Ex extends dx{constructor(e){super(8,e)}decode(e,t=0){const r=hx(e);return _x(r.readInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){const n=kx(e),i=hx(t);return i.writeInt32BE(n.hi32,r),i.writeUInt32BE(n.lo32,r+4),8}}cx.NearInt64BE=Ex;class Ax extends dx{constructor(e){super(4,e)}decode(e,t=0){return hx(e).readFloatLE(t)}encode(e,t,r=0){return hx(t).writeFloatLE(e,r),4}}cx.Float=Ax;class Mx extends dx{constructor(e){super(4,e)}decode(e,t=0){return hx(e).readFloatBE(t)}encode(e,t,r=0){return hx(t).writeFloatBE(e,r),4}}cx.FloatBE=Mx;class Nx extends dx{constructor(e){super(8,e)}decode(e,t=0){return hx(e).readDoubleLE(t)}encode(e,t,r=0){return hx(t).writeDoubleLE(e,r),8}}cx.Double=Nx;class Px extends dx{constructor(e){super(8,e)}decode(e,t=0){return hx(e).readDoubleBE(t)}encode(e,t,r=0){return hx(t).writeDoubleBE(e,r),8}}cx.DoubleBE=Px;class Tx extends dx{constructor(e,t,r){if(!(e instanceof dx))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof fx&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;!(t instanceof fx)&&0<e.span&&(n=t*e.span),super(n,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof fx&&(n=n.decode(e,t)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(e,t+r),++i}return r}decode(e,t=0){const r=[];let n=0,i=this.count;for(i instanceof fx&&(i=i.decode(e,t));n<i;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),n+=1;return r}encode(e,t,r=0){const n=this.elementLayout,i=e.reduce((e,i)=>e+n.encode(i,t,r+e),0);return this.count instanceof fx&&this.count.encode(e.length,t,r),i}}cx.Sequence=Tx;class Ox extends dx{constructor(e,t,r){if(!Array.isArray(e)||!e.reduce((e,t)=>e&&t instanceof dx,!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===r&&(r=t,t=void 0);for(const o of e)if(0>o.span&&void 0===o.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce((e,t)=>e+t.getSpan(),0)}catch(i){}super(n,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,n)=>{const i=n.getSpan(e,t);return t+=i,r+i},0)}catch(n){throw new RangeError("indeterminate span")}return r}decode(e,t=0){ux(e);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){const n=r;let i=0,o=0;for(const s of this.fields){let n=s.span;if(o=0<n?n:0,void 0!==s.property){const i=e[s.property];void 0!==i&&(o=s.encode(i,t,r),0>n&&(n=s.getSpan(t,r)))}i=r,r+=n}return i+o-n}fromArray(e){const t=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}cx.Structure=Ox;class Bx{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,r){throw new Error("UnionDiscriminator is abstract")}}cx.UnionDiscriminator=Bx;class Rx extends Bx{constructor(e,t){if(!(e instanceof fx&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}}cx.UnionLayoutDiscriminator=Rx;class Lx extends dx{constructor(e,t,r){let n;if(e instanceof yx||e instanceof vx)n=new Rx(new gx(e));else if(e instanceof fx&&e.isCount())n=new Rx(e);else{if(!(e instanceof Bx))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");n=e}if(void 0===t&&(t=null),!(null===t||t instanceof dx))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&(i=t.span,0<=i&&(e instanceof yx||e instanceof vx)&&(i+=n.layout.span)),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=e instanceof yx||e instanceof vx,this.defaultLayout=t,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return o(e)},this.configGetSourceVariant=function(e){o=e.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;const r=this.getVariant(e,t);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(const t in this.registry){const r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}decode(e,t=0){let r;const n=this.discriminator,i=n.decode(e,t),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=n.layout.span),r=this.makeDestinationObject(),r[n.property]=i,r[o.property]=o.decode(e,t+s)}else r=o.decode(e,t);return r}encode(e,t,r=0){const n=this.getSourceVariant(e);if(void 0===n){const n=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=n.layout.span),n.encode(e[n.property],t,r),o+i.encode(e[i.property],t,r+o)}return n.encode(e,t,r)}addVariant(e,t,r){const n=new jx(this,e,t,r);return this.registry[e]=n,n}getVariant(e,t=0){let r;return r=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[r]}}cx.Union=Lx;class jx extends dx{constructor(e,t,r,n){if(!(e instanceof Lx))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof dx))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=r.span&&r.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof n)throw new TypeError("variant must have a String property")}let i=e.span;0>e.span&&(i=r?r.span:0,0<=i&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span)),super(i,n),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let n=0;return this.layout&&(n=this.layout.getSpan(e,t+r)),r+n}decode(e,t=0){const r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let i=n;if(this.layout&&(this.layout.encode(e[this.property],t,r+n),i+=this.layout.getSpan(t,r+n),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function Ux(e){return 0>e&&(e+=4294967296),e}cx.VariantLayout=jx;class Dx extends dx{constructor(e,t,r){if(!(e instanceof yx||e instanceof vx))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let n=0;this._packedSetValue=function(e){return n=Ux(e),this},this._packedGetValue=function(){return n}}decode(e,t=0){const r=this.makeDestinationObject(),n=this.word.decode(e,t);this._packedSetValue(n);for(const i of this.fields)void 0!==i.property&&(r[i.property]=i.decode(e));return r}encode(e,t,r=0){const n=this.word.decode(t,r);this._packedSetValue(n);for(const i of this.fields)if(void 0!==i.property){const t=e[i.property];void 0!==t&&i.encode(t)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){const r=new Fx(this,e,t);return this.fields.push(r),r}addBoolean(e){const t=new zx(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}}cx.BitStructure=Dx;class Fx{constructor(e,t,r){if(!(e instanceof Dx))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");const n=8*e.span,i=e.fields.reduce((e,t)=>e+t.bits,0);if(t+i>n)throw new Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=n-i-t),this.wordMask=Ux(this.valueMask<<this.start),this.property=r}decode(e,t){return Ux(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==Ux(e&this.valueMask))throw new TypeError(px("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),r=Ux(e<<this.start);this.container._packedSetValue(Ux(t&~this.wordMask)|r)}}cx.BitField=Fx;let zx=class extends Fx{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e=+e),super.encode(e)}};cx.Boolean=zx;let qx=class extends dx{constructor(e,t){if(!(e instanceof fx&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof fx||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),hx(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof fx&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw new TypeError(px("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw new RangeError("encoding overruns Uint8Array");const i=hx(e);return hx(t).write(i.toString("hex"),r,n,"hex"),this.length instanceof fx&&this.length.encode(n,t,r),n}};cx.Blob=qx;class $x extends dx{constructor(e){super(-1,e)}getSpan(e,t=0){ux(e);let r=t;for(;r<e.length&&0!==e[r];)r+=1;return 1+r-t}decode(e,t=0){const r=this.getSpan(e,t);return hx(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));const n=lx.Buffer.from(e,"utf8"),i=n.length;if(r+i>t.length)throw new RangeError("encoding overruns Buffer");const o=hx(t);return n.copy(o,r),o[r+i]=0,i+1}}cx.CString=$x;class Wx extends dx{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return ux(e),e.length-t}decode(e,t=0){const r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return hx(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));const n=lx.Buffer.from(e,"utf8"),i=n.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(r+i>t.length)throw new RangeError("encoding overruns Buffer");return n.copy(hx(t),r),i}}cx.UTF8=Wx;class Gx extends dx{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}}cx.Constant=Gx,cx.greedy=(e,t)=>new mx(e,t);var Hx=cx.offset=(e,t,r)=>new gx(e,t,r),Vx=cx.u8=e=>new yx(1,e),Kx=cx.u16=e=>new yx(2,e);cx.u24=e=>new yx(3,e);var Zx=cx.u32=e=>new yx(4,e);cx.u40=e=>new yx(5,e),cx.u48=e=>new yx(6,e);var Yx=cx.nu64=e=>new Sx(e);cx.u16be=e=>new vx(2,e),cx.u24be=e=>new vx(3,e),cx.u32be=e=>new vx(4,e),cx.u40be=e=>new vx(5,e),cx.u48be=e=>new vx(6,e),cx.nu64be=e=>new Cx(e),cx.s8=e=>new bx(1,e),cx.s16=e=>new bx(2,e),cx.s24=e=>new bx(3,e),cx.s32=e=>new bx(4,e),cx.s40=e=>new bx(5,e),cx.s48=e=>new bx(6,e);var Jx=cx.ns64=e=>new Ix(e);cx.s16be=e=>new wx(2,e),cx.s24be=e=>new wx(3,e),cx.s32be=e=>new wx(4,e),cx.s40be=e=>new wx(5,e),cx.s48be=e=>new wx(6,e),cx.ns64be=e=>new Ex(e),cx.f32=e=>new Ax(e),cx.f32be=e=>new Mx(e),cx.f64=e=>new Nx(e),cx.f64be=e=>new Px(e);var Xx=cx.struct=(e,t,r)=>new Ox(e,t,r);cx.bits=(e,t,r)=>new Dx(e,t,r);var Qx=cx.seq=(e,t,r)=>new Tx(e,t,r);cx.union=(e,t,r)=>new Lx(e,t,r),cx.unionLayoutDiscriminator=(e,t)=>new Rx(e,t);var ek=cx.blob=(e,t)=>new qx(e,t);cx.cstr=e=>new $x(e),cx.utf8=(e,t)=>new Wx(e,t),cx.constant=(e,t)=>new Gx(e,t);function tk(e){if(Array.isArray(e)){return"%5B"+e.map(tk).join("%2C%20")+"%5D"}return"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function rk([e,t]){return`${e}=${tk(t)}`}function nk(e,t={}){{let r=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(r+=` '${function(e){const t=Object.entries(e).map(rk).join("&");return btoa(t)}(t)}'`),`${r}\``}}var ik=class extends Error{constructor(...[e,t]){let r,n;if(t){const{cause:e,...i}=t;e&&(n={cause:e}),Object.keys(i).length>0&&(r=i)}super(nk(e,r),n),f(this,"cause",this.cause),f(this,"context"),this.context={__code:e,...r},this.name="SolanaError"}};function ok(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function sk(e){return 1!==(null==e?void 0:e.endian)}function ak(e){return t={fixedSize:e.size,write(t,r,n){e.range&&function(e,t,r,n){if(n<t||n>r)throw new ik(8078011,{codecDescription:e,max:r,min:t,value:n})}(e.name,e.range[0],e.range[1],t);const i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,sk(e.config)),r.set(new Uint8Array(i),n),n+e.size}},Object.freeze({...t,encode:e=>{const r=new Uint8Array(function(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}(e,t));return t.write(e,r,0),r}});var t}function ck(e){return t={fixedSize:e.size,read(t,r=0){!function(e,t,r=0){if(t.length-r<=0)throw new ik(8078e3,{codecDescription:e})}(e.name,t,r),function(e,t,r,n=0){const i=r.length-n;if(i<t)throw new ik(8078001,{bytesLength:i,codecDescription:e,expected:t})}(e.name,e.size,t,r);const n=new DataView(function(e,t,r){const n=e.byteOffset+(t??0),i=r??e.byteLength;return e.buffer.slice(n,n+i)}(t,r,e.size));return[e.get(n,sk(e.config)),r+e.size]}},Object.freeze({...t,decode:(e,r=0)=>t.read(e,r)[0]});var t}var lk=(e={})=>function(e,t){if(ok(e)!==ok(t))throw new ik(8078004);if(ok(e)&&ok(t)&&e.fixedSize!==t.fixedSize)throw new ik(8078005,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!ok(e)&&!ok(t)&&e.maxSize!==t.maxSize)throw new ik(8078006,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}(((e={})=>ak({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}))(e),((e={})=>ck({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}))(e));class uk extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...o}=e,{path:s}=e,a=0===s.length?n:`At path: ${s.join(".")} -- ${n}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function hk(e){return"object"==typeof e&&null!=e}function dk(e){return hk(e)&&!Array.isArray(e)}function pk(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function fk(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=r,{refinement:a,message:c=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${pk(n)}\``}=e;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*mk(e,t,r,n){var i;hk(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const o of e){const e=fk(o,t,r,n);e&&(yield e)}}function*gk(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:s=!1}=r,a={path:n,branch:i,mask:s};o&&(e=t.coercer(e,a));let c="valid";for(const l of t.validator(e,a))l.explanation=r.message,c="not_valid",yield[l,void 0];for(let[l,u,h]of t.entries(e,a)){const t=gk(u,h,{path:void 0===l?n:[...n,l],branch:void 0===l?i:[...i,u],coerce:o,mask:s,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):o&&(u=r[1],void 0===l?e=u:e instanceof Map?e.set(l,u):e instanceof Set?e.add(u):hk(e)&&(void 0!==u||l in e)&&(e[l]=u))}if("not_valid"!==c)for(const l of t.refiner(e,a))l.explanation=r.message,c="not_refined",yield[l,void 0];"valid"===c&&(yield[void 0,e])}let yk=class{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:o=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=r,this.entries=s,this.coercer=o,this.validator=n?(e,t)=>mk(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>mk(i(e,t),t,this,e):()=>[]}assert(e,t){return function(e,t,r){const n=wk(e,t,{message:r});if(n[0])throw n[0]}(e,this,t)}create(e,t){return vk(e,this,t)}is(e){return bk(e,this)}mask(e,t){return function(e,t,r){const n=wk(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}(e,this,t)}validate(e,t={}){return wk(e,this,t)}};function vk(e,t,r){const n=wk(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function bk(e,t){return!wk(e,t)[0]}function wk(e,t,r={}){const n=gk(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(i[0]){return[new uk(i[0],function*(){for(const e of n)e[0]&&(yield e[0])}),void 0]}return[void 0,i[1]]}function xk(e,t){return new yk({type:e,schema:null,validator:t})}function kk(e){return new yk({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${pk(e)}`})}function _k(){return xk("boolean",e=>"boolean"==typeof e)}function Sk(e){return xk("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${pk(t)}`)}function Ck(e){const t=pk(e),r=typeof e;return new yk({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${pk(r)}`})}function Ik(e){return new yk({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function Ek(){return xk("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${pk(e)}`)}function Ak(e){return new yk({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function Mk(e,t){return new yk({type:"record",schema:null,*entries(r){if(hk(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>dk(e)||`Expected an object, but received: ${pk(e)}`,coercer:e=>dk(e)?{...e}:e})}function Nk(){return xk("string",e=>"string"==typeof e||`Expected a string, but received: ${pk(e)}`)}function Pk(e){const t=xk("never",()=>!1);return new yk({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${pk(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function Tk(e){const t=Object.keys(e);return new yk({type:"type",schema:e,*entries(r){if(hk(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>dk(e)||`Expected an object, but received: ${pk(e)}`,coercer:e=>dk(e)?{...e}:e})}function Ok(e){const t=e.map(e=>e.type).join(" | ");return new yk({type:"union",schema:null,coercer(t,r){for(const n of e){const[e,i]=n.validate(t,{coerce:!0,mask:r.mask});if(!e)return i}return t},validator(r,n){const i=[];for(const t of e){const[...e]=gk(r,t,n),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${pk(r)}`,...i]}})}function Bk(){return xk("unknown",()=>!0)}function Rk(e,t,r){return new yk({...e,coercer:(n,i)=>bk(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}var Lk,jk=new Uint8Array(16);function Uk(){if(!Lk&&!(Lk="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lk(jk)}const Dk=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Fk(e){return"string"==typeof e&&Dk.test(e)}for(var zk,qk,$k=[],Wk=0;Wk<256;++Wk)$k.push((Wk+256).toString(16).substr(1));function Gk(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=($k[e[t+0]]+$k[e[t+1]]+$k[e[t+2]]+$k[e[t+3]]+"-"+$k[e[t+4]]+$k[e[t+5]]+"-"+$k[e[t+6]]+$k[e[t+7]]+"-"+$k[e[t+8]]+$k[e[t+9]]+"-"+$k[e[t+10]]+$k[e[t+11]]+$k[e[t+12]]+$k[e[t+13]]+$k[e[t+14]]+$k[e[t+15]]).toLowerCase();if(!Fk(r))throw TypeError("Stringified UUID is invalid");return r}var Hk=0,Vk=0;function Kk(e){if(!Fk(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}function Zk(e,t,r){function n(e,n,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=Kk(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+e.length);if(s.set(n),s.set(e,n.length),(s=r(s))[6]=15&s[6]|t,s[8]=63&s[8]|128,i){o=o||0;for(var a=0;a<16;++a)i[o+a]=s[a];return i}return Gk(s)}try{n.name=e}catch(oA){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Yk(e){return 14+(e+64>>>9<<4)+1}function Jk(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function Xk(e,t,r,n,i,o){return Jk((s=Jk(Jk(t,e),Jk(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function Qk(e,t,r,n,i,o,s){return Xk(t&r|~t&n,e,t,i,o,s)}function e_(e,t,r,n,i,o,s){return Xk(t&n|r&~n,e,t,i,o,s)}function t_(e,t,r,n,i,o,s){return Xk(t^r^n,e,t,i,o,s)}function r_(e,t,r,n,i,o,s){return Xk(r^(t|~n),e,t,i,o,s)}var n_=Zk("v3",48,function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",i=0;i<r;i+=8){var o=e[i>>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Yk(t)-1]=t;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s<e.length;s+=16){var a=r,c=n,l=i,u=o;r=Qk(r,n,i,o,e[s],7,-680876936),o=Qk(o,r,n,i,e[s+1],12,-389564586),i=Qk(i,o,r,n,e[s+2],17,606105819),n=Qk(n,i,o,r,e[s+3],22,-1044525330),r=Qk(r,n,i,o,e[s+4],7,-176418897),o=Qk(o,r,n,i,e[s+5],12,1200080426),i=Qk(i,o,r,n,e[s+6],17,-1473231341),n=Qk(n,i,o,r,e[s+7],22,-45705983),r=Qk(r,n,i,o,e[s+8],7,1770035416),o=Qk(o,r,n,i,e[s+9],12,-1958414417),i=Qk(i,o,r,n,e[s+10],17,-42063),n=Qk(n,i,o,r,e[s+11],22,-1990404162),r=Qk(r,n,i,o,e[s+12],7,1804603682),o=Qk(o,r,n,i,e[s+13],12,-40341101),i=Qk(i,o,r,n,e[s+14],17,-1502002290),r=e_(r,n=Qk(n,i,o,r,e[s+15],22,1236535329),i,o,e[s+1],5,-165796510),o=e_(o,r,n,i,e[s+6],9,-1069501632),i=e_(i,o,r,n,e[s+11],14,643717713),n=e_(n,i,o,r,e[s],20,-373897302),r=e_(r,n,i,o,e[s+5],5,-701558691),o=e_(o,r,n,i,e[s+10],9,38016083),i=e_(i,o,r,n,e[s+15],14,-660478335),n=e_(n,i,o,r,e[s+4],20,-405537848),r=e_(r,n,i,o,e[s+9],5,568446438),o=e_(o,r,n,i,e[s+14],9,-1019803690),i=e_(i,o,r,n,e[s+3],14,-187363961),n=e_(n,i,o,r,e[s+8],20,1163531501),r=e_(r,n,i,o,e[s+13],5,-1444681467),o=e_(o,r,n,i,e[s+2],9,-51403784),i=e_(i,o,r,n,e[s+7],14,1735328473),r=t_(r,n=e_(n,i,o,r,e[s+12],20,-1926607734),i,o,e[s+5],4,-378558),o=t_(o,r,n,i,e[s+8],11,-2022574463),i=t_(i,o,r,n,e[s+11],16,1839030562),n=t_(n,i,o,r,e[s+14],23,-35309556),r=t_(r,n,i,o,e[s+1],4,-1530992060),o=t_(o,r,n,i,e[s+4],11,1272893353),i=t_(i,o,r,n,e[s+7],16,-155497632),n=t_(n,i,o,r,e[s+10],23,-1094730640),r=t_(r,n,i,o,e[s+13],4,681279174),o=t_(o,r,n,i,e[s],11,-358537222),i=t_(i,o,r,n,e[s+3],16,-722521979),n=t_(n,i,o,r,e[s+6],23,76029189),r=t_(r,n,i,o,e[s+9],4,-640364487),o=t_(o,r,n,i,e[s+12],11,-421815835),i=t_(i,o,r,n,e[s+15],16,530742520),r=r_(r,n=t_(n,i,o,r,e[s+2],23,-995338651),i,o,e[s],6,-198630844),o=r_(o,r,n,i,e[s+7],10,1126891415),i=r_(i,o,r,n,e[s+14],15,-1416354905),n=r_(n,i,o,r,e[s+5],21,-57434055),r=r_(r,n,i,o,e[s+12],6,1700485571),o=r_(o,r,n,i,e[s+3],10,-1894986606),i=r_(i,o,r,n,e[s+10],15,-1051523),n=r_(n,i,o,r,e[s+1],21,-2054922799),r=r_(r,n,i,o,e[s+8],6,1873313359),o=r_(o,r,n,i,e[s+15],10,-30611744),i=r_(i,o,r,n,e[s+6],15,-1560198380),n=r_(n,i,o,r,e[s+13],21,1309151649),r=r_(r,n,i,o,e[s+4],6,-145523070),o=r_(o,r,n,i,e[s+11],10,-1120210379),i=r_(i,o,r,n,e[s+2],15,718787259),n=r_(n,i,o,r,e[s+9],21,-343485551),r=Jk(r,a),n=Jk(n,c),i=Jk(i,l),o=Jk(o,u)}return[r,n,i,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(Yk(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))});function i_(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function o_(e,t){return e<<t|e>>>32-t}var s_=Zk("v5",80,function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i<n.length;++i)e.push(n.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.length/4+2,s=Math.ceil(o/16),a=new Array(s),c=0;c<s;++c){for(var l=new Uint32Array(16),u=0;u<16;++u)l[u]=e[64*c+4*u]<<24|e[64*c+4*u+1]<<16|e[64*c+4*u+2]<<8|e[64*c+4*u+3];a[c]=l}a[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(var h=0;h<s;++h){for(var d=new Uint32Array(80),p=0;p<16;++p)d[p]=a[h][p];for(var f=16;f<80;++f)d[f]=o_(d[f-3]^d[f-8]^d[f-14]^d[f-16],1);for(var m=r[0],g=r[1],y=r[2],v=r[3],b=r[4],w=0;w<80;++w){var x=Math.floor(w/20),k=o_(m,5)+i_(x,g,y,v)+b+t[x]+d[w]>>>0;b=v,v=y,y=o_(g,30)>>>0,g=m,m=k}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]});const a_=vw(Object.freeze(Object.defineProperty({__proto__:null,NIL:"00000000-0000-0000-0000-000000000000",parse:Kk,stringify:Gk,v1:function(e,t,r){var n=t&&r||0,i=t||new Array(16),o=(e=e||{}).node||zk,s=void 0!==e.clockseq?e.clockseq:qk;if(null==o||null==s){var a=e.random||(e.rng||Uk)();null==o&&(o=zk=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=qk=16383&(a[6]<<8|a[7]))}var c=void 0!==e.msecs?e.msecs:Date.now(),l=void 0!==e.nsecs?e.nsecs:Vk+1,u=c-Hk+(l-Vk)/1e4;if(u<0&&void 0===e.clockseq&&(s=s+1&16383),(u<0||c>Hk)&&void 0===e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Hk=c,Vk=l,qk=s;var h=(1e4*(268435455&(c+=122192928e5))+l)%4294967296;i[n++]=h>>>24&255,i[n++]=h>>>16&255,i[n++]=h>>>8&255,i[n++]=255&h;var d=c/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=255&d,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var p=0;p<6;++p)i[n+p]=o[p];return t||Gk(i)},v3:n_,v4:function(e,t,r){var n=(e=e||{}).random||(e.rng||Uk)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return Gk(n)},v5:s_,validate:Fk,version:function(e){if(!Fk(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},Symbol.toStringTag,{value:"Module"}))),c_=a_.v4;var l_=function(e,t,r,n){if("string"!=typeof e)throw new TypeError(e+" must be a string");const i="number"==typeof(n=n||{}).version?n.version:2;if(1!==i&&2!==i)throw new TypeError(i+" must be 1 or 2");const o={method:e};if(2===i&&(o.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");o.params=t}if(void 0===r){const e="function"==typeof n.generator?n.generator:function(){return c_()};o.id=e(o,n)}else 2===i&&null===r?n.notificationIdNull&&(o.id=null):o.id=r;return o};const u_=a_.v4,h_=l_,d_=function(e,t){if(!(this instanceof d_))return new d_(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return u_()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};var p_=d_;d_.prototype.request=function(e,t,r,n){const i=this;let o=null;const s=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&s)throw new TypeError("JSON-RPC 1.0 does not support batching");if(s||!s&&e&&"object"==typeof e&&"function"==typeof t)n=t,o=e;else{"function"==typeof r&&(n=r,r=void 0);const i="function"==typeof n;try{o=h_(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(oA){if(i)return void n(oA);throw oA}if(!i)return o}let a;try{a=JSON.stringify(o,this.options.replacer)}catch(oA){return void n(oA)}return this.callServer(a,function(e,t){i._parseResponse(e,t,n)}),o},d_.prototype._parseResponse=function(e,t,r){if(e)return void r(e);if(!t)return void r();let n;try{n=JSON.parse(t,this.options.reviver)}catch(i){return void r(i)}if(3!==r.length)r(null,n);else{if(Array.isArray(n)){const e=function(e){return void 0!==e.error},t=function(t){return!e(t)};return void r(null,n.filter(e),n.filter(t))}r(null,n.error,n.result)}};const f_=yw(p_);var m_={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var c,l,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,o),!0;case 6:return u.fn.call(u.context,t,n,i,o,s),!0}for(l=1,c=new Array(h-1);l<h;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var d,p=u.length;for(l=0;l<p;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),h){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,n);break;case 4:u[l].fn.call(u[l].context,t,n,i);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];u[l].fn.apply(u[l].context,c)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var c=0,l=[],u=a.length;c<u;c++)(a[c].fn!==t||i&&!a[c].once||n&&a[c].context!==n)&&l.push(a[c]);l.length?this._events[o]=1===l.length?l[0]:l:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a}(m_);const g_=yw(m_.exports);var y_=class extends g_{constructor(e,t){super(),f(this,"socket"),this.socket=new window.WebSocket(e,t.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,r){const n=r||t;try{this.socket.send(e),n()}catch(uh){n(uh)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,r){this.socket.addEventListener(e,t,r)}};var v_=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},b_=class extends g_{constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:n=!0,reconnect_interval:i=1e3,max_reconnects:o=5,...s}={},a,c){super(),f(this,"address"),f(this,"rpc_id"),f(this,"queue"),f(this,"options"),f(this,"autoconnect"),f(this,"ready"),f(this,"reconnect"),f(this,"reconnect_timer_id"),f(this,"reconnect_interval"),f(this,"max_reconnects"),f(this,"rest_options"),f(this,"current_reconnects"),f(this,"generate_request_id"),f(this,"socket"),f(this,"webSocketFactory"),f(this,"dataPack"),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=n,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=o,this.rest_options=s,this.current_reconnects=0,this.generate_request_id=a||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),this.dataPack=c||new v_,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,r,n){return n||"object"!=typeof r||(n=r,r=null),new Promise((i,o)=>{if(!this.ready)return o(new Error("socket not ready"));const s=this.generate_request_id(e,t),a={jsonrpc:"2.0",method:e,params:t||void 0,id:s};this.socket.send(this.dataPack.encode(a),n,e=>{if(e)return o(e);this.queue[s]={promise:[i,o]},r&&(this.queue[s].timeout=setTimeout(()=>{delete this.queue[s],o(new Error("reply timeout"))},r))})})}async login(e){const t=await this.call("rpc.login",e);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise((r,n)=>{if(!this.ready)return n(new Error("socket not ready"));const i={jsonrpc:"2.0",method:e,params:t};this.socket.send(this.dataPack.encode(i),e=>{if(e)return n(e);r()})})}async subscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket&&this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return void 0!==this.reconnect_timer_id}willReconnect(){return this.reconnect&&(0===this.max_reconnects||this.current_reconnects<this.max_reconnects)}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=M.from(e).toString());try{e=this.dataPack.decode(e)}catch(uh){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);const t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let r=0;r<e.params.length;r++)t.push(e.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,t)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,null==e?void 0:e.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>this.emit("error",e)),this.socket.addEventListener("close",({code:r,reason:n})=>{this.ready&&setTimeout(()=>this.emit("close",r,n),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)?this.reconnect_timer_id=setTimeout(()=>this._connect(e,t),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,n),1))})}};
18
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
19
+ const w_=(e,t)=>(e+(e>=0?t:-t)/E_)/t;function x_(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function k_(e,t){const r={};for(let n of Object.keys(t))r[n]=void 0===e[n]?t[n]:e[n];return Yv(r.lowS,"lowS"),Yv(r.prehash,"prehash"),void 0!==r.format&&x_(r.format),r}class __ extends Error{constructor(e=""){super(e)}}const S_={Err:__,_tlv:{encode:(e,t)=>{const{Err:r}=S_;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");const n=t.length/2,i=Xv(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const o=n>127?Xv(i.length/2|128):"";return Xv(e)+o+i+t},decode(e,t){const{Err:r}=S_;let n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");const i=t[n++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const s=t.subarray(n,n+e);if(s.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(const t of s)o=o<<8|t;if(n+=e,o<128)throw new r("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(n,n+o);if(s.length!==o)throw new r("tlv.decode: wrong value length");return{v:s,l:t.subarray(n+o)}}},_int:{encode(e){const{Err:t}=S_;if(e<C_)throw new t("integer: negative integers are not allowed");let r=Xv(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){const{Err:t}=S_;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return eb(e)}},toSig(e){const{Err:t,_int:r,_tlv:n}=S_,i=ib("signature",e),{v:o,l:s}=n.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=n.decode(2,o),{v:l,l:u}=n.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){const{_tlv:t,_int:r}=S_,n=t.encode(2,r.encode(e.r))+t.encode(2,r.encode(e.s));return t.encode(48,n)}},C_=BigInt(0),I_=BigInt(1),E_=BigInt(2),A_=BigInt(3),M_=BigInt(4);function N_(e,t){const{BYTES:r}=e;let n;if("bigint"==typeof t)n=t;else{let i=ib("private key",t);try{n=e.fromBytes(i)}catch(uh){throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof t}`)}}if(!e.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function P_(e,t={}){const r=Jb("weierstrass",e,t),{Fp:n,Fn:i}=r;let o=r.CURVE;const{h:s,n:a}=o;ub(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!n.is0(o.a)||"bigint"!=typeof c.beta||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=O_(n,i);function u(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const h=t.toBytes||function(e,t,r){const{x:i,y:o}=t.toAffine(),s=n.toBytes(i);if(Yv(r,"isCompressed"),r){u();return Gg(T_(!n.isOdd(o)),s)}return Gg(Uint8Array.of(4),s,n.toBytes(o))},d=t.fromBytes||function(e){Jv(e,void 0,"Point");const{publicKey:t,publicKeyUncompressed:r}=l,i=e.length,o=e[0],s=e.subarray(1);if(i!==t||2!==o&&3!==o){if(i===r&&4===o){const e=n.BYTES,t=n.fromBytes(s.subarray(0,e)),r=n.fromBytes(s.subarray(e,2*e));if(!f(t,r))throw new Error("bad point: is not on curve");return{x:t,y:r}}throw new Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${r}`)}{const e=n.fromBytes(s);if(!n.isValid(e))throw new Error("bad point: is not on curve, wrong x");const t=p(e);let r;try{r=n.sqrt(t)}catch(a){const e=a instanceof Error?": "+a.message:"";throw new Error("bad point: is not on curve, sqrt error"+e)}u();return!(1&~o)!==n.isOdd(r)&&(r=n.neg(r)),{x:e,y:r}}};function p(e){const t=n.sqr(e),r=n.mul(t,e);return n.add(n.add(r,n.mul(e,o.a)),o.b)}function f(e,t){const r=n.sqr(t),i=p(e);return n.eql(r,i)}if(!f(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const m=n.mul(n.pow(o.a,A_),M_),g=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(m,g)))throw new Error("bad curve params: a or b");function y(e,t,r=!1){if(!n.isValid(t)||r&&n.is0(t))throw new Error(`bad point coordinate ${e}`);return t}function v(e){if(!(e instanceof _))throw new Error("ProjectivePoint expected")}function b(e){if(!c||!c.basises)throw new Error("no endo");return function(e,t,r){const[[n,i],[o,s]]=t,a=w_(s*e,r),c=w_(-i*e,r);let l=e-a*n-c*o,u=-a*i-c*s;const h=l<C_,d=u<C_;h&&(l=-l),d&&(u=-u);const p=lb(Math.ceil(cb(r)/2))+I_;if(l<C_||l>=p||u<C_||u>=p)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:h,k1:l,k2neg:d,k2:u}}(e,c.basises,i.ORDER)}const w=hb((e,t)=>{const{X:r,Y:i,Z:o}=e;if(n.eql(o,n.ONE))return{x:r,y:i};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(o));const a=n.mul(r,t),c=n.mul(i,t),l=n.mul(o,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw new Error("invZ was invalid");return{x:a,y:c}}),x=hb(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.Y))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not field elements");if(!f(r,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function k(e,t,r,i,o){return r=new _(n.mul(r.X,e),r.Y,r.Z),t=Db(i,t),r=Db(o,r),t.add(r)}class _{constructor(e,t,r){this.X=y("x",e),this.Y=y("y",t,!0),this.Z=y("z",r),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof _)throw new Error("projective point not allowed");return n.is0(t)&&n.is0(r)?_.ZERO:new _(t,r,n.ONE)}static fromBytes(e){const t=_.fromAffine(d(Jv(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return _.fromBytes(ib("pointHex",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return C.createCache(this,e),t||this.multiply(A_),this}assertValidity(){x(this)}hasEvenY(){const{y:e}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(e)}equals(e){v(e);const{X:t,Y:r,Z:i}=this,{X:o,Y:s,Z:a}=e,c=n.eql(n.mul(t,a),n.mul(o,i)),l=n.eql(n.mul(r,a),n.mul(s,i));return c&&l}negate(){return new _(this.X,n.neg(this.Y),this.Z)}double(){const{a:e,b:t}=o,r=n.mul(t,A_),{X:i,Y:s,Z:a}=this;let c=n.ZERO,l=n.ZERO,u=n.ZERO,h=n.mul(i,i),d=n.mul(s,s),p=n.mul(a,a),f=n.mul(i,s);return f=n.add(f,f),u=n.mul(i,a),u=n.add(u,u),c=n.mul(e,u),l=n.mul(r,p),l=n.add(c,l),c=n.sub(d,l),l=n.add(d,l),l=n.mul(c,l),c=n.mul(f,c),u=n.mul(r,u),p=n.mul(e,p),f=n.sub(h,p),f=n.mul(e,f),f=n.add(f,u),u=n.add(h,h),h=n.add(u,h),h=n.add(h,p),h=n.mul(h,f),l=n.add(l,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,f),c=n.sub(c,h),u=n.mul(p,d),u=n.add(u,u),u=n.add(u,u),new _(c,l,u)}add(e){v(e);const{X:t,Y:r,Z:i}=this,{X:s,Y:a,Z:c}=e;let l=n.ZERO,u=n.ZERO,h=n.ZERO;const d=o.a,p=n.mul(o.b,A_);let f=n.mul(t,s),m=n.mul(r,a),g=n.mul(i,c),y=n.add(t,r),b=n.add(s,a);y=n.mul(y,b),b=n.add(f,m),y=n.sub(y,b),b=n.add(t,i);let w=n.add(s,c);return b=n.mul(b,w),w=n.add(f,g),b=n.sub(b,w),w=n.add(r,i),l=n.add(a,c),w=n.mul(w,l),l=n.add(m,g),w=n.sub(w,l),h=n.mul(d,b),l=n.mul(p,g),h=n.add(l,h),l=n.sub(m,h),h=n.add(m,h),u=n.mul(l,h),m=n.add(f,f),m=n.add(m,f),g=n.mul(d,g),b=n.mul(p,b),m=n.add(m,g),g=n.sub(f,g),g=n.mul(d,g),b=n.add(b,g),f=n.mul(m,b),u=n.add(u,f),f=n.mul(w,b),l=n.mul(y,l),l=n.sub(l,f),f=n.mul(y,m),h=n.mul(w,h),h=n.add(h,f),new _(l,u,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(_.ZERO)}multiply(e){const{endo:r}=t;if(!i.isValidNot0(e))throw new Error("invalid scalar: out of range");let n,o;const s=e=>C.cached(this,e,e=>Fb(_,e));if(r){const{k1neg:t,k1:i,k2neg:a,k2:c}=b(e),{p:l,f:u}=s(i),{p:h,f:d}=s(c);o=u.add(d),n=k(r.beta,l,h,t,a)}else{const{p:t,f:r}=s(e);n=t,o=r}return Fb(_,[n,o])[0]}multiplyUnsafe(e){const{endo:r}=t,n=this;if(!i.isValid(e))throw new Error("invalid scalar: out of range");if(e===C_||n.is0())return _.ZERO;if(e===I_)return n;if(C.hasCache(this))return this.multiply(e);if(r){const{k1neg:t,k1:i,k2neg:o,k2:s}=b(e),{p1:a,p2:c}=function(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>jb||n>jb;)r&Ub&&(o=o.add(i)),n&Ub&&(s=s.add(i)),i=i.double(),r>>=Ub,n>>=Ub;return{p1:o,p2:s}}(_,n,i,s);return k(r.beta,a,c,t,o)}return C.unsafe(n,e)}multiplyAndAddUnsafe(e,t,r){const n=this.multiplyUnsafe(t).add(e.multiplyUnsafe(r));return n.is0()?void 0:n}toAffine(e){return w(this,e)}isTorsionFree(){const{isTorsionFree:e}=t;return s===I_||(e?e(_,this):C.unsafe(this,a).is0())}clearCofactor(){const{clearCofactor:e}=t;return s===I_?this:e?e(_,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(e=!0){return Yv(e,"isCompressed"),this.assertValidity(),h(_,this,e)}toHex(e=!0){return Rg(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return Fb(_,e)}static msm(e,t){return Zb(_,i,e,t)}static fromPrivateKey(e){return _.BASE.multiply(N_(i,e))}}_.BASE=new _(o.Gx,o.Gy,n.ONE),_.ZERO=new _(n.ZERO,n.ONE,n.ZERO),_.Fp=n,_.Fn=i;const S=i.BITS,C=new Kb(_,t.endo?Math.ceil(S/2):S);return _.BASE.precompute(8),_}function T_(e){return Uint8Array.of(e?2:3)}function O_(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function B_(e,t={}){const{Fn:r}=e,n=t.randomBytes||Kg,i=Object.assign(O_(e.Fp,r),{seed:Lb(r.ORDER)});function o(e){try{return!!N_(r,e)}catch(uh){return!1}}function s(e=n(i.seed)){return function(e,t,r=!1){const n=e.length,i=Rb(t),o=Lb(t);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);const s=kb(r?tb(e):eb(e),t-pb)+pb;return r?nb(s,i):rb(s,i)}(Jv(e,i.seed,"seed"),r.ORDER)}function a(t,n=!0){return e.BASE.multiply(N_(r,t)).toBytes(n)}function c(t){if("bigint"==typeof t)return!1;if(t instanceof e)return!0;const{secretKey:n,publicKey:o,publicKeyUncompressed:s}=i;if(r.allowedLengths||n===o)return;const a=ib("key",t).length;return a===o||a===s}const l={isValidSecretKey:o,isValidPublicKey:function(t,r){const{publicKey:n,publicKeyUncompressed:o}=i;try{const i=t.length;return(!0!==r||i===n)&&((!1!==r||i===o)&&!!e.fromBytes(t))}catch(uh){return!1}},randomSecretKey:s,isValidPrivateKey:o,randomPrivateKey:s,normPrivateKeyToScalar:e=>N_(r,e),precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({getPublicKey:a,getSharedSecret:function(t,n,i=!0){if(!0===c(t))throw new Error("first arg must be private key");if(!1===c(n))throw new Error("second arg must be public key");const o=N_(r,t);return e.fromHex(n).multiply(o).toBytes(i)},keygen:function(e){const t=s(e);return{secretKey:t,publicKey:a(t)}},Point:e,utils:l,lengths:i})}function R_(e,t,r={}){Cg(t),ub(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=r.randomBytes||Kg,i=r.hmac||((e,...r)=>Uv(t,e,Gg(...r))),{Fp:o,Fn:s}=e,{ORDER:a,BITS:c}=s,{keygen:l,getPublicKey:u,getSharedSecret:h,utils:d,lengths:p}=B_(e,r),f={prehash:!1,lowS:"boolean"==typeof r.lowS&&r.lowS,format:void 0,extraEntropy:!1},m="compact";function g(e){return e>a>>I_}function y(e,t){if(!s.isValidNot0(t))throw new Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}class v{constructor(e,t,r){this.r=y("r",e),this.s=y("s",t),null!=r&&(this.recovery=r),Object.freeze(this)}static fromBytes(e,t=m){let r;if(function(e,t){x_(t);const r=p.signature;Jv(e,"compact"===t?r:"recovered"===t?r+1:void 0,`${t} signature`)}(e,t),"der"===t){const{r:t,s:r}=S_.toSig(Jv(e));return new v(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));const n=s.BYTES,i=e.subarray(0,n),o=e.subarray(n,2*n);return new v(s.fromBytes(i),s.fromBytes(o),r)}static fromHex(e,t){return this.fromBytes($g(e),t)}addRecoveryBit(e){return new v(this.r,this.s,e)}recoverPublicKey(t){const r=o.ORDER,{r:n,s:i,recovery:c}=this;if(null==c||![0,1,2,3].includes(c))throw new Error("recovery id invalid");if(a*E_<r&&c>1)throw new Error("recovery id is ambiguous for h>1 curve");const l=2===c||3===c?n+a:n;if(!o.isValid(l))throw new Error("recovery id 2 or 3 invalid");const u=o.toBytes(l),h=e.fromBytes(Gg(T_(!(1&c)),u)),d=s.inv(l),p=w(ib("msgHash",t)),f=s.create(-p*d),m=s.create(i*d),g=e.BASE.multiplyUnsafe(f).add(h.multiplyUnsafe(m));if(g.is0())throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return g(this.s)}toBytes(e=m){if(x_(e),"der"===e)return $g(S_.hexFromSig(this));const t=s.toBytes(this.r),r=s.toBytes(this.s);if("recovered"===e){if(null==this.recovery)throw new Error("recovery bit must be present");return Gg(Uint8Array.of(this.recovery),t,r)}return Gg(t,r)}toHex(e){return Rg(this.toBytes(e))}assertValidity(){}static fromCompact(e){return v.fromBytes(ib("sig",e),"compact")}static fromDER(e){return v.fromBytes(ib("sig",e),"der")}normalizeS(){return this.hasHighS()?new v(this.r,s.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Rg(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Rg(this.toBytes("compact"))}}const b=r.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=eb(e),r=8*e.length-c;return r>0?t>>BigInt(r):t},w=r.bits2int_modN||function(e){return s.create(b(e))},x=lb(c);function k(e){return ab("num < 2^"+c,e,C_,x),s.toBytes(e)}function _(e,r){return Jv(e,void 0,"message"),r?Jv(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:h,utils:d,lengths:p,Point:e,sign:function(r,o,a={}){r=ib("message",r);const{seed:c,k2sig:l}=function(t,r,i){if(["recovered","canonical"].some(e=>e in i))throw new Error("sign() legacy options not supported");const{lowS:o,prehash:a,extraEntropy:c}=k_(i,f);t=_(t,a);const l=w(t),u=N_(s,r),h=[k(u),k(l)];if(null!=c&&!1!==c){const e=!0===c?n(p.secretKey):c;h.push(ib("extraEntropy",e))}const d=Gg(...h),m=l;return{seed:d,k2sig:function(t){const r=b(t);if(!s.isValidNot0(r))return;const n=s.inv(r),i=e.BASE.multiply(r).toAffine(),a=s.create(i.x);if(a===C_)return;const c=s.create(n*s.create(m+a*u));if(c===C_)return;let l=(i.x===a?0:2)|Number(i.y&I_),h=c;return o&&g(c)&&(h=s.neg(c),l^=1),new v(a,h,l)}}}(r,o,a);return function(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");const n=e=>new Uint8Array(e),i=e=>Uint8Array.of(e);let o=n(e),s=n(e),a=0;const c=()=>{o.fill(1),s.fill(0),a=0},l=(...e)=>r(s,o,...e),u=(e=n(0))=>{s=l(i(0),e),o=l(),0!==e.length&&(s=l(i(1),e),o=l())},h=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){o=l();const t=o.slice();r.push(t),e+=o.length}return Gg(...r)};return(e,t)=>{let r;for(c(),u(e);!(r=t(h()));)u();return c(),r}}(t.outputLen,s.BYTES,i)(c,l)},verify:function(t,r,n,i={}){const{lowS:o,prehash:a,format:c}=k_(i,f);if(n=ib("publicKey",n),r=_(ib("message",r),a),"strict"in i)throw new Error("options.strict was renamed to lowS");const l=void 0===c?function(e){let t;const r="string"==typeof e||kg(e),n=!r&&null!==e&&"object"==typeof e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!r&&!n)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(n)t=new v(e.r,e.s);else if(r){try{t=v.fromBytes(ib("sig",e),"der")}catch(i){if(!(i instanceof S_.Err))throw i}if(!t)try{t=v.fromBytes(ib("sig",e),"compact")}catch(uh){return!1}}return t||!1}(t):v.fromBytes(ib("sig",t),c);if(!1===l)return!1;try{const t=e.fromBytes(n);if(o&&l.hasHighS())return!1;const{r:i,s:a}=l,c=w(r),u=s.inv(a),h=s.create(c*u),d=s.create(i*u),p=e.BASE.multiplyUnsafe(h).add(t.multiplyUnsafe(d));if(p.is0())return!1;return s.create(p.x)===i}catch(u){return!1}},recoverPublicKey:function(e,t,r={}){const{prehash:n}=k_(r,f);return t=_(t,n),v.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:v,hash:t})}function L_(e){const{CURVE:t,curveOpts:r}=function(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r=e.Fp;let n=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0;return{CURVE:t,curveOpts:{Fp:r,Fn:Bb(t.n,{BITS:e.nBitLength,allowedLengths:n,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes}}}(e),n={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:r,hash:e.hash,ecdsaOpts:n}}function j_(e){const{CURVE:t,curveOpts:r,hash:n,ecdsaOpts:i}=L_(e);return function(e,t){const r=t.Point;return Object.assign({},t,{ProjectivePoint:r,CURVE:Object.assign({},e,Ob(r.Fn.ORDER,r.Fn.BITS))})}(e,R_(P_(t,r),n,i))}
20
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
21
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
22
+ const U_={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},D_={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},F_=BigInt(2);const z_=Bb(U_.p,{sqrt:function(e){const t=U_.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,h=_b(u,r,t)*u%t,d=_b(h,r,t)*u%t,p=_b(d,F_,t)*l%t,f=_b(p,i,t)*p%t,m=_b(f,o,t)*f%t,g=_b(m,a,t)*m%t,y=_b(g,c,t)*g%t,v=_b(y,a,t)*m%t,b=_b(v,r,t)*u%t,w=_b(b,s,t)*f%t,x=_b(w,n,t)*l%t,k=_b(x,F_,t);if(!z_.eql(z_.sqr(k),e))throw new Error("Cannot find square root");return k}}),q_=function(e,t){const r=t=>j_({...e,hash:t});return{...r(t),create:r}}({...U_,Fp:z_,lowS:!0,endo:D_},Iy);function $_(e){try{return mw.ExtendedPoint.fromHex(e),!0}catch{return!1}}mw.utils.randomPrivateKey,mw.getPublicKey;const W_=mw.verify,G_=e=>M.isBuffer(e)?e:e instanceof Uint8Array?M.from(e.buffer,e.byteOffset,e.byteLength):M.from(e);class H_{constructor(e){Object.assign(this,e)}encode(){return M.from(ix(V_,this))}static decode(e){return ax(V_,this,e)}static decodeUnchecked(e){return Gw(V_,this,e)}}const V_=new Map;var K_;const Z_=32;let Y_=1;class J_ extends H_{constructor(e){if(super({}),this._bn=void 0,function(e){return void 0!==e._bn}(e))this._bn=e._bn;else{if("string"==typeof e){const t=Ew.decode(e);if(t.length!=Z_)throw new Error("Invalid public key input");this._bn=new kw(t)}else this._bn=new kw(e);if(this._bn.byteLength()>Z_)throw new Error("Invalid public key input")}}static unique(){const e=new J_(Y_);return Y_+=1,new J_(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return Ew.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(M);if(e.length===Z_)return e;const t=M.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,r){const n=M.concat([e.toBuffer(),M.from(t),r.toBuffer()]),i=Ay(n);return new J_(i)}static createProgramAddressSync(e,t){let r=M.alloc(0);e.forEach(function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");r=M.concat([r,G_(e)])}),r=M.concat([r,t.toBuffer(),M.from("ProgramDerivedAddress")]);const n=Ay(r);if($_(n))throw new Error("Invalid seeds, address must fall off the curve");return new J_(n)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let r,n=255;for(;0!=n;){try{const i=e.concat(M.from([n]));r=this.createProgramAddressSync(i,t)}catch(oA){if(oA instanceof TypeError)throw oA;n--;continue}return[r,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return $_(new J_(e).toBytes())}}K_=J_,J_.default=new K_("11111111111111111111111111111111"),V_.set(J_,{kind:"struct",fields:[["_bn","u256"]]}),new J_("BPFLoader1111111111111111111111111111111111");const X_=1232;class Q_ extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(Q_.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class eS extends Error{constructor(e,t){super(`Transaction was not confirmed in ${t.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(eS.prototype,"name",{value:"TransactionExpiredTimeoutError"});class tS extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(tS.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class rS{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e<t.length)return t[e];e-=t.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const t=new Map;this.keySegments().flat().forEach((e,r)=>{t.set(e.toBase58(),r)});const r=e=>{const r=t.get(e.toBase58());if(void 0===r)throw new Error("Encountered an unknown instruction account key during compilation");return r};return e.map(e=>({programIdIndex:r(e.programId),accountKeyIndexes:e.keys.map(e=>r(e.pubkey)),data:e.data}))}}const nS=(e="publicKey")=>ek(32,e),iS=(e="string")=>{const t=Xx([Zx("length"),Zx("lengthPadding"),ek(Hx(Zx(),-8),"chars")],e),r=t.decode.bind(t),n=t.encode.bind(t),i=t;return i.decode=(e,t)=>r(e,t).chars.toString(),i.encode=(e,t,r)=>{const i={chars:M.from(e,"utf8")};return n(i,t,r)},i.alloc=e=>Zx().span+Zx().span+M.from(e,"utf8").length,i};function oS(e,t){const r=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(t[e.property]);if("count"in e&&"elementLayout"in e){const n=t[e.property];if(Array.isArray(n))return n.length*r(e.elementLayout)}else if("fields"in e)return oS({layout:e},t[e.property]);return 0};let n=0;return e.layout.fields.forEach(e=>{n+=r(e)}),n}function sS(e){let t=0,r=0;for(;;){let n=e.shift();if(t|=(127&n)<<7*r,r+=1,!(128&n))break}return t}function aS(e,t){let r=t;for(;;){let t=127&r;if(r>>=7,0==r){e.push(t);break}t|=128,e.push(t)}}function cS(e,t){if(!e)throw new Error(t||"Assertion failed")}class lS{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const r=new Map,n=e=>{const t=e.toBase58();let n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},i=n(t);i.isSigner=!0,i.isWritable=!0;for(const o of e){n(o.programId).isInvoked=!0;for(const e of o.keys){const t=n(e.pubkey);t.isSigner||(t.isSigner=e.isSigner),t.isWritable||(t.isWritable=e.isWritable)}}return new lS(t,r)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];cS(e.length<=256,"Max static account keys length exceeded");const t=e.filter(([,e])=>e.isSigner&&e.isWritable),r=e.filter(([,e])=>e.isSigner&&!e.isWritable),n=e.filter(([,e])=>!e.isSigner&&e.isWritable),i=e.filter(([,e])=>!e.isSigner&&!e.isWritable),o={numRequiredSignatures:t.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{cS(t.length>0,"Expected at least one writable signer key");const[e]=t[0];cS(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...t.map(([e])=>new J_(e)),...r.map(([e])=>new J_(e)),...n.map(([e])=>new J_(e)),...i.map(([e])=>new J_(e))]]}extractTableLookup(e){const[t,r]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&e.isWritable),[n,i]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&!e.isWritable);if(0!==t.length||0!==n.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:n},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(e,t){const r=new Array,n=new Array;for(const[i,o]of this.keyMetaMap.entries())if(t(o)){const t=new J_(i),o=e.findIndex(e=>e.equals(t));o>=0&&(cS(o<256,"Max lookup table index exceeded"),r.push(o),n.push(t),this.keyMetaMap.delete(i))}return[r,n]}}const uS="Reached end of buffer unexpectedly";function hS(e){if(0===e.length)throw new Error(uS);return e.shift()}function dS(e,...t){const[r]=t;if(2===t.length?r+(t[1]??0)>e.length:r>=e.length)throw new Error(uS);return e.splice(...t)}class pS{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(e=>new J_(e)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Ew.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new rS(this.staticAccountKeys)}static compile(e){const t=lS.compile(e.instructions,e.payerKey),[r,n]=t.getMessageComponents(),i=new rS(n).compileInstructions(e.instructions).map(e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:Ew.encode(e.data)}));return new pS({header:r,accountKeys:n,recentBlockhash:e.recentBlockhash,instructions:i})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){return e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts}return e<t-this.header.numReadonlySignedAccounts}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];aS(t,e);const r=this.instructions.map(e=>{const{accounts:t,programIdIndex:r}=e,n=Array.from(Ew.decode(e.data));let i=[];aS(i,t.length);let o=[];return aS(o,n.length),{programIdIndex:r,keyIndicesCount:M.from(i),keyIndices:t,dataLength:M.from(o),data:n}});let n=[];aS(n,r.length);let i=M.alloc(X_);M.from(n).copy(i);let o=n.length;r.forEach(e=>{const t=Xx([Vx("programIdIndex"),ek(e.keyIndicesCount.length,"keyIndicesCount"),Qx(Vx("keyIndex"),e.keyIndices.length,"keyIndices"),ek(e.dataLength.length,"dataLength"),Qx(Vx("userdatum"),e.data.length,"data")]).encode(e,i,o);o+=t}),i=i.slice(0,o);const s=Xx([ek(1,"numRequiredSignatures"),ek(1,"numReadonlySignedAccounts"),ek(1,"numReadonlyUnsignedAccounts"),ek(t.length,"keyCount"),Qx(nS("key"),e,"keys"),nS("recentBlockhash")]),a={numRequiredSignatures:M.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:M.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:M.from([this.header.numReadonlyUnsignedAccounts]),keyCount:M.from(t),keys:this.accountKeys.map(e=>G_(e.toBytes())),recentBlockhash:Ew.decode(this.recentBlockhash)};let c=M.alloc(2048);const l=s.encode(a,c);return i.copy(c,l),c.slice(0,l+i.length)}static from(e){let t=[...e];const r=hS(t);if(r!==(127&r))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const n=hS(t),i=hS(t),o=sS(t);let s=[];for(let h=0;h<o;h++){const e=dS(t,0,Z_);s.push(new J_(M.from(e)))}const a=dS(t,0,Z_),c=sS(t);let l=[];for(let h=0;h<c;h++){const e=hS(t),r=dS(t,0,sS(t)),n=dS(t,0,sS(t)),i=Ew.encode(M.from(n));l.push({programIdIndex:e,accounts:r,data:i})}const u={header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:i},recentBlockhash:Ew.encode(M.from(a)),accountKeys:s,instructions:l};return new pS(u)}}class fS{constructor(e){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(const t of this.addressTableLookups)e+=t.readonlyIndexes.length+t.writableIndexes.length;return e}getAccountKeys(e){let t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new rS(this.staticAccountKeys,t)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(e>=r){return e-r<this.addressTableLookups.reduce((e,t)=>e+t.writableIndexes.length,0)}if(e>=this.header.numRequiredSignatures){return e-t<r-t-this.header.numReadonlyUnsignedAccounts}return e<t-this.header.numReadonlySignedAccounts}resolveAddressTableLookups(e){const t={writable:[],readonly:[]};for(const r of this.addressTableLookups){const n=e.find(e=>e.key.equals(r.accountKey));if(!n)throw new Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(const e of r.writableIndexes){if(!(e<n.state.addresses.length))throw new Error(`Failed to find address for index ${e} in address lookup table ${r.accountKey.toBase58()}`);t.writable.push(n.state.addresses[e])}for(const e of r.readonlyIndexes){if(!(e<n.state.addresses.length))throw new Error(`Failed to find address for index ${e} in address lookup table ${r.accountKey.toBase58()}`);t.readonly.push(n.state.addresses[e])}}return t}static compile(e){const t=lS.compile(e.instructions,e.payerKey),r=new Array,n={writable:new Array,readonly:new Array},i=e.addressLookupTableAccounts||[];for(const c of i){const e=t.extractTableLookup(c);if(void 0!==e){const[t,{writable:i,readonly:o}]=e;r.push(t),n.writable.push(...i),n.readonly.push(...o)}}const[o,s]=t.getMessageComponents(),a=new rS(s,n).compileInstructions(e.instructions);return new fS({header:o,staticAccountKeys:s,recentBlockhash:e.recentBlockhash,compiledInstructions:a,addressTableLookups:r})}serialize(){const e=Array();aS(e,this.staticAccountKeys.length);const t=this.serializeInstructions(),r=Array();aS(r,this.compiledInstructions.length);const n=this.serializeAddressTableLookups(),i=Array();aS(i,this.addressTableLookups.length);const o=Xx([Vx("prefix"),Xx([Vx("numRequiredSignatures"),Vx("numReadonlySignedAccounts"),Vx("numReadonlyUnsignedAccounts")],"header"),ek(e.length,"staticAccountKeysLength"),Qx(nS(),this.staticAccountKeys.length,"staticAccountKeys"),nS("recentBlockhash"),ek(r.length,"instructionsLength"),ek(t.length,"serializedInstructions"),ek(i.length,"addressTableLookupsLength"),ek(n.length,"serializedAddressTableLookups")]),s=new Uint8Array(X_),a=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(e=>e.toBytes()),recentBlockhash:Ew.decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:n},s);return s.slice(0,a)}serializeInstructions(){let e=0;const t=new Uint8Array(X_);for(const r of this.compiledInstructions){const n=Array();aS(n,r.accountKeyIndexes.length);const i=Array();aS(i,r.data.length);e+=Xx([Vx("programIdIndex"),ek(n.length,"encodedAccountKeyIndexesLength"),Qx(Vx(),r.accountKeyIndexes.length,"accountKeyIndexes"),ek(i.length,"encodedDataLength"),ek(r.data.length,"data")]).encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(n),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:r.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0;const t=new Uint8Array(X_);for(const r of this.addressTableLookups){const n=Array();aS(n,r.writableIndexes.length);const i=Array();aS(i,r.readonlyIndexes.length);e+=Xx([nS("accountKey"),ek(n.length,"encodedWritableIndexesLength"),Qx(Vx(),r.writableIndexes.length,"writableIndexes"),ek(i.length,"encodedReadonlyIndexesLength"),Qx(Vx(),r.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(n),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:r.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e];const r=hS(t),n=127&r;cS(r!==n,"Expected versioned message but received legacy message");cS(0===n,`Expected versioned message with version 0 but found version ${n}`);const i={numRequiredSignatures:hS(t),numReadonlySignedAccounts:hS(t),numReadonlyUnsignedAccounts:hS(t)},o=[],s=sS(t);for(let d=0;d<s;d++)o.push(new J_(dS(t,0,Z_)));const a=Ew.encode(dS(t,0,Z_)),c=sS(t),l=[];for(let d=0;d<c;d++){const e=hS(t),r=dS(t,0,sS(t)),n=sS(t),i=new Uint8Array(dS(t,0,n));l.push({programIdIndex:e,accountKeyIndexes:r,data:i})}const u=sS(t),h=[];for(let d=0;d<u;d++){const e=new J_(dS(t,0,Z_)),r=dS(t,0,sS(t)),n=dS(t,0,sS(t));h.push({accountKey:e,writableIndexes:r,readonlyIndexes:n})}return new fS({header:i,staticAccountKeys:o,recentBlockhash:a,compiledInstructions:l,addressTableLookups:h})}}let mS=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({});const gS=M.alloc(64).fill(0);class yS{constructor(e){this.keys=void 0,this.programId=void 0,this.data=M.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:r})=>({pubkey:e.toJSON(),isSigner:t,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}class vS{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:r}=e;this.minNonceContextSlot=t,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:r}=e;this.recentBlockhash=t,this.lastValidBlockHeight=r}else{const{recentBlockhash:t,nonceInfo:r}=e;r&&(this.nonceInfo=r),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(0===e.length)throw new Error("No instructions");return e.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new yS(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t,r;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.length<1&&console.warn("No instructions provided"),this.feePayer)r=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");r=this.signatures[0].publicKey}for(let f=0;f<t.length;f++)if(void 0===t[f].programId)throw new Error(`Transaction instruction index ${f} has undefined program id`);const n=[],i=[];t.forEach(e=>{e.keys.forEach(e=>{i.push({...e})});const t=e.programId.toString();n.includes(t)||n.push(t)}),n.forEach(e=>{i.push({pubkey:new J_(e),isSigner:!1,isWritable:!1})});const o=[];i.forEach(e=>{const t=e.pubkey.toString(),r=o.findIndex(e=>e.pubkey.toString()===t);r>-1?(o[r].isWritable=o[r].isWritable||e.isWritable,o[r].isSigner=o[r].isSigner||e.isSigner):o.push(e)}),o.sort(function(e,t){if(e.isSigner!==t.isSigner)return e.isSigner?-1:1;if(e.isWritable!==t.isWritable)return e.isWritable?-1:1;return e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});const s=o.findIndex(e=>e.pubkey.equals(r));if(s>-1){const[e]=o.splice(s,1);e.isSigner=!0,e.isWritable=!0,o.unshift(e)}else o.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const f of this.signatures){const e=o.findIndex(e=>e.pubkey.equals(f.publicKey));if(!(e>-1))throw new Error(`unknown signer: ${f.publicKey.toString()}`);o[e].isSigner||(o[e].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,c=0,l=0;const u=[],h=[];o.forEach(({pubkey:e,isSigner:t,isWritable:r})=>{t?(u.push(e.toString()),a+=1,r||(c+=1)):(h.push(e.toString()),r||(l+=1))});const d=u.concat(h),p=t.map(e=>{const{data:t,programId:r}=e;return{programIdIndex:d.indexOf(r.toString()),accounts:e.keys.map(e=>d.indexOf(e.pubkey.toString())),data:Ew.encode(t)}});return p.forEach(e=>{cS(e.programIdIndex>=0),e.accounts.forEach(e=>cS(e>=0))}),new pS({header:{numRequiredSignatures:a,numReadonlySignedAccounts:c,numReadonlyUnsignedAccounts:l},accountKeys:d,recentBlockhash:e,instructions:p})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);if(this.signatures.length===t.length){if(this.signatures.every((e,r)=>t[r].equals(e.publicKey)))return e}return this.signatures=t.map(e=>({signature:null,publicKey:e})),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(0===e.length)throw new Error("No signers");const t=new Set;this.signatures=e.filter(e=>{const r=e.toString();return!t.has(r)&&(t.add(r),!0)}).map(e=>({signature:null,publicKey:e}))}sign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,r=[];for(const i of e){const e=i.publicKey.toString();t.has(e)||(t.add(e),r.push(i))}this.signatures=r.map(e=>({signature:null,publicKey:e.publicKey}));const n=this._compile();this._partialSign(n,...r)}partialSign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,r=[];for(const i of e){const e=i.publicKey.toString();t.has(e)||(t.add(e),r.push(i))}const n=this._compile();this._partialSign(n,...r)}_partialSign(e,...t){const r=e.serialize();t.forEach(e=>{const t=((e,t)=>mw.sign(e,t.slice(0,32)))(r,e.secretKey);this._addSignature(e.publicKey,G_(t))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){cS(64===t.length);const r=this.signatures.findIndex(t=>e.equals(t.publicKey));if(r<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=M.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const r={};for(const{signature:n,publicKey:i}of this.signatures)null===n?t&&(r.missing||(r.missing=[])).push(i):W_(n,e,i.toBytes())||(r.invalid||(r.invalid=[])).push(i);return r.invalid||r.missing?r:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r){const e=this._getMessageSignednessErrors(n,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+=`\nInvalid signature for public key${1===e.invalid.length?"":"(s)"} [\`${e.invalid.map(e=>e.toBase58()).join("`, `")}\`].`),e.missing&&(t+=`\nMissing signature for public key${1===e.missing.length?"":"(s)"} [\`${e.missing.map(e=>e.toBase58()).join("`, `")}\`].`),new Error(t)}}return this._serialize(n)}_serialize(e){const{signatures:t}=this,r=[];aS(r,t.length);const n=r.length+64*t.length+e.length,i=M.alloc(n);return cS(t.length<256),M.from(r).copy(i,0),t.forEach(({signature:e},t)=>{null!==e&&(cS(64===e.length,"signature has invalid length"),M.from(e).copy(i,r.length+64*t))}),e.copy(i,r.length+64*t.length),cS(i.length<=X_,`Transaction too large: ${i.length} > 1232`),i}get keys(){return cS(1===this.instructions.length),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return cS(1===this.instructions.length),this.instructions[0].programId}get data(){return cS(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e];const r=sS(t);let n=[];for(let i=0;i<r;i++){const e=dS(t,0,64);n.push(Ew.encode(M.from(e)))}return vS.populate(pS.from(t),n)}static populate(e,t=[]){const r=new vS;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((t,n)=>{const i={signature:t==Ew.encode(gS)?null:Ew.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)}),e.instructions.forEach(t=>{const n=t.accounts.map(t=>{const n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some(e=>e.publicKey.toString()===n.toString())||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}});r.instructions.push(new yS({keys:n,programId:e.accountKeys[t.programIdIndex],data:Ew.decode(t.data)}))}),r._message=e,r._json=r.toJSON(),r}}new J_("SysvarC1ock11111111111111111111111111111111"),new J_("SysvarEpochSchedu1e111111111111111111111111"),new J_("Sysvar1nstructions1111111111111111111111111");const bS=new J_("SysvarRecentB1ockHashes11111111111111111111"),wS=new J_("SysvarRent111111111111111111111111111111111");new J_("SysvarRewards111111111111111111111111111111"),new J_("SysvarS1otHashes111111111111111111111111111"),new J_("SysvarS1otHistory11111111111111111111111111"),new J_("SysvarStakeHistory1111111111111111111111111");class xS extends Error{constructor({action:e,signature:t,transactionMessage:r,logs:n}){const i=n?`Logs: \n${JSON.stringify(n.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let s;switch(e){case"send":s=`Transaction ${t} resulted in an error. \n${r}. `+i+o;break;case"simulate":s=`Simulation failed. \nMessage: ${r}. \n`+i+o;break;default:s=`Unknown action '${(e=>e)(e)}'`}super(s),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=t,this.transactionMessage=r,this.transactionLogs=n||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){const e=this.transactionLogs;if(null==e||"object"!=typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((t,r)=>{e.getTransaction(this.signature).then(e=>{if(e&&e.meta&&e.meta.logMessages){const r=e.meta.logMessages;this.transactionLogs=r,t(r)}else r(new Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}}class kS extends Error{constructor({code:e,message:t,data:r},n){super(null!=n?`${n}: ${t}`:t),this.code=void 0,this.data=void 0,this.code=e,this.data=r,this.name="SolanaJSONRPCError"}}function _S(e){return new Promise(t=>setTimeout(t,e))}function SS(e,t){const r=e.layout.span>=0?e.layout.span:oS(e,t),n=M.alloc(r),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,n),n}const CS=Yx("lamportsPerSignature"),IS=Xx([Zx("version"),Zx("state"),nS("authorizedPubkey"),nS("nonce"),Xx([CS],"feeCalculator")]),ES=IS.span;class AS{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=IS.decode(G_(e),0);return new AS({authorizedPubkey:new J_(t.authorizedPubkey),nonce:new J_(t.nonce).toString(),feeCalculator:t.feeCalculator})}}function MS(e){const t=ek(8,e),r=t.decode.bind(t),n=t.encode.bind(t),i=t,o=lk();return i.decode=(e,t)=>{const n=r(e,t);return o.decode(n)},i.encode=(e,t,r)=>{const i=o.encode(e);return n(i,t,r)},i}const NS=Object.freeze({Create:{index:0,layout:Xx([Zx("instruction"),Jx("lamports"),Jx("space"),nS("programId")])},Assign:{index:1,layout:Xx([Zx("instruction"),nS("programId")])},Transfer:{index:2,layout:Xx([Zx("instruction"),MS("lamports")])},CreateWithSeed:{index:3,layout:Xx([Zx("instruction"),nS("base"),iS("seed"),Jx("lamports"),Jx("space"),nS("programId")])},AdvanceNonceAccount:{index:4,layout:Xx([Zx("instruction")])},WithdrawNonceAccount:{index:5,layout:Xx([Zx("instruction"),Jx("lamports")])},InitializeNonceAccount:{index:6,layout:Xx([Zx("instruction"),nS("authorized")])},AuthorizeNonceAccount:{index:7,layout:Xx([Zx("instruction"),nS("authorized")])},Allocate:{index:8,layout:Xx([Zx("instruction"),Jx("space")])},AllocateWithSeed:{index:9,layout:Xx([Zx("instruction"),nS("base"),iS("seed"),Jx("space"),nS("programId")])},AssignWithSeed:{index:10,layout:Xx([Zx("instruction"),nS("base"),iS("seed"),nS("programId")])},TransferWithSeed:{index:11,layout:Xx([Zx("instruction"),MS("lamports"),iS("seed"),nS("programId")])},UpgradeNonceAccount:{index:12,layout:Xx([Zx("instruction")])}});class PS{constructor(){}static createAccount(e){const t=SS(NS.Create,{lamports:e.lamports,space:e.space,programId:G_(e.programId.toBuffer())});return new yS({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}static transfer(e){let t,r;if("basePubkey"in e){t=SS(NS.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:G_(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{t=SS(NS.Transfer,{lamports:BigInt(e.lamports)}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new yS({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;if("basePubkey"in e){t=SS(NS.AssignWithSeed,{base:G_(e.basePubkey.toBuffer()),seed:e.seed,programId:G_(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{t=SS(NS.Assign,{programId:G_(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new yS({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=SS(NS.CreateWithSeed,{base:G_(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:G_(e.programId.toBuffer())});let r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||r.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new yS({keys:r,programId:this.programId,data:t})}static createNonceAccount(e){const t=new vS;"basePubkey"in e&&"seed"in e?t.add(PS.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:ES,programId:this.programId})):t.add(PS.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:ES,programId:this.programId}));const r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){const t=SS(NS.InitializeNonceAccount,{authorized:G_(e.authorizedPubkey.toBuffer())}),r={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:bS,isSigner:!1,isWritable:!1},{pubkey:wS,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new yS(r)}static nonceAdvance(e){const t=SS(NS.AdvanceNonceAccount),r={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:bS,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new yS(r)}static nonceWithdraw(e){const t=SS(NS.WithdrawNonceAccount,{lamports:e.lamports});return new yS({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:bS,isSigner:!1,isWritable:!1},{pubkey:wS,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){const t=SS(NS.AuthorizeNonceAccount,{authorized:G_(e.newAuthorizedPubkey.toBuffer())});return new yS({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static allocate(e){let t,r;if("basePubkey"in e){t=SS(NS.AllocateWithSeed,{base:G_(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:G_(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{t=SS(NS.Allocate,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new yS({keys:r,programId:this.programId,data:t})}}function TS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var OS,BS;function RS(){if(BS)return OS;BS=1;var e=Object.prototype.toString,t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};function r(n,i){var o,s,a,c,l,u,h;if(!0===n)return"true";if(!1===n)return"false";switch(typeof n){case"object":if(null===n)return null;if(n.toJSON&&"function"==typeof n.toJSON)return r(n.toJSON(),i);if("[object Array]"===(h=e.call(n))){for(a="[",s=n.length-1,o=0;o<s;o++)a+=r(n[o],!0)+",";return s>-1&&(a+=r(n[o],!0)),a+"]"}if("[object Object]"===h){for(s=(c=t(n).sort()).length,a="",o=0;o<s;)void 0!==(u=r(n[l=c[o]],!1))&&(a&&(a+=","),a+=JSON.stringify(l)+":"+u),o++;return"{"+a+"}"}return JSON.stringify(n);case"function":case"undefined":return i?null:void 0;case"string":return JSON.stringify(n);default:return isFinite(n)?n:null}}return OS=function(e){var t=r(e,!1);if(void 0!==t)return""+t}}PS.programId=new J_("11111111111111111111111111111111"),new J_("BPFLoader2111111111111111111111111111111111");var LS=TS(RS());function jS(e){let t=0;for(;e>1;)e/=2,t++;return t}class US{constructor(e,t,r,n,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=r,this.firstNormalEpoch=n,this.firstNormalSlot=i}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const r=jS(0===(t=e+32+1)?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32)))-jS(32)-1;return[r,e-(this.getSlotsInEpoch(r)-32)]}{const t=e-this.firstNormalSlot,r=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+r,t%this.slotsPerEpoch]}var t}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+jS(32)):this.slotsPerEpoch}}var DS=globalThis.fetch;class FS extends b_{constructor(e,t,r){super(e=>{const r=function(e,t){return new y_(e,t)}(e,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...t});return this.underlyingSocket="socket"in r?r.socket:r,r},e,t,r),this.underlyingSocket=void 0}call(...e){var t;const r=null==(t=this.underlyingSocket)?void 0:t.readyState;return 1===r?super.call(...e):Promise.reject(new Error("Tried to call a JSON-RPC method `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}notify(...e){var t;const r=null==(t=this.underlyingSocket)?void 0:t.readyState;return 1===r?super.notify(...e):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}}class zS{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){const e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){const t=function(e,t){let r;try{r=e.layout.decode(t)}catch(oA){throw new Error("invalid instruction; "+oA)}if(r.typeIndex!==e.index)throw new Error(`invalid account data; account type mismatch ${r.typeIndex} != ${e.index}`);return r}(qS,e),r=e.length-56;cS(r>=0,"lookup table is invalid"),cS(r%32==0,"lookup table is invalid");const n=r/32,{addresses:i}=Xx([Qx(nS(),n,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new J_(t.authority[0]):void 0,addresses:i.map(e=>new J_(e))}}}const qS={index:1,layout:Xx([Zx("typeIndex"),MS("deactivationSlot"),Yx("lastExtendedSlot"),Vx("lastExtendedStartIndex"),Vx(),Qx(nS(),Hx(Vx(),-1),"authority")])},$S=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;const WS=Rk(Sk(J_),Nk(),e=>new J_(e)),GS=Pk([Nk(),Ck("base64")]),HS=Rk(Sk(M),GS,e=>M.from(e[0],"base64"));function VS(e){let t,r;if("string"==typeof e)t=e;else if(e){const{commitment:n,...i}=e;t=n,r=i}return{commitment:t,config:r}}function KS(e){return e.map(e=>"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:e.memcmp.encoding??"base58"}}:e)}function ZS(e){return Ok([Tk({jsonrpc:Ck("2.0"),id:Nk(),result:e}),Tk({jsonrpc:Ck("2.0"),id:Nk(),error:Tk({code:Bk(),message:Nk(),data:Ak(xk("any",()=>!0))})})])}const YS=ZS(Bk());function JS(e){return Rk(ZS(e),YS,t=>"error"in t?t:{...t,result:vk(t.result,e)})}function XS(e){return JS(Tk({context:Tk({slot:Ek()}),value:e}))}function QS(e){return Tk({context:Tk({slot:Ek()}),value:e})}function eC(e,t){return 0===e?new fS({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new J_(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Ew.decode(e.data)})),addressTableLookups:t.addressTableLookups}):new pS(t)}const tC=Tk({foundation:Ek(),foundationTerm:Ek(),initial:Ek(),taper:Ek(),terminal:Ek()}),rC=JS(kk(Ik(Tk({epoch:Ek(),effectiveSlot:Ek(),amount:Ek(),postBalance:Ek(),commission:Ak(Ik(Ek()))})))),nC=kk(Tk({slot:Ek(),prioritizationFee:Ek()})),iC=Tk({total:Ek(),validator:Ek(),foundation:Ek(),epoch:Ek()}),oC=Tk({epoch:Ek(),slotIndex:Ek(),slotsInEpoch:Ek(),absoluteSlot:Ek(),blockHeight:Ak(Ek()),transactionCount:Ak(Ek())}),sC=Tk({slotsPerEpoch:Ek(),leaderScheduleSlotOffset:Ek(),warmup:_k(),firstNormalEpoch:Ek(),firstNormalSlot:Ek()}),aC=Mk(Nk(),kk(Ek())),cC=Ik(Ok([Tk({}),Nk()])),lC=Tk({err:cC}),uC=Ck("receivedSignature"),hC=Tk({"solana-core":Nk(),"feature-set":Ak(Ek())}),dC=Tk({program:Nk(),programId:WS,parsed:Bk()}),pC=Tk({programId:WS,accounts:kk(WS),data:Nk()}),fC=XS(Tk({err:Ik(Ok([Tk({}),Nk()])),logs:Ik(kk(Nk())),accounts:Ak(Ik(kk(Ik(Tk({executable:_k(),owner:Nk(),lamports:Ek(),data:kk(Nk()),rentEpoch:Ak(Ek())}))))),unitsConsumed:Ak(Ek()),returnData:Ak(Ik(Tk({programId:Nk(),data:Pk([Nk(),Ck("base64")])}))),innerInstructions:Ak(Ik(kk(Tk({index:Ek(),instructions:kk(Ok([dC,pC]))}))))})),mC=XS(Tk({byIdentity:Mk(Nk(),kk(Ek())),range:Tk({firstSlot:Ek(),lastSlot:Ek()})}));const gC=JS(tC),yC=JS(iC),vC=JS(nC),bC=JS(oC),wC=JS(sC),xC=JS(aC),kC=JS(Ek()),_C=XS(Tk({total:Ek(),circulating:Ek(),nonCirculating:Ek(),nonCirculatingAccounts:kk(WS)})),SC=Tk({amount:Nk(),uiAmount:Ik(Ek()),decimals:Ek(),uiAmountString:Ak(Nk())}),CC=XS(kk(Tk({address:WS,amount:Nk(),uiAmount:Ik(Ek()),decimals:Ek(),uiAmountString:Ak(Nk())}))),IC=XS(kk(Tk({pubkey:WS,account:Tk({executable:_k(),owner:WS,lamports:Ek(),data:HS,rentEpoch:Ek()})}))),EC=Tk({program:Nk(),parsed:Bk(),space:Ek()}),AC=XS(kk(Tk({pubkey:WS,account:Tk({executable:_k(),owner:WS,lamports:Ek(),data:EC,rentEpoch:Ek()})}))),MC=XS(kk(Tk({lamports:Ek(),address:WS}))),NC=Tk({executable:_k(),owner:WS,lamports:Ek(),data:HS,rentEpoch:Ek()}),PC=Tk({pubkey:WS,account:NC}),TC=Rk(Ok([Sk(M),EC]),Ok([GS,EC]),e=>Array.isArray(e)?vk(e,HS):e),OC=Tk({executable:_k(),owner:WS,lamports:Ek(),data:TC,rentEpoch:Ek()}),BC=Tk({pubkey:WS,account:OC}),RC=Tk({state:Ok([Ck("active"),Ck("inactive"),Ck("activating"),Ck("deactivating")]),active:Ek(),inactive:Ek()}),LC=JS(kk(Tk({signature:Nk(),slot:Ek(),err:cC,memo:Ik(Nk()),blockTime:Ak(Ik(Ek()))}))),jC=JS(kk(Tk({signature:Nk(),slot:Ek(),err:cC,memo:Ik(Nk()),blockTime:Ak(Ik(Ek()))}))),UC=Tk({subscription:Ek(),result:QS(NC)}),DC=Tk({pubkey:WS,account:NC}),FC=Tk({subscription:Ek(),result:QS(DC)}),zC=Tk({parent:Ek(),slot:Ek(),root:Ek()}),qC=Tk({subscription:Ek(),result:zC}),$C=Ok([Tk({type:Ok([Ck("firstShredReceived"),Ck("completed"),Ck("optimisticConfirmation"),Ck("root")]),slot:Ek(),timestamp:Ek()}),Tk({type:Ck("createdBank"),parent:Ek(),slot:Ek(),timestamp:Ek()}),Tk({type:Ck("frozen"),slot:Ek(),timestamp:Ek(),stats:Tk({numTransactionEntries:Ek(),numSuccessfulTransactions:Ek(),numFailedTransactions:Ek(),maxTransactionsPerEntry:Ek()})}),Tk({type:Ck("dead"),slot:Ek(),timestamp:Ek(),err:Nk()})]),WC=Tk({subscription:Ek(),result:$C}),GC=Tk({subscription:Ek(),result:QS(Ok([lC,uC]))}),HC=Tk({subscription:Ek(),result:Ek()}),VC=Tk({pubkey:Nk(),gossip:Ik(Nk()),tpu:Ik(Nk()),rpc:Ik(Nk()),version:Ik(Nk())}),KC=Tk({votePubkey:Nk(),nodePubkey:Nk(),activatedStake:Ek(),epochVoteAccount:_k(),epochCredits:kk(Pk([Ek(),Ek(),Ek()])),commission:Ek(),lastVote:Ek(),rootSlot:Ik(Ek())}),ZC=JS(Tk({current:kk(KC),delinquent:kk(KC)})),YC=Ok([Ck("processed"),Ck("confirmed"),Ck("finalized")]),JC=Tk({slot:Ek(),confirmations:Ik(Ek()),err:cC,confirmationStatus:Ak(YC)}),XC=XS(kk(Ik(JC))),QC=JS(Ek()),eI=Tk({accountKey:WS,writableIndexes:kk(Ek()),readonlyIndexes:kk(Ek())}),tI=Tk({signatures:kk(Nk()),message:Tk({accountKeys:kk(Nk()),header:Tk({numRequiredSignatures:Ek(),numReadonlySignedAccounts:Ek(),numReadonlyUnsignedAccounts:Ek()}),instructions:kk(Tk({accounts:kk(Ek()),data:Nk(),programIdIndex:Ek()})),recentBlockhash:Nk(),addressTableLookups:Ak(kk(eI))})}),rI=Tk({pubkey:WS,signer:_k(),writable:_k(),source:Ak(Ok([Ck("transaction"),Ck("lookupTable")]))}),nI=Tk({accountKeys:kk(rI),signatures:kk(Nk())}),iI=Tk({parsed:Bk(),program:Nk(),programId:WS}),oI=Tk({accounts:kk(WS),data:Nk(),programId:WS}),sI=Rk(Ok([oI,iI]),Ok([Tk({parsed:Bk(),program:Nk(),programId:Nk()}),Tk({accounts:kk(Nk()),data:Nk(),programId:Nk()})]),e=>vk(e,"accounts"in e?oI:iI)),aI=Tk({signatures:kk(Nk()),message:Tk({accountKeys:kk(rI),instructions:kk(sI),recentBlockhash:Nk(),addressTableLookups:Ak(Ik(kk(eI)))})}),cI=Tk({accountIndex:Ek(),mint:Nk(),owner:Ak(Nk()),programId:Ak(Nk()),uiTokenAmount:SC}),lI=Tk({writable:kk(WS),readonly:kk(WS)}),uI=Tk({err:cC,fee:Ek(),innerInstructions:Ak(Ik(kk(Tk({index:Ek(),instructions:kk(Tk({accounts:kk(Ek()),data:Nk(),programIdIndex:Ek()}))})))),preBalances:kk(Ek()),postBalances:kk(Ek()),logMessages:Ak(Ik(kk(Nk()))),preTokenBalances:Ak(Ik(kk(cI))),postTokenBalances:Ak(Ik(kk(cI))),loadedAddresses:Ak(lI),computeUnitsConsumed:Ak(Ek()),costUnits:Ak(Ek())}),hI=Tk({err:cC,fee:Ek(),innerInstructions:Ak(Ik(kk(Tk({index:Ek(),instructions:kk(sI)})))),preBalances:kk(Ek()),postBalances:kk(Ek()),logMessages:Ak(Ik(kk(Nk()))),preTokenBalances:Ak(Ik(kk(cI))),postTokenBalances:Ak(Ik(kk(cI))),loadedAddresses:Ak(lI),computeUnitsConsumed:Ak(Ek()),costUnits:Ak(Ek())}),dI=Ok([Ck(0),Ck("legacy")]),pI=Tk({pubkey:Nk(),lamports:Ek(),postBalance:Ik(Ek()),rewardType:Ik(Nk()),commission:Ak(Ik(Ek()))}),fI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),transactions:kk(Tk({transaction:tI,meta:Ik(uI),version:Ak(dI)})),rewards:Ak(kk(pI)),blockTime:Ik(Ek()),blockHeight:Ik(Ek())}))),mI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),rewards:Ak(kk(pI)),blockTime:Ik(Ek()),blockHeight:Ik(Ek())}))),gI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),transactions:kk(Tk({transaction:nI,meta:Ik(uI),version:Ak(dI)})),rewards:Ak(kk(pI)),blockTime:Ik(Ek()),blockHeight:Ik(Ek())}))),yI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),transactions:kk(Tk({transaction:aI,meta:Ik(hI),version:Ak(dI)})),rewards:Ak(kk(pI)),blockTime:Ik(Ek()),blockHeight:Ik(Ek())}))),vI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),transactions:kk(Tk({transaction:nI,meta:Ik(hI),version:Ak(dI)})),rewards:Ak(kk(pI)),blockTime:Ik(Ek()),blockHeight:Ik(Ek())}))),bI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),rewards:Ak(kk(pI)),blockTime:Ik(Ek()),blockHeight:Ik(Ek())}))),wI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),transactions:kk(Tk({transaction:tI,meta:Ik(uI)})),rewards:Ak(kk(pI)),blockTime:Ik(Ek())}))),xI=JS(Ik(Tk({blockhash:Nk(),previousBlockhash:Nk(),parentSlot:Ek(),signatures:kk(Nk()),blockTime:Ik(Ek())}))),kI=JS(Ik(Tk({slot:Ek(),meta:Ik(uI),blockTime:Ak(Ik(Ek())),transaction:tI,version:Ak(dI)}))),_I=JS(Ik(Tk({slot:Ek(),transaction:aI,meta:Ik(hI),blockTime:Ak(Ik(Ek())),version:Ak(dI)}))),SI=XS(Tk({blockhash:Nk(),lastValidBlockHeight:Ek()})),CI=XS(_k()),II=JS(kk(Tk({slot:Ek(),numTransactions:Ek(),numSlots:Ek(),samplePeriodSecs:Ek()}))),EI=XS(Ik(Tk({feeCalculator:Tk({lamportsPerSignature:Ek()})}))),AI=JS(Nk()),MI=JS(Nk()),NI=Tk({err:cC,logs:kk(Nk()),signature:Nk()}),PI=Tk({result:QS(NI),subscription:Ek()}),TI={"solana-client":"js/1.0.0-maintenance"};class OI{constructor(e,t){let r,n,i,o,s,a;var c;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const e={};return async t=>{const{commitment:r,config:n}=VS(t),i=this._buildArgs([],r,void 0,n),o=LS(i);return e[o]=e[o]??(async()=>{try{const e=vk(await this._rpcRequest("getBlockHeight",i),JS(Ek()));if("error"in e)throw new kS(e.error,"failed to get block height information");return e.result}finally{delete e[o]}})(),await e[o]}})(),t&&"string"==typeof t?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,r=t.wsEndpoint,n=t.httpHeaders,i=t.fetch,o=t.fetchMiddleware,s=t.disableRetryOnRateLimit,a=t.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(e),this._rpcWsEndpoint=r||function(e){const t=e.match($S);if(null==t)throw TypeError(`Failed to validate endpoint URL \`${e}\``);const[r,n,i,o]=t,s=e.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${n}${null==a?"":`:${a+1}`}${o}`}(e),this._rpcClient=function(e,t,r,n,i,o){const s=r||DS;let a;null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),n&&(a=async(e,t)=>{const r=await new Promise((r,i)=>{try{n(e,t,(e,t)=>r([e,t]))}catch(uh){i(uh)}});return await s(...r)});const c=new f_(async(r,n)=>{const o={method:"POST",body:r,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{},TI)};try{let t,r=5,c=500;for(;t=a?await a(e,o):await s(e,o),429===t.status&&!0!==i&&(r-=1,0!==r);)console.error(`Server responded with ${t.status} ${t.statusText}. Retrying after ${c}ms delay...`),await _S(c),c*=2;const l=await t.text();t.ok?n(null,l):n(new Error(`${t.status} ${t.statusText}: ${l}`))}catch(oA){oA instanceof Error&&n(oA)}},{});return c}(e,n,i,o,s,a),this._rpcRequest=(c=this._rpcClient,(e,t)=>new Promise((r,n)=>{c.request(e,t,(e,t)=>{e?n(e):r(t)})})),this._rpcBatchRequest=function(e){return t=>new Promise((r,n)=>{0===t.length&&r([]);const i=t.map(t=>e.request(t.methodName,t.args));e.request(i,(e,t)=>{e?n(e):r(t)})})}(this._rpcClient),this._rpcWebSocket=new FS(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgs([e.toBase58()],r,void 0,n),o=vk(await this._rpcRequest("getBalance",i),XS(Ek()));if("error"in o)throw new kS(o.error,`failed to get balance for ${e.toBase58()}`);return o.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(e=>e.value).catch(t=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+t)})}async getBlockTime(e){const t=vk(await this._rpcRequest("getBlockTime",[e]),JS(Ik(Ek())));if("error"in t)throw new kS(t.error,`failed to get block time for slot ${e}`);return t.result}async getMinimumLedgerSlot(){const e=vk(await this._rpcRequest("minimumLedgerSlot",[]),JS(Ek()));if("error"in e)throw new kS(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const e=vk(await this._rpcRequest("getFirstAvailableBlock",[]),kC);if("error"in e)throw new kS(e.error,"failed to get first available block");return e.result}async getSupply(e){let t={};t="string"==typeof e?{commitment:e}:e?{...e,commitment:e&&e.commitment||this.commitment}:{commitment:this.commitment};const r=vk(await this._rpcRequest("getSupply",[t]),_C);if("error"in r)throw new kS(r.error,"failed to get supply");return r.result}async getTokenSupply(e,t){const r=this._buildArgs([e.toBase58()],t),n=vk(await this._rpcRequest("getTokenSupply",r),XS(SC));if("error"in n)throw new kS(n.error,"failed to get token supply");return n.result}async getTokenAccountBalance(e,t){const r=this._buildArgs([e.toBase58()],t),n=vk(await this._rpcRequest("getTokenAccountBalance",r),XS(SC));if("error"in n)throw new kS(n.error,"failed to get token account balance");return n.result}async getTokenAccountsByOwner(e,t,r){const{commitment:n,config:i}=VS(r);let o=[e.toBase58()];"mint"in t?o.push({mint:t.mint.toBase58()}):o.push({programId:t.programId.toBase58()});const s=this._buildArgs(o,n,"base64",i),a=vk(await this._rpcRequest("getTokenAccountsByOwner",s),IC);if("error"in a)throw new kS(a.error,`failed to get token accounts owned by account ${e.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const i=this._buildArgs(n,r,"jsonParsed"),o=vk(await this._rpcRequest("getTokenAccountsByOwner",i),AC);if("error"in o)throw new kS(o.error,`failed to get token accounts owned by account ${e.toBase58()}`);return o.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},r=t.filter||t.commitment?[t]:[],n=vk(await this._rpcRequest("getLargestAccounts",r),MC);if("error"in n)throw new kS(n.error,"failed to get largest accounts");return n.result}async getTokenLargestAccounts(e,t){const r=this._buildArgs([e.toBase58()],t),n=vk(await this._rpcRequest("getTokenLargestAccounts",r),CC);if("error"in n)throw new kS(n.error,"failed to get token largest accounts");return n.result}async getAccountInfoAndContext(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgs([e.toBase58()],r,"base64",n),o=vk(await this._rpcRequest("getAccountInfo",i),XS(Ik(NC)));if("error"in o)throw new kS(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getParsedAccountInfo(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgs([e.toBase58()],r,"jsonParsed",n),o=vk(await this._rpcRequest("getAccountInfo",i),XS(Ik(OC)));if("error"in o)throw new kS(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(r){throw new Error("failed to get info about account "+e.toBase58()+": "+r)}}async getMultipleParsedAccounts(e,t){const{commitment:r,config:n}=VS(t),i=e.map(e=>e.toBase58()),o=this._buildArgs([i],r,"jsonParsed",n),s=vk(await this._rpcRequest("getMultipleAccounts",o),XS(kk(Ik(OC))));if("error"in s)throw new kS(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfoAndContext(e,t){const{commitment:r,config:n}=VS(t),i=e.map(e=>e.toBase58()),o=this._buildArgs([i],r,"base64",n),s=vk(await this._rpcRequest("getMultipleAccounts",o),XS(kk(Ik(NC))));if("error"in s)throw new kS(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfo(e,t){return(await this.getMultipleAccountsInfoAndContext(e,t)).value}async getStakeActivation(e,t,r){const{commitment:n,config:i}=VS(t),o=this._buildArgs([e.toBase58()],n,void 0,{...i,epoch:null!=r?r:null==i?void 0:i.epoch}),s=vk(await this._rpcRequest("getStakeActivation",o),JS(RC));if("error"in s)throw new kS(s.error,`failed to get Stake Activation ${e.toBase58()}`);return s.result}async getProgramAccounts(e,t){const{commitment:r,config:n}=VS(t),{encoding:i,...o}=n||{},s=this._buildArgs([e.toBase58()],r,i||"base64",{...o,...o.filters?{filters:KS(o.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",s),c=kk(PC),l=!0===o.withContext?vk(a,XS(c)):vk(a,JS(c));if("error"in l)throw new kS(l.error,`failed to get accounts owned by program ${e.toBase58()}`);return l.result}async getParsedProgramAccounts(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgs([e.toBase58()],r,"jsonParsed",n),o=vk(await this._rpcRequest("getProgramAccounts",i),JS(kk(BC)));if("error"in o)throw new kS(o.error,`failed to get accounts owned by program ${e.toBase58()}`);return o.result}async confirmTransaction(e,t){var r;let n,i;if("string"==typeof e)n=e;else{const t=e;if(null==(r=t.abortSignal)?void 0:r.aborted)return Promise.reject(t.abortSignal.reason);n=t.signature}try{i=Ew.decode(n)}catch(oA){throw new Error("signature must be base58 encoded: "+n)}return cS(64===i.length,"signature has invalid length"),"string"==typeof e?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:n}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise((t,r)=>{null!=e&&(e.aborted?r(e.reason):e.addEventListener("abort",()=>{r(e.reason)}))})}getTransactionConfirmationPromise({commitment:e,signature:t}){let r,n,i=!1;const o=new Promise((o,s)=>{try{r=this.onSignature(t,(e,t)=>{r=void 0;const n={context:t,value:e};o({__type:mS.PROCESSED,response:n})},e);const a=new Promise(e=>{null==r?e():n=this._onSubscriptionStateChange(r,t=>{"subscribed"===t&&e()})});(async()=>{if(await a,i)return;const r=await this.getSignatureStatus(t);if(i)return;if(null==r)return;const{context:n,value:c}=r;if(null!=c)if(null==c?void 0:c.err)s(c.err);else{switch(e){case"confirmed":case"single":case"singleGossip":if("processed"===c.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===c.confirmationStatus||"confirmed"===c.confirmationStatus)return}i=!0,o({__type:mS.PROCESSED,response:{context:n,value:c}})}})()}catch(oA){s(oA)}});return{abortConfirmation:()=>{n&&(n(),n=void 0),null!=r&&(this.removeSignatureListener(r),r=void 0)},confirmationPromise:o}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e,strategy:{abortSignal:t,lastValidBlockHeight:r,signature:n}}){let i=!1;const o=new Promise(t=>{const n=async()=>{try{return await this.getBlockHeight(e)}catch(t){return-1}};(async()=>{let e=await n();if(!i){for(;e<=r;){if(await _S(1e3),i)return;if(e=await n(),i)return}t({__type:mS.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:e,signature:n}),c=this.getCancellationPromise(t);let l;try{const e=await Promise.race([c,a,o]);if(e.__type!==mS.PROCESSED)throw new Q_(n);l=e.response}finally{i=!0,s()}return l}async confirmTransactionUsingDurableNonceStrategy({commitment:e,strategy:{abortSignal:t,minContextSlot:r,nonceAccountPubkey:n,nonceValue:i,signature:o}}){let s=!1;const a=new Promise(t=>{let o=i,a=null;const c=async()=>{try{const{context:t,value:i}=await this.getNonceAndContext(n,{commitment:e,minContextSlot:r});return a=t.slot,null==i?void 0:i.nonce}catch(t){return o}};(async()=>{if(o=await c(),!s)for(;;){if(i!==o)return void t({__type:mS.NONCE_INVALID,slotInWhichNonceDidAdvance:a});if(await _S(2e3),s)return;if(o=await c(),s)return}})()}),{abortConfirmation:c,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:e,signature:o}),u=this.getCancellationPromise(t);let h;try{const t=await Promise.race([u,l,a]);if(t.__type===mS.PROCESSED)h=t.response;else{let n;for(;;){const e=await this.getSignatureStatus(o);if(null==e)break;if(!(e.context.slot<(t.slotInWhichNonceDidAdvance??r))){n=e;break}await _S(400)}if(!(null==n?void 0:n.value))throw new tS(o);{const t=e||"finalized",{confirmationStatus:r}=n.value;switch(t){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new tS(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new tS(o);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new tS(o)}h={context:n.context,value:{err:n.value.err}}}}}finally{s=!0,c()}return h}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:e,signature:t}){let r;const n=new Promise(t=>{let n=this._confirmTransactionInitialTimeout||6e4;switch(e){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":n=this._confirmTransactionInitialTimeout||3e4}r=setTimeout(()=>t({__type:mS.TIMED_OUT,timeoutMs:n}),n)}),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:e,signature:t});let s;try{const e=await Promise.race([o,n]);if(e.__type!==mS.PROCESSED)throw new eS(t,e.timeoutMs/1e3);s=e.response}finally{clearTimeout(r),i()}return s}async getClusterNodes(){const e=vk(await this._rpcRequest("getClusterNodes",[]),JS(kk(VC)));if("error"in e)throw new kS(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(e){const t=this._buildArgs([],e),r=vk(await this._rpcRequest("getVoteAccounts",t),ZC);if("error"in r)throw new kS(r.error,"failed to get vote accounts");return r.result}async getSlot(e){const{commitment:t,config:r}=VS(e),n=this._buildArgs([],t,void 0,r),i=vk(await this._rpcRequest("getSlot",n),JS(Ek()));if("error"in i)throw new kS(i.error,"failed to get slot");return i.result}async getSlotLeader(e){const{commitment:t,config:r}=VS(e),n=this._buildArgs([],t,void 0,r),i=vk(await this._rpcRequest("getSlotLeader",n),JS(Nk()));if("error"in i)throw new kS(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(e,t){const r=[e,t],n=vk(await this._rpcRequest("getSlotLeaders",r),JS(kk(WS)));if("error"in n)throw new kS(n.error,"failed to get slot leaders");return n.result}async getSignatureStatus(e,t){const{context:r,value:n}=await this.getSignatureStatuses([e],t);cS(1===n.length);return{context:r,value:n[0]}}async getSignatureStatuses(e,t){const r=[e];t&&r.push(t);const n=vk(await this._rpcRequest("getSignatureStatuses",r),XC);if("error"in n)throw new kS(n.error,"failed to get signature status");return n.result}async getTransactionCount(e){const{commitment:t,config:r}=VS(e),n=this._buildArgs([],t,void 0,r),i=vk(await this._rpcRequest("getTransactionCount",n),JS(Ek()));if("error"in i)throw new kS(i.error,"failed to get transaction count");return i.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),r=vk(await this._rpcRequest("getInflationGovernor",t),gC);if("error"in r)throw new kS(r.error,"failed to get inflation");return r.result}async getInflationReward(e,t,r){const{commitment:n,config:i}=VS(r),o=this._buildArgs([e.map(e=>e.toBase58())],n,void 0,{...i,epoch:null!=t?t:null==i?void 0:i.epoch}),s=vk(await this._rpcRequest("getInflationReward",o),rC);if("error"in s)throw new kS(s.error,"failed to get inflation reward");return s.result}async getInflationRate(){const e=vk(await this._rpcRequest("getInflationRate",[]),yC);if("error"in e)throw new kS(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(e){const{commitment:t,config:r}=VS(e),n=this._buildArgs([],t,void 0,r),i=vk(await this._rpcRequest("getEpochInfo",n),bC);if("error"in i)throw new kS(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const e=vk(await this._rpcRequest("getEpochSchedule",[]),wC);if("error"in e)throw new kS(e.error,"failed to get epoch schedule");const t=e.result;return new US(t.slotsPerEpoch,t.leaderScheduleSlotOffset,t.warmup,t.firstNormalEpoch,t.firstNormalSlot)}async getLeaderSchedule(){const e=vk(await this._rpcRequest("getLeaderSchedule",[]),xC);if("error"in e)throw new kS(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(e,t){const r=this._buildArgs([e],t),n=vk(await this._rpcRequest("getMinimumBalanceForRentExemption",r),QC);return"error"in n?(console.warn("Unable to fetch minimum balance for rent exemption"),0):n.result}async getRecentBlockhashAndContext(e){const{context:t,value:{blockhash:r}}=await this.getLatestBlockhashAndContext(e);return{context:t,value:{blockhash:r,feeCalculator:{get lamportsPerSignature(){throw new Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(e){const t=vk(await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),II);if("error"in t)throw new kS(t.error,"failed to get recent performance samples");return t.result}async getFeeCalculatorForBlockhash(e,t){const r=this._buildArgs([e],t),n=vk(await this._rpcRequest("getFeeCalculatorForBlockhash",r),EI);if("error"in n)throw new kS(n.error,"failed to get fee calculator");const{context:i,value:o}=n.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(e,t){const r=G_(e.serialize()).toString("base64"),n=this._buildArgs([r],t),i=vk(await this._rpcRequest("getFeeForMessage",n),XS(Ik(Ek())));if("error"in i)throw new kS(i.error,"failed to get fee for message");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(e){var t;const r=null==(t=null==e?void 0:e.lockedWritableAccounts)?void 0:t.map(e=>e.toBase58()),n=(null==r?void 0:r.length)?[r]:[],i=vk(await this._rpcRequest("getRecentPrioritizationFees",n),vC);if("error"in i)throw new kS(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(e){const{commitment:t,config:r}=VS(e),n=this._buildArgs([],t,void 0,r),i=vk(await this._rpcRequest("getLatestBlockhash",n),SI);if("error"in i)throw new kS(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgs([e],r,void 0,n),o=vk(await this._rpcRequest("isBlockhashValid",i),CI);if("error"in o)throw new kS(o.error,"failed to determine if the blockhash `"+e+"`is valid");return o.result}async getVersion(){const e=vk(await this._rpcRequest("getVersion",[]),JS(hC));if("error"in e)throw new kS(e.error,"failed to get version");return e.result}async getGenesisHash(){const e=vk(await this._rpcRequest("getGenesisHash",[]),JS(Nk()));if("error"in e)throw new kS(e.error,"failed to get genesis hash");return e.result}async getBlock(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgsAtLeastConfirmed([e],r,void 0,n),o=await this._rpcRequest("getBlock",i);try{switch(null==n?void 0:n.transactionDetails){case"accounts":{const e=vk(o,gI);if("error"in e)throw e.error;return e.result}case"none":{const e=vk(o,mI);if("error"in e)throw e.error;return e.result}default:{const e=vk(o,fI);if("error"in e)throw e.error;const{result:t}=e;return t?{...t,transactions:t.transactions.map(({transaction:e,meta:t,version:r})=>({meta:t,transaction:{...e,message:eC(r,e.message)},version:r}))}:null}}}catch(s){throw new kS(s,"failed to get confirmed block")}}async getParsedBlock(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",n),o=await this._rpcRequest("getBlock",i);try{switch(null==n?void 0:n.transactionDetails){case"accounts":{const e=vk(o,vI);if("error"in e)throw e.error;return e.result}case"none":{const e=vk(o,bI);if("error"in e)throw e.error;return e.result}default:{const e=vk(o,yI);if("error"in e)throw e.error;return e.result}}}catch(s){throw new kS(s,"failed to get block")}}async getBlockProduction(e){let t,r;if("string"==typeof e)r=e;else if(e){const{commitment:n,...i}=e;r=n,t=i}const n=this._buildArgs([],r,"base64",t),i=vk(await this._rpcRequest("getBlockProduction",n),mC);if("error"in i)throw new kS(i.error,"failed to get block production information");return i.result}async getTransaction(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgsAtLeastConfirmed([e],r,void 0,n),o=vk(await this._rpcRequest("getTransaction",i),kI);if("error"in o)throw new kS(o.error,"failed to get transaction");const s=o.result;return s?{...s,transaction:{...s.transaction,message:eC(s.version,s.transaction.message)}}:s}async getParsedTransaction(e,t){const{commitment:r,config:n}=VS(t),i=this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",n),o=vk(await this._rpcRequest("getTransaction",i),_I);if("error"in o)throw new kS(o.error,"failed to get transaction");return o.result}async getParsedTransactions(e,t){const{commitment:r,config:n}=VS(t),i=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],r,"jsonParsed",n)}));return(await this._rpcBatchRequest(i)).map(e=>{const t=vk(e,_I);if("error"in t)throw new kS(t.error,"failed to get transactions");return t.result})}async getTransactions(e,t){const{commitment:r,config:n}=VS(t),i=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],r,void 0,n)}));return(await this._rpcBatchRequest(i)).map(e=>{const t=vk(e,kI);if("error"in t)throw new kS(t.error,"failed to get transactions");const r=t.result;return r?{...r,transaction:{...r.transaction,message:eC(r.version,r.transaction.message)}}:r})}async getConfirmedBlock(e,t){const r=this._buildArgsAtLeastConfirmed([e],t),n=vk(await this._rpcRequest("getBlock",r),wI);if("error"in n)throw new kS(n.error,"failed to get confirmed block");const i=n.result;if(!i)throw new Error("Confirmed block "+e+" not found");const o={...i,transactions:i.transactions.map(({transaction:e,meta:t})=>{const r=new pS(e.message);return{meta:t,transaction:{...e,message:r}}})};return{...o,transactions:o.transactions.map(({transaction:e,meta:t})=>({meta:t,transaction:vS.populate(e.message,e.signatures)}))}}async getBlocks(e,t,r){const n=this._buildArgsAtLeastConfirmed(void 0!==t?[e,t]:[e],r),i=vk(await this._rpcRequest("getBlocks",n),JS(kk(Ek())));if("error"in i)throw new kS(i.error,"failed to get blocks");return i.result}async getBlockSignatures(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=vk(await this._rpcRequest("getBlock",r),xI);if("error"in n)throw new kS(n.error,"failed to get block");const i=n.result;if(!i)throw new Error("Block "+e+" not found");return i}async getConfirmedBlockSignatures(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=vk(await this._rpcRequest("getBlock",r),xI);if("error"in n)throw new kS(n.error,"failed to get confirmed block");const i=n.result;if(!i)throw new Error("Confirmed block "+e+" not found");return i}async getConfirmedTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t),n=vk(await this._rpcRequest("getTransaction",r),kI);if("error"in n)throw new kS(n.error,"failed to get transaction");const i=n.result;if(!i)return i;const o=new pS(i.transaction.message),s=i.transaction.signatures;return{...i,transaction:vS.populate(o,s)}}async getParsedConfirmedTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),n=vk(await this._rpcRequest("getTransaction",r),_I);if("error"in n)throw new kS(n.error,"failed to get confirmed transaction");return n.result}async getParsedConfirmedTransactions(e,t){const r=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],t,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(e=>{const t=vk(e,_I);if("error"in t)throw new kS(t.error,"failed to get confirmed transactions");return t.result})}async getConfirmedSignaturesForAddress(e,t,r){let n={},i=await this.getFirstAvailableBlock();for(;!("until"in n)&&!(--t<=0||t<i);)try{const e=await this.getConfirmedBlockSignatures(t,"finalized");e.signatures.length>0&&(n.until=e.signatures[e.signatures.length-1].toString())}catch(oA){if(oA instanceof Error&&oA.message.includes("skipped"))continue;throw oA}let o=await this.getSlot("finalized");for(;!("before"in n||++r>o);)try{const e=await this.getConfirmedBlockSignatures(r);e.signatures.length>0&&(n.before=e.signatures[e.signatures.length-1].toString())}catch(oA){if(oA instanceof Error&&oA.message.includes("skipped"))continue;throw oA}return(await this.getConfirmedSignaturesForAddress2(e,n)).map(e=>e.signature)}async getConfirmedSignaturesForAddress2(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),i=vk(await this._rpcRequest("getConfirmedSignaturesForAddress2",n),LC);if("error"in i)throw new kS(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),i=vk(await this._rpcRequest("getSignaturesForAddress",n),jC);if("error"in i)throw new kS(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(e,t){const{context:r,value:n}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==n&&(i=new zS({key:e,state:zS.deserialize(n.data)})),{context:r,value:i}}async getNonceAndContext(e,t){const{context:r,value:n}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==n&&(i=AS.fromAccountData(n.data)),{context:r,value:i}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(e=>e.value).catch(t=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)})}async requestAirdrop(e,t){const r=vk(await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),AI);if("error"in r)throw new kS(r.error,`airdrop to ${e.toBase58()} failed`);return r.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await _S(100);const e=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(null!==this._blockhashInfo.latestBlockhash&&!e)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now(),t=this._blockhashInfo.latestBlockhash,r=t?t.blockhash:null;for(let n=0;n<50;n++){const e=await this.getLatestBlockhash("finalized");if(r!==e.blockhash)return this._blockhashInfo={latestBlockhash:e,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e;await _S(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){const{commitment:t,config:r}=VS(e),n=this._buildArgs([],t,"base64",r),i=vk(await this._rpcRequest("getStakeMinimumDelegation",n),XS(Ek()));if("error"in i)throw new kS(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(e,t,r){if("message"in e){const n=e.serialize(),i=M.from(n).toString("base64");if(Array.isArray(t)||void 0!==r)throw new Error("Invalid arguments");const o=t||{};o.encoding="base64","commitment"in o||(o.commitment=this.commitment),t&&"object"==typeof t&&"innerInstructions"in t&&(o.innerInstructions=t.innerInstructions);const s=[i,o],a=vk(await this._rpcRequest("simulateTransaction",s),fC);if("error"in a)throw new Error("failed to simulate transaction: "+a.error.message);return a.result}let n;if(e instanceof vS){let t=e;n=new vS,n.feePayer=t.feePayer,n.instructions=e.instructions,n.nonceInfo=t.nonceInfo,n.signatures=t.signatures}else n=vS.populate(e),n._message=n._json=void 0;if(void 0!==t&&!Array.isArray(t))throw new Error("Invalid arguments");const i=t;if(n.nonceInfo&&i)n.sign(...i);else{let e=this._disableBlockhashCaching;for(;;){const t=await this._blockhashWithExpiryBlockHeight(e);if(n.lastValidBlockHeight=t.lastValidBlockHeight,n.recentBlockhash=t.blockhash,!i)break;if(n.sign(...i),!n.signature)throw new Error("!signature");const r=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(r)&&!this._blockhashInfo.transactionSignatures.includes(r)){this._blockhashInfo.simulatedSignatures.push(r);break}e=!0}}const o=n._compile(),s=o.serialize(),a=n._serialize(s).toString("base64"),c={encoding:"base64",commitment:this.commitment};if(r){const e=(Array.isArray(r)?r:o.nonProgramIds()).map(e=>e.toBase58());c.accounts={encoding:"base64",addresses:e}}i&&(c.sigVerify=!0),t&&"object"==typeof t&&"innerInstructions"in t&&(c.innerInstructions=t.innerInstructions);const l=[a,c],u=vk(await this._rpcRequest("simulateTransaction",l),fC);if("error"in u){let e;if("data"in u.error&&(e=u.error.data.logs,e&&Array.isArray(e))){const t="\n ",r=t+e.join(t);console.error(u.error.message,r)}throw new xS({action:"simulate",signature:"",transactionMessage:u.error.message,logs:e})}return u.result}async sendTransaction(e,t,r){if("version"in e){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const r=e.serialize();return await this.sendRawTransaction(r,t)}if(void 0===t||!Array.isArray(t))throw new Error("Invalid arguments");const n=t;if(e.nonceInfo)e.sign(...n);else{let t=this._disableBlockhashCaching;for(;;){const r=await this._blockhashWithExpiryBlockHeight(t);if(e.lastValidBlockHeight=r.lastValidBlockHeight,e.recentBlockhash=r.blockhash,e.sign(...n),!e.signature)throw new Error("!signature");const i=e.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}t=!0}}const i=e.serialize();return await this.sendRawTransaction(i,r)}async sendRawTransaction(e,t){const r=G_(e).toString("base64");return await this.sendEncodedTransaction(r,t)}async sendEncodedTransaction(e,t){const r={encoding:"base64"},n=t&&t.skipPreflight,i=!0===n?"processed":t&&t.preflightCommitment||this.commitment;t&&null!=t.maxRetries&&(r.maxRetries=t.maxRetries),t&&null!=t.minContextSlot&&(r.minContextSlot=t.minContextSlot),n&&(r.skipPreflight=n),i&&(r.preflightCommitment=i);const o=[e,r],s=vk(await this._rpcRequest("sendTransaction",o),MI);if("error"in s){let e;throw"data"in s.error&&(e=s.error.data.logs),new xS({action:n?"send":"simulate",signature:"",transactionMessage:s.error.message,logs:e})}return s.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([e,t])=>{this._setSubscription(e,{...t,state:"pending"})})):this._updateSubscriptions()}_setSubscription(e,t){var r;const n=null==(r=this._subscriptionsByHash[e])?void 0:r.state;if(this._subscriptionsByHash[e]=t,n!==t.state){const r=this._subscriptionStateChangeCallbacksByHash[e];r&&r.forEach(e=>{try{e(t.state)}catch{}})}}_onSubscriptionStateChange(e,t){var r;const n=this._subscriptionHashByClientSubscriptionId[e];if(null==n)return()=>{};const i=(r=this._subscriptionStateChangeCallbacksByHash)[n]||(r[n]=new Set);return i.add(t),()=>{i.delete(t),0===i.size&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(oA){Error}},500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const e=this._rpcWebSocketGeneration,t=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async e=>{const r=this._subscriptionsByHash[e];if(void 0!==r)switch(r.state){case"pending":case"unsubscribed":if(0===r.callbacks.size)return delete this._subscriptionsByHash[e],"unsubscribed"===r.state&&delete this._subscriptionCallbacksByServerSubscriptionId[r.serverSubscriptionId],void(await this._updateSubscriptions());await(async()=>{const{args:n,method:i}=r;try{this._setSubscription(e,{...r,state:"subscribing"});const t=await this._rpcWebSocket.call(i,n);this._setSubscription(e,{...r,serverSubscriptionId:t,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[t]=r.callbacks,await this._updateSubscriptions()}catch(o){if(console.error(`Received ${o instanceof Error?"":"JSON-RPC "}error calling \`${i}\``,{args:n,error:o}),!t())return;this._setSubscription(e,{...r,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===r.callbacks.size&&await(async()=>{const{serverSubscriptionId:n,unsubscribeMethod:i}=r;if(this._subscriptionsAutoDisposedByRpc.has(n))this._subscriptionsAutoDisposedByRpc.delete(n);else{this._setSubscription(e,{...r,state:"unsubscribing"}),this._setSubscription(e,{...r,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[n])}catch(o){if(o instanceof Error&&console.error(`${i} error:`,o.message),!t())return;return this._setSubscription(e,{...r,state:"subscribed"}),void(await this._updateSubscriptions())}}this._setSubscription(e,{...r,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(e,t){const r=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==r&&r.forEach(e=>{try{e(...t)}catch(r){console.error(r)}})}_wsOnAccountNotification(e){const{result:t,subscription:r}=vk(e,UC);this._handleServerNotification(r,[t.value,t.context])}_makeSubscription(e,t){const r=this._nextClientSubscriptionId++,n=LS([e.method,t]),i=this._subscriptionsByHash[n];return void 0===i?this._subscriptionsByHash[n]={...e,args:t,callbacks:new Set([e.callback]),state:"pending"}:i.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[r]=n,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];const t=this._subscriptionsByHash[n];cS(void 0!==t,`Could not find a \`Subscription\` when tearing down client subscription #${r}`),t.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(e,t,r){const{commitment:n,config:i}=VS(r),o=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64",i);return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},o)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){const{result:t,subscription:r}=vk(e,FC);this._handleServerNotification(r,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(e,t,r,n){const{commitment:i,config:o}=VS(r),s=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",o||(n?{filters:KS(n)}:void 0));return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,t,r){const n=this._buildArgs(["object"==typeof e?{mentions:[e.toString()]}:e],r||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},n)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){const{result:t,subscription:r}=vk(e,PI);this._handleServerNotification(r,[t.value,t.context])}_wsOnSlotNotification(e){const{result:t,subscription:r}=vk(e,qC);this._handleServerNotification(r,[t])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){const{result:t,subscription:r}=vk(e,WC);this._handleServerNotification(r,[t])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,t){const r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];r?await r():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${t}' events could not be found.`)}_buildArgs(e,t,r,n){const i=t||this._commitment;if(i||r||n){let t={};r&&(t.encoding=r),i&&(t.commitment=i),n&&(t=Object.assign(t,n)),e.push(t)}return e}_buildArgsAtLeastConfirmed(e,t,r,n){const i=t||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,r,n)}_wsOnSignatureNotification(e){const{result:t,subscription:r}=vk(e,GC);"receivedSignature"!==t.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===t.value?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(e,t,r){const n=this._buildArgs([e],r||this._commitment||"finalized"),i=this._makeSubscription({callback:(e,r)=>{if("status"===e.type){t(e.result,r);try{this.removeSignatureListener(i)}catch(n){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},n);return i}onSignatureWithOptions(e,t,r){const{commitment:n,...i}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},o=this._buildArgs([e],n,void 0,i),s=this._makeSubscription({callback:(e,r)=>{t(e,r);try{this.removeSignatureListener(s)}catch(n){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){const{result:t,subscription:r}=vk(e,HC);this._handleServerNotification(r,[t])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}}var BI;Object.freeze({CreateLookupTable:{index:0,layout:Xx([Zx("instruction"),MS("recentSlot"),Vx("bumpSeed")])},FreezeLookupTable:{index:1,layout:Xx([Zx("instruction")])},ExtendLookupTable:{index:2,layout:Xx([Zx("instruction"),MS(),Qx(nS(),Hx(Zx(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Xx([Zx("instruction")])},CloseLookupTable:{index:4,layout:Xx([Zx("instruction")])}}),new J_("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:Xx([Vx("instruction"),Zx("units"),Zx("additionalFee")])},RequestHeapFrame:{index:1,layout:Xx([Vx("instruction"),Zx("bytes")])},SetComputeUnitLimit:{index:2,layout:Xx([Vx("instruction"),Zx("units")])},SetComputeUnitPrice:{index:3,layout:Xx([Vx("instruction"),MS("microLamports")])}}),new J_("ComputeBudget111111111111111111111111111111"),Xx([Vx("numSignatures"),Vx("padding"),Kx("signatureOffset"),Kx("signatureInstructionIndex"),Kx("publicKeyOffset"),Kx("publicKeyInstructionIndex"),Kx("messageDataOffset"),Kx("messageDataSize"),Kx("messageInstructionIndex")]),new J_("Ed25519SigVerify111111111111111111111111111"),q_.utils.isValidPrivateKey,Xx([Vx("numSignatures"),Kx("signatureOffset"),Vx("signatureInstructionIndex"),Kx("ethAddressOffset"),Vx("ethAddressInstructionIndex"),Kx("messageDataOffset"),Kx("messageDataSize"),Vx("messageInstructionIndex"),ek(20,"ethAddress"),ek(64,"signature"),Vx("recoveryId")]),new J_("KeccakSecp256k11111111111111111111111111111"),new J_("StakeConfig11111111111111111111111111111111");class RI{constructor(e,t,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=r}}BI=RI,RI.default=new BI(0,0,J_.default),Object.freeze({Initialize:{index:0,layout:Xx([Zx("instruction"),((e="authorized")=>Xx([nS("staker"),nS("withdrawer")],e))(),((e="lockup")=>Xx([Jx("unixTimestamp"),Jx("epoch"),nS("custodian")],e))()])},Authorize:{index:1,layout:Xx([Zx("instruction"),nS("newAuthorized"),Zx("stakeAuthorizationType")])},Delegate:{index:2,layout:Xx([Zx("instruction")])},Split:{index:3,layout:Xx([Zx("instruction"),Jx("lamports")])},Withdraw:{index:4,layout:Xx([Zx("instruction"),Jx("lamports")])},Deactivate:{index:5,layout:Xx([Zx("instruction")])},Merge:{index:7,layout:Xx([Zx("instruction")])},AuthorizeWithSeed:{index:8,layout:Xx([Zx("instruction"),nS("newAuthorized"),Zx("stakeAuthorizationType"),iS("authoritySeed"),nS("authorityOwner")])}}),new J_("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:Xx([Zx("instruction"),((e="voteInit")=>Xx([nS("nodePubkey"),nS("authorizedVoter"),nS("authorizedWithdrawer"),Vx("commission")],e))()])},Authorize:{index:1,layout:Xx([Zx("instruction"),nS("newAuthorized"),Zx("voteAuthorizationType")])},Withdraw:{index:3,layout:Xx([Zx("instruction"),Jx("lamports")])},UpdateValidatorIdentity:{index:4,layout:Xx([Zx("instruction")])},AuthorizeWithSeed:{index:10,layout:Xx([Zx("instruction"),((e="voteAuthorizeWithSeedArgs")=>Xx([Zx("voteAuthorizationType"),nS("currentAuthorityDerivedKeyOwnerPubkey"),iS("currentAuthorityDerivedKeySeed"),nS("newAuthorized")],e))()])}}),new J_("Vote111111111111111111111111111111111111111"),new J_("Va1idator1nfo111111111111111111111111111111"),Tk({name:Nk(),website:Ak(Nk()),details:Ak(Nk()),iconUrl:Ak(Nk()),keybaseUsername:Ak(Nk())}),new J_("Vote111111111111111111111111111111111111111"),Xx([nS("nodePubkey"),nS("authorizedWithdrawer"),Vx("commission"),Yx(),Qx(Xx([Yx("slot"),Zx("confirmationCount")]),Hx(Zx(),-8),"votes"),Vx("rootSlotValid"),Yx("rootSlot"),Yx(),Qx(Xx([Yx("epoch"),nS("authorizedVoter")]),Hx(Zx(),-8),"authorizedVoters"),Xx([Qx(Xx([nS("authorizedPubkey"),Yx("epochOfLastAuthorizedSwitch"),Yx("targetEpoch")]),32,"buf"),Yx("idx"),Vx("isEmpty")],"priorVoters"),Yx(),Qx(Xx([Yx("epoch"),Yx("credits"),Yx("prevCredits")]),Hx(Zx(),-8),"epochCredits"),Xx([Yx("slot"),Yx("timestamp")],"lastTimestamp")]);const LI=1e9,jI=Object.freeze(Object.defineProperty({__proto__:null,AddressLookupTableAccount:zS,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,Connection:OI,EpochSchedule:US,FeeCalculatorLayout:CS,LAMPORTS_PER_SOL:LI,Lockup:RI,MAX_SEED_LENGTH:32,Message:pS,MessageAccountKeys:rS,MessageV0:fS,NONCE_ACCOUNT_LENGTH:ES,NonceAccount:AS,PACKET_DATA_SIZE:X_,PUBLIC_KEY_LENGTH:Z_,PublicKey:J_,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:V_,SYSTEM_INSTRUCTION_LAYOUTS:NS,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:bS,SYSVAR_RENT_PUBKEY:wS,SendTransactionError:xS,SolanaJSONRPCError:kS,Struct:H_,SystemProgram:PS,Transaction:vS,TransactionExpiredBlockheightExceededError:Q_,TransactionExpiredNonceInvalidError:tS,TransactionExpiredTimeoutError:eS,TransactionInstruction:yS,TransactionStatus:mS,VERSION_PREFIX_MASK:127},Symbol.toStringTag,{value:"Module"})),UI=new J_("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new J_("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const DI=new J_("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new J_("So11111111111111111111111111111111111111112"),new J_("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const FI=e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)});var zI={};Object.defineProperty(zI,"__esModule",{value:!0});var qI=zI.toBigIntLE=function(e){{const t=I.from(e);t.reverse();const r=t.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}};zI.toBigIntBE=function(e){{const t=e.toString("hex");return 0===t.length?BigInt(0):BigInt(`0x${t}`)}};var $I=zI.toBufferLE=function(e,t){{const r=e.toString(16),n=I.from(r.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};zI.toBufferBE=function(e,t){{const r=e.toString(16);return I.from(r.padStart(2*t,"0").slice(0,2*t),"hex")}};const WI=(GI=8,e=>{const t=ek(GI,e),{encode:r,decode:n}=FI(t),i=t;return i.decode=(e,t)=>{const r=n(e,t);return qI(I.from(r))},i.encode=(e,t,n)=>{const i=$I(e,GI);return r(i,t,n)},i});var GI;const HI=e=>{const t=Vx(e),{encode:r,decode:n}=FI(t),i=t;return i.decode=(e,t)=>!!n(e,t),i.encode=(e,t,n)=>{const i=Number(e);return r(i,t,n)},i},VI=e=>{const t=ek(32,e),{encode:r,decode:n}=FI(t),i=t;return i.decode=(e,t)=>{const r=n(e,t);return new J_(r)},i.encode=(e,t,n)=>{const i=e.toBuffer();return r(i,t,n)},i};class KI extends Error{constructor(e){super(e)}}class ZI extends KI{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class YI extends KI{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}}class JI extends KI{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class XI extends KI{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class QI extends KI{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var eE,tE,rE,nE;(tE=eE||(eE={}))[tE.InitializeMint=0]="InitializeMint",tE[tE.InitializeAccount=1]="InitializeAccount",tE[tE.InitializeMultisig=2]="InitializeMultisig",tE[tE.Transfer=3]="Transfer",tE[tE.Approve=4]="Approve",tE[tE.Revoke=5]="Revoke",tE[tE.SetAuthority=6]="SetAuthority",tE[tE.MintTo=7]="MintTo",tE[tE.Burn=8]="Burn",tE[tE.CloseAccount=9]="CloseAccount",tE[tE.FreezeAccount=10]="FreezeAccount",tE[tE.ThawAccount=11]="ThawAccount",tE[tE.TransferChecked=12]="TransferChecked",tE[tE.ApproveChecked=13]="ApproveChecked",tE[tE.MintToChecked=14]="MintToChecked",tE[tE.BurnChecked=15]="BurnChecked",tE[tE.InitializeAccount2=16]="InitializeAccount2",tE[tE.SyncNative=17]="SyncNative",tE[tE.InitializeAccount3=18]="InitializeAccount3",tE[tE.InitializeMultisig2=19]="InitializeMultisig2",tE[tE.InitializeMint2=20]="InitializeMint2",tE[tE.GetAccountDataSize=21]="GetAccountDataSize",tE[tE.InitializeImmutableOwner=22]="InitializeImmutableOwner",tE[tE.AmountToUiAmount=23]="AmountToUiAmount",tE[tE.UiAmountToAmount=24]="UiAmountToAmount",tE[tE.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",tE[tE.TransferFeeExtension=26]="TransferFeeExtension",tE[tE.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",tE[tE.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",tE[tE.Reallocate=29]="Reallocate",tE[tE.MemoTransferExtension=30]="MemoTransferExtension",tE[tE.CreateNativeMint=31]="CreateNativeMint",tE[tE.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",tE[tE.InterestBearingMintExtension=33]="InterestBearingMintExtension",tE[tE.CpiGuardExtension=34]="CpiGuardExtension",tE[tE.InitializePermanentDelegate=35]="InitializePermanentDelegate",tE[tE.TransferHookExtension=36]="TransferHookExtension",tE[tE.MetadataPointerExtension=39]="MetadataPointerExtension",tE[tE.GroupPointerExtension=40]="GroupPointerExtension",tE[tE.GroupMemberPointerExtension=41]="GroupMemberPointerExtension",tE[tE.ScaledUiAmountExtension=43]="ScaledUiAmountExtension",tE[tE.PausableExtension=44]="PausableExtension",(nE=rE||(rE={}))[nE.Uninitialized=0]="Uninitialized",nE[nE.Mint=1]="Mint",nE[nE.Account=2]="Account";const iE=Xx([Vx("m"),Vx("n"),HI("isInitialized"),VI("signer1"),VI("signer2"),VI("signer3"),VI("signer4"),VI("signer5"),VI("signer6"),VI("signer7"),VI("signer8"),VI("signer9"),VI("signer10"),VI("signer11")]).span;var oE,sE;(sE=oE||(oE={}))[sE.Uninitialized=0]="Uninitialized",sE[sE.Initialized=1]="Initialized",sE[sE.Frozen=2]="Frozen";const aE=Xx([VI("mint"),VI("owner"),WI("amount"),Zx("delegateOption"),VI("delegate"),Vx("state"),Zx("isNativeOption"),WI("isNative"),WI("delegatedAmount"),Zx("closeAuthorityOption"),VI("closeAuthority")]),cE=aE.span;async function lE(e,t,r,n=UI){return function(e,t,r=UI){if(!t)throw new ZI;if(!t.owner.equals(r))throw new JI;if(t.data.length<cE)throw new XI;const n=aE.decode(t.data.slice(0,cE));let i=I.alloc(0);if(t.data.length>cE){if(t.data.length===iE)throw new XI;if(t.data[cE]!=rE.Account)throw new YI;i=t.data.slice(cE+1)}return{address:e,mint:n.mint,owner:n.owner,amount:n.amount,delegate:n.delegateOption?n.delegate:null,delegatedAmount:n.delegatedAmount,isInitialized:n.state!==oE.Uninitialized,isFrozen:n.state===oE.Frozen,isNative:!!n.isNativeOption,rentExemptReserve:n.isNativeOption?n.isNative:null,closeAuthority:n.closeAuthorityOption?n.closeAuthority:null,tlvData:i}}(t,await e.getAccountInfo(t,r),n)}async function uE(e,t,r=!1,n=UI,i=DI){if(!r&&!J_.isOnCurve(t.toBuffer()))throw new QI;const[o]=await J_.findProgramAddress([t.toBuffer(),n.toBuffer(),e.toBuffer()],i);return o}function hE(e,t,r,n,i=UI,o=DI){return function(e,t,r,n,i,o=UI,s=DI){const a=[{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:PS.programId,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1}];return new yS({keys:a,programId:s,data:i})}(e,t,r,n,I.alloc(0),i,o)}Xx([Zx("mintAuthorityOption"),VI("mintAuthority"),WI("supply"),Vx("decimals"),HI("isInitialized"),Zx("freezeAuthorityOption"),VI("freezeAuthority")]).span;const dE=Xx([Vx("instruction"),WI("amount")]);function pE(e,t,r,n,i=[],o=UI){const s=function(e,t,r){if(r.length){e.push({pubkey:t,isSigner:!1,isWritable:!1});for(const t of r)e.push({pubkey:t instanceof J_?t:t.publicKey,isSigner:!0,isWritable:!1})}else e.push({pubkey:t,isSigner:!0,isWritable:!1});return e}([{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0}],r,i),a=I.alloc(dE.span);return dE.encode({instruction:eE.Transfer,amount:BigInt(n)},a),new yS({keys:s,programId:o,data:a})}const fE=({options:e=[],value:n,onChange:i,placeholder:o,renderOption:s,getOptionKey:a,getOptionValue:c,getSearchableText:u,disabled:h=!1})=>{const[d,p]=r.useState(!1),[f,m]=r.useState(""),[g,y]=r.useState({top:0,left:0,width:400,maxHeight:450}),v=r.useRef(null),b=r.useRef(null),w=e.filter(e=>(u?u(e):"").toLowerCase().includes(f.toLowerCase())),x=e.find(e=>c(e)===n),k=()=>{if(b.current){const e=window.innerWidth,t=window.innerHeight,r=Math.min(400,e-40),n=Math.min(450,t-100);y({top:t/2-n/2,left:e/2-r/2,width:r,maxHeight:n})}};r.useEffect(()=>{const e=e=>{v.current&&!v.current.contains(e.target)&&b.current&&!b.current.contains(e.target)&&(p(!1),m(""))},t=()=>{d&&k()};if(d){k();const r=window.scrollY;document.body.style.position="fixed",document.body.style.top=`-${r}px`,document.body.style.width="100%",document.addEventListener("mousedown",e),window.addEventListener("resize",t)}return()=>{if(d){const e=document.body.style.top;document.body.style.position="",document.body.style.top="",document.body.style.width="",window.scrollTo(0,-1*parseInt(e||"0"))}document.removeEventListener("mousedown",e),window.removeEventListener("resize",t)}},[d]);const _=d&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-30 transition-opacity",style:{zIndex:999998},onClick:()=>{p(!1),m("")}}),t.jsxs("div",{ref:v,className:"fixed bg-white border-2 border-gray-200 rounded-3xl shadow-2xl overflow-hidden",style:{top:g.top,left:g.left,width:g.width,maxHeight:g.maxHeight,zIndex:999999,transform:"translateZ(0)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05)"},children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 bg-gradient-to-r from-[#7042D2]/10 to-purple-50",children:[t.jsx("h3",{className:"text-lg font-semibold text-[#7042D2]",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:o||"Select Option"}),t.jsx("button",{onClick:()=>{p(!1),m("")},className:"text-gray-500 hover:text-gray-700 transition-colors p-1 rounded-full hover:bg-gray-100",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsx("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:t.jsx("input",{type:"text",placeholder:"Search networks and tokens...",value:f,onChange:e=>m(e.target.value),className:"w-full p-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-[#7042D2]/20 focus:border-[#7042D2] text-sm",style:{fontFamily:"Bricolage Grotesque, sans-serif"},autoFocus:!0})}),t.jsx("div",{className:"overflow-y-auto custom-scrollbar",style:{maxHeight:(g.maxHeight||450)-180+"px",minHeight:"200px"},children:0===w.length?t.jsxs("div",{className:"p-8 text-gray-500 text-center",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:[t.jsx("div",{className:"text-4xl mb-3",children:"๐Ÿ”"}),t.jsx("div",{className:"text-lg mb-2",children:"No options found"}),t.jsx("div",{className:"text-sm text-gray-400",children:"Try a different search term"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-4 py-3 bg-gray-50 border-b border-gray-100 text-sm text-gray-600",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:[t.jsx("span",{className:"font-semibold",children:w.length})," option",1!==w.length?"s":""," available"]}),t.jsx("div",{className:"p-2",children:w.map(e=>t.jsx("button",{type:"button",onClick:()=>{i(c(e)),p(!1),m("")},className:"w-full p-4 text-left hover:bg-[#7042D2]/10 transition-all duration-200 rounded-xl mb-2 last:mb-0 "+(c(e)===n?"bg-[#7042D2]/20 text-[#7042D2] border-2 border-[#7042D2]/30":"text-gray-800 border-2 border-transparent hover:border-[#7042D2]/20"),style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:s(e)},a(e)))})]})}),t.jsx("div",{className:"p-3 bg-gradient-to-r from-gray-50 to-gray-100 border-t border-gray-200 text-center",children:t.jsx("div",{className:"text-xs text-gray-500",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:w.length>5?"โ†•๏ธ Scroll to see more options":"โœจ Select your preferred option"})})]})]});return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"relative",children:t.jsx("button",{ref:b,type:"button",onClick:()=>{h||(d||k(),p(!d))},disabled:h,className:`w-full p-4 border-2 rounded-2xl bg-gradient-to-r from-white to-gray-50 text-left focus:outline-none focus:ring-3 focus:ring-[#7042D2]/20 focus:border-[#7042D2] transition-all duration-300 ease-out shadow-lg hover:shadow-xl ${h?"opacity-50 cursor-not-allowed":"hover:border-[#7042D2]/50 cursor-pointer"} ${d?"border-[#7042D2] ring-3 ring-[#7042D2]/20":"border-gray-200"}`,style:{minHeight:"60px",fontFamily:"Bricolage Grotesque, sans-serif",fontSize:"16px",fontWeight:"500"},children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"flex items-center space-x-3",children:x?s(x):t.jsx("span",{className:"text-gray-500",children:o})}),t.jsx("div",{className:"transform transition-transform duration-200 "+(d?"rotate-180":""),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-[#7042D2]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})})}),"undefined"!=typeof document&&document.body&&l.createPortal(_,document.body),t.jsx("style",{children:"\n .custom-scrollbar {\n scrollbar-width: thin;\n scrollbar-color: #7042D2 #f1f1f1;\n }\n .custom-scrollbar::-webkit-scrollbar {\n width: 12px;\n }\n .custom-scrollbar::-webkit-scrollbar-track {\n background: #f8f9fa;\n border-radius: 10px;\n margin: 4px;\n }\n .custom-scrollbar::-webkit-scrollbar-thumb {\n background: linear-gradient(180deg, #7042D2 0%, #5b34b1 100%);\n border-radius: 10px;\n border: 2px solid #f8f9fa;\n }\n .custom-scrollbar::-webkit-scrollbar-thumb:hover {\n background: linear-gradient(180deg, #5b34b1 0%, #4c2a93 100%);\n }\n .custom-scrollbar::-webkit-scrollbar-corner {\n background: #f8f9fa;\n }\n "})]})},mE=({currentStep:e,targetStep:n,children:i,className:o="",duration:s=300})=>{const[a,c]=r.useState(e===n),[l,u]=r.useState(e===n);return r.useEffect(()=>{e===n?(u(!0),setTimeout(()=>c(!0),10)):(c(!1),setTimeout(()=>u(!1),s))},[e,n,s]),l?t.jsx("div",{className:`\n transition-all duration-300 ease-out\n ${a?"transform translate-y-0 opacity-100":"transform translate-y-full opacity-0"}\n ${o}\n `,style:{transitionDuration:`${s}ms`},children:i}):null},gE=({status:e,message:n,theme:i="light",payment:o=null,transactionHash:s=null,selectedPaymentMethod:a=null,selectedNetwork:c=null,merchantName:l="Merchant",onClose:u=null})=>{const[h,d]=r.useState(!1),[p,f]=r.useState(0);r.useEffect(()=>{if("processing"===e){const e=setInterval(()=>{f(e=>e>=90?e:e+15*Math.random())},500);return()=>clearInterval(e)}},[e]);const m=async()=>{if(s)try{await navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)}catch(oA){}},g=()=>{switch(e){case"processing":return t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-4 border-t-[#7042D2] border-blue-500/20"}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 bg-[#7042D2] rounded-full animate-pulse"})})]});case"success":return t.jsx("div",{className:"rounded-full h-16 w-16 bg-green-500 flex items-center justify-center animate-bounce",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-10 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})});case"error":return t.jsx("div",{className:"rounded-full h-12 w-12 bg-red-100 flex items-center justify-center",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})});default:return null}};return"processing"===e?t.jsxs("div",{className:"flex flex-col items-center justify-center py-6 px-4",children:[t.jsx("div",{className:"mb-6",children:g()}),t.jsx("h3",{className:"text-xl font-bold mb-3 text-gray-900",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:"Processing Payment"}),t.jsx("p",{className:"text-center text-gray-600 mb-6",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:"Your transaction has been sent to the blockchain and is being processed..."}),t.jsxs("div",{className:"w-full max-w-xs mb-4",children:[t.jsx("div",{className:"bg-gray-200 rounded-full h-3",children:t.jsx("div",{className:"bg-[#7042D2] h-3 rounded-full transition-all duration-500 ease-out",style:{width:`${p}%`}})}),t.jsxs("div",{className:"text-center mt-2 text-sm text-gray-500",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:["Processing... ",Math.round(p),"%"]})]}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),t.jsx("span",{className:"text-sm text-gray-600",children:"Transaction submitted"})]}),t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"w-2 h-2 bg-yellow-500 rounded-full animate-pulse"}),t.jsx("span",{className:"text-sm text-gray-600",children:"Confirming on blockchain..."})]}),t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"w-2 h-2 bg-gray-300 rounded-full"}),t.jsx("span",{className:"text-sm text-gray-400",children:"Finalizing payment..."})]})]}),t.jsx("div",{className:"mt-6 p-3 bg-blue-50 rounded-lg border border-blue-200",children:t.jsx("p",{className:"text-xs text-blue-800 text-center",children:"Please don't close this window. This usually takes 10-30 seconds."})})]}):"success"===e?t.jsxs("div",{className:"flex flex-col items-center justify-center py-6 px-4",children:[t.jsx("div",{className:"mb-6",children:g()}),t.jsx("h3",{className:"text-2xl font-bold mb-3 text-gray-900",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:"Payment Successful!"}),o&&a&&t.jsxs("p",{className:"text-center max-w-[235px] mb-6 text-gray-600",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:["Your payment of ",t.jsxs("span",{className:"text-[#7042D2] font-semibold",children:[o.totalAmount||o.amount," ",a.currency]})," has been completed."]}),s&&t.jsxs("div",{className:"w-full mb-6 px-4",children:[t.jsx("p",{className:"text-sm font-medium mb-2 text-gray-700",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:"Transaction Details"}),t.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border cursor-pointer transition-colors bg-gray-50 border-gray-200 hover:bg-gray-100 mb-3",onClick:m,children:[t.jsx("span",{className:"font-mono text-sm text-gray-700",children:(y=s,y?y.length<=16?y:`${y.slice(0,8)}...${y.slice(-8)}`:"")}),t.jsxs("div",{className:"flex items-center",children:[h?t.jsx("span",{className:"text-green-500 text-xs font-medium mr-2",children:"Copied!"}):null,t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(()=>{const e=((e,t)=>{if(!e||!t)return null;const r="string"==typeof t?t:t.shortName||t.name;return{ethereum:`https://etherscan.io/tx/${e}`,bsc:`https://bscscan.com/tx/${e}`,polygon:`https://polygonscan.com/tx/${e}`,arbitrum:`https://arbiscan.io/tx/${e}`,optimism:`https://optimistic.etherscan.io/tx/${e}`,avalanche:`https://snowtrace.io/tx/${e}`,celo:`https://celoscan.io/tx/${e}`,base:`https://basescan.org/tx/${e}`,solana:`https://explorer.solana.com/tx/${e}`,"solana-mainnet":`https://explorer.solana.com/tx/${e}`,"solana-devnet":`https://explorer.solana.com/tx/${e}?cluster=devnet`,"solana devnet":`https://explorer.solana.com/tx/${e}?cluster=devnet`}[null==r?void 0:r.toLowerCase()]||null})(s,c),r=(e=>{if(!e)return"Explorer";const t="string"==typeof e?e:e.shortName||e.name;return{ethereum:"Etherscan",bsc:"BscScan",polygon:"PolygonScan",arbitrum:"Arbiscan",optimism:"Optimistic Etherscan",avalanche:"SnowTrace",celo:"CeloScan",base:"BaseScan",solana:"Solana Explorer","solana-mainnet":"Solana Explorer","solana-devnet":"Solana Explorer (Devnet)","solana devnet":"Solana Explorer (Devnet)"}[null==t?void 0:t.toLowerCase()]||"Explorer"})(c);return c&&e&&t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 w-full p-3 rounded-lg border border-[#7042D2] bg-white hover:bg-purple-50 transition-colors group",children:[t.jsxs("span",{className:"text-sm font-medium text-[#7042D2]",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:["View on ",r]}),t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-[#7042D2] group-hover:translate-x-1 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})()]}),u&&t.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-[#7042D2] text-white font-semibold rounded-2xl text-lg shadow-md hover:bg-[#5b34b1] transition-colors",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:"Close"})]}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[t.jsx("div",{className:"mb-4",children:g()}),t.jsx("h3",{className:"text-xl font-bold mb-2 text-gray-900",children:"processing"===e?"Processing Payment":"error"===e?"Payment Failed":"Unknown Status"}),t.jsx("p",{className:"text-center text-gray-600",children:n})]});var y},yE={bitcoin:1,ethereum:1027,bsc:1839,polygon:3890,cardano:2010,avalanche:5805,fantom:3513,arbitrum:11841,optimism:11840,USDT:825,USDC:3408,BUSD:4687,DAI:4943,FRAX:6952,TUSD:2563,USDP:5992,USDD:5994,FDUSD:26081,PYUSD:28295,WBTC:3717,LINK:1975,UNI:7083,AAVE:7278,COMP:5692,YFI:5864,MKR:1518,SUSHI:6758,CRV:6538,SNX:2586,UMA:5617,BAL:5728,MANA:1966,SAND:6210,APE:18876,LDO:8e3,GRT:6719,ENS:13855,RPL:2943,SHIB:5994,MATIC:3890,BNB:1839,ADA:2010,SOL:5426,DOT:6636,AVAX:5805,TRX:1958,ALGO:4030,FTM:3513,ARB:11841,OP:11840,"1INCH":8104,DYDX:11156,ICP:8916,FIL:2280,CAKE:7186,RUNE:4157,ALPHA:7232,BNT:1727,KNC:1982,ZRX:1896,REN:2539,LRC:1934,WETH:2396,WMATIC:3890,WBNB:1839,UST:7129,USTC:7129,LUSD:8115,MIM:9681,FEI:8642,TRIBE:8741,RAI:8525,SUSD:2927},vE={ethereum:"https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png",bsc:"https://s2.coinmarketcap.com/static/img/coins/64x64/1839.png",polygon:"https://s2.coinmarketcap.com/static/img/coins/64x64/28321.png",arbitrum:"https://s2.coinmarketcap.com/static/img/coins/64x64/11841.png",avalanche:"https://s2.coinmarketcap.com/static/img/coins/64x64/5805.png",celo:"https://s2.coinmarketcap.com/static/img/coins/64x64/5567.png",optimism:"https://s2.coinmarketcap.com/static/img/coins/64x64/11840.png",base:"https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png",eth:"https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png",bnb:"https://s2.coinmarketcap.com/static/img/coins/64x64/1839.png",trx:"https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png",algo:"https://s2.coinmarketcap.com/static/img/coins/64x64/4030.png",matic:"https://s2.coinmarketcap.com/static/img/coins/64x64/28321.png",arb:"https://s2.coinmarketcap.com/static/img/coins/64x64/11841.png",avax:"https://s2.coinmarketcap.com/static/img/coins/64x64/5805.png",op:"https://s2.coinmarketcap.com/static/img/coins/64x64/11840.png",sol:"https://s2.coinmarketcap.com/static/img/coins/64x64/5426.png",solana:"https://s2.coinmarketcap.com/static/img/coins/64x64/5426.png","solana-mainnet":"https://s2.coinmarketcap.com/static/img/coins/64x64/5426.png","solana-devnet":"https://s2.coinmarketcap.com/static/img/coins/64x64/5426.png"},bE={metamask:"https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg",coinbase:"https://avatars.githubusercontent.com/u/18060234?s=280&v=4",rabby:"https://rabby.io/logo-128.png",zerion:"https://app.zerion.io/favicon-32x32.png",okx:"https://static.okx.com/cdn/assets/imgs/248/58E63FEA47A2B7D7.png",binance:"https://bin.bnbstatic.com/static/images/common/favicon.ico",cryptocom:"https://crypto.com/favicon.ico","1inch":"https://1inch.io/favicon.svg",hot:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTQiIGZpbGw9IiNGRjZBNkEiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIyIi8+CjxwYXRoIGQ9Ik0xMCAxMmg0djhoLTR2LTJoMnYtNGgtMnYtMnptNiAwaDJ2MmgtdjdoLTJ2LTIiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",phantom:"https://phantom.app/img/phantom-logo.svg",solflare:"https://solflare.com/assets/logo.svg",backpack:"https://www.backpack.exchange/_next/image?url=%2Fbackpack-logo.png&w=128&q=75",trust:"https://trustwallet.com/assets/images/favicon.png",default:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTQiIGZpbGw9IiM2MzY2RjEiIHN0cm9rZT0iI0Y5RkFGQiIgc3Ryb2tlLXdpZHRoPSIyIi8+CjxwYXRoIGQ9Ik0xMCAxMmgxMnY4SDEweiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHJ4PSIxIi8+CjxjaXJjbGUgY3g9IjE4IiBjeT0iMTYiIHI9IjEiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg=="},wE=e=>(e=>{if(!e)return null;const t=yE[e.toUpperCase()];return t?`https://s2.coinmarketcap.com/static/img/coins/64x64/${t}.png`:null})(e),xE=(e,t)=>{const r=e.toLowerCase(),n=t.toLowerCase();for(const[i,o]of Object.entries(bE))if(r.includes(i)||n.includes(i))return o;return bE.default},kE=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),_E=e=>{switch(e){case"trust":return window.ethereum&&!0===window.ethereum.isTrust;case"metaMask":return window.ethereum&&!0===window.ethereum.isMetaMask;case"injected":return window.ethereum&&!window.ethereum.isMetaMask&&!window.ethereum.isCoinbaseWallet;default:return!1}},SE=(e,t)=>{if(!t)return[];if(!["ethereum","bsc","polygon","arbitrum","optimism","avalanche","celo","base"].includes(t.shortName))return[];return[...(e||[]).map(e=>(e=>({type:e.id,name:e.name,icon:xE(e.name,e.id),description:`Connect using ${e.name}`,isInstalled:!0,connector:e,isWagmi:!0}))(e)),...kE()?[{type:"trust",name:"Trust Wallet",icon:"๐Ÿ›ก๏ธ",description:"Multi-chain wallet with transaction deep links",isInstalled:!1,connector:null,isWagmi:!1,mobileOnly:!0,hasTransactionDeepLinks:!0}]:[]]},CE=(e,t,r,n,i="metamask",o=null)=>{if(!e)return null;try{const t="https://paymentscreen.vercel.app",n=new URLSearchParams,o=(null==e?void 0:e.id)||(null==e?void 0:e.splitterPaymentId);if(!o)return null;n.set("paymentId",o),n.set("preferredWallet",i),n.set("isMobile","true");const s=`${t}?${n.toString()}`;let a;switch(i){case"metamask":a=`https://metamask.app.link/dapp/${s.replace("https://","")}`;break;case"trust":const e=(null==r?void 0:r.chainId)||1;a=`https://link.trustwallet.com/open_url?coin_id=${(e=>{const t="string"==typeof e&&e.startsWith("0x")?parseInt(e,16):parseInt(e);return[1,56,137,42161,10,43114,42220,8453].includes(t)?60:{}[t]||60})(e)}&url=${encodeURIComponent(s)}`;break;case"coinbase":a=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(s)}`;break;default:a=s}return a}catch(uh){return null}},IE=(e,t)=>{if(!t)return null;try{switch(e){case"metamask":return t.includes("metamask.app.link")?t:`https://metamask.app.link/dapp/${t.replace("https://","")}`;case"trust":return t.includes("link.trustwallet.com")?t:`https://link.trustwallet.com/open_url?coin_id=60&url=${encodeURIComponent(t)}`;case"coinbase":return t.includes("go.cb-w.com")?t:`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(t)}`;default:return t}}catch(uh){return t}},EE=Object.freeze(Object.defineProperty({__proto__:null,generateMobilePaymentDeepLink:IE,generateQRPaymentURI:CE},Symbol.toStringTag,{value:"Module"})),AE=({walletAddress:e,amount:n,currency:i,network:o,theme:s="light",paymentData:a=null,onPaymentDetected:c=null,config:l=null,selectedToken:h=null,selectedNetwork:d=null,preferredWallet:p="metamask",compact:f=!1})=>{const[m,g]=r.useState(""),[y,v]=r.useState(""),[b,w]=r.useState(!0),[x,k]=r.useState(!1),[_,S]=r.useState(!1),C=r.useRef(null);return r.useEffect(()=>{(async()=>{if(null==a?void 0:a.id){w(!0);try{if(!h||!h.contractAddress)throw new Error("Cannot generate QR code: Token contract address required");if(!d||!d.chainId)throw new Error("Cannot generate QR code: Network chain ID required");const e=CE(a,0,d,0,p);if(e.includes("metamask.app.link")||e.includes("link.trustwallet.com")||e.includes("go.cb-w.com"),!e)throw new Error("Failed to generate Coinley payment URL");g(e);const t=kE(),r=await u.toDataURL(e,{width:f?140:t?350:280,margin:2,errorCorrectionLevel:"M",color:{dark:"dark"===s?"#FFFFFF":"#000000",light:"dark"===s?"#000000":"#FFFFFF"}});v(r),w(!1)}catch(uh){w(!1)}}else w(!1)})()},[a,n,i,o,s,h,d,l,p]),r.useEffect(()=>()=>{C.current&&clearInterval(C.current)},[]),t.jsx("div",{className:"flex flex-col items-center",children:t.jsxs("div",{className:"flex gap-3 items-start w-full mb-2",children:[t.jsx("div",{className:"p-1.5 rounded-lg bg-white shadow-sm border flex-shrink-0",children:b?t.jsx("div",{className:"flex items-center justify-center",style:{width:140,height:140},children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-purple-600 mx-auto mb-1"}),t.jsx("div",{className:"text-xs text-gray-600",children:"Generating..."})]})}):y?t.jsx("img",{src:y,alt:"Payment QR Code",className:"rounded-lg",style:{width:140,height:140}}):t.jsx("div",{className:"flex items-center justify-center bg-gray-100 rounded-lg",style:{width:140,height:140},children:t.jsxs("div",{className:"text-center p-2",children:[t.jsx("div",{className:"text-lg mb-1",children:"โš ๏ธ"}),t.jsx("div",{className:"text-xs text-gray-600",children:(null==a?void 0:a.id)?"QR Failed":"Payment not created"})]})})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[t.jsxs("div",{className:"p-2 bg-gray-50 rounded-lg mb-2",children:[t.jsxs("div",{className:"flex justify-between items-center mb-1",children:[t.jsx("span",{className:"text-xs font-medium text-gray-600",children:"Amount:"}),t.jsxs("span",{className:"text-sm font-bold text-[#7042D2]",children:[n," ",i]})]}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-xs text-gray-500",children:"Network:"}),t.jsx("span",{className:"text-xs font-medium text-gray-700",children:o})]})]}),_?t.jsxs("div",{className:"flex items-center justify-center text-xs font-semibold text-green-600 p-1.5 bg-green-50 rounded-lg",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3.5 w-3.5 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Payment Received!"]}):t.jsx("div",{className:"p-1.5 rounded-lg bg-blue-50 border border-blue-200",children:t.jsx("p",{className:"text-xs text-blue-700 text-center leading-tight",children:"๐Ÿ“ฑ Scan with phone camera"})})]})]})})},ME=({selectedNetwork:e,onWalletSelect:i,onConnect:o,connectedWallet:s,loading:a,paymentData:c=null,selectedToken:l=null,api:u=null,onSolanaConnect:h=null,solanaWallet:d=null})=>{const[p,f]=r.useState(null),m=r.useMemo(()=>e?ym(e.type||e.shortName||e.id):dm,[e])===pm,{connectors:g}=n.useConnect(),{isConnected:y,address:v}=n.useAccount(),b=r.useMemo(()=>m?d.availableWallets.map(e=>({type:e.id,name:e.name,icon:xE(e.name,e.id)||"๐Ÿ”—",description:e.adapter?"Available":"Not installed",isSolana:!0,wallet:e})):SE(g,e),[m,d.availableWallets,g,e]),w=async(t,r)=>{if(kE())if(c)try{const{generateQRPaymentURI:n,generateMobilePaymentDeepLink:i}=await Promise.resolve().then(()=>EE),o=n(c,l,e,(null==u?void 0:u.config)||{},r);if(!o)throw new Error("Failed to generate payment URL");const s=i(r,o);if(!s)throw new Error(`Failed to generate ${t.name} deep link`);window.location.href=s}catch(uh){alert(`Failed to open ${t.name}: ${uh.message}`)}else alert("Please create a payment first before selecting a mobile wallet.");else alert(`Please install ${t.name} mobile app or use the browser extension if available.`)};return e?0===b.length?t.jsxs("div",{className:"text-center p-4",children:[t.jsxs("p",{className:"text-gray-500 mb-4",children:["No compatible wallets found for ",e.name]}),t.jsx("div",{className:"p-3 bg-amber-50 rounded-lg border border-amber-200",children:t.jsxs("div",{className:"text-sm text-amber-800",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:[t.jsx("div",{className:"font-medium mb-2",children:"Install a compatible wallet:"}),t.jsx("div",{className:"space-y-1 text-xs",children:m?t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:["โ€ข ",t.jsx("a",{href:um.PHANTOM.downloadUrl,target:"_blank",rel:"noopener noreferrer",className:"text-amber-700 underline hover:text-amber-900",children:"Install Phantom Wallet"})]}),t.jsxs("div",{children:["โ€ข ",t.jsx("a",{href:um.SOLFLARE.downloadUrl,target:"_blank",rel:"noopener noreferrer",className:"text-amber-700 underline hover:text-amber-900",children:"Install Solflare Wallet"})]}),t.jsxs("div",{children:["โ€ข ",t.jsx("a",{href:um.BACKPACK.downloadUrl,target:"_blank",rel:"noopener noreferrer",className:"text-amber-700 underline hover:text-amber-900",children:"Install Backpack Wallet"})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:["โ€ข ",t.jsx("a",{href:"https://metamask.io/download/",target:"_blank",rel:"noopener noreferrer",className:"text-amber-700 underline hover:text-amber-900",children:"Install MetaMask Wallet"})]}),t.jsxs("div",{children:["โ€ข ",t.jsx("a",{href:"https://www.coinbase.com/wallet",target:"_blank",rel:"noopener noreferrer",className:"text-amber-700 underline hover:text-amber-900",children:"Install Coinbase Wallet"})]})]})})]})})]}):t.jsxs("div",{className:"space-y-4",children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:["Select Wallet for ",e.name]}),t.jsx(fE,{options:b,value:(null==s?void 0:s.walletType)||p||"",onChange:async e=>{f(e);const t=b.find(t=>t.type===e);if(t){if(i(e),t.isSolana){try{const t=await d.connectWallet(e);h&&await h({walletType:e,publicKey:t,wallet:d})}catch(uh){console.error("Failed to connect Solana wallet:",uh),alert(`Failed to connect: ${uh.message}`)}return}t.isWagmi&&t.connector?await o(t.connector):t.isWagmi||await w(t,e)}},placeholder:"Choose your wallet...",renderOption:e=>{var r,n,i,o,c,l,u;return t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsxs("div",{className:"w-8 h-8 flex items-center justify-center",children:[e.icon.startsWith("http")||e.icon.startsWith("data:")?t.jsx("img",{src:e.icon,alt:e.name,className:"w-6 h-6 rounded-full object-contain",onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="block"}}):t.jsx("div",{className:"text-2xl",children:e.icon}),t.jsx("div",{className:"text-xl",style:{display:"none"},children:"๐Ÿ”—"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"font-semibold text-gray-800 flex items-center",children:[e.name,!e.isSolana&&_E(e.type)&&t.jsx("span",{className:"ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full",children:"DETECTED"}),e.isSolana&&(null==(r=e.wallet)?void 0:r.adapter)&&t.jsx("span",{className:"ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full",children:"DETECTED"}),e.isSolana&&(null==(n=d.connectedWallet)?void 0:n.id)===e.type&&t.jsx("span",{className:"ml-2 px-2 py-1 bg-green-100 text-green-700 text-xs rounded-full",children:"CONNECTED"}),!e.isSolana&&(null==s?void 0:s.walletType)===e.type&&t.jsx("span",{className:"ml-2 px-2 py-1 bg-green-100 text-green-700 text-xs rounded-full",children:"CONNECTED"})]}),t.jsx("div",{className:"text-sm text-gray-500",children:e.isSolana&&(null==(i=d.connectedWallet)?void 0:i.id)===e.type?`Connected โ€ข ${null==(o=d.publicKey)?void 0:o.slice(0,6)}...${null==(c=d.publicKey)?void 0:c.slice(-4)}`:(null==s?void 0:s.walletType)===e.type?`Connected โ€ข ${null==(l=s.account)?void 0:l.slice(0,6)}...${null==(u=s.account)?void 0:u.slice(-4)}`:e.description})]}),a&&p===e.type&&t.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-[#7042D2]"})]})},getOptionKey:e=>e.type,getOptionValue:e=>e.type,getSearchableText:e=>`${e.name} ${e.description}`,disabled:a})]}):t.jsx("div",{className:"text-center p-4",children:t.jsx("p",{className:"text-gray-500",children:"Please select a network first"})})},NE=(()=>{if(void 0!==ae&&ae.env)return!1;if("undefined"!=typeof window){const e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e||e.includes("192.168.")}return!1})()||(()=>{if("undefined"!=typeof window){const e=new URLSearchParams(window.location.search);return"true"===e.get("debug")||"true"===e.get("debugMode")}return!1})(),PE=({paymentData:e,selectedToken:n,selectedNetwork:i,config:o,onPaymentStarted:s=()=>{},onError:a=()=>{}})=>{var c,l;const[u,h]=r.useState(null),[d,p]=r.useState(!1),[f,m]=r.useState([]),[g,y]=r.useState(!1),[v,b]=r.useState(0);r.useEffect(()=>{var t,r,o;(null==e?void 0:e.id)&&(null==n?void 0:n.contractAddress)&&(null==i?void 0:i.chainId)&&((null==(t=null==e?void 0:e.contractCall)?void 0:t.contractAddress)||(null==e?void 0:e.contractAddress))?w("success","โœ… Payment data complete",{paymentId:e.id,tokenContract:n.contractAddress,chainId:i.chainId,paymentContract:(null==(o=null==e?void 0:e.contractCall)?void 0:o.contractAddress)||(null==e?void 0:e.contractAddress)}):(w("debug","โณ Waiting for complete payment data",{hasPaymentId:!!(null==e?void 0:e.id),hasTokenContract:!!(null==n?void 0:n.contractAddress),hasChainId:!!(null==i?void 0:i.chainId),hasPaymentContract:!(!(null==(r=null==e?void 0:e.contractCall)?void 0:r.contractAddress)&&!(null==e?void 0:e.contractAddress)),checkCount:v}),b(e=>e+1))},[e,n,i,v]);const w=(e,t,r=null)=>{const n=(new Date).toLocaleTimeString(),i={id:Date.now()+Math.random(),type:e,message:t,data:r,timestamp:n};NE&&(m(e=>[...e,i].slice(-20)),e.toUpperCase())},x=[{id:"metamask",name:"MetaMask",icon:"๐ŸฆŠ",description:"Connect with MetaMask mobile"},{id:"trust",name:"Trust Wallet",icon:"๐Ÿ›ก๏ธ",description:"Connect with Trust Wallet"},{id:"coinbase",name:"Coinbase Wallet",icon:"๐Ÿ’™",description:"Connect with Coinbase Wallet"}];if(!e)return t.jsx("div",{className:"p-4 bg-amber-50 rounded-lg border border-amber-200",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-amber-800 font-medium mb-2",children:"โš ๏ธ Payment Required"}),t.jsx("div",{className:"text-sm text-amber-700",children:"Please create a payment before selecting a wallet"})]})});const k=(null==e?void 0:e.id)&&(null==n?void 0:n.contractAddress)&&(null==i?void 0:i.chainId)&&((null==(c=null==e?void 0:e.contractCall)?void 0:c.contractAddress)||(null==e?void 0:e.contractAddress));return t.jsx("div",{className:"space-y-4",children:k?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700",style:{fontFamily:"Bricolage Grotesque, sans-serif"},children:"Select Mobile Wallet"}),t.jsx(fE,{options:x,value:u||"",onChange:async t=>{const r=x.find(e=>e.id===t);if(r){h(t),p(!0);try{if(w("info",`๐Ÿš€ Mobile wallet selected: ${r.name}`),!e)throw new Error("Payment data not available. Please create payment first.");w("debug","๐Ÿ” Payment Data Check",{hasPaymentData:!!e,hasSelectedToken:!!n,hasSelectedNetwork:!!i,hasConfig:!!o,paymentId:(null==e?void 0:e.id)||(null==e?void 0:e.splitterPaymentId),tokenAddress:null==n?void 0:n.contractAddress,networkChainId:null==i?void 0:i.chainId,amount:(null==e?void 0:e.totalAmount)||(null==e?void 0:e.amount)||(null==o?void 0:o.amount)});const a=CE(e,0,i,0,t);if(!a)throw new Error("Failed to generate payment URL");w("success","๐Ÿ“ฑ Generated payment URL",{url:a,length:a.length});const c=IE(t,a);if(!c)throw new Error(`Failed to generate ${r.name} deep link`);w("success",`๐Ÿ”— Deep link generated for ${r.name}`,{deepLink:c}),s({walletType:t,walletName:r.name,paymentUrl:a,deepLink:c}),setTimeout(()=>{w("info",`๐Ÿ“ฑ Opening ${r.name}...`),window.location.href=c},500)}catch(uh){w("error","โŒ Mobile wallet connection failed",{error:uh.message,walletId:t,hasPaymentData:!!e,hasSelectedToken:!!n,hasSelectedNetwork:!!i}),a(uh.message),p(!1),h(null)}}},placeholder:"Choose your wallet...",renderOption:e=>t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"w-8 h-8 flex items-center justify-center",children:t.jsx("div",{className:"text-2xl",children:e.icon})}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"font-semibold text-gray-800",children:[e.name,u===e.id&&d&&t.jsx("span",{className:"ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full animate-pulse",children:"Opening..."})]}),t.jsx("div",{className:"text-sm text-gray-500",children:e.description})]})]}),getOptionKey:e=>e.id,getOptionValue:e=>e.id,getSearchableText:e=>`${e.name} ${e.description}`,disabled:d}),t.jsx("div",{className:"text-xs text-gray-500 mt-2",children:"Select a wallet to open it with your payment details"})]}),d&&u&&t.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-lg animate-pulse",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-blue-600 border-t-transparent"}),t.jsxs("div",{className:"text-sm text-blue-700",children:["Opening ",null==(l=x.find(e=>e.id===u))?void 0:l.name,"..."]})]})}),t.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg",children:[t.jsxs("div",{className:"flex justify-between items-center text-sm",children:[t.jsx("span",{className:"text-gray-600",children:"Amount:"}),t.jsxs("span",{className:"font-semibold text-gray-800",children:[e.totalAmount," ",(null==n?void 0:n.symbol)||"USDC"]})]}),t.jsxs("div",{className:"flex justify-between items-center text-sm mt-1",children:[t.jsx("span",{className:"text-gray-600",children:"Network:"}),t.jsx("span",{className:"text-gray-800",children:(null==i?void 0:i.name)||"Ethereum"})]})]}),t.jsx("div",{className:"p-3 bg-purple-50 border border-purple-200 rounded-lg",children:t.jsxs("div",{className:"text-xs text-purple-700",children:[t.jsx("div",{className:"font-medium mb-1",children:"๐Ÿ“ฑ Mobile Payment"}),t.jsx("div",{children:"Your selected wallet app will open with payment details pre-filled"})]})}),NE&&t.jsxs("div",{className:"mt-4",children:[t.jsxs("button",{onClick:()=>y(!g),className:"w-full text-xs py-2 px-3 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 transition-colors",children:[g?"๐Ÿ”ฝ Hide Debug Info":"๐Ÿ”ง Show Debug Info"," (",f.length," logs)"]}),g&&t.jsxs("div",{className:"mt-2 p-3 bg-gray-900 text-green-400 rounded-lg text-xs font-mono max-h-80 overflow-y-auto",children:[t.jsx("div",{className:"text-white mb-2 font-bold",children:"๐Ÿ“ฑ Mobile Debug Panel"}),0===f.length?t.jsx("div",{className:"text-gray-400",children:"No debug logs yet. Try selecting a wallet..."}):f.map(e=>t.jsxs("div",{className:"mb-3 pb-2 border-b border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"px-2 py-1 rounded text-xs font-bold "+("error"===e.type?"bg-red-600 text-white":"success"===e.type?"bg-green-600 text-white":"debug"===e.type?"bg-blue-600 text-white":"bg-gray-600 text-white"),children:e.type.toUpperCase()}),t.jsx("span",{className:"text-gray-400",children:e.timestamp})]}),t.jsx("div",{className:"text-yellow-300 mb-1",children:e.message}),e.data&&t.jsx("div",{className:"text-gray-300 text-xs",children:t.jsxs("details",{children:[t.jsx("summary",{className:"cursor-pointer text-blue-300 hover:text-blue-200",children:"๐Ÿ“Š Data"}),t.jsx("pre",{className:"mt-1 p-2 bg-gray-800 rounded overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(e.data,null,2)})]})})]},e.id)),t.jsx("button",{onClick:()=>m([]),className:"mt-2 px-3 py-1 bg-red-600 text-white rounded text-xs hover:bg-red-700",children:"Clear Logs"})]})]})]}):t.jsx("div",{className:"p-4 bg-amber-50 rounded-lg border border-amber-200",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-amber-800 font-medium mb-2",children:"โณ Preparing Payment..."}),t.jsx("div",{className:"text-sm text-amber-700",children:"Payment is being prepared. Please wait a moment..."}),t.jsx("div",{className:"mt-3",children:t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-amber-600 border-t-transparent mx-auto"})})]})})})},TE=({error:e,onRetry:r,onDismiss:n,context:i="payment",className:o=""})=>{if(!e)return null;const s=$v(e),a=(e=>{switch(e){case"user_rejected":return"info";case"insufficient_funds":case"wrong_network":case"wallet_disconnected":case"payment_pending":return"warning";case"network_error":case"gas_error":case"rate_limited":return"error";default:return"critical"}})(s.type),c=(e=>{switch(e){case"user_rejected":default:return"Try Again";case"insufficient_funds":return"Add Funds & Retry";case"wrong_network":return"Switch Network & Retry";case"wallet_disconnected":return"Reconnect Wallet";case"payment_pending":return"Check Again";case"network_error":case"rate_limited":return"Retry";case"popup_blocked":return"Allow Popups & Retry";case"mobile_wallet_error":return"Open Wallet App"}})(s.type),l={info:{container:"bg-blue-50 border-blue-200",title:"text-blue-800",message:"text-blue-700",icon:"โ„น๏ธ",button:"bg-blue-600 hover:bg-blue-700"},warning:{container:"bg-amber-50 border-amber-200",title:"text-amber-800",message:"text-amber-700",icon:"โš ๏ธ",button:"bg-amber-600 hover:bg-amber-700"},error:{container:"bg-red-50 border-red-200",title:"text-red-800",message:"text-red-700",icon:"โŒ",button:"bg-red-600 hover:bg-red-700"},critical:{container:"bg-red-50 border-red-300",title:"text-red-900",message:"text-red-800",icon:"๐Ÿšจ",button:"bg-red-700 hover:bg-red-800"}},u=l[a]||l.error;return t.jsxs("div",{className:`p-4 border rounded-lg ${u.container} ${o}`,children:[t.jsxs("div",{className:"flex items-start space-x-3",children:[t.jsx("div",{className:"flex-shrink-0 text-xl",children:u.icon}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:`font-semibold ${u.title} mb-1`,children:s.title}),t.jsx("div",{className:`text-sm ${u.message} mb-2`,children:s.message}),s.suggestion&&t.jsxs("div",{className:`text-xs ${u.message} opacity-90`,children:["๐Ÿ’ก ",s.suggestion]})]}),n&&t.jsx("button",{onClick:n,className:"flex-shrink-0 text-gray-400 hover:text-gray-600 transition-colors","aria-label":"Dismiss error",children:t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),r&&t.jsxs("div",{className:"mt-3 flex justify-end space-x-2",children:[n&&"info"===a&&t.jsx("button",{onClick:n,className:"px-3 py-1.5 text-xs text-gray-600 hover:text-gray-800 transition-colors",children:"Cancel"}),t.jsx("button",{onClick:r,className:`px-4 py-2 text-sm font-medium text-white rounded-md transition-colors ${u.button}`,children:c})]}),!1]})},OE="method",BE="confirm",RE="processing",LE="success",jE="wallet",UE="qr",DE="deposit",FE="Bricolage Grotesque, sans-serif",zE=({depositAddress:e,amount:n,currency:i,network:o,networkName:s,paymentId:a,expiresAt:c,requiredConfirmations:l=20,theme:h="light",api:d=null,onPaymentDetected:p=null,onPaymentConfirmed:f=null,onExpired:m=null,explorerUrl:g=null})=>{const[y,v]=r.useState(""),[b,w]=r.useState(!0),[x,k]=r.useState(!1),[_,S]=r.useState("awaiting"),[C,I]=r.useState("0"),[E,A]=r.useState(0),[M,N]=r.useState(null),[P,T]=r.useState(!1),[O,B]=r.useState(null),R=r.useRef(null),L=r.useRef(null),j=kE();r.useEffect(()=>{(async()=>{if(e){w(!0);try{const t=await u.toDataURL(e,{width:j?200:180,margin:2,errorCorrectionLevel:"M",color:{dark:"dark"===h?"#FFFFFF":"#000000",light:"dark"===h?"#1F2937":"#FFFFFF"}});v(t),w(!1)}catch(uh){console.error("Failed to generate QR code:",uh),w(!1)}}else w(!1)})()},[e,h,j]),r.useEffect(()=>{if(!c)return;const e=()=>{const e=(new Date).getTime(),t=new Date(c).getTime()-e;if(t<=0)return T(!0),N(null),void(m&&m());const r=Math.floor(t%36e5/6e4),n=Math.floor(t%6e4/1e3);N(`${r}:${n.toString().padStart(2,"0")}`)};return e(),L.current=setInterval(e,1e3),()=>{L.current&&clearInterval(L.current)}},[c,m]);const U=r.useCallback(async()=>{if(d&&a&&"confirmed"!==_&&"swept"!==_)try{const e=await d.getDepositBalance(a);e.success&&(I(e.balance||"0"),parseFloat(e.balance)>0&&"awaiting"===_&&(S("detected"),p&&p(e)),e.isComplete&&S("confirming"));const t=await d.getDepositStatus(a);if(t.success&&t.payment){const e=t.payment;A(e.confirmations||0),e.depositTxHash&&B(e.depositTxHash),"completed"===e.status&&(S("confirmed"),f&&f(e)),e.sweptAt&&S("swept")}}catch(uh){console.warn("Failed to check deposit status:",uh.message)}},[d,a,_,p,f]);r.useEffect(()=>{if(d&&a&&!P)return U(),R.current=setInterval(U,5e3),()=>{R.current&&clearInterval(R.current)}},[d,a,P,U]);const D=(()=>{if(P)return{message:"Payment expired",color:"text-red-600",bgColor:"bg-red-50",icon:"โฐ"};switch(_){case"detected":case"confirming":return{message:"Transfer detected! Processing...",color:"text-blue-600",bgColor:"bg-blue-50",icon:"โณ"};case"confirmed":return{message:"Payment confirmed!",color:"text-green-600",bgColor:"bg-green-50",icon:"โœ…"};case"swept":return{message:"Payment complete - Funds delivered!",color:"text-green-600",bgColor:"bg-green-50",icon:"๐ŸŽ‰"};default:return{message:"Send exact amount to address below",color:"text-gray-600",bgColor:"bg-gray-50",icon:"๐Ÿ“ค"}}})(),F="dark"===h;return t.jsxs("div",{className:"flex flex-col items-center w-full",style:{fontFamily:FE},children:[t.jsx("div",{className:`w-full p-3 rounded-lg mb-4 ${D.bgColor} border ${F?"border-gray-600":"border-gray-200"}`,children:t.jsxs("div",{className:`flex items-center justify-center ${D.color} font-medium`,children:[t.jsx("span",{className:"mr-2",children:D.icon}),D.message]})}),t.jsxs("div",{className:`flex ${j?"flex-col":"flex-row"} gap-4 w-full`,children:[t.jsx("div",{className:"flex-shrink-0 "+(j?"mx-auto":""),children:t.jsx("div",{className:`p-2 rounded-xl ${F?"bg-gray-800":"bg-white"} shadow-md border ${F?"border-gray-700":"border-gray-200"}`,children:b?t.jsx("div",{className:"flex items-center justify-center",style:{width:j?200:180,height:j?200:180},children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600 mx-auto mb-2"}),t.jsx("div",{className:"text-sm "+(F?"text-gray-400":"text-gray-600"),children:"Generating..."})]})}):y?t.jsx("img",{src:y,alt:"Transfer Address QR",className:"rounded-lg",style:{width:j?200:180,height:j?200:180}}):t.jsx("div",{className:"flex items-center justify-center rounded-lg "+(F?"bg-gray-700":"bg-gray-100"),style:{width:j?200:180,height:j?200:180},children:t.jsx("span",{className:"text-sm "+(F?"text-gray-400":"text-gray-500"),children:"QR unavailable"})})})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[t.jsxs("div",{className:`p-3 rounded-lg mb-3 ${F?"bg-gray-800":"bg-purple-50"} border ${F?"border-gray-700":"border-purple-200"}`,children:[t.jsx("div",{className:"text-xs font-medium mb-1 "+(F?"text-gray-400":"text-purple-600"),children:"Send Exactly:"}),t.jsxs("div",{className:"text-2xl font-bold text-[#7042D2]",children:[n," ",i]}),t.jsxs("div",{className:"text-xs mt-1 "+(F?"text-gray-400":"text-gray-500"),children:["on ",s||o]})]}),t.jsxs("div",{className:`p-3 rounded-lg ${F?"bg-gray-800":"bg-gray-50"} border ${F?"border-gray-700":"border-gray-200"}`,children:[t.jsx("div",{className:"text-xs font-medium mb-2 "+(F?"text-gray-400":"text-gray-600"),children:"Transfer Address:"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("code",{className:`flex-1 text-xs font-mono break-all p-2 rounded ${F?"bg-gray-900 text-gray-300":"bg-white text-gray-800"} border ${F?"border-gray-700":"border-gray-300"}`,children:e}),t.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(e),k(!0),setTimeout(()=>k(!1),2e3)}catch(uh){console.error("Failed to copy:",uh)}},className:"p-2 rounded-lg transition-colors "+(x?"bg-green-500 text-white":F?"bg-gray-700 text-gray-300 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"),title:x?"Copied!":"Copy address",children:x?t.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):t.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]}),t.jsxs("div",{className:"flex gap-2 mt-3",children:[M&&!P&&"awaiting"===_&&t.jsxs("div",{className:`flex-1 p-2 rounded-lg text-center ${F?"bg-gray-800":"bg-orange-50"} border ${F?"border-gray-700":"border-orange-200"}`,children:[t.jsx("div",{className:"text-xs "+(F?"text-gray-400":"text-orange-600"),children:"Expires in"}),t.jsx("div",{className:"text-lg font-bold "+(F?"text-orange-400":"text-orange-600"),children:M})]}),parseFloat(C)>0&&t.jsxs("div",{className:`flex-1 p-2 rounded-lg text-center ${F?"bg-gray-800":"bg-green-50"} border ${F?"border-gray-700":"border-green-200"}`,children:[t.jsx("div",{className:"text-xs "+(F?"text-gray-400":"text-green-600"),children:"Received"}),t.jsxs("div",{className:"text-lg font-bold "+(F?"text-green-400":"text-green-600"),children:[C," ",i]})]})]})]})]}),O&&g&&t.jsx("div",{className:"w-full mt-4",children:t.jsxs("a",{href:`${g}/tx/${O}`,target:"_blank",rel:"noopener noreferrer",className:`flex items-center justify-center gap-2 p-2 rounded-lg ${F?"bg-gray-800 text-blue-400 hover:bg-gray-700":"bg-blue-50 text-blue-600 hover:bg-blue-100"} transition-colors`,children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),"View transaction on explorer"]})}),t.jsxs("div",{className:`w-full mt-4 p-3 rounded-lg ${F?"bg-gray-800 border-gray-700":"bg-gray-50 border-gray-200"} border`,children:[t.jsx("div",{className:"text-xs font-medium mb-2 "+(F?"text-gray-300":"text-gray-700"),children:"๐Ÿ“‹ Instructions:"}),t.jsxs("ol",{className:"text-xs space-y-1 "+(F?"text-gray-400":"text-gray-600"),children:[t.jsx("li",{children:"1. Copy the transfer address or scan QR code"}),t.jsxs("li",{children:["2. Send ",t.jsxs("strong",{children:[n," ",i]})," from any wallet"]}),t.jsxs("li",{children:["3. Wait for ",l," confirmations"]}),t.jsx("li",{children:"4. Payment will be automatically confirmed"})]})]})]})},qE=new i.QueryClient,$E=({publicKey:e,apiKey:i,apiSecret:s,apiUrl:a,config:c,onSuccess:l,onError:u,onClose:h,isOpen:d,theme:p="light"})=>{var f;const m=((e,t,n)=>{const[i,o]=r.useState("method"),[s,a]=r.useState([]),[c,l]=r.useState([]),[u,h]=r.useState(null),[d,p]=r.useState(null),[f,m]=r.useState(null),[g,y]=r.useState(null),[v,b]=r.useState(!1),[w,x]=r.useState(""),[k,_]=r.useState(!1),[S,C]=r.useState("Processing transaction..."),[I,E]=r.useState("wallet"),[A,M]=r.useState(null),N=r.useRef(new om(e,t,n)),P=()=>{if(!u)return!1;const e=parseInt(u.chainId);return[8453,56,42161,137,10,43114].includes(e)};return{currentStep:i,networks:s,tokens:c,selectedNetwork:u,selectedToken:d,paymentMethod:f,paymentData:g,loading:v,error:w,processing:k,processingMessage:S,paymentType:I,actualTransactionHash:A,setCurrentStep:o,setSelectedNetwork:h,setSelectedToken:p,setPaymentMethod:m,setError:x,setProcessing:_,setProcessingMessage:C,setPaymentType:E,setActualTransactionHash:M,loadData:async()=>{var e,t;try{b(!0),x("");const[r,n]=await Promise.all([N.current.getNetworks(),N.current.getTokens()]),i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test("undefined"!=typeof navigator?navigator.userAgent:""),o=(null==(e=r.networks)?void 0:e.reduce((e,t)=>{if("tron"===t.shortName||"algorand"===t.shortName)return e;const r="solana"===t.shortName||"solana"===t.chainType;if(r&&i)return e;if(!(r||t.chainId&&null!==t.chainId))return e;const n=r?`solana-${t.shortName}`:`${t.chainId}-${t.shortName}`;return e.some(e=>("solana"===e.shortName||"solana"===e.chainType?`solana-${e.shortName}`:`${e.chainId}-${e.shortName}`)===n)||e.push(t),e},[]))||[],s=(null==(t=n.stablecoins)?void 0:t.reduce((e,t)=>{var r,n,o,s,a;if(!["USDC","USDT","SOL"].includes(t.symbol))return e;if("tron"===(null==(r=t.Network)?void 0:r.shortName)||"algorand"===(null==(n=t.Network)?void 0:n.shortName))return e;if(("solana"===(null==(o=t.Network)?void 0:o.shortName)||"solana"===(null==(s=t.Network)?void 0:s.chainType))&&i)return e;const c=`${t.symbol}-${(null==(a=t.Network)?void 0:a.shortName)||t.networkId}`;return e.some(e=>{var t;return`${e.symbol}-${(null==(t=e.Network)?void 0:t.shortName)||e.networkId}`===c})||e.push(t),e},[]))||[];a(o),l(s)}catch(oA){x("Failed to load payment options. Using fallback data.")}finally{b(!1)}},createPayment:async e=>{var t;try{b(!0),x("");const r={amount:e.amount,currency:d.symbol,network:u.shortName,customerEmail:e.customerEmail,callbackUrl:e.callbackUrl,metadata:{...e.metadata,merchantWalletAddresses:e.merchantWalletAddresses,paymentMethod:f,selectedNetwork:u.shortName,selectedToken:d.symbol,wagmiEnabled:!0}},n=await N.current.createPayment(r);y(n.payment),em.trackPaymentCreated(null==(t=n.payment)?void 0:t.id,e.amount,u.shortName,d.symbol),o("confirm")}catch(oA){x(oA.message),em.trackError("payment_creation_failed",oA.message,{amount:e.amount,network:null==u?void 0:u.shortName,token:null==d?void 0:d.symbol})}finally{b(!1)}},failPayment:async(e="Payment cancelled by user")=>{if(null==g?void 0:g.id)try{await N.current.failPayment(g.id,e)}catch(t){}},resetState:()=>{o("method"),h(null),p(null),m(null),y(null),x(""),_(!1),M(null),E("wallet")},resetTransactionState:()=>{x(""),_(!1),M(null),o("confirm")},isDepositSupported:P,createDepositPayment:async e=>{var t;try{if(b(!0),x(""),!P())throw new Error(`Deposit address payments not supported on ${(null==u?void 0:u.name)||"this network"}. Use wallet payment instead.`);const r={amount:e.amount,currency:d.symbol,network:u.shortName,customerEmail:e.customerEmail,callbackUrl:e.callbackUrl,metadata:{...e.metadata,paymentMethod:"deposit_address",selectedNetwork:u.shortName,selectedToken:d.symbol}},n=await N.current.createDepositPayment(r);if(!n.success)throw new Error(n.error||"Failed to create deposit payment");return y({...n.payment,isDepositPayment:!0}),em.trackPaymentCreated(null==(t=n.payment)?void 0:t.id,e.amount,u.shortName,d.symbol),o("confirm"),n.payment}catch(oA){throw x(oA.message),em.trackError("deposit_payment_creation_failed",oA.message,{amount:e.amount,network:null==u?void 0:u.shortName,token:null==d?void 0:d.symbol}),oA}finally{b(!1)}},api:N.current}})(a,e||i,e?null:s),g=(()=>{const[e,t]=r.useState(null),[i,s]=r.useState(null),[a,c]=r.useState(""),{connect:l,connectors:u}=n.useConnect(),{isConnected:h,address:d,chain:p}=n.useAccount(),{switchChain:f}=n.useSwitchChain();return r.useEffect(()=>{s(h&&d?{account:d,chainId:null==p?void 0:p.id,walletType:e}:null)},[h,d,p,e]),{selectedWalletType:e,connectedWallet:i,connectionError:a,isConnected:h,address:d,chain:p,connectors:u,handleWalletSelection:e=>{t(e),c("")},connectWallet:async(e,t=null)=>{var r,n,i;if(!e)return c("Please select a wallet first"),!1;try{if(c(""),await l({connector:e}),t){const a=gm(t.shortName),l=(null==(r=e.name)?void 0:r.toLowerCase())||"",u=l.includes("zerion")||l.includes("trust")||l.includes("rabby")?5e3:500;await new Promise(e=>setTimeout(e,u));const h=o.getAccount(im).chainId;if(a&&h!==a)try{await f({chainId:a}),await new Promise(e=>setTimeout(e,1e3))}catch(s){return 4001===s.code||(null==(n=s.message)?void 0:n.includes("User rejected"))?c("Network switch was cancelled by user"):(null==(i=s.message)?void 0:i.includes("Unrecognized chain ID"))?c(`${t.name} network is not added to your wallet. Please add it manually.`):c(`Failed to switch to ${t.name}. Please switch manually in your wallet.`),!1}}return!0}catch(oA){return 4001===oA.code||oA.message.includes("User rejected")||oA.message.includes("rejected")?c("User cancelled the connection request"):c(`Failed to connect to ${e.name}. Please try again.`),!1}},disconnectWallet:()=>{s(null),t(null),c("")},switchChain:f,ensureCorrectNetwork:async e=>{var t,r;if(!e)return!0;try{const i=gm(e.shortName),s=o.getAccount(im).chainId;if(i&&s!==i)try{return await f({chainId:i}),await new Promise(e=>setTimeout(e,1e3)),!0}catch(n){return 4001===n.code||(null==(t=n.message)?void 0:t.includes("User rejected"))?c("Network switch was cancelled. Please switch to the correct network in your wallet."):(null==(r=n.message)?void 0:r.includes("Unrecognized chain ID"))?c(`${e.name} network is not added to your wallet. Please add it manually.`):c(`Failed to switch to ${e.name}. Please switch manually in your wallet.`),!1}return!0}catch(L){return c("Failed to verify network. Please check your wallet connection."),!1}},clearError:()=>{c("")},setSelectedWalletType:t,connect:l}})(),y=(()=>{const[e,t]=r.useState(null),[n,i]=r.useState(null),[o,s]=r.useState(!1),[a,c]=r.useState(null),[l,u]=r.useState([]);r.useEffect(()=>{var e,t,r,n,i;const o=[];"undefined"!=typeof window&&(null==(e=window.solana)?void 0:e.isPhantom)&&o.push({...um.PHANTOM,adapter:window.solana}),"undefined"!=typeof window&&(null==(t=window.solflare)?void 0:t.isSolflare)&&o.push({...um.SOLFLARE,adapter:window.solflare}),"undefined"!=typeof window&&(null==(r=window.backpack)?void 0:r.isBackpack)&&o.push({...um.BACKPACK,adapter:window.backpack}),"undefined"!=typeof window&&(null==(n=window.trustwallet)?void 0:n.solana)&&o.push({...um.TRUST_WALLET,adapter:window.trustwallet.solana}),"undefined"!=typeof window&&(null==(i=window.magicEden)?void 0:i.solana)&&o.push({...um.MAGIC_EDEN,adapter:window.magicEden.solana}),u(o)},[]);const h=r.useCallback(()=>{t(null),i(null)},[]),d=r.useCallback(e=>{if(e){const r=e.toString();i(r),t(e=>e?{...e,publicKey:r}:null)}else h()},[h]),p=r.useCallback(async e=>{s(!0),c(null);try{const r=l.find(t=>t.id===e);if(!r)throw new Error(`Wallet ${e} not found. Please install it first.`);const n=r.adapter,o=await n.connect(),s=(null==o?void 0:o.publicKey)||n.publicKey;if(!s)throw new Error("Failed to get wallet public key");const a=s.toString();return t({id:e,name:r.name,adapter:n,publicKey:a}),i(a),n.on&&(n.on("disconnect",h),n.on("accountChanged",d)),s.toString()}catch(oA){console.error("โŒ Error connecting to Solana wallet:",oA);let t=oA.message||"Failed to connect wallet";throw(4001===oA.code||t.includes("User rejected"))&&(t="Connection request was rejected"),c(t),new Error(t)}finally{s(!1)}},[l,h,d]),f=r.useCallback(async()=>{if(null==e?void 0:e.adapter)try{e.adapter.removeListener&&(e.adapter.removeListener("disconnect",h),e.adapter.removeListener("accountChanged",d)),await e.adapter.disconnect()}catch(oA){console.error("Error disconnecting wallet:",oA)}t(null),i(null)},[e,h,d]),m=r.useCallback(e=>l.some(t=>t.id===e),[l]),g=r.useCallback(e=>{const t=Object.values(um).find(t=>t.id===e);if(!t)return null;const r=/Android|iPhone|iPad|iPod/i.test(navigator.userAgent),n=/iPhone|iPad|iPod/i.test(navigator.userAgent),i=/Android/i.test(navigator.userAgent);if(r){if(n&&t.installUrl.ios)return t.installUrl.ios;if(i&&t.installUrl.android)return t.installUrl.android}return t.installUrl.chrome||t.downloadUrl},[]),y=r.useCallback(async(e,t=1e9)=>{if(!n)throw new Error("Wallet not connected");try{const{PublicKey:r}=await Promise.resolve().then(()=>jI),i=new r(n),o=await e.requestAirdrop(i,t);return await e.confirmTransaction(o),o}catch(oA){throw console.error("โŒ Airdrop failed:",oA),oA}},[n]);return{connectedWallet:e,publicKey:n,address:n,isConnecting:o,error:a,availableWallets:l,connectWallet:p,disconnectWallet:f,isWalletInstalled:m,getInstallUrl:g,requestAirdrop:y,isConnected:!!e&&!!n}})(),v=r.useMemo(()=>m.selectedNetwork?ym(m.selectedNetwork.type||m.selectedNetwork.shortName||m.selectedNetwork.id):dm,[m.selectedNetwork])===pm,b=r.useMemo(()=>!(!v||!m.selectedNetwork)&&(e=>{if(!e)return!1;const t=!0===e.isTestnet||"true"===e.isTestnet,r=(e.name||"").toLowerCase().includes("devnet"),n=(e.shortName||"").toLowerCase().includes("devnet"),i=(e.type||"").toLowerCase().includes("devnet"),o=(e.id||"").toLowerCase().includes("devnet");return t||r||n||i||o})(m.selectedNetwork),[v,m.selectedNetwork]),w=((e,t)=>{const[n,i]=r.useState(!1),[o,s]=r.useState(null),[a,c]=r.useState(null),l=r.useRef(0),u=r.useCallback(()=>{const t=Array.isArray(e)?e:[e];if(!t||0===t.length||!t[0])return null;const r=t[l.current%t.length];return new OI(r,"confirmed")},[e]);r.useCallback(()=>{const t=Array.isArray(e)?e:[e];l.current=(l.current+1)%t.length},[e]);const h=r.useCallback(async(e,r)=>{if(!(null==t?void 0:t.adapter)||!t.publicKey)throw new Error("Wallet not connected");i(!0),c(null),s(null);try{const n=u();if(!n)throw new Error("Solana RPC connection not available. Please select a Solana network.");const o=t.adapter,a=Math.floor(r*LI),c=new J_(t.publicKey),l=new J_(e),h=(new vS).add(PS.transfer({fromPubkey:c,toPubkey:l,lamports:a})),{blockhash:d,lastValidBlockHeight:p}=await n.getLatestBlockhash();h.recentBlockhash=d,h.feePayer=c;const f=await o.signTransaction(h),m=await n.sendRawTransaction(f.serialize());return s(m),i(!1),{signature:m,success:!0}}catch(oA){throw console.error("โŒ SOL transaction failed:",oA),c(oA.message||"Transaction failed"),i(!1),oA}},[t,u]),d=r.useCallback(async(e,r,n,o)=>{if(!(null==t?void 0:t.adapter)||!t.publicKey)throw new Error("Wallet not connected");i(!0),c(null),s(null);try{const a=u();if(!a)throw new Error("Solana RPC connection not available. Please select a Solana network.");const c=t.adapter,l=Math.floor(n*Math.pow(10,o)),h=new J_(t.publicKey),d=new J_(r),p=new J_(e),f=await uE(p,h,!1,UI,DI),m=await uE(p,d,!1,UI,DI),g=(new vS).add(pE(f,m,h,l,[],UI)),{blockhash:y,lastValidBlockHeight:v}=await a.getLatestBlockhash();g.recentBlockhash=y,g.feePayer=h;const b=await c.signTransaction(g),w=await a.sendRawTransaction(b.serialize());return s(w),i(!1),{signature:w,success:!0}}catch(oA){console.error("โŒ SPL Token transaction failed:",oA);let t=oA.message||"Transaction failed";throw t.includes("Account not found")?t="Recipient token account not found. They need to have received this token before.":t.includes("insufficient")?t="Insufficient balance":t.includes("User rejected")&&(t="Transaction was rejected"),c(t),i(!1),new Error(t)}},[t,u]),p=r.useCallback(async e=>{try{const r=u();if(!r)return console.warn("โš ๏ธ Cannot fetch SOL balance: RPC connection not available"),0;const n=new J_(e||t.publicKey);return await r.getBalance(n)/LI}catch(oA){return console.error("Error getting SOL balance:",oA),0}},[t,u]),f=r.useCallback(async(e,r)=>{try{const n=u();if(!n)return console.warn("โš ๏ธ Cannot fetch SPL token balance: RPC connection not available"),0;const i=new J_(r||t.publicKey),o=new J_(e),s=await uE(o,i,!1,UI,DI),a=await n.getTokenAccountBalance(s);return parseFloat(a.value.uiAmount||0)}catch(oA){return console.error("Error getting SPL token balance:",oA),0}},[t,u]),m=r.useCallback(async()=>{try{const e=u();return e?(await e.getRecentBlockhash(),5e-6):5e-6}catch(oA){return console.error("Error estimating fee:",oA),5e-6}},[u]);return{isProcessing:n,txSignature:o,error:a,sendSOL:h,sendSPLToken:d,sendSplitPayment:r.useCallback(async({tokenMintAddress:e,merchantAddress:r,coinleyAddress:n,merchantAmount:o,coinleyAmount:a,decimals:l=6})=>{if(!(null==t?void 0:t.adapter)||!t.publicKey)throw new Error("Wallet not connected");i(!0),c(null),s(null);try{const c=u();if(!c)throw new Error("Solana RPC connection not available. Please select a Solana network.");const d=t.adapter,p=Math.floor(o*Math.pow(10,l)),f=Math.floor(a*Math.pow(10,l)),m=o+a,g=new J_(t.publicKey),y=new J_(r),v=new J_(n),b=new J_(e),w=await uE(b,g,!1,UI,DI),x=await uE(b,y,!1,UI,DI),k=await uE(b,v,!1,UI,DI),_=new vS;try{await lE(c,x)}catch(h){_.add(hE(g,x,y,b,UI,DI))}try{await lE(c,k)}catch(h){_.add(hE(g,k,v,b,UI,DI))}_.add(pE(w,x,g,p,[],UI)),_.add(pE(w,k,g,f,[],UI));const{blockhash:S,lastValidBlockHeight:C}=await c.getLatestBlockhash();_.recentBlockhash=S,_.feePayer=g;const I=await d.signTransaction(_),E=await c.sendRawTransaction(I.serialize());return s(E),i(!1),{signature:E,success:!0,merchantAmount:o,coinleyAmount:a,totalAmount:m}}catch(oA){console.error("โŒ Split payment failed:",oA);let t=oA.message||"Transaction failed";throw t.includes("insufficient")||t.includes("0x1")?t="Insufficient token balance":t.includes("User rejected")&&(t="Transaction was rejected"),c(t),i(!1),new Error(t)}},[t,u]),getSOLBalance:p,getSPLTokenBalance:f,estimateFee:m,connection:u()}})(r.useMemo(()=>{if(!v||!m.selectedNetwork)return[];return sm},[v,m.selectedNetwork,b]),y.connectedWallet),[x,k]=r.useState("metamask"),[_,S]=r.useState(!1),[C,I]=r.useState(()=>!("undefined"==typeof window||!window.sessionStorage)&&"true"===sessionStorage.getItem("coinley_mobile_payment_started")),[E,A]=r.useState(!1);r.useEffect(()=>{S(kE())},[]);const{currentStep:M,networks:N,tokens:P,selectedNetwork:T,selectedToken:O,paymentData:B,loading:R,error:L,paymentType:j,loadData:U,createPayment:D,createDepositPayment:F,isDepositSupported:z,failPayment:q,resetState:$,setSelectedNetwork:W,setSelectedToken:G,setPaymentType:H,setCurrentStep:V,setError:K}=m,{connectedWallet:Z,address:Y,connectWallet:J,handleWalletSelection:X}=g,Q=Vv(B,O,T,Y,m.api,g),{executePaymentTransaction:ee,processFinalPayment:te,transactionStep:re,transactionError:ne,currentTransactionHash:ie}=Q;r.useEffect(()=>{M===LE&&"undefined"!=typeof window&&window.sessionStorage&&sessionStorage.removeItem("coinley_mobile_payment_started")},[M]),r.useEffect(()=>{if(d){U(),$(),em.trackModalOpened(null==c?void 0:c.merchantName,null==c?void 0:c.amount);const e=window.scrollY;document.body.style.position="fixed",document.body.style.top=`-${e}px`,document.body.style.width="100%",document.body.style.overflow="hidden"}else{const e=document.body.style.top;document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflow="",window.scrollTo(0,-1*parseInt(e||"0"))}return()=>{if(d){const e=document.body.style.top;document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflow="",window.scrollTo(0,-1*parseInt(e||"0"))}}},[d]),r.useEffect(()=>{if("processing"===re||"approve"===re||"splitPayment"===re){const e=setTimeout(()=>{K("Transaction timed out. Please try again."),V(BE),Q.resetTransaction()},12e4);return()=>clearTimeout(e)}},[re]);const oe=async()=>{em.trackModalClosed("user_cancelled"),await q(),h()},se={ethereum:{text:"High fees",color:"text-red-500"},polygon:{text:"~$0.01 fees",color:"text-green-500"},bsc:{text:"~$0.02 fees",color:"text-green-500"},base:{text:"~$0.03 fees",color:"text-green-500"},optimism:{text:"~$0.60 fees",color:"text-yellow-600"},arbitrum:{text:"~$0.50 fees",color:"text-yellow-600"},avalanche:{text:"Low fees",color:"text-green-500"},celo:{text:"Low fees",color:"text-green-500"},solana:{text:"~$0.001 fees",color:"text-green-500"}};return d?t.jsxs("div",{className:"fixed inset-0 z-50",children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:oe,"aria-hidden":"true"}),t.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4",style:{zIndex:51},children:t.jsxs("div",{className:"relative pt-4 w-full max-w-md max-h-[90vh] mx-auto shadow-xl bg-gray-100 rounded-3xl flex flex-col overflow-hidden",style:{zIndex:52},children:[t.jsxs("div",{className:"flex-shrink-0 bg-white flex justify-between items-center mb-3 mr-3 ml-3 py-3 px-2 rounded-full",children:[t.jsxs("div",{className:"flex-1 flex items-center gap-2 px-4",children:[t.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center",children:t.jsx("img",{src:tm,alt:"Coinley"})}),t.jsx("span",{className:"text-base font-semibold text-gray-800",style:{fontFamily:FE},children:"Payment Details"})]}),M!==LE&&M!==RE&&t.jsx("button",{onClick:oe,className:"text-gray-500 hover:text-gray-700 focus:outline-none",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c&&M!==LE&&t.jsx("div",{className:"flex-shrink-0 mb-3 px-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xs text-gray-600",children:"Total Amount"}),t.jsxs("div",{className:"text-3xl font-bold text-[#7042D2] mt-1 leading-tight tracking-tight",style:{fontFamily:FE},children:["$",(ae=c.amount,parseFloat(ae).toFixed(2))]}),t.jsx("div",{className:"mt-1 text-xs text-gray-500",children:"No additional fees"}),t.jsx("div",{className:"text-xs text-gray-600 mt-2",children:"Payment to:"}),t.jsxs("div",{className:"text-sm font-semibold mt-0.5 flex gap-1.5 items-center justify-center",style:{fontFamily:FE},children:[t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M15.3 7.50065L15.8 10.0007H4.2L4.7 7.50065H15.3ZM16.6667 3.33398H3.33333V5.00065H16.6667V3.33398ZM16.6667 5.83398H3.33333L2.5 10.0007V11.6673H3.33333V16.6673H11.6667V11.6673H15V16.6673H16.6667V11.6673H17.5V10.0007L16.6667 5.83398ZM5 15.0007V11.6673H10V15.0007H5Z",fill:"#7042D2"})}),c.merchantName||"Merchant"]})]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-contain",children:[t.jsx(mE,{currentStep:M,targetStep:OE,children:t.jsxs("div",{className:"pb-4 pt-3 px-5 bg-white rounded-t-2xl",children:[t.jsx("h3",{className:"font-semibold text-center mb-3 text-sm",style:{fontFamily:FE},children:"Choose Payment Method"}),t.jsxs("div",{className:"space-y-3 mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700",style:{fontFamily:FE},children:"Select Network"}),t.jsx(fE,{options:N,value:(null==T?void 0:T.id)||"",onChange:e=>{const t=N.find(t=>t.id===e);W(t),G(null),em.trackNetworkSelected(null==t?void 0:t.name,null==c?void 0:c.merchantName)},placeholder:"Choose your network...",renderOption:e=>{var r,n,i;const o="object"==typeof(s=e)&&(null==s?void 0:s.logo)?s.logo:"object"==typeof s&&(null==s?void 0:s.shortName)?vE[s.shortName.toLowerCase()]:"string"==typeof s?vE[s.toLowerCase()]:null;var s;const a=se[null==(r=e.shortName)?void 0:r.toLowerCase()];return t.jsxs("div",{className:"flex items-center space-x-3 w-full",children:[o?t.jsx("img",{src:o,alt:e.name,className:"w-8 h-8 rounded-full",onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="flex"}}):null,t.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-200 flex items-center justify-center",style:{display:o?"none":"flex"},children:t.jsx("span",{className:"text-xs font-bold text-gray-600",children:null==(n=e.shortName)?void 0:n.slice(0,2).toUpperCase()})}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"font-semibold text-gray-800",children:e.name}),a&&t.jsx("span",{className:`text-xs font-medium ${a.color}`,children:a.text})]}),t.jsx("div",{className:"text-sm text-gray-500",children:null==(i=e.shortName)?void 0:i.toUpperCase()})]})]})},getOptionKey:e=>e.id,getOptionValue:e=>e.id,getSearchableText:e=>`${e.name} ${e.shortName}`,disabled:R})]}),T&&t.jsxs("div",{className:"space-y-3 mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700",style:{fontFamily:FE},children:"Select Token"}),t.jsx(fE,{options:P.filter(e=>{var t;return(null==(t=e.Network)?void 0:t.shortName)===(null==T?void 0:T.shortName)||e.networkId===(null==T?void 0:T.id)}),value:(null==O?void 0:O.id)||"",onChange:e=>{const t=P.filter(e=>{var t;return(null==(t=e.Network)?void 0:t.shortName)===(null==T?void 0:T.shortName)||e.networkId===(null==T?void 0:T.id)}).find(t=>t.id===e);G(t),em.trackTokenSelected(null==t?void 0:t.symbol,null==T?void 0:T.name,null==c?void 0:c.merchantName)},placeholder:"Choose your token...",renderOption:e=>{var r,n;const i=wE(e.symbol);return t.jsxs("div",{className:"flex items-center space-x-3",children:[i?t.jsx("img",{src:i,alt:e.symbol,className:"w-8 h-8 rounded-full",onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="flex"}}):null,t.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-200 flex items-center justify-center",style:{display:i?"none":"flex"},children:t.jsx("span",{className:"text-xs font-bold text-gray-600",children:null==(r=e.symbol)?void 0:r.slice(0,2)})}),t.jsxs("div",{children:[t.jsxs("div",{className:"font-semibold text-gray-800",children:[e.name," (",e.symbol,")"]}),t.jsxs("div",{className:"text-sm text-gray-500",children:[(null==(n=e.Network)?void 0:n.name)||"Unknown Network",e.isStablecoin&&t.jsx("span",{className:"ml-2 text-green-600",children:"โ€ข Stablecoin"})]})]})]})},getOptionKey:e=>e.id,getOptionValue:e=>e.id,getSearchableText:e=>`${e.name} ${e.symbol}`,disabled:R})]}),T&&O&&t.jsx("button",{onClick:()=>D(c),disabled:R,className:"w-full bg-[#7042D2] text-white py-4 px-4 rounded-xl hover:bg-[#5b34b1] disabled:opacity-50 font-semibold transition-all duration-200 shadow-lg hover:shadow-xl",style:{fontFamily:FE},children:R?"Creating Payment...":"Continue"})]})}),t.jsx(mE,{currentStep:M,targetStep:BE,children:T&&O&&B&&t.jsxs("div",{className:"pb-4 pt-4 px-4 bg-white rounded-t-2xl",children:[!_&&t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"flex border-b border-gray-200",children:[t.jsx("button",{onClick:()=>H(jE),className:"py-3 px-4 text-sm font-semibold transition-all duration-200 "+(j===jE?"border-b-2 border-[#7042D2] text-[#7042D2]":"text-gray-500 hover:text-gray-700"),style:{fontFamily:FE},children:"Wallet"}),z()&&t.jsx("button",{onClick:()=>H(DE),className:"py-3 px-4 text-sm font-semibold transition-all duration-200 "+(j===DE?"border-b-2 border-[#7042D2] text-[#7042D2]":"text-gray-500 hover:text-gray-700"),style:{fontFamily:FE},children:"Transfer"}),t.jsx("button",{onClick:()=>H(UE),className:"py-3 px-4 text-sm font-semibold transition-all duration-200 "+(j===UE?"border-b-2 border-[#7042D2] text-[#7042D2]":"text-gray-500 hover:text-gray-700"),style:{fontFamily:FE},children:"QR Code"})]})}),_?t.jsx(PE,{paymentData:B,selectedToken:O,selectedNetwork:T,config:c,onPaymentStarted:e=>{I(!0),"undefined"!=typeof window&&window.sessionStorage&&sessionStorage.setItem("coinley_mobile_payment_started","true"),e.walletName},onError:e=>{K(e)}}):j===jE?t.jsx(ME,{selectedNetwork:T,onWalletSelect:X,onConnect:async e=>{await J(e,T)},connectedWallet:v?y.connectedWallet:Z,loading:R,solanaWallet:y,onSolanaConnect:async({walletType:e,publicKey:t,wallet:r})=>{}}):null,j===UE&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2",children:[t.jsx("div",{className:"text-xs font-medium text-gray-600 mb-1.5 text-center",style:{fontFamily:FE},children:"Optimize QR for:"}),t.jsx("div",{className:"flex gap-1.5 justify-center flex-wrap",children:[{id:"metamask",name:"MetaMask",icon:"๐ŸฆŠ"},{id:"trust",name:"Trust",icon:"๐Ÿ›ก๏ธ"},{id:"coinbase",name:"Coinbase",icon:"๐Ÿ’™"}].map(e=>t.jsxs("button",{onClick:()=>k(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all duration-200 "+(x===e.id?"bg-[#7042D2] text-white shadow-md":"bg-gray-100 text-gray-700 hover:bg-gray-200"),style:{fontFamily:FE},children:[t.jsx("span",{className:"text-sm",children:e.icon}),t.jsx("span",{children:e.name})]},e.id))})]}),t.jsx(AE,{amount:(null==B?void 0:B.totalAmount)||(null==B?void 0:B.amount)||(null==c?void 0:c.amount),currency:null==O?void 0:O.symbol,network:null==T?void 0:T.shortName,theme:p,paymentData:B,config:c,selectedToken:O,selectedNetwork:T,preferredWallet:x,compact:!0})]}),j===DE&&(null==B?void 0:B.isDepositPayment)&&t.jsxs(t.Fragment,{children:[t.jsx(zE,{depositAddress:B.depositAddress,amount:B.amount,currency:null==O?void 0:O.symbol,network:null==T?void 0:T.shortName,networkName:null==T?void 0:T.name,paymentId:B.id,expiresAt:B.expiresAt,requiredConfirmations:B.requiredConfirmations||20,theme:p,api:m.api,explorerUrl:(null==(f=B.explorer)?void 0:f.address)?B.explorer.address.split("/address/")[0]:null,onPaymentDetected:e=>{},onPaymentConfirmed:e=>{V(LE),l&&l({paymentId:e.id,transactionHash:e.depositTxHash,sweepTxHash:e.sweepTxHash,network:null==T?void 0:T.shortName,currency:null==O?void 0:O.symbol,paymentDetails:e})},onExpired:()=>{K("Payment expired. Please create a new payment.")}}),t.jsx("div",{className:"mt-4",children:t.jsx("button",{type:"button",onClick:()=>V(OE),className:"w-full py-2.5 px-3 bg-gray-200 hover:bg-gray-300 text-[#7042D2] font-semibold rounded-xl transition-all duration-200 text-sm",style:{fontFamily:FE},children:"Cancel & Choose Different Method"})})]}),j===DE&&!(null==B?void 0:B.isDepositPayment)&&t.jsxs("div",{className:"text-center py-6",children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("div",{className:"text-4xl mb-2",children:"๐Ÿ’ธ"}),t.jsx("h3",{className:"text-lg font-semibold text-gray-800",style:{fontFamily:FE},children:"Transfer Payment"}),t.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Get a unique address to send crypto from any wallet"})]}),t.jsx("button",{onClick:async()=>{try{await F(c)}catch(oA){}},disabled:R,className:"w-full bg-[#7042D2] text-white py-3 px-4 rounded-xl hover:bg-[#5b34b1] disabled:opacity-50 font-semibold transition-all duration-200",style:{fontFamily:FE},children:R?"Generating Address...":"Generate Transfer Address"}),t.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"Supported on Base, BSC, Arbitrum, Polygon, Optimism & Avalanche"})]}),(L||ne)&&t.jsx("div",{className:"mt-4",children:t.jsx(TE,{error:ne||L,onRetry:()=>{K(""),Q.resetTransaction(),"error"===re&&Z&&ee()},onDismiss:()=>{K(""),Q.resetTransaction()},context:"payment"})}),!(j===DE&&(null==B?void 0:B.isDepositPayment))&&t.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-4",children:[t.jsx("button",{type:"button",onClick:()=>V(OE),className:"w-full py-2.5 px-3 bg-gray-200 hover:bg-gray-300 text-[#7042D2] font-semibold rounded-xl transition-all duration-200 text-sm",style:{fontFamily:FE},children:"Back"}),t.jsx("button",{type:"button",onClick:async()=>{var e,t,r,n,i,o,s,a,c,u,h,d,p,f,g,x;if(_&&C){if(!(null==B?void 0:B.id))return void K("Payment ID not found. Please refresh and try again.");try{A(!0),V(RE),K("");const s=await m.api.checkPaymentStatus(B.id);if("completed"===(null==(e=s.payment)?void 0:e.status))V(LE),l&&l({paymentId:B.id,transactionHash:s.payment.transactionHash,senderAddress:s.payment.senderWalletAddress||s.payment.fromAddress||Y||(null==y?void 0:y.publicKey),network:null==T?void 0:T.shortName,currency:null==O?void 0:O.symbol,paymentDetails:s.payment});else if("pending"===(null==(t=s.payment)?void 0:t.status)){const e=await m.api.verifyQRPayment(B.id);if(e.success&&e.verified)V(LE),l&&l({paymentId:B.id,transactionHash:null==(r=e.onChainData)?void 0:r.transactionHash,senderAddress:(null==(n=e.onChainData)?void 0:n.from)||(null==(i=e.payment)?void 0:i.senderWalletAddress)||Y||(null==y?void 0:y.publicKey),network:null==T?void 0:T.shortName,currency:null==O?void 0:O.symbol,paymentDetails:e.payment});else{const t=e.message||"Payment not yet confirmed on blockchain";K(`${t}. Please complete the payment in your wallet and try again.`),V(BE)}}else"failed"===(null==(o=s.payment)?void 0:o.status)?(K("Payment failed. Please try creating a new payment."),V(BE)):(K("Payment not found. Please verify the payment ID and try again."),V(BE))}catch(k){K(`Verification failed: ${k.message}. Please ensure payment was completed and try again.`),V(BE)}finally{A(!1)}}else if(j!==UE){if(v&&y.isConnected||Z&&Y)try{let e;if(V(RE),K(""),!v&&Q.setTransactionError&&Q.setTransactionError(""),v){const t=(null==B?void 0:B.recipientWallet)||(null==B?void 0:B.merchantWallet)||(null==B?void 0:B.merchantWalletAddress);if(!t)throw new Error("Merchant wallet address not found");if("SOL"===O.symbol||O.isNative){e=(await w.sendSOL(t,parseFloat(B.totalAmount||B.amount))).signature}else{const r=parseFloat(B.totalAmount||B.amount),n=O.decimals||6,i=null==(p=O.symbol)?void 0:p.toUpperCase();let o=O.address||O.contractAddress;if(o&&o.length>=32&&o.length<=44&&!o.startsWith("0x"));else{const e=(b?hm:lm)[i];(null==e?void 0:e.address)&&(o=e.address)}if(B.coinleyWallet&&B.merchantPercentage&&B.coinleyPercentage){const i=r*B.merchantPercentage/1e4,s=r*B.coinleyPercentage/1e4;e=(await w.sendSplitPayment({tokenMintAddress:o,merchantAddress:t,coinleyAddress:B.coinleyWallet,merchantAmount:i,coinleyAmount:s,decimals:n})).signature}else{e=(await w.sendSPLToken(o,t,r,n)).signature}}await m.api.processPayment(B.id,e,T.shortName,y.publicKey)}else e=await ee();if(e&&(K(""),Q.setTransactionError(""),V(LE),l)){const t={paymentId:B.id,transactionHash:e,senderAddress:v?null==y?void 0:y.publicKey:Y,network:null==T?void 0:T.shortName,currency:null==O?void 0:O.symbol,paymentDetails:B};l(t)}}catch(k){V(BE),(null==(f=k.message)?void 0:f.includes("User rejected"))||(null==(g=k.message)?void 0:g.includes("User denied"))||4001===k.code||"ACTION_REJECTED"===k.code?K("Transaction was cancelled by user. Please try again."):K(k.message||"Transaction failed. Please try again."),v?null==(x=w.resetTransaction)||x.call(w):Q.resetTransaction()}}else{if(!(null==B?void 0:B.id))return void K("Payment ID not found. Please refresh and try again.");try{V(RE),K("");const e=await m.api.checkPaymentStatus(B.id);if("completed"===(null==(s=e.payment)?void 0:s.status))V(LE),l&&l({paymentId:B.id,transactionHash:e.payment.transactionHash,senderAddress:e.payment.senderWalletAddress||e.payment.fromAddress||Y||(null==y?void 0:y.publicKey),network:null==T?void 0:T.shortName,currency:null==O?void 0:O.symbol,paymentDetails:e.payment});else if("pending"===(null==(a=e.payment)?void 0:a.status)){const e=await m.api.verifyQRPayment(B.id);if(e.success&&e.verified)V(LE),l&&l({paymentId:B.id,transactionHash:null==(c=e.onChainData)?void 0:c.transactionHash,senderAddress:(null==(u=e.onChainData)?void 0:u.from)||(null==(h=e.payment)?void 0:h.senderWalletAddress)||Y||(null==y?void 0:y.publicKey),network:null==T?void 0:T.shortName,currency:null==O?void 0:O.symbol,paymentDetails:e.payment});else{const t=e.message||"Payment not yet confirmed on blockchain";K(`${t}. Please complete the payment and try again.`),V(BE)}}else"failed"===(null==(d=e.payment)?void 0:d.status)?(K("Payment failed. Please try creating a new payment."),V(BE)):(K("Payment not found. Please verify the payment ID and try again."),V(BE))}catch(k){K(`Verification failed: ${k.message}. Please ensure payment was completed and try again.`),V(BE)}}},className:"bg-green-600 text-white w-full py-2.5 px-3 font-semibold rounded-xl hover:bg-green-700 transition-all duration-200 shadow-lg hover:shadow-xl disabled:opacity-50 text-sm",disabled:(()=>{const e=j===jE&&!_&&!v&&!Z,t=j===jE&&!_&&v&&!y.isConnected,r=_&&!C,n="processing"===re,i=w.isProcessing;return e||t||r||n||i||E})(),style:{fontFamily:FE},children:E?"Verifying...":"processing"===re||w.isProcessing?"Processing...":_&&C?"I Have Paid":_?"Select Wallet":j===UE?"I Have Paid":"Pay Now"})]})]})}),t.jsx(mE,{currentStep:M,targetStep:RE,children:t.jsx(gE,{status:"processing",message:v?w.isProcessing?"Confirming Solana transaction...":"Processing your Solana payment...":"approve"===re?"Approving token spending...":"splitPayment"===re?"Processing payment split...":ie?"Confirming transaction on blockchain...":"Processing your payment...",theme:p,transactionHash:v?w.txSignature:ie,selectedNetwork:T})}),t.jsx(mE,{currentStep:M,targetStep:LE,children:t.jsx(gE,{status:"success",message:"Payment completed successfully!",theme:p,payment:B,transactionHash:v?w.txSignature||(null==B?void 0:B.transactionHash):ie||(null==B?void 0:B.transactionHash),selectedPaymentMethod:O,selectedNetwork:T,merchantName:(null==c?void 0:c.merchantName)||"Merchant",onClose:h})}),(L||ne)&&t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg mx-6 mb-4",children:[t.jsx("p",{className:"text-red-800 text-sm",children:L||ne}),t.jsx("button",{onClick:()=>{K(""),Q.setTransactionError("")},className:"mt-2 text-red-600 hover:text-red-800 text-xs underline",children:"Dismiss"})]})]}),M!==LE&&t.jsxs("div",{className:"text-center text-xs text-gray-500 flex items-center justify-center gap-1 py-6 bg-white rounded-b-3xl",style:{fontFamily:FE},children:[t.jsxs("p",{children:["Powered by ",t.jsx("span",{className:"text-[#7042D2] font-semibold",children:"Coinley"})," - Multi-Wallet Support"]}),t.jsxs("svg",{className:"inline w-4 h-4 text-green-500 ml-1",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2",fill:"none"}),t.jsx("path",{d:"M9 12l2 2 4-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})})]}):null;var ae},WE=e=>t.jsx(n.WagmiProvider,{config:im,children:t.jsx(i.QueryClientProvider,{client:qE,children:t.jsx($E,{...e})})}),GE=r.createContext(null),HE=r.forwardRef(({customerEmail:e="",merchantName:t="",onSuccess:n,onError:i,onClose:o,theme:s="light",autoOpen:a=!1,testMode:c=!1,debug:l=!1,merchantWalletAddresses:u={}},h)=>{const d=r.useContext(GE);if(!d)throw new Error("CoinleyCheckout must be used within a CoinleyProvider");const{openPayment:p,closePayment:f}=d,m=t=>{try{if(!t.amount||t.amount<=0)throw new Error("Amount must be greater than 0");const r={...t,customerEmail:t.customerEmail||e,merchantWalletAddresses:{...u,...t.merchantWalletAddresses},metadata:{...t.metadata,testMode:c,checkoutVersion:"1.0.0"}};p(r,{onSuccess:n,onError:i,onClose:o})}catch(uh){i&&i(uh)}},g=()=>{f()};return r.useImperativeHandle(h,()=>({open:m,close:g})),null});HE.displayName="CoinleyCheckout";const VE={ethereum:Ov,bsc:_v,polygon:Lv,arbitrum:bv,optimism:Rv,avalanche:wv},KE=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],type:"function"}];const ZE=new class{constructor(){this.clients=new Map}getClient(e){if(!this.clients.has(e)){const t=VE[e];if(!t)throw new Error(`Unsupported network: ${e}`);const r=c.createPublicClient({chain:t,transport:c.http()});this.clients.set(e,r)}return this.clients.get(e)}async checkNativeBalance(e,t){try{const r=this.getClient(t),n=await r.getBalance({address:e}),i=c.formatUnits(n,18);return{balance:parseFloat(i),balanceWei:n.toString(),symbol:this.getNativeTokenSymbol(t),decimals:18}}catch(uh){throw new Error(`Failed to check native balance: ${uh.message}`)}}async checkTokenBalance(e,t,r){try{const n=this.getClient(r),i=c.getContract({address:t,abi:KE,client:n}),[o,s,a]=await Promise.all([i.read.balanceOf([e]),i.read.decimals().catch(()=>18),i.read.symbol().catch(()=>"TOKEN")]);return{balance:parseFloat(c.formatUnits(o,s)),balanceWei:o.toString(),symbol:a,decimals:s,tokenAddress:t}}catch(uh){throw new Error(`Failed to check token balance: ${uh.message}`)}}async validateBalance(e,t,r,n,i=!0){try{let o,s=null;o=t.contractAddress?await this.checkTokenBalance(e,t.contractAddress,n):await this.checkNativeBalance(e,n),t.contractAddress&&i&&(s=await this.checkNativeBalance(e,n));const a=o.balance>=r,c=a?0:r-o.balance;let l=0,u=!0,h=0;if(i)if(l=this.estimateGasFee(n,!!t.contractAddress),t.contractAddress)u=s.balance>=l,h=u?0:l-s.balance;else{const e=r+l;u=o.balance>=e,h=u?0:e-o.balance}const d={isValid:a&&u,tokenBalance:o,nativeBalance:s,requiredAmount:r,estimatedGasFee:l,hasEnoughTokens:a,hasEnoughForGas:u,tokenShortfall:c,gasShortfall:h,errors:[]};if(a||d.errors.push(`Insufficient ${t.symbol} balance. Need ${r} ${t.symbol}, have ${o.balance.toFixed(6)} ${t.symbol}`),!u){const e=(null==s?void 0:s.symbol)||this.getNativeTokenSymbol(n);t.contractAddress?d.errors.push(`Insufficient ${e} for gas fees. Need ~${l.toFixed(6)} ${e}, have ${s.balance.toFixed(6)} ${e}`):d.errors.push(`Insufficient ${e} for payment + gas. Need ${(r+l).toFixed(6)} ${e} total, have ${o.balance.toFixed(6)} ${e}`)}return d}catch(uh){return{isValid:!1,errors:[`Failed to check balance: ${uh.message}`],tokenBalance:null,nativeBalance:null}}}estimateGasFee(e,t=!1){return{ethereum:t?.001:5e-4,bsc:t?5e-4:3e-4,polygon:t?.01:.005,arbitrum:t?3e-4:2e-4,optimism:t?3e-4:2e-4,avalanche:t?.001:5e-4}[e]||.001}getNativeTokenSymbol(e){return{ethereum:"ETH",bsc:"BNB",polygon:"MATIC",arbitrum:"ETH",optimism:"ETH",avalanche:"AVAX"}[e]||"ETH"}async getBalance(e,t,r){return t.contractAddress?await this.checkTokenBalance(e,t.contractAddress,r):await this.checkNativeBalance(e,r)}formatBalance(e,t,r=6){return null==e?"Unknown":0===e?`0 ${t}`:e<.001?`${e.toFixed(8)} ${t}`:e<1?`${e.toFixed(6)} ${t}`:`${e.toFixed(4)} ${t}`}async checkMultipleBalances(e,t,r){try{const n=t.map(t=>this.getBalance(e,t,r).catch(e=>({error:e.message,symbol:t.symbol,balance:0})));return await Promise.all(n)}catch(uh){throw uh}}};class YE{constructor(e,t,r){this.baseURL=e.endsWith("/")?e.slice(0,-1):e,this.apiKey=t,this.apiSecret=r}async request(e,t={}){const r=`${this.baseURL}${e}`,n={"Content-Type":"application/json","X-API-Key":this.apiKey,"X-API-Secret":this.apiSecret,...t.headers},i=await fetch(r,{...t,headers:n});if(!i.ok){const e=await i.json().catch(()=>({}));throw new Error(e.error||`HTTP ${i.status}`)}return i.json()}async getNetworks(){try{return await this.request("/api/networks")}catch(uh){return{networks:[{id:"1",name:"Ethereum",shortName:"ethereum",chainId:"0x1",type:"ethereum"},{id:"56",name:"BSC",shortName:"bsc",chainId:"0x38",type:"bsc"},{id:"137",name:"Polygon",shortName:"polygon",chainId:"0x89",type:"polygon"},{id:"42161",name:"Arbitrum",shortName:"arbitrum",chainId:"0xa4b1",type:"arbitrum"},{id:"10",name:"Optimism",shortName:"optimism",chainId:"0xa",type:"optimism"},{id:"43114",name:"Avalanche",shortName:"avalanche",chainId:"0xa86a",type:"avalanche"},{id:"42220",name:"Celo",shortName:"celo",chainId:"0xa4ec",type:"celo"},{id:"8453",name:"Base",shortName:"base",chainId:"0x2105",type:"base"}]}}}async getTokens(){try{return await this.request("/api/networks/stablecoins")}catch(uh){return{stablecoins:[{id:"1",name:"Tether USD",symbol:"USDT",contractAddress:"0xdAC17F958D2ee523a2206206994597C13D831ec7",decimals:6,networkId:"1",Network:{shortName:"ethereum",name:"Ethereum"}},{id:"2",name:"USD Coin",symbol:"USDC",contractAddress:"0xA0b86a33E641a3FA62e50A9da1CE0647a2bFBC5A",decimals:6,networkId:"1",Network:{shortName:"ethereum",name:"Ethereum"}},{id:"3",name:"Binance USD",symbol:"BUSD",contractAddress:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",decimals:18,networkId:"56",Network:{shortName:"bsc",name:"BSC"}},{id:"4",name:"USD Coin",symbol:"USDC",contractAddress:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",decimals:18,networkId:"56",Network:{shortName:"bsc",name:"BSC"}},{id:"5",name:"USD Coin",symbol:"USDC",contractAddress:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",decimals:6,networkId:"137",Network:{shortName:"polygon",name:"Polygon"}},{id:"6",name:"Tether USD",symbol:"USDT",contractAddress:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",decimals:6,networkId:"137",Network:{shortName:"polygon",name:"Polygon"}},{id:"7",name:"Tether USD",symbol:"USDT",contractAddress:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",decimals:6,networkId:"42161",Network:{shortName:"arbitrum",name:"Arbitrum"}},{id:"8",name:"USD Coin",symbol:"USDC",contractAddress:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",decimals:6,networkId:"42161",Network:{shortName:"arbitrum",name:"Arbitrum"}},{id:"9",name:"Tether USD",symbol:"USDT",contractAddress:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",decimals:6,networkId:"10",Network:{shortName:"optimism",name:"Optimism"}},{id:"10",name:"USD Coin",symbol:"USDC",contractAddress:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",decimals:6,networkId:"10",Network:{shortName:"optimism",name:"Optimism"}},{id:"11",name:"Tether USD",symbol:"USDT",contractAddress:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",decimals:6,networkId:"43114",Network:{shortName:"avalanche",name:"Avalanche"}},{id:"12",name:"USD Coin",symbol:"USDC",contractAddress:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",decimals:6,networkId:"43114",Network:{shortName:"avalanche",name:"Avalanche"}},{id:"13",name:"Tether USD",symbol:"USDT",contractAddress:"0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e",decimals:6,networkId:"42220",Network:{shortName:"celo",name:"Celo"}},{id:"14",name:"USD Coin",symbol:"USDC",contractAddress:"0xcebA9300f2b948710d2653dD7B07f33A8B32118C",decimals:6,networkId:"42220",Network:{shortName:"celo",name:"Celo"}},{id:"15",name:"Tether USD",symbol:"USDT",contractAddress:"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",decimals:6,networkId:"8453",Network:{shortName:"base",name:"Base"}},{id:"16",name:"USD Coin",symbol:"USDC",contractAddress:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",decimals:6,networkId:"8453",Network:{shortName:"base",name:"Base"}}]}}}async createPayment(e){return await this.request("/api/payments/create",{method:"POST",body:JSON.stringify(e)})}async updatePaymentStatus(e,t,r=null){return await this.request(`/api/payments/${e}/status`,{method:"PUT",body:JSON.stringify({status:t,transactionHash:r})})}}const JE=globalThis||self;!function(){const e=M;"undefined"!=typeof globalThis&&(globalThis.Buffer=e),"undefined"!=typeof window&&(window.Buffer=e),void 0!==JE&&(JE.Buffer=e),"undefined"!=typeof self&&(self.Buffer=e)}();class XE{constructor(e={}){if(!e.publicKey&&!e.apiKey)throw new Error("CoinleyVanilla: publicKey or apiKey is required");if(!e.publicKey&&!e.apiSecret)throw new Error("CoinleyVanilla: apiSecret is required when using apiKey");if(!e.apiUrl)throw new Error("CoinleyVanilla: apiUrl is required");this.config={publicKey:e.publicKey||null,apiKey:e.apiKey||null,apiSecret:e.apiSecret||null,apiUrl:e.apiUrl.replace(/\/$/,""),theme:e.theme||"light",debug:e.debug||!1,...e},this.isOpen=!1,this.root=null,this.container=null,this.callbacks={},this.currentPayment=null,this.config.debug}open(e,t={}){if(!this.isOpen)try{this._validatePaymentConfig(e),this.callbacks=t,this.currentPayment=e,this._createContainer(),this.root=d.createRoot(this.container),this.isOpen=!0,this.root.render(r.createElement(WE,{publicKey:this.config.publicKey,apiKey:this.config.apiKey,apiSecret:this.config.apiSecret,apiUrl:this.config.apiUrl,isOpen:!0,theme:this.config.theme,config:{amount:e.amount,customerEmail:e.customerEmail,merchantName:e.merchantName||"Merchant",callbackUrl:e.callbackUrl||this._getDefaultCallbackUrl(),merchantWalletAddresses:e.merchantWalletAddresses||{},preferredNetwork:e.preferredNetwork,preferredCurrency:e.preferredCurrency,metadata:{...e.metadata,source:"vanilla-sdk",sdkVersion:"2.0.0",timestamp:(new Date).toISOString()}},onSuccess:this._handleSuccess.bind(this),onError:this._handleError.bind(this),onClose:this._handleClose.bind(this)})),this.config.debug}catch(uh){t.onError&&t.onError(uh.message||"Failed to open payment modal")}}close(){this.isOpen&&(this._cleanup(),this.config.debug)}isPaymentOpen(){return this.isOpen}updateConfig(e){this.config={...this.config,...e},this.config.debug}getConfig(){return{...this.config}}getCurrentPayment(){return this.currentPayment?{...this.currentPayment}:null}_validatePaymentConfig(e){if(!e)throw new Error("Payment configuration is required");if(!e.amount||"number"!=typeof e.amount||e.amount<=0)throw new Error("Valid amount (number > 0) is required");if(!e.customerEmail||"string"!=typeof e.customerEmail)throw new Error("Customer email is required");if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.customerEmail))throw new Error("Invalid email format");if(e.merchantWalletAddresses){if("object"!=typeof e.merchantWalletAddresses)throw new Error("merchantWalletAddresses must be an object");Object.keys(e.merchantWalletAddresses).length}}_createContainer(){this.container||(this.container=document.createElement("div"),this.container.id="coinley-payment-container",this.container.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 999999;\n ",document.body.appendChild(this.container))}_getDefaultCallbackUrl(){return"undefined"!=typeof window?`${window.location.origin}/api/webhooks/coinley`:""}_handleSuccess(e,t,r){this.config.debug,this.callbacks.onSuccess&&this.callbacks.onSuccess(e,t,r)}_handleError(e){this.config.debug,this.callbacks.onError&&this.callbacks.onError(e)}_handleClose(){this._cleanup(),this.callbacks.onClose&&this.callbacks.onClose()}_cleanup(){if(this.isOpen=!1,this.root){try{this.root.unmount()}catch(uh){}this.root=null}this.container&&this.container.parentNode&&(this.container.parentNode.removeChild(this.container),this.container=null),this.currentPayment=null}}function QE(){document.querySelectorAll('script[src*="coinley-vanilla"]').forEach(e=>{const t=e.getAttribute("data-public-key"),r=e.getAttribute("data-api-key"),n=e.getAttribute("data-api-secret"),i=e.getAttribute("data-api-url"),o=e.getAttribute("data-theme")||"light",s=e.hasAttribute("data-debug");if((t||r&&n)&&i)try{window.coinley=new XE({publicKey:t,apiKey:r,apiSecret:n,apiUrl:i,theme:o,debug:s})}catch(uh){}})}"undefined"!=typeof window&&(window.CoinleyVanilla=XE,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",QE):QE());class eA{constructor(e="https://paymentscreen.vercel.app/"){this.basePaymentUrl=e.endsWith("/")?e:e+"/"}generatePaymentURL(e){const{merchant:t,amount:r,productAmount:n,platformFee:i,networkFee:o,token:s="USDC",network:a="Ethereum Mainnet",merchantAddress:c}=e;if(!t)throw new Error("Merchant name is required");if(!r)throw new Error("Amount is required");if(!c)throw new Error("Merchant address (smart contract) is required");const l=n||.95*r,u=i||.03*r,h=o||.02*r,d=new URLSearchParams({merchant:t,amount:r.toString(),productAmount:l.toString(),platformFee:u.toString(),networkFee:h.toString(),token:s,network:a,merchantAddress:c});return this.basePaymentUrl+"?"+d.toString()}async generateQRCode(e,t={}){const{width:r=300,margin:n=2,colorDark:i="#7c3aed",colorLight:o="#ffffff"}=t;try{const t=this.generatePaymentURL(e);return{qrCodeDataURL:await u.toDataURL(t,{width:r,margin:n,color:{dark:i,light:o}}),paymentURL:t,paymentData:{...e,qrCodeUrl:t}}}catch(uh){throw new Error(`Failed to generate QR code: ${uh.message}`)}}async generateQRCodeToCanvas(e,t,r={}){const{width:n=300,margin:i=2,colorDark:o="#7c3aed",colorLight:s="#ffffff"}=r;try{const r=this.generatePaymentURL(e);return await u.toCanvas(t,r,{width:n,margin:i,color:{dark:o,light:s}}),r}catch(uh){throw new Error(`Failed to generate QR code to canvas: ${uh.message}`)}}validatePaymentData(e){const t=[],r=[];e.merchant||t.push("Merchant name is required"),(!e.amount||e.amount<=0)&&t.push("Valid amount is required"),e.merchantAddress||t.push("Merchant address (smart contract) is required"),e.merchantAddress&&!/^0x[a-fA-F0-9]{40}$/.test(e.merchantAddress)&&t.push("Invalid Ethereum address format for merchantAddress"),e.amount>1e4&&r.push("Large payment amount detected");return(e.platformFee||0)+(e.networkFee||0)>.1*e.amount&&r.push("High fees detected (>10% of total amount)"),{isValid:0===t.length,errors:t,warnings:r}}async createPaymentQR(e){const{merchantName:t,amount:r,productAmount:n,platformFee:i,networkFee:o,token:s,network:a,merchantWalletAddresses:c,selectedNetwork:l="ethereum",...u}=e,h={merchant:t||"Coinley Merchant",amount:r,productAmount:n,platformFee:i,networkFee:o,token:s||"USDC",network:a||"Ethereum Mainnet",merchantAddress:(null==c?void 0:c[l])||(null==c?void 0:c.ethereum)||(null==c?void 0:c.splitPaymentContract),...u},d=this.validatePaymentData(h);if(!d.isValid)throw new Error(`Payment validation failed: ${d.errors.join(", ")}`);return{...await this.generateQRCode(h),validation:d,instructions:{userAction:"Scan this QR code with your mobile wallet to pay",expectedFlow:"QR Scan โ†’ Payment Screen โ†’ Wallet Connect โ†’ Split Payment โ†’ Confirmation",supportedWallets:["MetaMask","Trust Wallet","Coinbase Wallet","WalletConnect compatible wallets"]}}}}const tA=new eA;"undefined"!=typeof window&&(window.Buffer=M),"undefined"!=typeof globalThis&&(globalThis.Buffer=M);const rA={formatAmount:(e,t=2)=>e.toFixed(t),truncateAddress:(e,t=6,r=4)=>e?e.length<=t+r?e:`${e.slice(0,t)}...${e.slice(-r)}`:"",isValidAddress:(e,t)=>{if(!e)return!1;switch(t.toLowerCase()){case"ethereum":case"bsc":case"polygon":return/^0x[a-fA-F0-9]{40}$/.test(e);case"tron":return/^T[a-zA-Z0-9]{33}$/.test(e);case"solana":return/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e);default:return e.length>0}},copyToClipboard:async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}};class nA extends Error{constructor(e,t){super(e),this.name="CoinleyError",this.code=t}}const iA={react:"\nimport { CoinleyProvider, CoinleyCheckout } from 'coinley-test';\n\n// New recommended way - using publicKey only\n<CoinleyProvider\n publicKey=\"pk_your-public-key\"\n apiUrl=\"https://api.coinley.io\"\n>\n <CoinleyCheckout\n ref={checkoutRef}\n onSuccess={({ paymentId, transactionHash, senderAddress, network, currency, paymentDetails }) => {\n console.log('Payment successful!');\n console.log('Payment ID:', paymentId);\n console.log('Transaction Hash:', transactionHash);\n console.log('Sender Address:', senderAddress); // Wallet address that made the payment\n console.log('Network:', network); // e.g., 'ethereum', 'bsc', 'polygon'\n console.log('Currency:', currency); // e.g., 'USDT', 'USDC'\n console.log('Full Details:', paymentDetails);\n }}\n onError={(error) => console.error('Error:', error)}\n onClose={() => console.log('Closed')}\n />\n</CoinleyProvider>\n\n// Legacy way (still supported) - using apiKey + apiSecret\n<CoinleyProvider\n apiKey=\"your-api-key\"\n apiSecret=\"your-api-secret\"\n apiUrl=\"https://api.coinley.io\"\n>\n ...\n</CoinleyProvider>\n ",vanilla:'\n\x3c!-- Include via CDN --\x3e\n<script src="https://unpkg.com/coinley-test@latest/vanilla"><\/script>\n<link rel="stylesheet" href="https://unpkg.com/coinley-test@latest/vanilla/style.css">\n\n<script>\n// New recommended way - using publicKey only\nconst coinley = new CoinleyVanilla({\n publicKey: "pk_your-public-key",\n apiUrl: "https://api.coinley.io",\n theme: "light"\n});\n\n// Legacy way (still supported)\nconst coinleyLegacy = new CoinleyVanilla({\n apiKey: "your-api-key",\n apiSecret: "your-api-secret",\n apiUrl: "https://api.coinley.io",\n theme: "light"\n});\n\n// Use in checkout\ncoinley.open({\n amount: 100,\n customerEmail: "customer@example.com",\n merchantName: "Your Store",\n merchantWalletAddresses: {\n ethereum: "0x...",\n bsc: "0x..."\n }\n}, {\n onSuccess: ({ paymentId, transactionHash, senderAddress, network, currency, paymentDetails }) => {\n console.log(\'Payment successful!\');\n console.log(\'Sender Address:\', senderAddress); // Wallet that made the payment\n console.log(\'Network:\', network); // e.g., \'ethereum\', \'bsc\'\n console.log(\'Currency:\', currency); // e.g., \'USDT\', \'USDC\'\n },\n onError: (error) => console.error(\'Error:\', error),\n onClose: () => console.log(\'Closed\')\n});\n<\/script>\n '};e.CoinleyCheckout=HE,e.CoinleyError=nA,e.CoinleyProvider=({publicKey:e,apiKey:n,apiSecret:i,apiUrl:o,theme:s="light",debug:a=!1,children:c})=>{const[l,u]=r.useState(!1),[h,d]=r.useState(null),[p,f]=r.useState({}),[m,g]=r.useState(""),y=()=>{u(!1),d(null),p.onClose&&p.onClose()},v={openPayment:(e,t)=>{d(e),t&&f(t),u(!0)},closePayment:y};return t.jsxs(GE.Provider,{value:v,children:[c,l&&h&&t.jsx(WE,{publicKey:e,apiKey:n,apiSecret:i,apiUrl:o,isOpen:l,config:h,theme:s,debug:a,merchantName:m,onSuccess:p.onSuccess,onError:p.onError,onClose:y})]})},e.CoinleyVanilla=XE,e.DEFAULT_CONFIG={theme:"light",debug:!1,testMode:!1,autoOpen:!1},e.EnhancedSimpleCoinleyPayment=WE,e.PaymentAPI=class{constructor(e,t,r=null){t&&t.startsWith("pk_")?(this.publicKey=t,this.apiKey=null,this.apiSecret=null):(this.publicKey=null,this.apiKey=t,this.apiSecret=r),this.api=h.create({baseURL:e.endsWith("/")?e.slice(0,-1):e,timeout:3e4,headers:{"Content-Type":"application/json"}}),this.api.interceptors.request.use(e=>{if(this.publicKey)e.headers["x-public-key"]=this.publicKey;else{e.headers["x-api-key"]=this.apiKey,e.headers["x-api-secret"]=this.apiSecret;const t=this.generateMerchantToken();t&&(e.headers.Authorization=`Bearer ${t}`)}return e},e=>Promise.reject(e)),this.api.interceptors.response.use(e=>e,e=>{var t,r,n;if(401===(null==(t=e.response)?void 0:t.status))throw new Error("Authentication failed. Please check your API credentials.");if(404===(null==(r=e.response)?void 0:r.status))throw new Error("API endpoint not found. Please check your API URL.");if((null==(n=e.response)?void 0:n.status)>=500)throw new Error("Server error. Please try again later.");throw e})}generateMerchantToken(){try{const e=`${this.apiKey}:${this.apiSecret}`;return btoa(e)}catch(uh){return null}}async request(e,t={}){var r,n;try{return(await this.api({url:e,method:t.method||"GET",data:t.data||t.body?JSON.parse(t.body||"{}"):void 0,...t})).data}catch(uh){if(null==(n=null==(r=uh.response)?void 0:r.data)?void 0:n.error)throw new Error(uh.response.data.error);throw new Error(uh.message||"Request failed")}}async createPayment(e){var t,r;try{return(await this.api.post("/api/payments/create",e)).data}catch(uh){if(null==(r=null==(t=uh.response)?void 0:t.data)?void 0:r.error)throw new Error(uh.response.data.error);throw new Error(uh.message||"Failed to create payment")}}async getPayment(e){var t,r;try{return(await this.api.get(`/api/payments/${e}`)).data}catch(uh){if(null==(r=null==(t=uh.response)?void 0:t.data)?void 0:r.error)throw new Error(uh.response.data.error);throw new Error(uh.message||"Failed to get payment details")}}async getNetworks(){try{return(await this.api.get("/api/networks")).data}catch(uh){return{networks:[{id:"ethereum",name:"Ethereum",shortName:"ethereum",chainId:1,type:"ethereum",explorerUrl:"https://etherscan.io",isTestnet:!1},{id:"bsc",name:"Binance Smart Chain",shortName:"bsc",chainId:56,type:"bsc",explorerUrl:"https://bscscan.com",isTestnet:!1},{id:"polygon",name:"Polygon",shortName:"polygon",chainId:137,type:"ethereum",explorerUrl:"https://polygonscan.com",isTestnet:!1}]}}}async getStablecoins(){try{return(await this.api.get("/api/networks/stablecoins")).data}catch(uh){return{stablecoins:[{id:"usdt-eth",name:"Tether USD",symbol:"USDT",contractAddress:"0xdAC17F958D2ee523a2206206994597C13D831ec7",decimals:6,isStablecoin:!0,networkId:"ethereum",Network:{id:"ethereum",name:"Ethereum",shortName:"ethereum",type:"ethereum"}},{id:"usdc-eth",name:"USD Coin",symbol:"USDC",contractAddress:"0xA0b86a33E6441d81d0B93bF9EE0f74ca32F7e6f6",decimals:6,isStablecoin:!0,networkId:"ethereum",Network:{id:"ethereum",name:"Ethereum",shortName:"ethereum",type:"ethereum"}}]}}}async verifyQRPayment(e){var t,r;try{return(await this.api.post("/api/payments/verify-qr",{paymentId:e})).data}catch(uh){if(null==(r=null==(t=uh.response)?void 0:t.data)?void 0:r.error)throw new Error(uh.response.data.error);throw new Error(uh.message||"Failed to verify payment")}}async processPayment(e,t,r,n){var i;try{return(await this.api.post("/api/payments/process",{paymentId:e,transactionHash:t,network:r,senderAddress:n})).data}catch(uh){if(null==(i=uh.response)?void 0:i.data){const t=uh.response.data,r=t.error||t.message||"Payment processing failed",n=new Error(r);throw n.isAlreadyCompleted=t.isAlreadyCompleted||!1,n.verificationAttempts=t.verificationAttempts||0,n.statusCode=uh.response.status,n.originalData=t,n}throw new Error(uh.message||"Failed to process PaymentSplitter transaction")}}async getContractInfo(e){var t,r;try{return(await this.api.get(`/api/payments/contract/${e}`)).data.contractInfo}catch(uh){if(null==(r=null==(t=uh.response)?void 0:t.data)?void 0:r.error)throw new Error(uh.response.data.error);throw new Error(uh.message||"Failed to get contract information")}}async getPaymentSplitterStatus(e){var t,r;try{return(await this.api.get(`/api/payments/splitter-status/${e}`)).data.paymentSplitterStatus}catch(uh){if(null==(r=null==(t=uh.response)?void 0:t.data)?void 0:r.error)throw new Error(uh.response.data.error);throw new Error(uh.message||"Failed to get PaymentSplitter status")}}async checkPaymentSplitterHealth(){try{return(await this.api.get("/api/payments/health")).data.paymentSplitterHealth}catch(uh){return{error:uh.message}}}async healthCheck(){try{return 200===(await this.api.get("/api/health")).status}catch(uh){return!1}}},e.PaymentQRGenerator=eA,e.QRCodePayment=({apiKey:e,apiSecret:n,apiUrl:i,config:o,onSuccess:s,onError:a,onClose:c,isOpen:l,theme:h="light",mode:d="splitpayment",splitPaymentUrl:p="https://paymentscreen.vercel.app/"})=>{var f;const[m,g]=r.useState("network"),[y,v]=r.useState([]),[b,w]=r.useState([]),[x,k]=r.useState(null),[_,S]=r.useState(null),[C,I]=r.useState(null),[E,A]=r.useState(!1),[M,N]=r.useState(""),[P,T]=r.useState(""),[O,B]=r.useState(""),[R,L]=r.useState(""),[j,U]=r.useState(!1),[D,F]=r.useState(""),[z,q]=r.useState(!1),[$,W]=r.useState(null),G=r.useRef(new YE(i,e,n)),H=r.useRef(null);r.useEffect(()=>(l&&(K(),V()),()=>{H.current&&clearInterval(H.current)}),[l]);const V=()=>{g("network"),k(null),S(null),I(null),N(""),T(""),B(""),L(""),U(!1),F(""),q(!1),W(null),H.current&&clearInterval(H.current)},K=async()=>{try{A(!0),N("");const[e,t]=await Promise.all([G.current.getNetworks(),G.current.getTokens()]);v(e.networks||[]),w(t.stablecoins||[])}catch(oA){N("Failed to load payment options.")}finally{A(!1)}},Z=async e=>{if(!_||!x||!C)return!1;try{const t=await ZE.validateBalance(e,_,C.totalAmount,x.shortName,!0);return W(t),!!t.isValid||(N(`Insufficient balance: ${t.errors.join(", ")}`),!1)}catch(t){return N(`Failed to check balance: ${t.message}`),!1}};if(!l)return null;const Y="dark"===h;return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:t.jsxs("div",{className:"rounded-lg shadow-xl max-w-md w-full mx-4 "+(Y?"bg-gray-900 text-white":"bg-white text-gray-900"),children:[t.jsxs("div",{className:"p-4 border-b flex justify-between items-center "+(Y?"border-gray-700":"border-gray-200"),children:[t.jsxs("div",{className:"text-center flex-1",children:[t.jsx("h2",{className:"text-lg font-semibold",children:"splitpayment"===d?"Split Payment QR":"QR Code Payment"}),o.amount&&t.jsxs("p",{className:"text-2xl font-bold text-purple-600",children:["$",o.amount.toFixed(2)]}),t.jsx("p",{className:"text-xs text-blue-600",children:"splitpayment"===d?"๐Ÿ“ฑ Scan to redirect to payment screen":"๐Ÿ“ฑ Scan with mobile wallet"})]}),t.jsx("button",{onClick:c,className:"ml-4 text-gray-500 hover:text-gray-700 "+(Y?"hover:text-gray-300":""),children:"โœ•"})]}),t.jsxs("div",{className:"p-4 min-h-[400px]",children:[M&&t.jsxs("div",{className:"mb-4 p-3 bg-red-100 text-red-700 rounded border border-red-200",children:[M,t.jsx("button",{onClick:()=>N(""),className:"ml-2 text-red-500 hover:text-red-700",children:"โœ•"})]}),"network"===m&&t.jsxs("div",{className:"space-y-4",children:[t.jsx("h3",{className:"font-medium text-center",children:"Select Network"}),t.jsx("div",{className:"space-y-2",children:y.map(e=>{var r;const n=null==(r=o.merchantWalletAddresses)?void 0:r[e.shortName];return t.jsxs("button",{onClick:()=>{k(e),g("token")},disabled:!n,className:"w-full p-3 border rounded-lg text-left transition-colors "+(n?"hover:border-purple-500 "+(Y?"border-gray-600 hover:bg-gray-800":"border-gray-200 hover:bg-gray-50"):"opacity-50 cursor-not-allowed "+(Y?"border-gray-700":"border-gray-100")),children:[t.jsx("div",{className:"font-medium",children:e.name}),t.jsxs("div",{className:"text-sm "+(Y?"text-gray-400":"text-gray-500"),children:[e.shortName.toUpperCase(),!n&&" (No merchant address configured)"]})]},e.id)})})]}),"token"===m&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{onClick:()=>g("network"),className:""+(Y?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),children:"โ†"}),t.jsxs("h3",{className:"font-medium",children:["Select Token on ",null==x?void 0:x.name]})]}),t.jsx("div",{className:"space-y-2",children:b.filter(e=>{var t;return(null==(t=e.Network)?void 0:t.shortName)===(null==x?void 0:x.shortName)}).map(e=>t.jsxs("button",{onClick:()=>{S(e),(async e=>{var t,r;try{A(!0),N("");const n={amount:o.amount,currency:e.symbol,network:x.shortName,customerEmail:o.customerEmail,callbackUrl:o.callbackUrl,metadata:{...o.metadata,merchantWalletAddresses:o.merchantWalletAddresses,paymentMethod:"split_payment_qr",selectedNetwork:x.shortName,selectedToken:e.symbol}},i=await G.current.createPayment(n);I(i.payment);const s=(null==(t=o.merchantWalletAddresses)?void 0:t.splitPaymentContract)||(null==(r=o.merchantWalletAddresses)?void 0:r[x.shortName]);if(!s)throw new Error("Split payment contract address not found in config");const a=new URLSearchParams({merchant:o.merchantName||"Coinley Merchant",amount:i.payment.totalAmount.toString(),productAmount:(.95*i.payment.totalAmount).toFixed(2),platformFee:(.03*i.payment.totalAmount).toFixed(2),networkFee:(.02*i.payment.totalAmount).toFixed(2),token:e.symbol,network:x.name,merchantAddress:s,paymentId:i.payment.id}),c=p+"?"+a.toString();T(c);const l=await u.toDataURL(c,{width:256,margin:2,color:{dark:"#7c3aed",light:"#ffffff"}});B(l),g("scan")}catch(n){N(n.message||"Failed to generate split payment QR code")}finally{A(!1)}})(e)},disabled:E,className:"w-full p-3 border rounded-lg hover:border-purple-500 text-left transition-colors disabled:opacity-50 "+(Y?"border-gray-600 hover:bg-gray-800":"border-gray-200 hover:bg-gray-50"),children:[t.jsx("div",{className:"font-medium",children:e.name}),t.jsx("div",{className:"text-sm "+(Y?"text-gray-400":"text-gray-500"),children:e.symbol})]},e.id))})]}),"scan"===m&&t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"font-medium mb-4",children:"splitpayment"===d?"Scan QR Code to Open Payment Screen":"Scan QR Code with Mobile Wallet"}),O?t.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[t.jsx("div",{className:"p-4 rounded-lg "+(Y?"bg-gray-800":"bg-gray-50"),children:t.jsx("img",{src:O,alt:"Payment QR Code",className:"mx-auto",style:{width:"200px",height:"200px"}})}),t.jsxs("div",{className:"text-sm space-y-1 "+(Y?"text-gray-300":"text-gray-600"),children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{children:"Amount:"}),t.jsxs("span",{className:"font-medium",children:[null==C?void 0:C.totalAmount," ",null==_?void 0:_.symbol]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{children:"Network:"}),t.jsx("span",{className:"font-medium",children:null==x?void 0:x.name})]}),"splitpayment"===d&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{children:"Merchant:"}),t.jsx("span",{className:"font-medium",children:o.merchantName||"Coinley Merchant"})]})]}),t.jsx("div",{className:"p-3 rounded-lg text-xs "+(Y?"bg-blue-900 text-blue-200":"bg-blue-50 text-blue-600"),children:"splitpayment"===d?t.jsxs(t.Fragment,{children:["๐Ÿ“ฑ Scan this QR code with your mobile wallet to open the payment screen.",t.jsx("br",{}),"The payment screen will auto-connect your wallet and execute the split payment."]}):"๐Ÿ“ฑ Open your mobile wallet and scan this QR code to connect and pay"}),"splitpayment"===d?t.jsx("button",{onClick:()=>window.open(P,"_blank"),className:"w-full bg-purple-600 text-white py-2 px-4 rounded hover:bg-purple-700 text-sm",children:"๐Ÿ”— Test Payment Screen (Opens in new tab)"}):t.jsx("button",{onClick:async()=>{try{A(!0),N("");const e="0x742d35Cc6634C0532925a3b8D9a5C7C47C77E4";F(e),U(!0),await Z(e),g("confirm")}catch(e){N("Failed to simulate wallet connection")}finally{A(!1)}},disabled:E,className:"w-full bg-gray-600 text-white py-2 px-4 rounded hover:bg-gray-700 disabled:opacity-50 text-sm",children:E?"Connecting...":"๐Ÿงช Simulate Wallet Scan (Test)"})]}):t.jsxs("div",{className:"flex items-center justify-center py-8",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"}),t.jsx("span",{className:"ml-2",children:"Generating QR Code..."})]})]})}),"confirm"===m&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:t.jsx("span",{className:"text-2xl",children:"๐Ÿ“ฑ"})}),t.jsx("h3",{className:"font-medium",children:"Mobile Wallet Connected"}),t.jsx("p",{className:"text-sm mt-2 "+(Y?"text-gray-300":"text-gray-600"),children:"Ready to complete payment"})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"p-3 bg-green-50 rounded-lg border border-green-200",children:[t.jsx("p",{className:"text-green-600 text-sm font-medium",children:"โœ… Wallet Connected"}),t.jsxs("p",{className:"font-mono text-xs text-green-700 mt-1",children:[null==D?void 0:D.slice(0,6),"...",null==D?void 0:D.slice(-4)]})]}),$&&t.jsx("div",{className:"p-3 rounded-lg border "+($.isValid?"bg-green-50 border-green-200":"bg-red-50 border-red-200"),children:t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{children:"Required:"}),t.jsxs("span",{className:"font-medium",children:[null==C?void 0:C.totalAmount," ",null==_?void 0:_.symbol]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{children:"Your Balance:"}),t.jsx("span",{className:"font-medium "+($.hasEnoughTokens?"text-green-600":"text-red-600"),children:ZE.formatBalance(null==(f=$.tokenBalance)?void 0:f.balance,null==_?void 0:_.symbol)})]}),$.nativeBalance&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{children:"Gas Balance:"}),t.jsx("span",{className:"font-medium "+($.hasEnoughForGas?"text-green-600":"text-red-600"),children:ZE.formatBalance($.nativeBalance.balance,$.nativeBalance.symbol)})]})]})}),t.jsx("button",{onClick:async()=>{try{q(!0),N("");const e=`0x${Math.random().toString(16).substring(2,66)}`;await new Promise(e=>setTimeout(e,3e3)),g("success"),null==s||s(C.id,e,{network:x.name,token:_.symbol,amount:C.totalAmount,method:"qr_code",walletAddress:D})}catch(e){N("Transaction confirmation failed")}finally{q(!1)}},disabled:z||!(null==$?void 0:$.isValid),className:"w-full bg-green-600 text-white py-3 px-4 rounded-lg hover:bg-green-700 disabled:opacity-50 font-medium",children:z?"Processing Payment...":(null==$?void 0:$.isValid)?`Confirm Payment of ${null==C?void 0:C.totalAmount} ${null==_?void 0:_.symbol}`:"Insufficient Balance"})]})]}),"success"===m&&t.jsxs("div",{className:"text-center space-y-4",children:[t.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto",children:t.jsx("span",{className:"text-2xl",children:"โœ…"})}),t.jsx("h3",{className:"font-medium text-green-600",children:"Payment Successful!"}),t.jsx("p",{className:"text-sm "+(Y?"text-gray-300":"text-gray-600"),children:"Transaction completed via QR code scan"}),t.jsx("button",{onClick:c,className:"w-full bg-green-600 text-white py-3 px-4 rounded-lg hover:bg-green-700 font-medium",children:"Close"})]}),E&&"scan"!==m&&"confirm"!==m&&t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"})})]})]})})},e.SimpleCoinleyProvider=({children:e,...t})=>e,e.ThemeProvider=({initialTheme:e="light",children:n})=>{const[i,o]=r.useState(e);return r.useEffect(()=>{document.documentElement.setAttribute("data-coinley-theme",i)},[i]),t.jsx("div",{className:`coinley-theme-${i}`,children:n})},e.USAGE_EXAMPLES=iA,e.VERSION="0.0.27",e.generatePaymentQR=(e,t)=>tA.generateQRCode(e,t),e.generatePaymentURL=e=>tA.generatePaymentURL(e),e.paymentQR=tA,e.sdkAnalytics=em,e.useCoinley=()=>{const e=r.useContext(GE);if(!e)throw new Error("useCoinley must be used within a CoinleyProvider");return e},e.utils=rA,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
23
+ //# sourceMappingURL=index.umd.js.map