@frak-labs/core-sdk 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see bundle.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FrakSDK=t():e.FrakSDK=t()}(globalThis,()=>(()=>{var e={"../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackExtension=void 0,t.JsonPackExtension=class{constructor(e,t){this.tag=e,this.val=t}}},"../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackValue=void 0,t.JsonPackValue=class{constructor(e){this.val=e}}},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoder=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class o extends n.CborDecoderBase{readAsMap(){let e=this.reader.u8();if(e>>5==5)return this.readMap(31&e);throw 0}readMap(e){let t=this.readMinorLen(e);return t>=0?this.readMapRaw(t):this.readMapIndef()}readMapRaw(e){let t=new Map;for(let r=0;r<e;r++){let e=this.val(),r=this.val();t.set(e,r)}return t}readMapIndef(){let e=new Map;for(;255!==this.reader.peak();){let t=this.val();if(255===this.reader.peak())throw 7;let r=this.val();e.set(t,r)}return this.reader.x++,e}skipN(e){for(let t=0;t<e;t++)this.skipAny()}skipAny(){this.skipAnyRaw(this.reader.u8())}skipAnyRaw(e){let t=31&e;switch(e>>5){case 0:case 1:this.skipUNint(t);break;case 2:this.skipBin(t);break;case 3:this.skipStr(t);break;case 4:this.skipArr(t);break;case 5:this.skipObj(t);break;case 7:this.skipTkn(t);break;case 6:this.skipTag(t)}}skipMinorLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}skipUNint(e){if(!(e<=23))switch(e){case 24:return this.reader.skip(1);case 25:return this.reader.skip(2);case 26:return this.reader.skip(4);case 27:return this.reader.skip(8);default:throw 1}}skipBin(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipBinChunk();this.reader.x++}}skipBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;this.skipBin(t)}skipStr(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipStrChunk();this.reader.x++}}skipStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;this.skipStr(t)}skipArr(e){let t=this.skipMinorLen(e);if(t>=0)this.skipN(t);else{for(;255!==this.reader.peak();)this.skipAny();this.reader.x++}}skipObj(e){let t=this.readMinorLen(e);if(t>=0)return this.skipN(2*t);for(;255!==this.reader.peak();){if(this.skipAny(),255===this.reader.peak())throw 7;this.skipAny()}this.reader.x++}skipTag(e){if(0>this.skipMinorLen(e))throw 1;this.skipAny()}skipTkn(e){switch(e){case 24:this.reader.skip(1);return;case 25:this.reader.skip(2);return;case 26:this.reader.skip(4);return;case 27:this.reader.skip(8);return}if(!(e<=23))throw 1}validate(e,t=0,r=e.length){if(this.reader.reset(e),this.reader.x=t,this.skipAny(),this.reader.x-t!==r)throw 8}decodeLevel(e){return this.reader.reset(e),this.readLevel()}readLevel(){let e=this.reader.u8(),t=e>>5,r=31&e;switch(t){case 4:return this.readArrLevel(r);case 5:return this.readObjLevel(r);default:return super.readAnyRaw(e)}}readPrimitiveOrVal(){switch(this.reader.peak()>>5){case 4:case 5:return this.readAsValue();default:return this.val()}}readAsValue(){let e=this.reader,t=e.x;this.skipAny();let r=e.x;return new i.JsonPackValue(e.uint8.subarray(t,r))}readObjLevel(e){let t=this.readMinorLen(e);return t>=0?this.readObjRawLevel(t):this.readObjIndefLevel()}readObjRawLevel(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.readPrimitiveOrVal();t[e]=r}return t}readObjIndefLevel(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.readPrimitiveOrVal();e[t]=r}return this.reader.x++,e}readArrLevel(e){let t=this.readMinorLen(e);return t>=0?this.readArrRawLevel(t):this.readArrIndefLevel()}readArrRawLevel(e){let t=[];for(let r=0;r<e;r++)t.push(this.readPrimitiveOrVal());return t}readArrIndefLevel(){let e=[];for(;255!==this.reader.peak();)e.push(this.readPrimitiveOrVal());return this.reader.x++,e}readHdr(e){let t=this.reader.u8();if(t>>5!==e)throw 0;let r=31&t;if(r<24)return r;switch(r){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1}throw 1}readStrHdr(){return this.readHdr(3)}readObjHdr(){return this.readHdr(5)}readArrHdr(){return this.readHdr(4)}findKey(e){let t=this.readObjHdr();for(let r=0;r<t;r++){if(this.key()===e)return this;this.skipAny()}throw 9}findIndex(e){if(e>=this.readArrHdr())throw 10;for(let t=0;t<e;t++)this.skipAny();return this}find(e){for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r?this.findKey(r):this.findIndex(r)}return this}}t.CborDecoder=o},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderBase=void 0;let n=r("../../node_modules/tslib/tslib.es6.mjs"),i=r("../../node_modules/@jsonjoy.com/util/lib/buffers/f16.js"),o=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),s=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js"),a=r("../../node_modules/@jsonjoy.com/util/lib/buffers/Reader.js"),u=n.__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/sharedCachedUtf8Decoder.js"));t.CborDecoderBase=class{constructor(e=new a.Reader,t=u.default){this.reader=e,this.keyDecoder=t}read(e){return this.reader.reset(e),this.val()}decode(e){return this.reader.reset(e),this.val()}val(){let e=this.reader.u8(),t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readAnyRaw(e){let t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readMinorLen(e){if(e<24)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}readUint(e){if(e<25)return 24===e?this.reader.u8():e;{if(e<27)return 25===e?this.reader.u16():this.reader.u32();let t=this.reader.u64();return t>0x1fffffffffffff?t:Number(t)}}readNint(e){if(e<25)return 24===e?-this.reader.u8()-1:-e-1;{if(e<27)return 25===e?-this.reader.u16()-1:-this.reader.u32()-1;let t=this.reader.u64();return t>0x1ffffffffffffe?-t-BigInt(1):-Number(t)-1}}readBin(e){let t=this.reader;if(e<=23)return t.buf(e);switch(e){case 24:return t.buf(t.u8());case 25:return t.buf(t.u16());case 26:return t.buf(t.u32());case 27:return t.buf(Number(t.u64()));case 31:{let e=0,t=[];for(;255!==this.reader.peak();){let r=this.readBinChunk();e+=r.length,t.push(r)}this.reader.x++;let r=new Uint8Array(e),n=0,i=t.length;for(let e=0;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r}default:throw 1}}readBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;return this.readBin(t)}readAsStr(){let e=this.reader.u8();if(3!=e>>5)throw 11;return this.readStr(31&e)}readStr(e){let t=this.reader;if(e<=23)return t.utf8(e);switch(e){case 24:return t.utf8(t.u8());case 25:return t.utf8(t.u16());case 26:return t.utf8(t.u32());case 27:return t.utf8(Number(t.u64()));case 31:{let e="";for(;255!==t.peak();)e+=this.readStrChunk();return this.reader.x++,e}default:throw 1}}readStrLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());default:throw 1}}readStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;return this.readStr(t)}readArr(e){let t=this.readMinorLen(e);return t>=0?this.readArrRaw(t):this.readArrIndef()}readArrRaw(e){let t=[];for(let r=0;r<e;r++)t.push(this.val());return t}readArrIndef(){let e=[];for(;255!==this.reader.peak();)e.push(this.val());return this.reader.x++,e}readObj(e){if(e<28){let t=e;switch(e){case 24:t=this.reader.u8();break;case 25:t=this.reader.u16();break;case 26:t=this.reader.u32();break;case 27:t=Number(this.reader.u64())}let r={};for(let e=0;e<t;e++){let e=this.key();if("__proto__"===e)throw 6;let t=this.val();r[e]=t}return r}if(31===e)return this.readObjIndef();throw 1}readObjRaw(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.val();t[e]=r}return t}readObjIndef(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.val();e[t]=r}return this.reader.x++,e}key(){let e=this.reader.u8();if(3!=e>>5)return String(this.readAnyRaw(e));let t=this.readStrLen(31&e);if(t>31)return this.reader.utf8(t);let r=this.keyDecoder.decode(this.reader.uint8,this.reader.x,t);return this.reader.skip(t),r}readTag(e){if(e<=23)return this.readTagRaw(e);switch(e){case 24:return this.readTagRaw(this.reader.u8());case 25:return this.readTagRaw(this.reader.u16());case 26:return this.readTagRaw(this.reader.u32());case 27:return this.readTagRaw(Number(this.reader.u64()));default:throw 1}}readTagRaw(e){return new o.JsonPackExtension(e,this.val())}readTkn(e){switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;case 24:return new s.JsonPackValue(this.reader.u8());case 25:return this.f16();case 26:return this.reader.f32();case 27:return this.reader.f64()}if(e<=23)return new s.JsonPackValue(e);throw 1}f16(){return(0,i.decodeF16)(this.reader.u16())}}},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderDag=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js");class o extends i.CborDecoder{readTagRaw(e){let t=this.val();return 42===e?new n.JsonPackExtension(e,t):t}}t.CborDecoderDag=o},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoder=void 0;let n=r("../../node_modules/@jsonjoy.com/util/lib/buffers/isFloat32.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),o=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),s=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class a extends o.CborEncoderFast{writeUnknown(e){this.writeNull()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);switch(e.constructor){case Object:return this.writeObj(e);case Array:return this.writeArr(e);case Uint8Array:return this.writeBin(e);case Map:return this.writeMap(e);case i.JsonPackExtension:return this.writeTag(e.tag,e.val);case s.JsonPackValue:let t=e.val;return this.writer.buf(t,t.length);default:if(e instanceof Uint8Array)return this.writeBin(e);if(Array.isArray(e))return this.writeArr(e);if(e instanceof Map)return this.writeMap(e);return this.writeUnknown(e)}case"undefined":return this.writeUndef();case"bigint":return this.writeBigInt(e);default:return this.writeUnknown(e)}}writeFloat(e){(0,n.isFloat32)(e)?this.writer.u8f32(250,e):this.writer.u8f64(251,e)}writeMap(e){this.writeMapHdr(e.size),e.forEach((e,t)=>{this.writeAny(t),this.writeAny(e)})}writeUndef(){this.writer.u8(247)}}t.CborEncoder=a},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderDag=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js");class i extends n.CborEncoderStable{writeUndef(){this.writeNull()}writeFloat(e){if(e!=e||!Number.isFinite(e))return this.writeNull();this.writer.u8f64(251,e)}writeTag(e,t){42===e&&this.writeTagHdr(e),this.writeAny(t)}}t.CborEncoderDag=i},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderFast=void 0;let n=r("../../node_modules/@jsonjoy.com/util/lib/buffers/Writer.js"),i=Number.isSafeInteger;t.CborEncoderFast=class{constructor(e=new n.Writer){this.writer=e}encode(e){return this.writeAny(e),this.writer.flush()}encodeToSlice(e){return this.writeAny(e),this.writer.flushSlice()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);if(e.constructor===Array)return this.writeArr(e);return this.writeObj(e)}}writeCbor(){this.writer.u8u16(217,55799)}writeEnd(){this.writer.u8(255)}writeNull(){this.writer.u8(246)}writeBoolean(e){e?this.writer.u8(245):this.writer.u8(244)}writeNumber(e){i(e)?this.writeInteger(e):"bigint"==typeof e?this.writeBigInt(e):this.writeFloat(e)}writeBigInt(e){e>=0?this.writeBigUint(e):this.writeBigSint(e)}writeBigUint(e){if(e<=Number.MAX_SAFE_INTEGER)return this.writeUInteger(Number(e));this.writer.u8u64(27,e)}writeBigSint(e){if(e>=Number.MIN_SAFE_INTEGER)return this.encodeNint(Number(e));let t=-BigInt(1)-e;this.writer.u8u64(59,t)}writeInteger(e){e>=0?this.writeUInteger(e):this.encodeNint(e)}writeUInteger(e){let t=this.writer;t.ensureCapacity(9);let r=t.uint8,n=t.x;e<=23?r[n++]=0+e:e<=255?(r[n++]=24,r[n++]=e):e<=65535?(r[n++]=25,t.view.setUint16(n,e),n+=2):e<=0xffffffff?(r[n++]=26,t.view.setUint32(n,e),n+=4):(r[n++]=27,t.view.setBigUint64(n,BigInt(e)),n+=8),t.x=n}encodeNumber(e){this.writeNumber(e)}encodeInteger(e){this.writeInteger(e)}encodeUint(e){this.writeUInteger(e)}encodeNint(e){let t=-1-e,r=this.writer;r.ensureCapacity(9);let n=r.uint8,i=r.x;t<24?n[i++]=32+t:t<=255?(n[i++]=56,n[i++]=t):t<=65535?(n[i++]=57,r.view.setUint16(i,t),i+=2):t<=0xffffffff?(n[i++]=58,r.view.setUint32(i,t),i+=4):(n[i++]=59,r.view.setBigUint64(i,BigInt(t)),i+=8),r.x=i}writeFloat(e){this.writer.u8f64(251,e)}writeBin(e){let t=e.length;this.writeBinHdr(t),this.writer.buf(e,t)}writeBinHdr(e){let t=this.writer;e<=23?t.u8(64+e):e<=255?t.u16(22528+e):e<=65535?t.u8u16(89,e):e<=0xffffffff?t.u8u32(90,e):t.u8u64(91,e)}writeStr(e){let t=this.writer,r=4*e.length;t.ensureCapacity(5+r);let n=t.uint8,i=t.x;r<=23?t.x++:r<=255?(n[t.x++]=120,i=t.x,t.x++):r<=65535?(n[t.x++]=121,i=t.x,t.x+=2):(n[t.x++]=122,i=t.x,t.x+=4);let o=t.utf8(e);r<=23?n[i]=96+o:r<=255?n[i]=o:r<=65535?t.view.setUint16(i,o):t.view.setUint32(i,o)}writeStrHdr(e){let t=this.writer;e<=23?t.u8(96+e):e<=255?t.u16(30720+e):e<=65535?t.u8u16(121,e):t.u8u32(122,e)}writeAsciiStr(e){this.writeStrHdr(e.length),this.writer.ascii(e)}writeArr(e){let t=e.length;this.writeArrHdr(t);for(let r=0;r<t;r++)this.writeAny(e[r])}writeArrHdr(e){let t=this.writer;e<=23?t.u8(128+e):e<=255?t.u16(38912+e):e<=65535?t.u8u16(153,e):e<=0xffffffff?t.u8u32(154,e):t.u8u64(155,e)}writeObj(e){let t=Object.keys(e),r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeObjHdr(e){let t=this.writer;e<=23?t.u8(160+e):e<=255?t.u16(47104+e):e<=65535?t.u8u16(185,e):e<=0xffffffff?t.u8u32(186,e):t.u8u64(187,e)}writeMapHdr(e){this.writeObjHdr(e)}writeStartMap(){this.writer.u8(191)}writeTag(e,t){this.writeTagHdr(e),this.writeAny(t)}writeTagHdr(e){let t=this.writer;e<=23?t.u8(192+e):e<=255?t.u16(55296+e):e<=65535?t.u8u16(217,e):e<=0xffffffff?t.u8u32(218,e):t.u8u64(219,e)}writeTkn(e){let t=this.writer;e<=23?t.u8(224+e):e<=255&&t.u16(63488+e)}writeStartStr(){this.writer.u8(127)}writeStrChunk(e){throw Error("Not implemented")}writeEndStr(){throw Error("Not implemented")}writeStartBin(){this.writer.u8(95)}writeBinChunk(e){throw Error("Not implemented")}writeEndBin(){throw Error("Not implemented")}writeStartArr(){this.writer.u8(159)}writeArrChunk(e){throw Error("Not implemented")}writeEndArr(){this.writer.u8(255)}writeStartObj(){this.writer.u8(191)}writeObjChunk(e,t){throw Error("Not implemented")}writeEndObj(){this.writer.u8(255)}}},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderStable=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),i=r("../../node_modules/@jsonjoy.com/util/lib/sort/insertion2.js"),o=r("../../node_modules/@jsonjoy.com/util/lib/objKeyCmp.js"),s=e=>e<=23?1:e<=255?2:e<=65535?3:5;class a extends n.CborEncoder{writeObj(e){let t=Object.keys(e);(0,i.sort)(t,o.objKeyCmp);let r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeStr(e){let t=this.writer,r=e.length,n=4*r;t.ensureCapacity(5+n);let i=s(r),o=t.x,a=o+i;t.x=a;let u=t.utf8(e),f=t.uint8,l=s(u);switch(l!==i&&f.copyWithin(a+(l-i),a,a+u),l){case 1:f[o]=96+u;break;case 2:f[o]=120,f[o+1]=u;break;case 3:f[o]=121,t.view.setUint16(o+1,u);break;case 5:f[o]=122,t.view.setUint32(o+1,u)}t.x=o+l+u}writeUndef(){this.writeNull()}}t.CborEncoderStable=a},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r("../../node_modules/tslib/tslib.es6.mjs");n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js"),t)},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../../node_modules/@jsonjoy.com/util/lib/buffers/Reader.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Reader=void 0;let n=r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/index.js");t.Reader=class{constructor(){this.uint8=new Uint8Array([]),this.view=new DataView(this.uint8.buffer),this.x=0}reset(e){this.x=0,this.uint8=e,this.view=new DataView(e.buffer,e.byteOffset,e.length)}peak(){return this.view.getUint8(this.x)}skip(e){this.x+=e}buf(e){let t=this.x+e,r=this.uint8.subarray(this.x,t);return this.x=t,r}u8(){return this.uint8[this.x++]}i8(){return this.view.getInt8(this.x++)}u16(){let e=this.x,t=(this.uint8[e++]<<8)+this.uint8[e++];return this.x=e,t}i16(){let e=this.view.getInt16(this.x);return this.x+=2,e}u32(){let e=this.view.getUint32(this.x);return this.x+=4,e}i32(){let e=this.view.getInt32(this.x);return this.x+=4,e}u64(){let e=this.view.getBigUint64(this.x);return this.x+=8,e}i64(){let e=this.view.getBigInt64(this.x);return this.x+=8,e}f32(){let e=this.x;return this.x+=4,this.view.getFloat32(e)}f64(){let e=this.x;return this.x+=8,this.view.getFloat64(e)}utf8(e){let t=this.x;return this.x+=e,(0,n.decodeUtf8)(this.uint8,t,e)}ascii(e){let t=this.uint8,r="",n=this.x+e;for(let e=this.x;e<n;e++)r+=String.fromCharCode(t[e]);return this.x=n,r}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/Slice.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Slice=void 0,t.Slice=class{constructor(e,t,r,n){this.uint8=e,this.view=t,this.start=r,this.end=n}subarray(){return this.uint8.subarray(this.start,this.end)}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/Writer.js":function(e,t,r){"use strict";var n=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Writer=void 0;let i=r("../../node_modules/@jsonjoy.com/util/lib/buffers/Slice.js"),o=new DataView(new Uint8Array([]).buffer),s="function"==typeof n,a=s?n.prototype.utf8Write:null,u=s?n.from:null,f="undefined"!=typeof TextEncoder?new TextEncoder:null;t.Writer=class{constructor(e=65536){this.allocSize=e,this.view=o,this.x0=0,this.x=0,this.uint8=new Uint8Array(e),this.size=e,this.view=new DataView(this.uint8.buffer)}grow(e){let t=this.x0,r=this.x,n=this.uint8,i=new Uint8Array(e),o=new DataView(i.buffer),s=n.subarray(t,r);i.set(s,0),this.x=r-t,this.x0=0,this.uint8=i,this.size=e,this.view=o}ensureCapacity(e){let t=this.size,r=t-this.x;if(r<e){let n=t-this.x0+(e-r);this.grow(n<=this.allocSize?this.allocSize:2*n)}}move(e){this.ensureCapacity(e),this.x+=e}reset(){this.x0=this.x}newBuffer(e){let t=this.uint8=new Uint8Array(e);this.size=e,this.view=new DataView(t.buffer),this.x=this.x0=0}flush(){let e=this.uint8.subarray(this.x0,this.x);return this.x0=this.x,e}flushSlice(){let e=new i.Slice(this.uint8,this.view,this.x0,this.x);return this.x0=this.x,e}u8(e){this.ensureCapacity(1),this.uint8[this.x++]=e}u16(e){this.ensureCapacity(2),this.view.setUint16(this.x,e),this.x+=2}u32(e){this.ensureCapacity(4),this.view.setUint32(this.x,e),this.x+=4}i32(e){this.ensureCapacity(4),this.view.setInt32(this.x,e),this.x+=4}u64(e){this.ensureCapacity(8),this.view.setBigUint64(this.x,BigInt(e)),this.x+=8}f64(e){this.ensureCapacity(8),this.view.setFloat64(this.x,e),this.x+=8}u8u16(e,t){this.ensureCapacity(3);let r=this.x;this.uint8[r++]=e,this.uint8[r++]=t>>>8,this.uint8[r++]=255&t,this.x=r}u8u32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setUint32(r,t),this.x=r+4}u8u64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setBigUint64(r,BigInt(t)),this.x=r+8}u8f32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setFloat32(r,t),this.x=r+4}u8f64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setFloat64(r,t),this.x=r+8}buf(e,t){this.ensureCapacity(t);let r=this.x;this.uint8.set(e,r),this.x=r+t}utf8(e){let t=4*e.length;if(t<168)return this.utf8Native(e);if(a){let r=a.call(this.uint8,e,this.x,t);return this.x+=r,r}if(u){let r=this.uint8,n=r.byteOffset+this.x,i=u(r.buffer).subarray(n,n+t).write(e,0,t,"utf8");return this.x+=i,i}if(t>1024&&f){let r=f.encodeInto(e,this.uint8.subarray(this.x,this.x+t)).written;return this.x+=r,r}return this.utf8Native(e)}utf8Native(e){let t=e.length,r=this.uint8,n=this.x,i=0;for(;i<t;){let o=e.charCodeAt(i++);if((0xffffff80&o)==0){r[n++]=o;continue}if((0xfffff800&o)==0)r[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<t){let t=e.charCodeAt(i);(64512&t)==56320&&(i++,o=((1023&o)<<10)+(1023&t)+65536)}(0xffff0000&o)==0?r[n++]=o>>12&15|224:(r[n++]=o>>18&7|240,r[n++]=o>>12&63|128),r[n++]=o>>6&63|128}r[n++]=63&o|128}let o=n-this.x;return this.x=n,o}ascii(e){let t=e.length;this.ensureCapacity(t);let r=this.uint8,n=this.x,i=0;for(;i<t;)r[n++]=e.charCodeAt(i++);this.x=n}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/f16.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeF16=void 0;let r=Math.pow;t.decodeF16=e=>{let t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:r(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}},"../../node_modules/@jsonjoy.com/util/lib/buffers/isFloat32.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFloat32=void 0;let r=new DataView(new ArrayBuffer(4));t.isFloat32=e=>(r.setFloat32(0,e),e===r.getFloat32(0))},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/CachedUtf8Decoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CachedUtf8Decoder=void 0;let n=r("../../node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v10.js")),i=1+Math.round(0xfffffffe*Math.random());class o{constructor(e,t){this.bytes=e,this.value=t}}t.CachedUtf8Decoder=class{constructor(){this.caches=[];for(let e=0;e<31;e++)this.caches.push([])}get(e,t,r){let n=this.caches[r-1],i=n.length;e:for(let o=0;o<i;o++){let i=n[o],s=i.bytes;for(let n=0;n<r;n++)if(s[n]!==e[t+n])continue e;return i.value}return null}store(e,t){let r=this.caches[e.length-1],n=new o(e,t);if(r.length>=16)r[i^=i<<13,i^=i>>>17,((i^=i<<5)>>>0)%16+0]=n;else r.push(n)}decode(e,t,r){if(!r)return"";let i=this.get(e,t,r);if(null!==i)return i;let o=(0,n.default)(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,o),o}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeAscii.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeAsciiMax15=t.decodeAscii=void 0;let r=String.fromCharCode;t.decodeAscii=(e,t,n)=>{let i=[];for(let r=0;r<n;r++){let r=e[t++];if(128&r)return;i.push(r)}return r.apply(String,i)},t.decodeAsciiMax15=(e,t,n)=>{if(n<4)if(n<2)if(0===n)return"";else{let n=e[t++];if((128&n)>1){t-=1;return}return r(n)}else{let i=e[t++],o=e[t++];if((128&i)>0||(128&o)>0){t-=2;return}if(n<3)return r(i,o);let s=e[t++];if((128&s)>0){t-=3;return}return r(i,o,s)}{let i=e[t++],o=e[t++],s=e[t++],a=e[t++];if((128&i)>0||(128&o)>0||(128&s)>0||(128&a)>0){t-=4;return}if(n<6)if(4===n)return r(i,o,s,a);else{let n=e[t++];if((128&n)>0){t-=5;return}return r(i,o,s,a,n)}if(n<8){let u=e[t++],f=e[t++];if((128&u)>0||(128&f)>0){t-=6;return}if(n<7)return r(i,o,s,a,u,f);let l=e[t++];if((128&l)>0){t-=7;return}return r(i,o,s,a,u,f,l)}{let u=e[t++],f=e[t++],l=e[t++],c=e[t++];if((128&u)>0||(128&f)>0||(128&l)>0||(128&c)>0){t-=8;return}if(n<10)if(8===n)return r(i,o,s,a,u,f,l,c);else{let n=e[t++];if((128&n)>0){t-=9;return}return r(i,o,s,a,u,f,l,c,n)}if(n<12){let h=e[t++],d=e[t++];if((128&h)>0||(128&d)>0){t-=10;return}if(n<11)return r(i,o,s,a,u,f,l,c,h,d);let p=e[t++];if((128&p)>0){t-=11;return}return r(i,o,s,a,u,f,l,c,h,d,p)}{let h=e[t++],d=e[t++],p=e[t++],y=e[t++];if((128&h)>0||(128&d)>0||(128&p)>0||(128&y)>0){t-=12;return}if(n<14)if(12===n)return r(i,o,s,a,u,f,l,c,h,d,p,y);else{let n=e[t++];if((128&n)>0){t-=13;return}return r(i,o,s,a,u,f,l,c,h,d,p,y,n)}{let w=e[t++],b=e[t++];if((128&w)>0||(128&b)>0){t-=14;return}if(n<15)return r(i,o,s,a,u,f,l,c,h,d,p,y,w,b);let g=e[t++];if((128&g)>0){t-=15;return}return r(i,o,s,a,u,f,l,c,h,d,p,y,w,b,g)}}}}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/index.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeUtf8=void 0,t.decodeUtf8=r("../../node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v16.js")).default},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v10.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s="";for(;i<o;){let t=e[i++];if((128&t)==0){s+=r(t);continue}let n=63&e[i++];if((224&t)==192){s+=r((31&t)<<6|n);continue}let o=63&e[i++];if((240&t)==224){s+=r((31&t)<<12|n<<6|o);continue}if((248&t)==240){let a=(7&t)<<18|n<<12|o<<6|63&e[i++];a>65535?s+=r((a-=65536)>>>10&1023|55296,a=56320|1023&a):s+=r(a)}else s+=r(t)}return s}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v16.js":function(e,t,r){"use strict";var n=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0});let i=r("../../node_modules/tslib/tslib.es6.mjs"),o=r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeAscii.js"),s=i.__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v18.js")),a=void 0!==n,u=a?n.prototype.utf8Slice:null,f=a?n.from:null,l=(e,t,r)=>(0,o.decodeAsciiMax15)(e,t,r)??(0,s.default)(e,t,r),c=(e,t,r)=>(0,o.decodeAscii)(e,t,r)??(0,s.default)(e,t,r),h=u?(e,t,r)=>u.call(e,t,t+r):f?(e,t,r)=>f(e).subarray(t,t+r).toString("utf8"):s.default;t.default=(e,t,r)=>r<16?l(e,t,r):r<32?c(e,t,r):h(e,t,r)},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v18.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s=[];for(;i<o;){let t=e[i++];if((128&t)!=0){let r=63&e[i++];if((224&t)==192)t=(31&t)<<6|r;else{let n=63&e[i++];if((240&t)==224)t=(31&t)<<12|r<<6|n;else if((248&t)==240){let o=(7&t)<<18|r<<12|n<<6|63&e[i++];if(o>65535){let e=(o-=65536)>>>10&1023|55296;t=56320|1023&o,s.push(e)}else t=o}}}s.push(t)}return r.apply(String,s)}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/sharedCachedUtf8Decoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=new(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/CachedUtf8Decoder.js")).CachedUtf8Decoder},"../../node_modules/@jsonjoy.com/util/lib/objKeyCmp.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.objKeyCmp=void 0,t.objKeyCmp=(e,t)=>{let r=e.length,n=t.length;return r===n?e>t?1:-1:r-n}},"../../node_modules/@jsonjoy.com/util/lib/sort/insertion2.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sort=void 0,t.sort=(e,t)=>{let r=e.length;for(let n=1;n<r;n++){let r=e[n],i=n;for(;0!==i&&t(e[i-1],r)>0;)e[i]=e[i-1],i--;e[i]=r}return e}},"../../node_modules/base64-js/index.js":function(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=u(e),s=o[0],a=o[1],f=new i((s+a)*3/4-a),l=0,c=a>0?s-4:s;for(r=0;r<c;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],f[l++]=t>>16&255,f[l++]=t>>8&255,f[l++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[l++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[l++]=t>>8&255,f[l++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(function(e,t,n){for(var i,o=[],s=t;s<n;s+=3)i=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,s,s+16383>a?a:s+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},"../../node_modules/buffer/index.js":function(e,t,r){"use strict";var n=r("../../node_modules/base64-js/index.js"),i=r("../../node_modules/buffer/node_modules/ieee754/index.js"),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|p(n,i),u=s(o),f=u.write(n,i);return f!==o&&(u=u.slice(0,f)),u}if(ArrayBuffer.isView(e)){var l=e;if(I(l,Uint8Array)){var y=new Uint8Array(l);return h(y.buffer,y.byteOffset,y.byteLength)}return c(l)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var w=e.valueOf&&e.valueOf();if(null!=w&&w!==e)return a.from(w,t,r);var b=function(e){if(a.isBuffer(e)){var t=0|d(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(b)return b;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),s(e<0?0:0|d(e))}function c(e){for(var t=e.length<0?0:0|d(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return S(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,r){var i,o,s,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=U[e[o]];return i}(this,t,r);case"utf8":case"utf-8":return m(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,o=t,s=r,0===o&&s===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(o,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function w(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){var o;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return g(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=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,u/=2,r/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(f(e,o)===f(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else -1!==l&&(o-=o-l),l=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,h=0;h<u;h++)if(f(e,o+h)!==f(t,h)){c=!1;break}if(c)return o}return -1}function m(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,f=e[i],l=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:(192&(o=e[i+1]))==128&&(u=(31&f)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],(192&o)==128&&(192&s)==128&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}var h=n,d=h.length;if(d<=4096)return String.fromCharCode.apply(String,h);for(var p="",y=0;y<d;)p+=String.fromCharCode.apply(String,h.slice(y,y+=4096));return p}function v(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,o){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,o){return t*=1,r>>>=0,o||j(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,o){return t*=1,r>>>=0,o||j(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=a,t.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(f(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return l(e)},a.allocUnsafeSlow=function(e){return l(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(I(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),I(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,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)},a.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}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(I(o,Uint8Array))i+o.length>n.length?a.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(a.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)w(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?m(this,0,e):y.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(I(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw 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 RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,u=Math.min(o,s),f=this.slice(n,i),l=e.slice(t,r),c=0;c<u;++c)if(f[c]!==l[c]){o=f[c],s=l[c];break}return o<s?-1:+(s<o)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},a.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))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,s,a,u,f,l,c,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var d=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a,u=parseInt(t.substr(2*s,2),16);if((a=u)!=a)break;e[r+s]=u}return s}(this,e,t,r);case"utf8":case"utf-8":return i=t,o=r,C(A(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return s=t,a=r,C(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,s,a);case"base64":return u=t,f=r,C(S(e),this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l=t,c=r,C(function(e,t){for(var r,n,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(e,this.length-l),this,l,c);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw 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||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},a.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 TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;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{var s=a.isBuffer(e)?e:a.from(e,n),u=s.length;if(0===u)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%u]}return this};var E=/[^+/0-9A-Za-z-_]/g;function A(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319||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=(i-55296<<10|r-56320)+65536}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){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function S(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(E,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function C(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var U=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},"../../node_modules/buffer/node_modules/ieee754/index.js":function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,f=u>>1,l=-7,c=r?i-1:0,h=r?-1:1,d=e[t+c];for(c+=h,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+c],c+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+c],c+=h,l-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,f=8*o-i-1,l=(1<<f)-1,c=l>>1,h=5960464477539062e-23*(23===i),d=n?0:o-1,p=n?1:-1,y=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+c>=1?t+=h/u:t+=h*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;e[r+d]=255&s,d+=p,s/=256,f-=8);e[r+d-p]|=128*y}},"../../node_modules/tslib/tslib.es6.mjs":function(e,t,r){"use strict";r.r(t),r.d(t,{__addDisposableResource:()=>T,__assign:()=>o,__asyncDelegator:()=>E,__asyncGenerator:()=>_,__asyncValues:()=>A,__await:()=>k,__awaiter:()=>p,__classPrivateFieldGet:()=>B,__classPrivateFieldIn:()=>L,__classPrivateFieldSet:()=>P,__createBinding:()=>w,__decorate:()=>a,__disposeResources:()=>R,__esDecorate:()=>f,__exportStar:()=>b,__extends:()=>i,__generator:()=>y,__importDefault:()=>O,__importStar:()=>U,__makeTemplateObject:()=>S,__metadata:()=>d,__param:()=>u,__propKey:()=>c,__read:()=>m,__rest:()=>s,__rewriteRelativeImportExtension:()=>D,__runInitializers:()=>l,__setFunctionName:()=>h,__spread:()=>v,__spreadArray:()=>j,__spreadArrays:()=>x,__values:()=>g,default:()=>N});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function a(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}function u(e,t){return function(r,n){t(r,n,e)}}function f(e,t,r,n,i,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,u=n.kind,f="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),h=!1,d=r.length-1;d>=0;d--){var p={};for(var y in n)p[y]="access"===y?{}:n[y];for(var y in n.access)p.access[y]=n.access[y];p.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var w=(0,r[d])("accessor"===u?{get:c.get,set:c.set}:c[f],p);if("accessor"===u){if(void 0===w)continue;if(null===w||"object"!=typeof w)throw TypeError("Object expected");(a=s(w.get))&&(c.get=a),(a=s(w.set))&&(c.set=a),(a=s(w.init))&&i.unshift(a)}else(a=s(w))&&("field"===u?i.unshift(a):c[f]=a)}l&&Object.defineProperty(l,n.name,c),h=!0}function l(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}function c(e){return"symbol"==typeof e?e:"".concat(e)}function h(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function y(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){var f=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&f[0]?n.return:f[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,f[1])).done)return i;switch(n=0,i&&(f=[2&f[0],i.value]),f[0]){case 0:case 1:i=f;break;case 4:return o.label++,{value:f[1],done:!1};case 5:o.label++,n=f[1],f=[0];continue;case 7:f=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===f[0]||2===f[0])){o=0;continue}if(3===f[0]&&(!i||f[1]>i[0]&&f[1]<i[3])){o.label=f[1];break}if(6===f[0]&&o.label<i[1]){o.label=i[1],i=f;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(f);break}i[2]&&o.ops.pop(),o.trys.pop();continue}f=t.call(e,o)}catch(e){f=[6,e],n=0}finally{r=i=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}}var w=Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function b(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||w(t,e,r)}function g(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 TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}function x(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n}function j(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function _(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,f)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){o.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=i[e](t)).value instanceof k?Promise.resolve(r.value.v).then(u,f):l(o[0][2],r)}catch(e){l(o[0][3],e)}}function u(e){a("next",e)}function f(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function E(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:k(e[n](t)),done:!1}:i?i(t):t}:i}}function A(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){var o,s,a;o=n,s=i,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){o({value:e,done:a})},s)})}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var C=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},I=function(e){return(I=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function U(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=I(e),n=0;n<r.length;n++)"default"!==r[n]&&w(t,e,r[n]);return C(t,e),t}function O(e){return e&&e.__esModule?e:{default:e}}function B(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function P(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function L(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function T(e,t,r){if(null!=t){var n,i;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(i=n)}if("function"!=typeof n)throw TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var M="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function R(e){function t(t){e.error=e.hasError?new M(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function i(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(i);if(r.dispose){var o=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(o).then(i,function(e){return t(e),i()})}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function D(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,i,o){return r?t?".jsx":".js":!n||i&&o?n+i+"."+o.toLowerCase()+"js":e}):e}let N={__extends:i,__assign:o,__rest:s,__decorate:a,__param:u,__esDecorate:f,__runInitializers:l,__propKey:c,__setFunctionName:h,__metadata:d,__awaiter:p,__generator:y,__createBinding:w,__exportStar:b,__values:g,__read:m,__spread:v,__spreadArrays:x,__spreadArray:j,__await:k,__asyncGenerator:_,__asyncDelegator:E,__asyncValues:A,__makeTemplateObject:S,__importStar:U,__importDefault:O,__classPrivateFieldGet:B,__classPrivateFieldSet:P,__classPrivateFieldIn:L,__addDisposableResource:T,__disposeResources:R,__rewriteRelativeImportExtension:D}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";let e;r.r(n),r.d(n,{base64urlEncode:()=>f,sendInteraction:()=>e2,Deferred:()=>a,ReferralInteractionEncoder:()=>tf,getProductInformation:()=>e5,decompressJsonFromB64:()=>ea,getSupportedLocale:()=>eE,openSso:()=>e6,productTypes:()=>eC,PurchaseInteractionEncoder:()=>t_,FrakRpcError:()=>t,base64urlDecode:()=>l,referralInteraction:()=>td,productTypesMask:()=>eI,interactionTypes:()=>eU,processReferral:()=>tl,PressInteractionEncoder:()=>tp,sendTransaction:()=>e9,WebShopInteractionEncoder:()=>tE,decompressJson:()=>es,compressJsonToB64:()=>er,hashAndCompressData:()=>ee,trackPurchaseStatus:()=>e3,watchWalletStatus:()=>eO,RpcErrorCodes:()=>s,setupClient:()=>eb,RetailInteractionEncoder:()=>tA,getCurrencyAmountKey:()=>eA,siweAuthenticate:()=>e7,getSupportedCurrency:()=>ew,decompressDataAndCheckHash:()=>eo,displayModal:()=>e1,FrakContextManager:()=>e_,locales:()=>ey,ClientNotFound:()=>o,baseIframeProps:()=>el,createIframe:()=>ec,modalBuilder:()=>te,compressJson:()=>et,displayEmbeddedWallet:()=>e8,createIFrameFrakClient:()=>ed,DebugInfoGatherer:()=>ef,formatAmount:()=>eS});class t extends Error{code;data;constructor(e,t,r){super(t),this.code=e,this.data=r}}class i extends t{constructor(e){super(s.internalError,e)}}class o extends t{constructor(){super(s.clientNotConnected,"Client not found")}}let s={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};class a{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}}var u=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js");function f(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function l(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0))}function c(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function h(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function d(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function p(e,t){h(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function y(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function w(e,t){return e<<32-t|e>>>t}let b=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function g(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}"function"==typeof Uint8Array.from([]).toHex&&Uint8Array.fromHex;function m(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),h(e),e}class v{clone(){return this._cloneInto()}}function x(e){let t=t=>e().update(m(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class j extends v{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=y(this.buffer)}update(e){d(this);let{view:t,buffer:r,blockLen:n}=this,i=(e=m(e)).length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){let t=y(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){d(this),p(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(0xffffffff),s=Number(r>>i&o),a=Number(r&o),u=4*!!n,f=4*!n;e.setUint32(t+u,s,n),e.setUint32(t+f,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);let s=y(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let u=a/4,f=this.get();if(u>f.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)s.setUint32(4*e,f[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}let k=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),_=new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),E=new Uint32Array(64);class A extends j{constructor(e=32){super(64,e,8,!1),this.A=0|_[0],this.B=0|_[1],this.C=0|_[2],this.D=0|_[3],this.E=0|_[4],this.F=0|_[5],this.G=0|_[6],this.H=0|_[7]}get(){let{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 r=0;r<16;r++,t+=4)E[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=E[e-15],r=E[e-2],n=w(t,7)^w(t,18)^t>>>3,i=w(r,17)^w(r,19)^r>>>10;E[e]=i+E[e-7]+n+E[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:f}=this;for(let e=0;e<64;e++){var l,c,h,d;let t=f+(w(s,6)^w(s,11)^w(s,25))+((l=s)&a^~l&u)+k[e]+E[e]|0,p=(w(r,2)^w(r,13)^w(r,22))+((c=r)&(h=n)^c&(d=i)^h&d)|0;f=u,u=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+p|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,u=u+this.G|0,f=f+this.H|0,this.set(r,n,i,o,s,a,u,f)}roundClean(){E.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let S=x(()=>new A);function C(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}let I="2.28.1",U={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${I}`};class O extends Error{constructor(e,t={}){let r=t.cause instanceof O?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof O&&t.cause.docsPath||t.docsPath,i=U.getDocsUrl?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...U.version?[`Version: ${U.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=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=I}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}class B extends O{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 P extends O{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 L(e,{dir:t,size:r=32}={}){return"string"==typeof e?T(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new P({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let i=0;i<r;i++){let o="right"===t;n[o?i:r-i-1]=e[o?i:e.length-i-1]}return n}(e,{dir:t,size:r})}function T(e,{dir:t,size:r=32}={}){if(null===r)return e;let n=e.replace("0x","");if(n.length>2*r)throw new P({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}class M extends O{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 R extends O{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function D(e){return C(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function N(e,{size:t}){if(D(e)>t)throw new R({givenSize:D(e),maxSize:t})}let z=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function $(e,t={}){return"number"==typeof e||"bigint"==typeof e?V(e,t):"string"==typeof e?J(e,t):"boolean"==typeof e?F(e,t):H(e,t)}function F(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(N(r,{size:t.size}),L(r,{size:t.size})):r}function H(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=z[e[t]];let n=`0x${r}`;return"number"==typeof t.size?(N(n,{size:t.size}),L(n,{dir:"right",size:t.size})):n}function V(e,t={}){let r,{signed:n,size:i}=t,o=BigInt(e);i?r=n?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let s="bigint"==typeof r&&n?-r-1n:0;if(r&&o>r||o<s){let t="bigint"==typeof e?"n":"";throw new M({max:r?`${r}${t}`:void 0,min:`${s}${t}`,signed:n,size:i,value:`${e}${t}`})}let a=`0x${(n&&o<0?(1n<<BigInt(8*i))+BigInt(o):o).toString(16)}`;return i?L(a,{size:i}):a}let W=new TextEncoder;function J(e,t={}){return H(W.encode(e),t)}let q=new TextEncoder;function G(e,t={}){return"number"==typeof e||"bigint"==typeof e?Y(V(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(N(r,{size:t.size}),L(r,{size:t.size})):r}(e,t):C(e)?Y(e,t):Z(e,t)}let K={zero:48,nine:57,A:65,F:70,a:97,f:102};function X(e){return e>=K.zero&&e<=K.nine?e-K.zero:e>=K.A&&e<=K.F?e-(K.A-10):e>=K.a&&e<=K.f?e-(K.a-10):void 0}function Y(e,t={}){let r=e;t.size&&(N(r,{size:t.size}),r=L(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let r=X(n.charCodeAt(t++)),i=X(n.charCodeAt(t++));if(void 0===r||void 0===i)throw new O(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);o[e]=16*r+i}return o}function Z(e,t={}){let r=q.encode(e);return"number"==typeof t.size?(N(r,{size:t.size}),L(r,{dir:"right",size:t.size})):r}let Q=new u.CborEncoder;function ee(e){let t={...e,validationHash:en(e)};return Q.encode(t)}function et(e){return Q.encode(e)}function er(e){return f(et(e))}function en(e){var t,r;return $(S(C(t=Q.encode(e),{strict:!1})?G(t):t))}let ei=new u.CborDecoder;function eo(e){if(!e.length)throw new t(s.corruptedResponse,"Missing compressed data");let r=es(e);if(!r)throw new t(s.corruptedResponse,"Invalid compressed data");if(!r?.validationHash)throw new t(s.corruptedResponse,"Missing validation hash");let{validationHash:n,...i}=r;if(en(i)!==r.validationHash)throw new t(s.corruptedResponse,"Invalid data validation hash");return r}function es(e){try{return ei.decode(e)}catch(t){return console.error("Invalid compressed data",{e:t,data:e}),null}}function ea(e){return es(l(e))}let eu="nexus-wallet-backup";class ef{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e){this.lastResponse={event:e.data,origin:e.origin,timestamp:Date.now()}}setLastRequest(e,t){this.lastRequest={event:e,target:t,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn("Failed to encode debug data",e),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+("complete"===this.iframe.contentDocument.readyState):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let r=this.getIframeStatus(),n=this.getNavigatorInfo(),i="Unknown";return e instanceof t?i=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?i=e.message:"string"==typeof e&&(i=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:n?this.base64Encode(n):"no-navigator",iframeStatus:r?this.base64Encode(r):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:i}}static empty(){return new ef}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FrakSDK=t():e.FrakSDK=t()}(globalThis,()=>(()=>{var e={"../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackExtension=void 0,t.JsonPackExtension=class{constructor(e,t){this.tag=e,this.val=t}}},"../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackValue=void 0,t.JsonPackValue=class{constructor(e){this.val=e}}},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoder=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class o extends n.CborDecoderBase{readAsMap(){let e=this.reader.u8();if(e>>5==5)return this.readMap(31&e);throw 0}readMap(e){let t=this.readMinorLen(e);return t>=0?this.readMapRaw(t):this.readMapIndef()}readMapRaw(e){let t=new Map;for(let r=0;r<e;r++){let e=this.val(),r=this.val();t.set(e,r)}return t}readMapIndef(){let e=new Map;for(;255!==this.reader.peak();){let t=this.val();if(255===this.reader.peak())throw 7;let r=this.val();e.set(t,r)}return this.reader.x++,e}skipN(e){for(let t=0;t<e;t++)this.skipAny()}skipAny(){this.skipAnyRaw(this.reader.u8())}skipAnyRaw(e){let t=31&e;switch(e>>5){case 0:case 1:this.skipUNint(t);break;case 2:this.skipBin(t);break;case 3:this.skipStr(t);break;case 4:this.skipArr(t);break;case 5:this.skipObj(t);break;case 7:this.skipTkn(t);break;case 6:this.skipTag(t)}}skipMinorLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}skipUNint(e){if(!(e<=23))switch(e){case 24:return this.reader.skip(1);case 25:return this.reader.skip(2);case 26:return this.reader.skip(4);case 27:return this.reader.skip(8);default:throw 1}}skipBin(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipBinChunk();this.reader.x++}}skipBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;this.skipBin(t)}skipStr(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipStrChunk();this.reader.x++}}skipStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;this.skipStr(t)}skipArr(e){let t=this.skipMinorLen(e);if(t>=0)this.skipN(t);else{for(;255!==this.reader.peak();)this.skipAny();this.reader.x++}}skipObj(e){let t=this.readMinorLen(e);if(t>=0)return this.skipN(2*t);for(;255!==this.reader.peak();){if(this.skipAny(),255===this.reader.peak())throw 7;this.skipAny()}this.reader.x++}skipTag(e){if(0>this.skipMinorLen(e))throw 1;this.skipAny()}skipTkn(e){switch(e){case 24:this.reader.skip(1);return;case 25:this.reader.skip(2);return;case 26:this.reader.skip(4);return;case 27:this.reader.skip(8);return}if(!(e<=23))throw 1}validate(e,t=0,r=e.length){if(this.reader.reset(e),this.reader.x=t,this.skipAny(),this.reader.x-t!==r)throw 8}decodeLevel(e){return this.reader.reset(e),this.readLevel()}readLevel(){let e=this.reader.u8(),t=e>>5,r=31&e;switch(t){case 4:return this.readArrLevel(r);case 5:return this.readObjLevel(r);default:return super.readAnyRaw(e)}}readPrimitiveOrVal(){switch(this.reader.peak()>>5){case 4:case 5:return this.readAsValue();default:return this.val()}}readAsValue(){let e=this.reader,t=e.x;this.skipAny();let r=e.x;return new i.JsonPackValue(e.uint8.subarray(t,r))}readObjLevel(e){let t=this.readMinorLen(e);return t>=0?this.readObjRawLevel(t):this.readObjIndefLevel()}readObjRawLevel(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.readPrimitiveOrVal();t[e]=r}return t}readObjIndefLevel(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.readPrimitiveOrVal();e[t]=r}return this.reader.x++,e}readArrLevel(e){let t=this.readMinorLen(e);return t>=0?this.readArrRawLevel(t):this.readArrIndefLevel()}readArrRawLevel(e){let t=[];for(let r=0;r<e;r++)t.push(this.readPrimitiveOrVal());return t}readArrIndefLevel(){let e=[];for(;255!==this.reader.peak();)e.push(this.readPrimitiveOrVal());return this.reader.x++,e}readHdr(e){let t=this.reader.u8();if(t>>5!==e)throw 0;let r=31&t;if(r<24)return r;switch(r){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1}throw 1}readStrHdr(){return this.readHdr(3)}readObjHdr(){return this.readHdr(5)}readArrHdr(){return this.readHdr(4)}findKey(e){let t=this.readObjHdr();for(let r=0;r<t;r++){if(this.key()===e)return this;this.skipAny()}throw 9}findIndex(e){if(e>=this.readArrHdr())throw 10;for(let t=0;t<e;t++)this.skipAny();return this}find(e){for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r?this.findKey(r):this.findIndex(r)}return this}}t.CborDecoder=o},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderBase=void 0;let n=r("../../node_modules/tslib/tslib.es6.mjs"),i=r("../../node_modules/@jsonjoy.com/util/lib/buffers/f16.js"),o=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),s=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js"),a=r("../../node_modules/@jsonjoy.com/util/lib/buffers/Reader.js"),u=n.__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/sharedCachedUtf8Decoder.js"));t.CborDecoderBase=class{constructor(e=new a.Reader,t=u.default){this.reader=e,this.keyDecoder=t}read(e){return this.reader.reset(e),this.val()}decode(e){return this.reader.reset(e),this.val()}val(){let e=this.reader.u8(),t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readAnyRaw(e){let t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readMinorLen(e){if(e<24)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}readUint(e){if(e<25)return 24===e?this.reader.u8():e;{if(e<27)return 25===e?this.reader.u16():this.reader.u32();let t=this.reader.u64();return t>0x1fffffffffffff?t:Number(t)}}readNint(e){if(e<25)return 24===e?-this.reader.u8()-1:-e-1;{if(e<27)return 25===e?-this.reader.u16()-1:-this.reader.u32()-1;let t=this.reader.u64();return t>0x1ffffffffffffe?-t-BigInt(1):-Number(t)-1}}readBin(e){let t=this.reader;if(e<=23)return t.buf(e);switch(e){case 24:return t.buf(t.u8());case 25:return t.buf(t.u16());case 26:return t.buf(t.u32());case 27:return t.buf(Number(t.u64()));case 31:{let e=0,t=[];for(;255!==this.reader.peak();){let r=this.readBinChunk();e+=r.length,t.push(r)}this.reader.x++;let r=new Uint8Array(e),n=0,i=t.length;for(let e=0;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r}default:throw 1}}readBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;return this.readBin(t)}readAsStr(){let e=this.reader.u8();if(3!=e>>5)throw 11;return this.readStr(31&e)}readStr(e){let t=this.reader;if(e<=23)return t.utf8(e);switch(e){case 24:return t.utf8(t.u8());case 25:return t.utf8(t.u16());case 26:return t.utf8(t.u32());case 27:return t.utf8(Number(t.u64()));case 31:{let e="";for(;255!==t.peak();)e+=this.readStrChunk();return this.reader.x++,e}default:throw 1}}readStrLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());default:throw 1}}readStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;return this.readStr(t)}readArr(e){let t=this.readMinorLen(e);return t>=0?this.readArrRaw(t):this.readArrIndef()}readArrRaw(e){let t=[];for(let r=0;r<e;r++)t.push(this.val());return t}readArrIndef(){let e=[];for(;255!==this.reader.peak();)e.push(this.val());return this.reader.x++,e}readObj(e){if(e<28){let t=e;switch(e){case 24:t=this.reader.u8();break;case 25:t=this.reader.u16();break;case 26:t=this.reader.u32();break;case 27:t=Number(this.reader.u64())}let r={};for(let e=0;e<t;e++){let e=this.key();if("__proto__"===e)throw 6;let t=this.val();r[e]=t}return r}if(31===e)return this.readObjIndef();throw 1}readObjRaw(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.val();t[e]=r}return t}readObjIndef(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.val();e[t]=r}return this.reader.x++,e}key(){let e=this.reader.u8();if(3!=e>>5)return String(this.readAnyRaw(e));let t=this.readStrLen(31&e);if(t>31)return this.reader.utf8(t);let r=this.keyDecoder.decode(this.reader.uint8,this.reader.x,t);return this.reader.skip(t),r}readTag(e){if(e<=23)return this.readTagRaw(e);switch(e){case 24:return this.readTagRaw(this.reader.u8());case 25:return this.readTagRaw(this.reader.u16());case 26:return this.readTagRaw(this.reader.u32());case 27:return this.readTagRaw(Number(this.reader.u64()));default:throw 1}}readTagRaw(e){return new o.JsonPackExtension(e,this.val())}readTkn(e){switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;case 24:return new s.JsonPackValue(this.reader.u8());case 25:return this.f16();case 26:return this.reader.f32();case 27:return this.reader.f64()}if(e<=23)return new s.JsonPackValue(e);throw 1}f16(){return(0,i.decodeF16)(this.reader.u16())}}},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderDag=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js");class o extends i.CborDecoder{readTagRaw(e){let t=this.val();return 42===e?new n.JsonPackExtension(e,t):t}}t.CborDecoderDag=o},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoder=void 0;let n=r("../../node_modules/@jsonjoy.com/util/lib/buffers/isFloat32.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),o=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),s=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class a extends o.CborEncoderFast{writeUnknown(e){this.writeNull()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);switch(e.constructor){case Object:return this.writeObj(e);case Array:return this.writeArr(e);case Uint8Array:return this.writeBin(e);case Map:return this.writeMap(e);case i.JsonPackExtension:return this.writeTag(e.tag,e.val);case s.JsonPackValue:let t=e.val;return this.writer.buf(t,t.length);default:if(e instanceof Uint8Array)return this.writeBin(e);if(Array.isArray(e))return this.writeArr(e);if(e instanceof Map)return this.writeMap(e);return this.writeUnknown(e)}case"undefined":return this.writeUndef();case"bigint":return this.writeBigInt(e);default:return this.writeUnknown(e)}}writeFloat(e){(0,n.isFloat32)(e)?this.writer.u8f32(250,e):this.writer.u8f64(251,e)}writeMap(e){this.writeMapHdr(e.size),e.forEach((e,t)=>{this.writeAny(t),this.writeAny(e)})}writeUndef(){this.writer.u8(247)}}t.CborEncoder=a},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderDag=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js");class i extends n.CborEncoderStable{writeUndef(){this.writeNull()}writeFloat(e){if(e!=e||!Number.isFinite(e))return this.writeNull();this.writer.u8f64(251,e)}writeTag(e,t){42===e&&this.writeTagHdr(e),this.writeAny(t)}}t.CborEncoderDag=i},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderFast=void 0;let n=r("../../node_modules/@jsonjoy.com/util/lib/buffers/Writer.js"),i=Number.isSafeInteger;t.CborEncoderFast=class{constructor(e=new n.Writer){this.writer=e}encode(e){return this.writeAny(e),this.writer.flush()}encodeToSlice(e){return this.writeAny(e),this.writer.flushSlice()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);if(e.constructor===Array)return this.writeArr(e);return this.writeObj(e)}}writeCbor(){this.writer.u8u16(217,55799)}writeEnd(){this.writer.u8(255)}writeNull(){this.writer.u8(246)}writeBoolean(e){e?this.writer.u8(245):this.writer.u8(244)}writeNumber(e){i(e)?this.writeInteger(e):"bigint"==typeof e?this.writeBigInt(e):this.writeFloat(e)}writeBigInt(e){e>=0?this.writeBigUint(e):this.writeBigSint(e)}writeBigUint(e){if(e<=Number.MAX_SAFE_INTEGER)return this.writeUInteger(Number(e));this.writer.u8u64(27,e)}writeBigSint(e){if(e>=Number.MIN_SAFE_INTEGER)return this.encodeNint(Number(e));let t=-BigInt(1)-e;this.writer.u8u64(59,t)}writeInteger(e){e>=0?this.writeUInteger(e):this.encodeNint(e)}writeUInteger(e){let t=this.writer;t.ensureCapacity(9);let r=t.uint8,n=t.x;e<=23?r[n++]=0+e:e<=255?(r[n++]=24,r[n++]=e):e<=65535?(r[n++]=25,t.view.setUint16(n,e),n+=2):e<=0xffffffff?(r[n++]=26,t.view.setUint32(n,e),n+=4):(r[n++]=27,t.view.setBigUint64(n,BigInt(e)),n+=8),t.x=n}encodeNumber(e){this.writeNumber(e)}encodeInteger(e){this.writeInteger(e)}encodeUint(e){this.writeUInteger(e)}encodeNint(e){let t=-1-e,r=this.writer;r.ensureCapacity(9);let n=r.uint8,i=r.x;t<24?n[i++]=32+t:t<=255?(n[i++]=56,n[i++]=t):t<=65535?(n[i++]=57,r.view.setUint16(i,t),i+=2):t<=0xffffffff?(n[i++]=58,r.view.setUint32(i,t),i+=4):(n[i++]=59,r.view.setBigUint64(i,BigInt(t)),i+=8),r.x=i}writeFloat(e){this.writer.u8f64(251,e)}writeBin(e){let t=e.length;this.writeBinHdr(t),this.writer.buf(e,t)}writeBinHdr(e){let t=this.writer;e<=23?t.u8(64+e):e<=255?t.u16(22528+e):e<=65535?t.u8u16(89,e):e<=0xffffffff?t.u8u32(90,e):t.u8u64(91,e)}writeStr(e){let t=this.writer,r=4*e.length;t.ensureCapacity(5+r);let n=t.uint8,i=t.x;r<=23?t.x++:r<=255?(n[t.x++]=120,i=t.x,t.x++):r<=65535?(n[t.x++]=121,i=t.x,t.x+=2):(n[t.x++]=122,i=t.x,t.x+=4);let o=t.utf8(e);r<=23?n[i]=96+o:r<=255?n[i]=o:r<=65535?t.view.setUint16(i,o):t.view.setUint32(i,o)}writeStrHdr(e){let t=this.writer;e<=23?t.u8(96+e):e<=255?t.u16(30720+e):e<=65535?t.u8u16(121,e):t.u8u32(122,e)}writeAsciiStr(e){this.writeStrHdr(e.length),this.writer.ascii(e)}writeArr(e){let t=e.length;this.writeArrHdr(t);for(let r=0;r<t;r++)this.writeAny(e[r])}writeArrHdr(e){let t=this.writer;e<=23?t.u8(128+e):e<=255?t.u16(38912+e):e<=65535?t.u8u16(153,e):e<=0xffffffff?t.u8u32(154,e):t.u8u64(155,e)}writeObj(e){let t=Object.keys(e),r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeObjHdr(e){let t=this.writer;e<=23?t.u8(160+e):e<=255?t.u16(47104+e):e<=65535?t.u8u16(185,e):e<=0xffffffff?t.u8u32(186,e):t.u8u64(187,e)}writeMapHdr(e){this.writeObjHdr(e)}writeStartMap(){this.writer.u8(191)}writeTag(e,t){this.writeTagHdr(e),this.writeAny(t)}writeTagHdr(e){let t=this.writer;e<=23?t.u8(192+e):e<=255?t.u16(55296+e):e<=65535?t.u8u16(217,e):e<=0xffffffff?t.u8u32(218,e):t.u8u64(219,e)}writeTkn(e){let t=this.writer;e<=23?t.u8(224+e):e<=255&&t.u16(63488+e)}writeStartStr(){this.writer.u8(127)}writeStrChunk(e){throw Error("Not implemented")}writeEndStr(){throw Error("Not implemented")}writeStartBin(){this.writer.u8(95)}writeBinChunk(e){throw Error("Not implemented")}writeEndBin(){throw Error("Not implemented")}writeStartArr(){this.writer.u8(159)}writeArrChunk(e){throw Error("Not implemented")}writeEndArr(){this.writer.u8(255)}writeStartObj(){this.writer.u8(191)}writeObjChunk(e,t){throw Error("Not implemented")}writeEndObj(){this.writer.u8(255)}}},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderStable=void 0;let n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),i=r("../../node_modules/@jsonjoy.com/util/lib/sort/insertion2.js"),o=r("../../node_modules/@jsonjoy.com/util/lib/objKeyCmp.js"),s=e=>e<=23?1:e<=255?2:e<=65535?3:5;class a extends n.CborEncoder{writeObj(e){let t=Object.keys(e);(0,i.sort)(t,o.objKeyCmp);let r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeStr(e){let t=this.writer,r=e.length,n=4*r;t.ensureCapacity(5+n);let i=s(r),o=t.x,a=o+i;t.x=a;let u=t.utf8(e),c=t.uint8,f=s(u);switch(f!==i&&c.copyWithin(a+(f-i),a,a+u),f){case 1:c[o]=96+u;break;case 2:c[o]=120,c[o+1]=u;break;case 3:c[o]=121,t.view.setUint16(o+1,u);break;case 5:c[o]=122,t.view.setUint32(o+1,u)}t.x=o+f+u}writeUndef(){this.writeNull()}}t.CborEncoderStable=a},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r("../../node_modules/tslib/tslib.es6.mjs");n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js"),t)},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},"../../node_modules/@jsonjoy.com/util/lib/buffers/Reader.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Reader=void 0;let n=r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/index.js");t.Reader=class{constructor(){this.uint8=new Uint8Array([]),this.view=new DataView(this.uint8.buffer),this.x=0}reset(e){this.x=0,this.uint8=e,this.view=new DataView(e.buffer,e.byteOffset,e.length)}peak(){return this.view.getUint8(this.x)}skip(e){this.x+=e}buf(e){let t=this.x+e,r=this.uint8.subarray(this.x,t);return this.x=t,r}u8(){return this.uint8[this.x++]}i8(){return this.view.getInt8(this.x++)}u16(){let e=this.x,t=(this.uint8[e++]<<8)+this.uint8[e++];return this.x=e,t}i16(){let e=this.view.getInt16(this.x);return this.x+=2,e}u32(){let e=this.view.getUint32(this.x);return this.x+=4,e}i32(){let e=this.view.getInt32(this.x);return this.x+=4,e}u64(){let e=this.view.getBigUint64(this.x);return this.x+=8,e}i64(){let e=this.view.getBigInt64(this.x);return this.x+=8,e}f32(){let e=this.x;return this.x+=4,this.view.getFloat32(e)}f64(){let e=this.x;return this.x+=8,this.view.getFloat64(e)}utf8(e){let t=this.x;return this.x+=e,(0,n.decodeUtf8)(this.uint8,t,e)}ascii(e){let t=this.uint8,r="",n=this.x+e;for(let e=this.x;e<n;e++)r+=String.fromCharCode(t[e]);return this.x=n,r}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/Slice.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Slice=void 0,t.Slice=class{constructor(e,t,r,n){this.uint8=e,this.view=t,this.start=r,this.end=n}subarray(){return this.uint8.subarray(this.start,this.end)}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/Writer.js":function(e,t,r){"use strict";var n=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Writer=void 0;let i=r("../../node_modules/@jsonjoy.com/util/lib/buffers/Slice.js"),o=new DataView(new Uint8Array([]).buffer),s="function"==typeof n,a=s?n.prototype.utf8Write:null,u=s?n.from:null,c="undefined"!=typeof TextEncoder?new TextEncoder:null;t.Writer=class{constructor(e=65536){this.allocSize=e,this.view=o,this.x0=0,this.x=0,this.uint8=new Uint8Array(e),this.size=e,this.view=new DataView(this.uint8.buffer)}grow(e){let t=this.x0,r=this.x,n=this.uint8,i=new Uint8Array(e),o=new DataView(i.buffer),s=n.subarray(t,r);i.set(s,0),this.x=r-t,this.x0=0,this.uint8=i,this.size=e,this.view=o}ensureCapacity(e){let t=this.size,r=t-this.x;if(r<e){let n=t-this.x0+(e-r);this.grow(n<=this.allocSize?this.allocSize:2*n)}}move(e){this.ensureCapacity(e),this.x+=e}reset(){this.x0=this.x}newBuffer(e){let t=this.uint8=new Uint8Array(e);this.size=e,this.view=new DataView(t.buffer),this.x=this.x0=0}flush(){let e=this.uint8.subarray(this.x0,this.x);return this.x0=this.x,e}flushSlice(){let e=new i.Slice(this.uint8,this.view,this.x0,this.x);return this.x0=this.x,e}u8(e){this.ensureCapacity(1),this.uint8[this.x++]=e}u16(e){this.ensureCapacity(2),this.view.setUint16(this.x,e),this.x+=2}u32(e){this.ensureCapacity(4),this.view.setUint32(this.x,e),this.x+=4}i32(e){this.ensureCapacity(4),this.view.setInt32(this.x,e),this.x+=4}u64(e){this.ensureCapacity(8),this.view.setBigUint64(this.x,BigInt(e)),this.x+=8}f64(e){this.ensureCapacity(8),this.view.setFloat64(this.x,e),this.x+=8}u8u16(e,t){this.ensureCapacity(3);let r=this.x;this.uint8[r++]=e,this.uint8[r++]=t>>>8,this.uint8[r++]=255&t,this.x=r}u8u32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setUint32(r,t),this.x=r+4}u8u64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setBigUint64(r,BigInt(t)),this.x=r+8}u8f32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setFloat32(r,t),this.x=r+4}u8f64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setFloat64(r,t),this.x=r+8}buf(e,t){this.ensureCapacity(t);let r=this.x;this.uint8.set(e,r),this.x=r+t}utf8(e){let t=4*e.length;if(t<168)return this.utf8Native(e);if(a){let r=a.call(this.uint8,e,this.x,t);return this.x+=r,r}if(u){let r=this.uint8,n=r.byteOffset+this.x,i=u(r.buffer).subarray(n,n+t).write(e,0,t,"utf8");return this.x+=i,i}if(t>1024&&c){let r=c.encodeInto(e,this.uint8.subarray(this.x,this.x+t)).written;return this.x+=r,r}return this.utf8Native(e)}utf8Native(e){let t=e.length,r=this.uint8,n=this.x,i=0;for(;i<t;){let o=e.charCodeAt(i++);if((0xffffff80&o)==0){r[n++]=o;continue}if((0xfffff800&o)==0)r[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<t){let t=e.charCodeAt(i);(64512&t)==56320&&(i++,o=((1023&o)<<10)+(1023&t)+65536)}(0xffff0000&o)==0?r[n++]=o>>12&15|224:(r[n++]=o>>18&7|240,r[n++]=o>>12&63|128),r[n++]=o>>6&63|128}r[n++]=63&o|128}let o=n-this.x;return this.x=n,o}ascii(e){let t=e.length;this.ensureCapacity(t);let r=this.uint8,n=this.x,i=0;for(;i<t;)r[n++]=e.charCodeAt(i++);this.x=n}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/f16.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeF16=void 0;let r=Math.pow;t.decodeF16=e=>{let t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:r(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}},"../../node_modules/@jsonjoy.com/util/lib/buffers/isFloat32.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFloat32=void 0;let r=new DataView(new ArrayBuffer(4));t.isFloat32=e=>(r.setFloat32(0,e),e===r.getFloat32(0))},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/CachedUtf8Decoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CachedUtf8Decoder=void 0;let n=r("../../node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v10.js")),i=1+Math.round(0xfffffffe*Math.random());class o{constructor(e,t){this.bytes=e,this.value=t}}t.CachedUtf8Decoder=class{constructor(){this.caches=[];for(let e=0;e<31;e++)this.caches.push([])}get(e,t,r){let n=this.caches[r-1],i=n.length;e:for(let o=0;o<i;o++){let i=n[o],s=i.bytes;for(let n=0;n<r;n++)if(s[n]!==e[t+n])continue e;return i.value}return null}store(e,t){let r=this.caches[e.length-1],n=new o(e,t);if(r.length>=16)r[i^=i<<13,i^=i>>>17,((i^=i<<5)>>>0)%16+0]=n;else r.push(n)}decode(e,t,r){if(!r)return"";let i=this.get(e,t,r);if(null!==i)return i;let o=(0,n.default)(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,o),o}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeAscii.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeAsciiMax15=t.decodeAscii=void 0;let r=String.fromCharCode;t.decodeAscii=(e,t,n)=>{let i=[];for(let r=0;r<n;r++){let r=e[t++];if(128&r)return;i.push(r)}return r.apply(String,i)},t.decodeAsciiMax15=(e,t,n)=>{if(n<4)if(n<2)if(0===n)return"";else{let n=e[t++];if((128&n)>1){t-=1;return}return r(n)}else{let i=e[t++],o=e[t++];if((128&i)>0||(128&o)>0){t-=2;return}if(n<3)return r(i,o);let s=e[t++];if((128&s)>0){t-=3;return}return r(i,o,s)}{let i=e[t++],o=e[t++],s=e[t++],a=e[t++];if((128&i)>0||(128&o)>0||(128&s)>0||(128&a)>0){t-=4;return}if(n<6)if(4===n)return r(i,o,s,a);else{let n=e[t++];if((128&n)>0){t-=5;return}return r(i,o,s,a,n)}if(n<8){let u=e[t++],c=e[t++];if((128&u)>0||(128&c)>0){t-=6;return}if(n<7)return r(i,o,s,a,u,c);let f=e[t++];if((128&f)>0){t-=7;return}return r(i,o,s,a,u,c,f)}{let u=e[t++],c=e[t++],f=e[t++],l=e[t++];if((128&u)>0||(128&c)>0||(128&f)>0||(128&l)>0){t-=8;return}if(n<10)if(8===n)return r(i,o,s,a,u,c,f,l);else{let n=e[t++];if((128&n)>0){t-=9;return}return r(i,o,s,a,u,c,f,l,n)}if(n<12){let h=e[t++],d=e[t++];if((128&h)>0||(128&d)>0){t-=10;return}if(n<11)return r(i,o,s,a,u,c,f,l,h,d);let p=e[t++];if((128&p)>0){t-=11;return}return r(i,o,s,a,u,c,f,l,h,d,p)}{let h=e[t++],d=e[t++],p=e[t++],y=e[t++];if((128&h)>0||(128&d)>0||(128&p)>0||(128&y)>0){t-=12;return}if(n<14)if(12===n)return r(i,o,s,a,u,c,f,l,h,d,p,y);else{let n=e[t++];if((128&n)>0){t-=13;return}return r(i,o,s,a,u,c,f,l,h,d,p,y,n)}{let b=e[t++],w=e[t++];if((128&b)>0||(128&w)>0){t-=14;return}if(n<15)return r(i,o,s,a,u,c,f,l,h,d,p,y,b,w);let g=e[t++];if((128&g)>0){t-=15;return}return r(i,o,s,a,u,c,f,l,h,d,p,y,b,w,g)}}}}}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/index.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeUtf8=void 0,t.decodeUtf8=r("../../node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v16.js")).default},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v10.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s="";for(;i<o;){let t=e[i++];if((128&t)==0){s+=r(t);continue}let n=63&e[i++];if((224&t)==192){s+=r((31&t)<<6|n);continue}let o=63&e[i++];if((240&t)==224){s+=r((31&t)<<12|n<<6|o);continue}if((248&t)==240){let a=(7&t)<<18|n<<12|o<<6|63&e[i++];a>65535?s+=r((a-=65536)>>>10&1023|55296,a=56320|1023&a):s+=r(a)}else s+=r(t)}return s}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v16.js":function(e,t,r){"use strict";var n=r("../../node_modules/buffer/index.js").Buffer;Object.defineProperty(t,"__esModule",{value:!0});let i=r("../../node_modules/tslib/tslib.es6.mjs"),o=r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeAscii.js"),s=i.__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v18.js")),a=void 0!==n,u=a?n.prototype.utf8Slice:null,c=a?n.from:null,f=(e,t,r)=>(0,o.decodeAsciiMax15)(e,t,r)??(0,s.default)(e,t,r),l=(e,t,r)=>(0,o.decodeAscii)(e,t,r)??(0,s.default)(e,t,r),h=u?(e,t,r)=>u.call(e,t,t+r):c?(e,t,r)=>c(e).subarray(t,t+r).toString("utf8"):s.default;t.default=(e,t,r)=>r<16?f(e,t,r):r<32?l(e,t,r):h(e,t,r)},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v18.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s=[];for(;i<o;){let t=e[i++];if((128&t)!=0){let r=63&e[i++];if((224&t)==192)t=(31&t)<<6|r;else{let n=63&e[i++];if((240&t)==224)t=(31&t)<<12|r<<6|n;else if((248&t)==240){let o=(7&t)<<18|r<<12|n<<6|63&e[i++];if(o>65535){let e=(o-=65536)>>>10&1023|55296;t=56320|1023&o,s.push(e)}else t=o}}}s.push(t)}return r.apply(String,s)}},"../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/sharedCachedUtf8Decoder.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=new(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/CachedUtf8Decoder.js")).CachedUtf8Decoder},"../../node_modules/@jsonjoy.com/util/lib/objKeyCmp.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.objKeyCmp=void 0,t.objKeyCmp=(e,t)=>{let r=e.length,n=t.length;return r===n?e>t?1:-1:r-n}},"../../node_modules/@jsonjoy.com/util/lib/sort/insertion2.js":function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sort=void 0,t.sort=(e,t)=>{let r=e.length;for(let n=1;n<r;n++){let r=e[n],i=n;for(;0!==i&&t(e[i-1],r)>0;)e[i]=e[i-1],i--;e[i]=r}return e}},"../../node_modules/base64-js/index.js":function(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=u(e),s=o[0],a=o[1],c=new i((s+a)*3/4-a),f=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[f++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(function(e,t,n){for(var i,o=[],s=t;s<n;s+=3)i=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,s,s+16383>a?a:s+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},"../../node_modules/buffer/index.js":function(e,t,r){"use strict";var n=r("../../node_modules/base64-js/index.js"),i=r("../../node_modules/buffer/node_modules/ieee754/index.js"),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return f(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|p(n,i),u=s(o),c=u.write(n,i);return c!==o&&(u=u.slice(0,c)),u}if(ArrayBuffer.isView(e)){var f=e;if(C(f,Uint8Array)){var y=new Uint8Array(f);return h(y.buffer,y.byteOffset,y.byteLength)}return l(f)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(C(e,ArrayBuffer)||e&&C(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(C(e,SharedArrayBuffer)||e&&C(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var b=e.valueOf&&e.valueOf();if(null!=b&&b!==e)return a.from(b,t,r);var w=function(e){if(a.isBuffer(e)){var t=0|d(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(w)return w;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return c(e),s(e<0?0:0|d(e))}function l(e){for(var t=e.length<0?0:0|d(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||C(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return S(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,r){var i,o,s,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=O[e[o]];return i}(this,t,r);case"utf8":case"utf-8":return m(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,o=t,s=r,0===o&&s===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(o,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function w(e,t,r,n,i){var o;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return g(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=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,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else -1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var l=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){l=!1;break}if(l)return o}return -1}function m(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:(192&(o=e[i+1]))==128&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=e[i+1],s=e[i+2],(192&o)==128&&(192&s)==128&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}var h=n,d=h.length;if(d<=4096)return String.fromCharCode.apply(String,h);for(var p="",y=0;y<d;)p+=String.fromCharCode.apply(String,h.slice(y,y+=4096));return p}function v(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,o){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,o){return t*=1,r>>>=0,o||j(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,o){return t*=1,r>>>=0,o||j(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=a,t.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(c(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return f(e)},a.allocUnsafeSlow=function(e){return f(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(C(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),C(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,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)},a.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}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(C(o,Uint8Array))i+o.length>n.length?a.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(a.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)b(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)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},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?m(this,0,e):y.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(C(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw 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 RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,u=Math.min(o,s),c=this.slice(n,i),f=e.slice(t,r),l=0;l<u;++l)if(c[l]!==f[l]){o=c[l],s=f[l];break}return o<s?-1:+(s<o)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},a.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))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,s,a,u,c,f,l,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var d=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a,u=parseInt(t.substr(2*s,2),16);if((a=u)!=a)break;e[r+s]=u}return s}(this,e,t,r);case"utf8":case"utf-8":return i=t,o=r,I(A(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return s=t,a=r,I(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,s,a);case"base64":return u=t,c=r,I(S(e),this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f=t,l=r,I(function(e,t){for(var r,n,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(e,this.length-f),this,f,l);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw 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||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},a.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 TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;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{var s=a.isBuffer(e)?e:a.from(e,n),u=s.length;if(0===u)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%u]}return this};var E=/[^+/0-9A-Za-z-_]/g;function A(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319||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=(i-55296<<10|r-56320)+65536}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){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function S(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(E,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function C(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var O=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},"../../node_modules/buffer/node_modules/ieee754/index.js":function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=5960464477539062e-23*(23===i),d=n?0:o-1,p=n?1:-1,y=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+l>=1?t+=h/u:t+=h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+d]=255&s,d+=p,s/=256,c-=8);e[r+d-p]|=128*y}},"../../node_modules/process/browser.js":function(e){var t,r,n,i=e.exports={};function o(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var u=[],c=!1,f=-1;function l(){c&&n&&(c=!1,n.length?u=n.concat(u):f=-1,u.length&&h())}function h(){if(!c){var e=a(l);c=!0;for(var t=u.length;t;){for(n=u,u=[];++f<t;)n&&n[f].run();f=-1,t=u.length}n=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new d(e,t)),1!==u.length||c||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}},"../../node_modules/tslib/tslib.es6.mjs":function(e,t,r){"use strict";r.r(t),r.d(t,{__addDisposableResource:()=>L,__assign:()=>o,__asyncDelegator:()=>E,__asyncGenerator:()=>_,__asyncValues:()=>A,__await:()=>k,__awaiter:()=>p,__classPrivateFieldGet:()=>P,__classPrivateFieldIn:()=>T,__classPrivateFieldSet:()=>B,__createBinding:()=>b,__decorate:()=>a,__disposeResources:()=>R,__esDecorate:()=>c,__exportStar:()=>w,__extends:()=>i,__generator:()=>y,__importDefault:()=>U,__importStar:()=>O,__makeTemplateObject:()=>S,__metadata:()=>d,__param:()=>u,__propKey:()=>l,__read:()=>m,__rest:()=>s,__rewriteRelativeImportExtension:()=>N,__runInitializers:()=>f,__setFunctionName:()=>h,__spread:()=>v,__spreadArray:()=>j,__spreadArrays:()=>x,__values:()=>g,default:()=>D});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function a(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}function u(e,t){return function(r,n){t(r,n,e)}}function c(e,t,r,n,i,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,u=n.kind,c="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),h=!1,d=r.length-1;d>=0;d--){var p={};for(var y in n)p[y]="access"===y?{}:n[y];for(var y in n.access)p.access[y]=n.access[y];p.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var b=(0,r[d])("accessor"===u?{get:l.get,set:l.set}:l[c],p);if("accessor"===u){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw TypeError("Object expected");(a=s(b.get))&&(l.get=a),(a=s(b.set))&&(l.set=a),(a=s(b.init))&&i.unshift(a)}else(a=s(b))&&("field"===u?i.unshift(a):l[c]=a)}f&&Object.defineProperty(f,n.name,l),h=!0}function f(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}function l(e){return"symbol"==typeof e?e:"".concat(e)}function h(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function y(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){var c=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var b=Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function w(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||b(t,e,r)}function g(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 TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}function x(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n}function j(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function _(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){o.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=i[e](t)).value instanceof k?Promise.resolve(r.value.v).then(u,c):f(o[0][2],r)}catch(e){f(o[0][3],e)}}function u(e){a("next",e)}function c(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function E(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:k(e[n](t)),done:!1}:i?i(t):t}:i}}function A(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){var o,s,a;o=n,s=i,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){o({value:e,done:a})},s)})}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var I=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},C=function(e){return(C=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function O(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=C(e),n=0;n<r.length;n++)"default"!==r[n]&&b(t,e,r[n]);return I(t,e),t}function U(e){return e&&e.__esModule?e:{default:e}}function P(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function B(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function T(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function L(e,t,r){if(null!=t){var n,i;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(i=n)}if("function"!=typeof n)throw TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var M="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function R(e){function t(t){e.error=e.hasError?new M(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function i(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(i);if(r.dispose){var o=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(o).then(i,function(e){return t(e),i()})}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function N(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,i,o){return r?t?".jsx":".js":!n||i&&o?n+i+"."+o.toLowerCase()+"js":e}):e}let D={__extends:i,__assign:o,__rest:s,__decorate:a,__param:u,__esDecorate:c,__runInitializers:f,__propKey:l,__setFunctionName:h,__metadata:d,__awaiter:p,__generator:y,__createBinding:b,__exportStar:w,__values:g,__read:m,__spread:v,__spreadArrays:x,__spreadArray:j,__await:k,__asyncGenerator:_,__asyncDelegator:E,__asyncValues:A,__makeTemplateObject:S,__importStar:O,__importDefault:U,__classPrivateFieldGet:P,__classPrivateFieldSet:B,__classPrivateFieldIn:T,__addDisposableResource:L,__disposeResources:R,__rewriteRelativeImportExtension:N}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";let e,t,i,o;r.r(n),r.d(n,{decompressJsonFromB64:()=>ev,PressInteractionEncoder:()=>t_,getProductInformation:()=>to,openSso:()=>ti,createIFrameFrakClient:()=>eS,getCurrencyAmountKey:()=>ez,hashAndCompressData:()=>ed,sendInteraction:()=>tt,FrakContextManager:()=>eN,getSupportedLocale:()=>eD,compressJsonToB64:()=>ey,baseIframeProps:()=>ek,DebugInfoGatherer:()=>ej,base64urlEncode:()=>y,compressJson:()=>ep,processReferral:()=>tv,ReferralInteractionEncoder:()=>tm,modalBuilder:()=>tf,productTypes:()=>eV,referralInteraction:()=>tk,siweAuthenticate:()=>tu,FrakRpcError:()=>c,locales:()=>eC,trackPurchaseStatus:()=>ts,productTypesMask:()=>eH,interactionTypes:()=>eW,decompressJson:()=>em,PurchaseInteractionEncoder:()=>tT,getSupportedCurrency:()=>eO,sendTransaction:()=>tc,formatAmount:()=>e$,trackEvent:()=>eF,RpcErrorCodes:()=>h,ClientNotFound:()=>l,base64urlDecode:()=>b,displayEmbeddedWallet:()=>tn,displayModal:()=>tr,watchWalletStatus:()=>eq,Deferred:()=>d,RetailInteractionEncoder:()=>tM,setupClient:()=>eU,createIframe:()=>e_,WebShopInteractionEncoder:()=>tL,decompressDataAndCheckHash:()=>eg});var s=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":"application/json",...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,r]of Object.entries(this.headers)){let n=await r;null!==n&&(e[t]=n)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,r,n){try{let n=await fetch(e,{method:"POST",headers:await this.resolveHeaders(),body:JSON.stringify(t??{}),keepalive:!0,...r});if(401===n.status)return null;if(200!==n.status&&202!==n.status)throw Error(`HTTP error! status: ${n.status}`);let i=await n.text();return i?JSON.parse(i):null}catch(i){if(n<this.maxRetries){let i=this.initialRetryDelay*Math.pow(2,n);return await new Promise(e=>setTimeout(e,i)),this.post(e,t,r,n+1)}return console.error("Max retries reached:",i),null}}async fetch(e,t,r={}){let n=`${this.baseUrl}${e}`;return this.post(n,t,r,0)}},a=class{constructor(e){this.options=e,this.queue=[];let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t["openpanel-client-secret"]=e.clientSecret),t["openpanel-sdk-name"]=e.sdk||"node",t["openpanel-sdk-version"]=e.sdkVersion||"1.0.0",this.api=new s({baseUrl:e.apiUrl||"https://api.openpanel.dev",defaultHeaders:t})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send(e){return this.options.disabled||this.options.filter&&!this.options.filter(e)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push(e),Promise.resolve()):this.api.fetch("/track",e)}setGlobalProperties(e){this.global={...this.global,...e}}async track(e,t){return this.send({type:"track",payload:{name:e,profileId:t?.profileId??this.profileId,properties:{...this.global??{},...t??{}}}})}async identify(e){if(e.profileId&&(this.profileId=e.profileId,this.flush()),Object.keys(e).length>1)return this.send({type:"identify",payload:{...e,properties:{...this.global,...e.properties}}})}async alias(e){return this.send({type:"alias",payload:e})}async increment(e){return this.send({type:"increment",payload:e})}async decrement(e){return this.send({type:"decrement",payload:e})}clear(){this.profileId=void 0}flush(){this.queue.forEach(e=>{this.send({...e,payload:{...e.payload,profileId:e.payload.profileId??this.profileId}})}),this.queue=[]}},u=class extends a{constructor(e){super({sdk:"web",sdkVersion:"1.0.1",...e}),this.options=e,this.lastPath="",this.isServer()||(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&this.trackScreenViews(),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes())}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>"u"}trackOutgoingLinks(){this.isServer()||document.addEventListener("click",e=>{let t=e.target,r=t.closest("a");if(r&&t){let e=r.getAttribute("href");e?.startsWith("http")&&super.track("link_out",{href:e,text:r.innerText||r.getAttribute("title")||t.getAttribute("alt")||t.getAttribute("title")})}})}trackScreenViews(){if(this.isServer())return;this.screenView();let e=history.pushState;history.pushState=function(...t){let r=e.apply(this,t);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),r};let t=history.replaceState;history.replaceState=function(...e){let r=t.apply(this,e);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),r},window.addEventListener("popstate",()=>{window.dispatchEvent(new Event("locationchange"))});let r=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener("hashchange",r):window.addEventListener("locationchange",r)}trackAttributes(){this.isServer()||document.addEventListener("click",e=>{let t=e.target,r=t.closest("button"),n=t.closest("a"),i=r?.getAttribute("data-track")?r:n?.getAttribute("data-track")?n:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith("data-")&&"data-track"!==t.name&&(e[t.name.replace(/^data-/,"").replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_",""))]=t.value);let t=i.getAttribute("data-track");t&&super.track(t,e)}})}screenView(e,t){let r,n;this.isServer()||("string"==typeof e?(r=e,n=t):(r=window.location.href,n=e),this.lastPath!==r&&(this.lastPath=r,super.track("screen_view",{...n??{},__path:r,__title:document.title})))}};class c extends Error{code;data;constructor(e,t,r){super(t),this.code=e,this.data=r}}class f extends c{constructor(e){super(h.internalError,e)}}class l extends c{constructor(){super(h.clientNotConnected,"Client not found")}}let h={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};class d{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}}var p=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js");function y(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function b(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0))}function w(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function g(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function m(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function v(e,t){g(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function x(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function j(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function k(e,t){return e<<32-t|e>>>t}let _=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0]?e=>e:function(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}return e};function E(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),g(e),e}class A{}function S(e){let t=t=>e().update(E(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class I extends A{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=j(this.buffer)}update(e){m(this),g(e=E(e));let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){let t=j(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){m(this),v(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,x(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(0xffffffff),s=Number(r>>i&o),a=Number(r&o),u=4*!!n,c=4*!n;e.setUint32(t+u,s,n),e.setUint32(t+c,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);let s=j(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let u=a/4,c=this.get();if(u>c.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)s.setUint32(4*e,c[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{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()}}let C=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),O=BigInt(0x100000000-1),U=BigInt(32);function P(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:r,l:s}=function(e,t=!1){return t?{h:Number(e&O),l:Number(e>>U&O)}:{h:0|Number(e>>U&O),l:0|Number(e&O)}}(e[o],t);[n[o],i[o]]=[r,s]}return[n,i]}let B=(e,t,r)=>e<<r|t>>>32-r,T=(e,t,r)=>t<<r|e>>>32-r,L=(e,t,r)=>t<<r-32|e>>>64-r,M=(e,t,r)=>e<<r-32|t>>>64-r,R=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),N=new Uint32Array(64);class D extends I{constructor(e=32){super(64,e,8,!1),this.A=0|C["0"],this.B=0|C["1"],this.C=0|C["2"],this.D=0|C["3"],this.E=0|C["4"],this.F=0|C["5"],this.G=0|C["6"],this.H=0|C["7"]}get(){let{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 r=0;r<16;r++,t+=4)N[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=N[e-15],r=N[e-2],n=k(t,7)^k(t,18)^t>>>3,i=k(r,17)^k(r,19)^r>>>10;N[e]=i+N[e-7]+n+N[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let e=0;e<64;e++){var f,l,h,d;let t=c+(k(s,6)^k(s,11)^k(s,25))+((f=s)&a^~f&u)+R[e]+N[e]|0,p=(k(r,2)^k(r,13)^k(r,22))+((l=r)&(h=n)^l&(d=i)^h&d)|0;c=u,u=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+p|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,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){x(N)}destroy(){this.set(0,0,0,0,0,0,0,0),x(this.buffer)}}P(["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)));let z=S(()=>new D);function $(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}let F="2.31.2",V={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${F}`};class H extends Error{constructor(e,t={}){let r=t.cause instanceof H?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof H&&t.cause.docsPath||t.docsPath,i=V.getDocsUrl?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...V.version?[`Version: ${V.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=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=F}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}class W extends H{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 q extends H{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 J(e,{dir:t,size:r=32}={}){return"string"==typeof e?G(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new q({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let i=0;i<r;i++){let o="right"===t;n[o?i:r-i-1]=e[o?i:e.length-i-1]}return n}(e,{dir:t,size:r})}function G(e,{dir:t,size:r=32}={}){if(null===r)return e;let n=e.replace("0x","");if(n.length>2*r)throw new q({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}class K extends H{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 X extends H{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Y(e){return $(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Z(e,{size:t}){if(Y(e)>t)throw new X({givenSize:Y(e),maxSize:t})}let Q=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ee(e,t={}){return"number"==typeof e||"bigint"==typeof e?en(e,t):"string"==typeof e?eo(e,t):"boolean"==typeof e?et(e,t):er(e,t)}function et(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(Z(r,{size:t.size}),J(r,{size:t.size})):r}function er(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=Q[e[t]];let n=`0x${r}`;return"number"==typeof t.size?(Z(n,{size:t.size}),J(n,{dir:"right",size:t.size})):n}function en(e,t={}){let r,{signed:n,size:i}=t,o=BigInt(e);i?r=n?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let s="bigint"==typeof r&&n?-r-1n:0;if(r&&o>r||o<s){let t="bigint"==typeof e?"n":"";throw new K({max:r?`${r}${t}`:void 0,min:`${s}${t}`,signed:n,size:i,value:`${e}${t}`})}let a=`0x${(n&&o<0?(1n<<BigInt(8*i))+BigInt(o):o).toString(16)}`;return i?J(a,{size:i}):a}let ei=new TextEncoder;function eo(e,t={}){return er(ei.encode(e),t)}let es=new TextEncoder;function ea(e,t={}){return"number"==typeof e||"bigint"==typeof e?ef(en(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(Z(r,{size:t.size}),J(r,{size:t.size})):r}(e,t):$(e)?ef(e,t):el(e,t)}let eu={zero:48,nine:57,A:65,F:70,a:97,f:102};function ec(e){return e>=eu.zero&&e<=eu.nine?e-eu.zero:e>=eu.A&&e<=eu.F?e-(eu.A-10):e>=eu.a&&e<=eu.f?e-(eu.a-10):void 0}function ef(e,t={}){let r=e;t.size&&(Z(r,{size:t.size}),r=J(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let r=ec(n.charCodeAt(t++)),i=ec(n.charCodeAt(t++));if(void 0===r||void 0===i)throw new H(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);o[e]=16*r+i}return o}function el(e,t={}){let r=es.encode(e);return"number"==typeof t.size?(Z(r,{size:t.size}),J(r,{dir:"right",size:t.size})):r}let eh=new p.CborEncoder;function ed(e){let t={...e,validationHash:eb(e)};return eh.encode(t)}function ep(e){return eh.encode(e)}function ey(e){return y(ep(e))}function eb(e){var t,r;return ee(z($(t=eh.encode(e),{strict:!1})?ea(t):t))}let ew=new p.CborDecoder;function eg(e){if(!e.length)throw new c(h.corruptedResponse,"Missing compressed data");let t=em(e);if(!t)throw new c(h.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new c(h.corruptedResponse,"Missing validation hash");let{validationHash:r,...n}=t;if(eb(n)!==t.validationHash)throw new c(h.corruptedResponse,"Invalid data validation hash");return t}function em(e){try{return ew.decode(e)}catch(t){return console.error("Invalid compressed data",{e:t,data:e}),null}}function ev(e){return em(b(e))}let ex="nexus-wallet-backup";class ej{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e){this.lastResponse={event:e.data,origin:e.origin,timestamp:Date.now()}}setLastRequest(e,t){this.lastRequest={event:e,target:t,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn("Failed to encode debug data",e),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+("complete"===this.iframe.contentDocument.readyState):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let t=this.getIframeStatus(),r=this.getNavigatorInfo(),n="Unknown";return e instanceof c?n=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?n=e.message:"string"==typeof e&&(n=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:r?this.base64Encode(r):"no-navigator",iframeStatus:t?this.base64Encode(t):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:n}}static empty(){return new ej}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
3
3
  Debug Information:
4
4
  -----------------
5
5
  Timestamp: ${t.timestamp}
@@ -11,9 +11,9 @@
11
11
  Last Response: ${t.lastResponse}
12
12
  Client Status: ${t.clientStatus}
13
13
  Error: ${t.error}
14
- `.trim()}}let el={id:"frak-wallet",name:"frak-wallet",title:"Frak Wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px",colorScheme:"auto"}};function ec({walletBaseUrl:e,config:t}){let r=document.querySelector("#frak-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=el.id,n.name=el.name,n.allow=el.allow,n.style.zIndex=el.style.zIndex.toString(),eh({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(r=>{n?.addEventListener("load",()=>r(n)),n.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function eh({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function ed({config:e,iframe:r}){let n=function(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}(),o=function({iframe:e}){let t=new a;return{handleEvent:async r=>{switch(r.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":r.data.backup?localStorage.setItem(eu,r.data.backup):localStorage.removeItem(eu);break;case"remove-backup":localStorage.removeItem(eu);break;case"show":case"hide":eh({iframe:e,isVisible:"show"===r.iframeLifecycle});break;case"handshake":e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:r.data.token,currentUrl:window.location.href}},"*");break;case"redirect":window.location.href=`${r.data.baseRedirectUrl}${encodeURIComponent(window.location.href)}`}},isConnected:t.promise}}({iframe:r}),u=new ef(e,r),f=function({frakWalletUrl:e,iframe:r,channelManager:n,iframeLifecycleManager:i,debugInfo:o}){if("undefined"==typeof window)throw new t(s.configError,"iframe client should be used in the browser");if(!r.contentWindow)throw new t(s.configError,"The iframe does not have a product window");let a=r.contentWindow;async function u(t){if(!t.origin)return;try{if(new URL(t.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(e){console.log("Unable to check frak msg origin",e);return}if("object"!=typeof t.data)return;if(o.setLastResponse(t),"iframeLifecycle"in t.data)return void await i.handleEvent(t.data);if("clientLifecycle"in t.data)return void console.error("Client lifecycle event received on the client side, dismissing it");let r=t.data.id,s=n.getRpcResolver(r);s&&s(t.data)}return window.addEventListener("message",u),{sendEvent:function(t){a.postMessage(t,{targetOrigin:e}),o.setLastRequest(t,e)},cleanup:function(){window.removeEventListener("message",u)}}}({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:r,channelManager:n,iframeLifecycleManager:o,debugInfo:u}),l=async e=>{if(!await o.isConnected)throw new t(s.clientNotConnected,"The iframe provider isn't connected yet");let r=new a,i=n.createChannel(e=>{let o=eo(e.data);o.error?r.reject(new t(o.error.code,o.error.message,o.error?.data)):r.resolve(o.result),n.removeChannel(i)}),u=ee(e);return f.sendEvent({id:i,topic:e.method,data:u}),r.promise},c=async(e,r)=>{if(!await o.isConnected)throw new t(s.clientNotConnected,"The iframe provider isn't connected yet");let a=n.createChannel(e=>{let t=eo(e.data);if(t.result)r(t.result);else throw new i("No valid result in the response")}),u=ee(e);f.sendEvent({id:a,topic:e.method,data:u})},h=function(e,t){let r,n,i=()=>e.sendEvent({clientLifecycle:"heartbeat"});function o(){r&&clearInterval(r),n&&clearTimeout(n)}return async function(){i(),r=setInterval(i,100),n=setTimeout(()=>{o(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,o()}(),o}(f,o),d=async()=>{h(),n.destroy(),f.cleanup(),r.remove()},p=ep({config:e,messageHandler:f,lifecycleManager:o}).then(()=>u.updateSetupStatus(!0));return{config:e,debugInfo:u,waitForConnection:o.isConnected,waitForSetup:p,request:l,listenerRequest:c,destroy:d}}async function ep({config:e,messageHandler:t,lifecycleManager:r}){async function n(){let r=e.customizations?.css;r&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:r}})}async function i(){let r=e.customizations?.i18n;r&&t.sendEvent({clientLifecycle:"modal-i18n",data:{i18n:r}})}async function o(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(eu);e&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:e}})}await r.isConnected,await Promise.all([n(),i(),o()])}let ey={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function ew(e){return e&&e in ey?e:"eur"}async function eb({config:e}){let t=function(e){let t=ew(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}(e),r=await ec({config:t});if(!r)return void console.error("Failed to create iframe");let n=ed({config:t,iframe:r});return(await n.waitForSetup,await n.waitForConnection)?n:void console.error("Failed to connect to client")}let eg="fCtx";function em(e){if(e?.r)try{let t=Y(e.r);return f(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function ev(e){if(e&&0!==e.length)try{let t=l(e);return{r:H(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function ex({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(eg);return t?ev(t):null}function ej({url:e,context:t}){if(!e)return null;let r=ex({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=em(n);if(!i)return null;let o=new URL(e);return o.searchParams.set(eg,i),o.toString()}function ek(e){let t=new URL(e);return t.searchParams.delete(eg),t.toString()}let e_={compress:em,decompress:ev,parse:ex,update:ej,remove:ek,replaceUrl:function({url:e,context:t}){let r;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let n=e??window.location.href;(r=null!==t?ej({url:n,context:t}):ek(n))&&window.history.replaceState(null,"",r.toString())}};function eE(e){return e?ey[e]??ey.eur:ey.eur}function eA(e){return e?`${e}Amount`:"eurAmount"}function eS(e,t){let r=eE(t),n=ew(t);return e.toLocaleString(r,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2})}let eC={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},eI=Object.entries(eC).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{}),eU={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}};function eO(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(e=>(eB(e.interactionToken),e));let r=new a,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},e=>{t(e),eB(e.interactionToken),n||(r.resolve(e),n=!0)}).then(()=>r.promise)}function eB(e){"undefined"!=typeof window&&(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}let eP=BigInt(0x100000000-1),eL=BigInt(32),eT=(e,t,r)=>e<<r|t>>>32-r,eM=(e,t,r)=>t<<r|e>>>32-r,eR=(e,t,r)=>t<<r-32|e>>>64-r,eD=(e,t,r)=>e<<r-32|t>>>64-r,eN=[],ez=[],e$=[],eF=BigInt(0),eH=BigInt(1),eV=BigInt(2),eW=BigInt(7),eJ=BigInt(256),eq=BigInt(113);for(let e=0,t=eH,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],eN.push(2*(5*n+r)),ez.push((e+1)*(e+2)/2%64);let i=eF;for(let e=0;e<7;e++)(t=(t<<eH^(t>>eW)*eq)%eJ)&eV&&(i^=eH<<(eH<<BigInt(e))-eH);e$.push(i)}let[eG,eK]=function(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:s}=function(e,t=!1){return t?{h:Number(e&eP),l:Number(e>>eL&eP)}:{h:0|Number(e>>eL&eP),l:0|Number(e&eP)}}(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}(e$,!0),eX=(e,t,r)=>r>32?eR(e,t,r):eT(e,t,r),eY=(e,t,r)=>r>32?eD(e,t,r):eM(e,t,r);class eZ extends v{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,c(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}keccak(){b||g(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=eX(o,s,1)^r[n],u=eY(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=u}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=ez[r],o=eX(t,i,n),s=eY(t,i,n),a=eN[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=eG[n],e[1]^=eK[n]}r.fill(0)}(this.state32,this.rounds),b||g(this.state32),this.posOut=0,this.pos=0}update(e){d(this);let{blockLen:t,state:r}=this,n=(e=m(e)).length;for(let i=0;i<n;){let 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;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){d(this,!1),h(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let 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 Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return c(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(p(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new eZ(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}}let eQ=x(()=>new eZ(136,1,32));function e0(e,t){let r=eQ(C(e,{strict:!1})?G(e):e);return"bytes"===(t||"hex")?r:$(r)}async function e2(e,{productId:t,interaction:r,validation:n}){let i=t??function({domain:e}){return e0($((e??window.location.host).replace("www.","")))}(e.config);return await e.request({method:"frak_sendInteraction",params:[i,r,n]})}async function e1(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,r,e.config.metadata]})}async function e8(e,t){return await e.request({method:"frak_displayEmbeddedWallet",params:[t,e.config.metadata]})}async function e6(e,t){let{metadata:r,customizations:n}=e.config;await e.request({method:"frak_sso",params:[t,r.name,n?.css]})}async function e5(e){return await e.request({method:"frak_getProductInformation"})}async function e3(e){if("undefined"==typeof window)return void console.warn("[Frak] No window found, can't track purchase");let t=window.sessionStorage.getItem("frak-wallet-interaction-token");if(!t)return void console.warn("[Frak] No frak session found, skipping purchase check");await fetch("https://backend.frak.id/interactions/listenForPurchase",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","x-wallet-sdk-auth":t},body:JSON.stringify(e)})}let e4=256;async function e7(t,{siwe:r,metadata:n}){let i=t.config?.domain??window.location.host,o=r?.statement??`I confirm that I want to use my Frak wallet on: ${t.config.metadata.name}`,s={...r,statement:o,nonce:r?.nonce??function(t=11){if(!e||e4+t>512){e="",e4=0;for(let t=0;t<256;t++)e+=(256+256*Math.random()|0).toString(16).substring(1)}return e.substring(e4,e4+++t)}(96),uri:r?.uri??`https://${i}`,version:r?.version??"1",domain:i};return(await e1(t,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:s}}})).siweAuthenticate}async function e9(e,{tx:t,metadata:r}){return(await e1(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function te(e,{metadata:t,login:r,openSession:n}){return function e(t,r){async function n(e){return e&&(r.metadata=e(r.metadata??{})),await e1(t,r)}return{params:r,sendTx:function(n){return e(t,{...r,steps:{...r.steps,sendTransaction:n}})},reward:function(n){return e(t,{...r,steps:{...r.steps,final:{...n,action:{key:"reward"}}}})},sharing:function(n,i){return e(t,{...r,steps:{...r.steps,final:{...i,action:{key:"sharing",options:n}}}})},display:n}}(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}class tt extends O{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class tr extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&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){let e=this.keys().next().value;e&&this.delete(e)}return this}}let tn=new tr(8192),ti=/^0x[a-fA-F0-9]{40}$/,to=new tr(8192);function ts(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(to.has(n))return to.get(n);let i=!!ti.test(e)&&(e.toLowerCase()===e||!r||function(e,t){if(tn.has(`${e}.${void 0}`))return tn.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=e0(Z(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let o=`0x${i.join("")}`;return tn.set(`${e}.${t}`,o),o}(e)===e);return to.set(n,i),i}function ta(e){return"string"==typeof e[0]?tu(e):function(e){let t=0;for(let r of e)t+=r.length;let r=new Uint8Array(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return r}(e)}function tu(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}let tf={createLink:()=>({handlerTypeDenominator:$(eC.referral),interactionData:eU.referral.createLink}),referred({referrer:e}){let t=tu([eU.referral.referred,L(e,{size:32})]);return{handlerTypeDenominator:$(eC.referral),interactionData:t}}};async function tl(e,{walletStatus:r,frakContext:n,modalConfig:i,productId:o,options:a}){let u=!1;async function f(){if(!u)return u=!0,th(e,{modalConfig:{...i,loggedIn:{action:{key:"referred"}}},walletStatus:r})}async function l(t){let r=tf.referred({referrer:t});await e2(e,{productId:o,interaction:r})}try{let{status:e,currentWallet:t}=await tc({initialWalletStatus:r,getFreshWalletStatus:f,pushReferralInteraction:l,frakContext:n});return e_.replaceUrl({url:window.location?.href,context:a?.alwaysAppendUrl?{r:t}:null}),e}catch(e){return console.log("Error processing referral",{error:e}),e_.replaceUrl({url:window.location?.href,context:a?.alwaysAppendUrl?{r:r?.wallet}:null}),function(e){if(e instanceof t)switch(e.code){case s.walletNotConnected:return"no-wallet";case s.serverErrorForInteractionDelegation:return"no-session"}return"error"}(e)}}async function tc({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let i=e?.wallet;return n?.r?(i||(i=await t()),i&&function(e,t){if(!ts(e,{strict:!1}))throw new tt({address:e});if(!ts(t,{strict:!1}))throw new tt({address:t});return e.toLowerCase()===t.toLowerCase()}(n.r,i))?{status:"self-referral",currentWallet:i}:(e?.interactionSession||(i=await t()),await r(n.r),{status:"success",currentWallet:i}):{status:"no-referrer",currentWallet:i}}async function th(e,{modalConfig:t,walletStatus:r}){if(!r?.interactionSession){let r=await e8(e,t??{});return r?.wallet??void 0}return r.wallet??void 0}async function td(e,{productId:t,modalConfig:r,options:n}={}){let i=e_.parse({url:window.location.href}),o=await eO(e);try{return await tl(e,{walletStatus:o,frakContext:i,modalConfig:r,productId:t,options:n})}catch(e){console.warn("Error processing referral",{error:e})}}let tp={openArticle({articleId:e}){let t=tu([eU.press.openArticle,L(e,{size:32})]);return{handlerTypeDenominator:$(eC.press),interactionData:t}},readArticle({articleId:e}){let t=tu([eU.press.readArticle,L(e,{size:32})]);return{handlerTypeDenominator:$(eC.press),interactionData:t}}};class ty extends O{constructor({expectedLength:e,givenLength:t,type:r}){super(`ABI encoding array length mismatch for type ${r}.
14
+ `.trim()}}let ek={id:"frak-wallet",name:"frak-wallet",title:"Frak Wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px",colorScheme:"auto"}};function e_({walletBaseUrl:e,config:t}){let r=document.querySelector("#frak-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=ek.id,n.name=ek.name,n.allow=ek.allow,n.style.zIndex=ek.style.zIndex.toString(),eE({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(r=>{n?.addEventListener("load",()=>r(n)),n.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function eE({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}var eA=r("../../node_modules/process/browser.js");function eS({config:e,iframe:t}){let r,n=function(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}(),i=function({iframe:e}){let t=new d;return{handleEvent:async r=>{switch(r.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":r.data.backup?localStorage.setItem(ex,r.data.backup):localStorage.removeItem(ex);break;case"remove-backup":localStorage.removeItem(ex);break;case"show":case"hide":eE({iframe:e,isVisible:"show"===r.iframeLifecycle});break;case"handshake":e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:r.data.token,currentUrl:window.location.href}},"*");break;case"redirect":window.location.href=`${r.data.baseRedirectUrl}${encodeURIComponent(window.location.href)}`}},isConnected:t.promise}}({iframe:t}),o=new ej(e,t),s=function({frakWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:n,debugInfo:i}){if("undefined"==typeof window)throw new c(h.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new c(h.configError,"The iframe does not have a product window");let o=t.contentWindow;async function s(t){if(!t.origin)return;try{if(new URL(t.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(e){console.log("Unable to check frak msg origin",e);return}if("object"!=typeof t.data)return;if(i.setLastResponse(t),"iframeLifecycle"in t.data)return void await n.handleEvent(t.data);if("clientLifecycle"in t.data)return void console.error("Client lifecycle event received on the client side, dismissing it");let o=t.data.id,s=r.getRpcResolver(o);s&&s(t.data)}return window.addEventListener("message",s),{sendEvent:function(t){o.postMessage(t,{targetOrigin:e}),i.setLastRequest(t,e)},cleanup:function(){window.removeEventListener("message",s)}}}({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:n,iframeLifecycleManager:i,debugInfo:o}),a=async e=>{if(!await i.isConnected)throw new c(h.clientNotConnected,"The iframe provider isn't connected yet");let t=new d,r=n.createChannel(e=>{let i=eg(e.data);i.error?t.reject(new c(i.error.code,i.error.message,i.error?.data)):t.resolve(i.result),n.removeChannel(r)}),o=ed(e);return s.sendEvent({id:r,topic:e.method,data:o}),t.promise},l=async(e,t)=>{if(!await i.isConnected)throw new c(h.clientNotConnected,"The iframe provider isn't connected yet");let r=n.createChannel(e=>{let r=eg(e.data);if(r.result)t(r.result);else throw new f("No valid result in the response")}),o=ed(e);s.sendEvent({id:r,topic:e.method,data:o})},p=function(e,t){let r,n,i=()=>e.sendEvent({clientLifecycle:"heartbeat"});function o(){r&&clearInterval(r),n&&clearTimeout(n)}return async function(){i(),r=setInterval(i,100),n=setTimeout(()=>{o(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,o()}(),o}(s,i),y=async()=>{p(),n.destroy(),s.cleanup(),t.remove()};eA.env.OPEN_PANEL_API_URL&&eA.env.OPEN_PANEL_SDK_CLIENT_ID&&(console.log("[Frak SDK] Initializing OpenPanel"),(r=new u({apiUrl:eA.env.OPEN_PANEL_API_URL,clientId:eA.env.OPEN_PANEL_SDK_CLIENT_ID,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>!("track"===e&&t?.properties)||("sdkVersion"in t.properties||(t.properties={...t.properties,sdkVersion:eA.env.SDK_VERSION}),!0)})).setGlobalProperties({sdkVersion:eA.env.SDK_VERSION}),r.init());let b=eI({config:e,messageHandler:s,lifecycleManager:i}).then(()=>o.updateSetupStatus(!0));return{config:e,debugInfo:o,waitForConnection:i.isConnected,waitForSetup:b,request:a,listenerRequest:l,destroy:y,openPanel:r}}async function eI({config:e,messageHandler:t,lifecycleManager:r}){async function n(){let r=e.customizations?.css;r&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:r}})}async function i(){let r=e.customizations?.i18n;r&&t.sendEvent({clientLifecycle:"modal-i18n",data:{i18n:r}})}async function o(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(ex);e&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:e}})}await r.isConnected,await Promise.allSettled([n(),i(),o()])}let eC={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function eO(e){return e&&e in eC?e:"eur"}async function eU({config:e}){let t=function(e){let t=eO(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}(e),r=await e_({config:t});if(!r)return void console.error("Failed to create iframe");let n=eS({config:t,iframe:r});return(await n.waitForSetup,await n.waitForConnection)?n:void console.error("Failed to connect to client")}let eP="fCtx";function eB(e){if(e?.r)try{let t=ef(e.r);return y(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function eT(e){if(e&&0!==e.length)try{let t=b(e);return{r:er(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function eL({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(eP);return t?eT(t):null}function eM({url:e,context:t}){if(!e)return null;let r=eL({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=eB(n);if(!i)return null;let o=new URL(e);return o.searchParams.set(eP,i),o.toString()}function eR(e){let t=new URL(e);return t.searchParams.delete(eP),t.toString()}let eN={compress:eB,decompress:eT,parse:eL,update:eM,remove:eR,replaceUrl:function({url:e,context:t}){let r;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let n=e??window.location.href;(r=null!==t?eM({url:n,context:t}):eR(n))&&window.history.replaceState(null,"",r.toString())}};function eD(e){return e?eC[e]??eC.eur:eC.eur}function ez(e){return e?`${e}Amount`:"eurAmount"}function e$(e,t){let r=eD(t),n=eO(t);return e.toLocaleString(r,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2})}function eF(e,t,r={}){if(!e)return void console.debug("[Frak] No client provided, skipping event tracking");try{e.openPanel?.track(t,r)}catch(e){console.debug("[Frak] Failed to track event:",t,e)}}let eV={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},eH=Object.entries(eV).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{}),eW={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}};function eq(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(t=>(eJ(e,t),t));let r=new d,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},i=>{eJ(e,i),t(i),n||(r.resolve(i),n=!0)}).then(()=>r.promise)}function eJ(e,t){"undefined"!=typeof window&&(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?window.sessionStorage.setItem("frak-wallet-interaction-token",t.interactionToken):window.sessionStorage.removeItem("frak-wallet-interaction-token"))}let eG=BigInt(0),eK=BigInt(1),eX=BigInt(2),eY=BigInt(7),eZ=BigInt(256),eQ=BigInt(113),e0=[],e1=[],e2=[];for(let e=0,t=eK,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],e0.push(2*(5*n+r)),e1.push((e+1)*(e+2)/2%64);let i=eG;for(let e=0;e<7;e++)(t=(t<<eK^(t>>eY)*eQ)%eZ)&eX&&(i^=eK<<(eK<<BigInt(e))-eK);e2.push(i)}let e8=P(e2,!0),e6=e8[0],e5=e8[1],e3=(e,t,r)=>r>32?L(e,t,r):B(e,t,r),e4=(e,t,r)=>r>32?M(e,t,r):T(e,t,r);class e7 extends A{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,w(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}clone(){return this._cloneInto()}keccak(){_(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=e3(o,s,1)^r[n],u=e4(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=u}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=e1[r],o=e3(t,i,n),s=e4(t,i,n),a=e0[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=e6[n],e[1]^=e5[n]}x(r)}(this.state32,this.rounds),_(this.state32),this.posOut=0,this.pos=0}update(e){m(this),g(e=E(e));let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let 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;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){m(this,!1),g(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let 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 Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return w(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(v(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,x(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new e7(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}}let e9=(t=1,i=136,o=32,S(()=>new e7(i,t,o)));function te(e,t){let r=e9($(e,{strict:!1})?ea(e):e);return"bytes"===(t||"hex")?r:ee(r)}async function tt(e,{productId:t,interaction:r,validation:n}){let i=t??function({domain:e}){return te(ee((e??window.location.host).replace("www.","")))}(e.config);return await e.request({method:"frak_sendInteraction",params:[i,r,n]})}async function tr(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,r,e.config.metadata]})}async function tn(e,t){return await e.request({method:"frak_displayEmbeddedWallet",params:[t,e.config.metadata]})}async function ti(e,t){let{metadata:r,customizations:n}=e.config;await e.request({method:"frak_sso",params:[t,r.name,n?.css]})}async function to(e){return await e.request({method:"frak_getProductInformation"})}async function ts(e){if("undefined"==typeof window)return void console.warn("[Frak] No window found, can't track purchase");let t=window.sessionStorage.getItem("frak-wallet-interaction-token");if(!t)return void console.warn("[Frak] No frak session found, skipping purchase check");await fetch("https://backend.frak.id/interactions/listenForPurchase",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","x-wallet-sdk-auth":t},body:JSON.stringify(e)})}let ta=256;async function tu(t,{siwe:r,metadata:n}){let i=t.config?.domain??window.location.host,o=r?.statement??`I confirm that I want to use my Frak wallet on: ${t.config.metadata.name}`,s={...r,statement:o,nonce:r?.nonce??function(t=11){if(!e||ta+t>512){e="",ta=0;for(let t=0;t<256;t++)e+=(256+256*Math.random()|0).toString(16).substring(1)}return e.substring(ta,ta+++t)}(96),uri:r?.uri??`https://${i}`,version:r?.version??"1",domain:i};return(await tr(t,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:s}}})).siweAuthenticate}async function tc(e,{tx:t,metadata:r}){return(await tr(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function tf(e,{metadata:t,login:r,openSession:n}){return function e(t,r){async function n(e){return e&&(r.metadata=e(r.metadata??{})),await tr(t,r)}return{params:r,sendTx:function(n){return e(t,{...r,steps:{...r.steps,sendTransaction:n}})},reward:function(n){return e(t,{...r,steps:{...r.steps,final:{...n,action:{key:"reward"}}}})},sharing:function(n,i){return e(t,{...r,steps:{...r.steps,final:{...i,action:{key:"sharing",options:n}}}})},display:n}}(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}class tl extends H{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 th extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&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){let e=this.keys().next().value;e&&this.delete(e)}return this}}let td=new th(8192),tp=/^0x[a-fA-F0-9]{40}$/,ty=new th(8192);function tb(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(ty.has(n))return ty.get(n);let i=!!tp.test(e)&&(e.toLowerCase()===e||!r||function(e,t){if(td.has(`${e}.${void 0}`))return td.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=te(el(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let o=`0x${i.join("")}`;return td.set(`${e}.${t}`,o),o}(e)===e);return ty.set(n,i),i}function tw(e){return"string"==typeof e[0]?tg(e):function(e){let t=0;for(let r of e)t+=r.length;let r=new Uint8Array(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return r}(e)}function tg(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}let tm={createLink:()=>({handlerTypeDenominator:ee(eV.referral),interactionData:eW.referral.createLink}),referred({referrer:e}){let t=tg([eW.referral.referred,J(e,{size:32})]);return{handlerTypeDenominator:ee(eV.referral),interactionData:t}}};async function tv(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:i,options:o}){let s=!1;async function a(){if(!s)return s=!0,tj(e,{modalConfig:{...n,loggedIn:{action:{key:"referred"}}},walletStatus:t})}async function u(t){let r=tm.referred({referrer:t});await Promise.allSettled([tt(e,{productId:i,interaction:r}),eF(e,"user_referred",{properties:{referrer:t}})])}try{let{status:e,currentWallet:n}=await tx({initialWalletStatus:t,getFreshWalletStatus:a,pushReferralInteraction:u,frakContext:r});return eN.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:n}:null}),e}catch(e){return console.log("Error processing referral",{error:e}),eN.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:t?.wallet}:null}),function(e){if(e instanceof c)switch(e.code){case h.walletNotConnected:return"no-wallet";case h.serverErrorForInteractionDelegation:return"no-session"}return"error"}(e)}}async function tx({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let i=e?.wallet;return n?.r?(i||(i=await t()),i&&function(e,t){if(!tb(e,{strict:!1}))throw new tl({address:e});if(!tb(t,{strict:!1}))throw new tl({address:t});return e.toLowerCase()===t.toLowerCase()}(n.r,i))?{status:"self-referral",currentWallet:i}:(e?.interactionSession||(i=await t()),await r(n.r),{status:"success",currentWallet:i}):{status:"no-referrer",currentWallet:i}}async function tj(e,{modalConfig:t,walletStatus:r}){if(!r?.interactionSession){let r=await tn(e,t??{});return r?.wallet??void 0}return r.wallet??void 0}async function tk(e,{productId:t,modalConfig:r,options:n}={}){let i=eN.parse({url:window.location.href}),o=await eq(e);try{return await tv(e,{walletStatus:o,frakContext:i,modalConfig:r,productId:t,options:n})}catch(e){console.warn("Error processing referral",{error:e})}}let t_={openArticle({articleId:e}){let t=tg([eW.press.openArticle,J(e,{size:32})]);return{handlerTypeDenominator:ee(eV.press),interactionData:t}},readArticle({articleId:e}){let t=tg([eW.press.readArticle,J(e,{size:32})]);return{handlerTypeDenominator:ee(eV.press),interactionData:t}}};class tE extends H{constructor({expectedLength:e,givenLength:t,type:r}){super(`ABI encoding array length mismatch for type ${r}.
15
15
  Expected length: ${e}
16
- Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class tw extends O{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${D(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class tb extends O{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch.
16
+ Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class tA extends H{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${Y(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class tS extends H{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch.
17
17
  Expected length (params): ${e}
18
- Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class tg extends O{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type.
19
- Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class tm extends O{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}function tv(e,t){if("number"==typeof t&&t>0&&t>D(e)-1)throw new B({offset:t,position:"start",size:D(e)})}function tx(e,t,r){if("number"==typeof t&&"number"==typeof r&&D(e)!==r-t)throw new B({offset:r,position:"end",size:D(e)})}let tj=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function tk(e){let t=0;for(let r=0;r<e.length;r++){let{dynamic:n,encoded:i}=e[r];n?t+=32:t+=D(i)}let r=[],n=[],i=0;for(let o=0;o<e.length;o++){let{dynamic:s,encoded:a}=e[o];s?(r.push(V(t+i,{size:32})),n.push(a),i+=D(a)):r.push(a)}return ta([...r,...n])}let t_={startPurchase({purchaseId:e}){let t=tu([eU.purchase.started,L(e,{size:32})]);return{handlerTypeDenominator:$(eC.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=function(e,t){if(e.length!==t.length)throw new tb({expectedLength:e.length,givenLength:t.length});let r=tk(function({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(function e({param:t,value:r}){let n=function(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}(t.type);if(n){let[i,o]=n;return function(t,{length:r,param:n}){let i=null===r;if(!Array.isArray(t))throw new tm(t);if(!i&&t.length!==r)throw new ty({expectedLength:r,givenLength:t.length,type:`${n.type}[${r}]`});let o=!1,s=[];for(let r=0;r<t.length;r++){let i=e({param:n,value:t[r]});i.dynamic&&(o=!0),s.push(i)}if(i||o){let e=tk(s);if(i){let t=V(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?ta([t,e]):t}}if(o)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:ta(s.map(({encoded:e})=>e))}}(r,{length:i,param:{...t,type:o}})}if("tuple"===t.type)return function(t,{param:r}){let n=!1,i=[];for(let o=0;o<r.components.length;o++){let s=r.components[o],a=Array.isArray(t)?o:s.name,u=e({param:s,value:t[a]});i.push(u),u.dynamic&&(n=!0)}return{dynamic:n,encoded:n?tk(i):ta(i.map(({encoded:e})=>e))}}(r,{param:t});if("address"===t.type){var i=r;if(!ts(i))throw new tt({address:i});return{dynamic:!1,encoded:T(i.toLowerCase())}}if("bool"===t.type){var o=r;if("boolean"!=typeof o)throw new O(`Invalid boolean value: "${o}" (type: ${typeof o}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:T(F(o))}}if(t.type.startsWith("uint")||t.type.startsWith("int")){let e=t.type.startsWith("int"),[,,n="256"]=tj.exec(t.type)??[];return function(e,{signed:t,size:r=256}){if("number"==typeof r){let n=2n**(BigInt(r)-(t?1n:0n))-1n,i=t?-n-1n:0n;if(e>n||e<i)throw new M({max:n.toString(),min:i.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:V(e,{size:32,signed:t})}}(r,{signed:e,size:Number(n)})}if(t.type.startsWith("bytes"))return function(e,{param:t}){let[,r]=t.type.split("bytes"),n=D(e);if(!r){let t=e;return n%32!=0&&(t=T(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:ta([T(V(n,{size:32})),t])}}if(n!==Number.parseInt(r))throw new tw({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:T(e,{dir:"right"})}}(r,{param:t});if("string"===t.type){var s=r;let e=J(s),t=Math.ceil(D(e)/32),n=[];for(let r=0;r<t;r++)n.push(T(function(e,t,r,{strict:n}={}){return C(e,{strict:!1})?function(e,t,r,{strict:n}={}){tv(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&tx(i,t,r),i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){tv(e,t);let i=e.slice(t,r);return n&&tx(i,t,r),i}(e,t,r,{strict:n})}(e,32*r,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:ta([T(V(D(e),{size:32})),...n])}}throw new tg(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}({param:e[n],value:t[n]}));return r}({params:e,values:t}));return 0===r.length?"0x":r}([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=tu([eU.purchase.completed,r]);return{handlerTypeDenominator:$(eC.purchase),interactionData:n}},unsafeCompletedPurchase({purchaseId:e}){let t=tu([eU.purchase.unsafeCompleted,L(e,{size:32})]);return{handlerTypeDenominator:$(eC.purchase),interactionData:t}}},tE={open:()=>({handlerTypeDenominator:$(eC.webshop),interactionData:eU.webshop.open})},tA={customerMeeting({agencyId:e}){let t=tu([eU.retail.customerMeeting,L(e,{size:32})]);return{handlerTypeDenominator:$(eC.retail),interactionData:t}}}})(),n})());
18
+ Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class tI extends H{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type.
19
+ Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class tC extends H{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}function tO(e,t){if("number"==typeof t&&t>0&&t>Y(e)-1)throw new W({offset:t,position:"start",size:Y(e)})}function tU(e,t,r){if("number"==typeof t&&"number"==typeof r&&Y(e)!==r-t)throw new W({offset:r,position:"end",size:Y(e)})}let tP=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function tB(e){let t=0;for(let r=0;r<e.length;r++){let{dynamic:n,encoded:i}=e[r];n?t+=32:t+=Y(i)}let r=[],n=[],i=0;for(let o=0;o<e.length;o++){let{dynamic:s,encoded:a}=e[o];s?(r.push(en(t+i,{size:32})),n.push(a),i+=Y(a)):r.push(a)}return tw([...r,...n])}let tT={startPurchase({purchaseId:e}){let t=tg([eW.purchase.started,J(e,{size:32})]);return{handlerTypeDenominator:ee(eV.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=function(e,t){if(e.length!==t.length)throw new tS({expectedLength:e.length,givenLength:t.length});let r=tB(function({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(function e({param:t,value:r}){let n=function(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}(t.type);if(n){let[i,o]=n;return function(t,{length:r,param:n}){let i=null===r;if(!Array.isArray(t))throw new tC(t);if(!i&&t.length!==r)throw new tE({expectedLength:r,givenLength:t.length,type:`${n.type}[${r}]`});let o=!1,s=[];for(let r=0;r<t.length;r++){let i=e({param:n,value:t[r]});i.dynamic&&(o=!0),s.push(i)}if(i||o){let e=tB(s);if(i){let t=en(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?tw([t,e]):t}}if(o)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:tw(s.map(({encoded:e})=>e))}}(r,{length:i,param:{...t,type:o}})}if("tuple"===t.type)return function(t,{param:r}){let n=!1,i=[];for(let o=0;o<r.components.length;o++){let s=r.components[o],a=Array.isArray(t)?o:s.name,u=e({param:s,value:t[a]});i.push(u),u.dynamic&&(n=!0)}return{dynamic:n,encoded:n?tB(i):tw(i.map(({encoded:e})=>e))}}(r,{param:t});if("address"===t.type){var i=r;if(!tb(i))throw new tl({address:i});return{dynamic:!1,encoded:G(i.toLowerCase())}}if("bool"===t.type){var o=r;if("boolean"!=typeof o)throw new H(`Invalid boolean value: "${o}" (type: ${typeof o}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:G(et(o))}}if(t.type.startsWith("uint")||t.type.startsWith("int")){let e=t.type.startsWith("int"),[,,n="256"]=tP.exec(t.type)??[];return function(e,{signed:t,size:r=256}){if("number"==typeof r){let n=2n**(BigInt(r)-(t?1n:0n))-1n,i=t?-n-1n:0n;if(e>n||e<i)throw new K({max:n.toString(),min:i.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:en(e,{size:32,signed:t})}}(r,{signed:e,size:Number(n)})}if(t.type.startsWith("bytes"))return function(e,{param:t}){let[,r]=t.type.split("bytes"),n=Y(e);if(!r){let t=e;return n%32!=0&&(t=G(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:tw([G(en(n,{size:32})),t])}}if(n!==Number.parseInt(r))throw new tA({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:G(e,{dir:"right"})}}(r,{param:t});if("string"===t.type){var s=r;let e=eo(s),t=Math.ceil(Y(e)/32),n=[];for(let r=0;r<t;r++)n.push(G(function(e,t,r,{strict:n}={}){return $(e,{strict:!1})?function(e,t,r,{strict:n}={}){tO(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&tU(i,t,r),i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){tO(e,t);let i=e.slice(t,r);return n&&tU(i,t,r),i}(e,t,r,{strict:n})}(e,32*r,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:tw([G(en(Y(e),{size:32})),...n])}}throw new tI(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}({param:e[n],value:t[n]}));return r}({params:e,values:t}));return 0===r.length?"0x":r}([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=tg([eW.purchase.completed,r]);return{handlerTypeDenominator:ee(eV.purchase),interactionData:n}},unsafeCompletedPurchase({purchaseId:e}){let t=tg([eW.purchase.unsafeCompleted,J(e,{size:32})]);return{handlerTypeDenominator:ee(eV.purchase),interactionData:t}}},tL={open:()=>({handlerTypeDenominator:ee(eV.webshop),interactionData:eW.webshop.open})},tM={customerMeeting({agencyId:e}){let t=tg([eW.retail.customerMeeting,J(e,{size:32})]);return{handlerTypeDenominator:ee(eV.retail),interactionData:t}}}})(),n})());