onairos 0.1.310 → 0.1.311
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/dist/onairos.bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["React"],e);else{var n="object"==typeof exports?e(require("react")):e(t.React);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e,n,r,i,o={317:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>r});const r={}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(431);e.default=class{BigNum;constructor(){this.BigNum=(t,e)=>new(r.BigNumber.clone({DECIMAL_PLACES:e}))(t)}winstonToAr(t,{formatted:e=!1,decimals:n=12,trim:r=!0}={}){let i=this.stringToBigNum(t,n).shiftedBy(-12);return e?i.toFormat(n):i.toFixed(n)}arToWinston(t,{formatted:e=!1}={}){let n=this.stringToBigNum(t).shiftedBy(12);return e?n.toFormat():n.toFixed(0)}compare(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.comparedTo(r)}isEqual(t,e){return 0===this.compare(t,e)}isLessThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isLessThan(r)}isGreaterThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isGreaterThan(r)}add(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.plus(e).toFixed(0)}sub(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.minus(e).toFixed(0)}stringToBigNum(t,e=12){return this.BigNum(t,e)}}},759:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498);n(317);class i{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(t,e){this.api=t,this.network=e}async get(t){const e=await this.api.get(`${i.HASH_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getByHeight(t){const e=await this.api.get(`${i.HEIGHT_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getCurrent(){const{current:t}=await this.network.getInfo();return await this.get(t)}}e.default=i},879:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(244);e.default=class{api;constructor(t){this.api=t}async getTransactionOffset(t){const e=await this.api.get(`tx/${t}/offset`);if(200===e.status)return e.data;throw new Error(`Unable to get transaction offset: ${(0,r.getError)(e)}`)}async getChunk(t){const e=await this.api.get(`chunk/${t}`);if(200===e.status)return e.data;throw new Error(`Unable to get chunk: ${(0,r.getError)(e)}`)}async getChunkData(t){const e=await this.getChunk(t);return i.b64UrlToBuffer(e.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t){const e=await this.getTransactionOffset(t),n=parseInt(e.size),r=parseInt(e.offset)-n+1,i=new Uint8Array(n);let o=0;for(;o<n;){let t;this.api.config.logging&&console.log(`[chunk] ${o}/${n}`);try{t=await this.getChunkData(r+o)}catch(t){console.error(`[chunk] Failed to fetch chunk at offset ${r+o}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(!t)throw new Error(`Couldn't complete data download at ${o}/${n}`);i.set(t,o),o+=t.length}return i}}},536:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(586),i=n(874),o=n(363),s=n(248),a=n(935),c=n(927),l=n(825),u=n(244),h=n(243),d=n(879),f=n(759);class p{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new o.default;static utils=u;constructor(t){this.api=new i.default(t),this.wallets=new c.default(this.api,p.crypto),this.chunks=new d.default(this.api),this.transactions=new a.default(this.api,p.crypto,this.chunks),this.silo=new h.default(this.api,this.crypto,this.transactions),this.network=new s.default(this.api),this.blocks=new f.default(this.api,this.network),this.ar=new r.default}get crypto(){return p.crypto}get utils(){return p.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(t,e){const n={};if(Object.assign(n,t),!(t.data||t.target&&t.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(null==t.owner&&e&&"use_wallet"!==e&&(n.owner=e.n),null==t.last_tx&&(n.last_tx=await this.transactions.getTransactionAnchor()),"string"==typeof t.data&&(t.data=u.stringToBuffer(t.data)),t.data instanceof ArrayBuffer&&(t.data=new Uint8Array(t.data)),t.data&&!(t.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(null==t.reward){const e=t.data?t.data.byteLength:0;n.reward=await this.transactions.getPrice(e,n.target)}n.data_root="",n.data_size=t.data?t.data.byteLength.toString():"0",n.data=t.data||new Uint8Array(0);const r=new l.default(n);return await r.getSignatureData(),r}async createSiloTransaction(t,e,n){const r={};if(Object.assign(r,t),!t.data)throw new Error("Silo transactions must have a 'data' value");if(!n)throw new Error("No Silo URI specified.");if(t.target||t.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(null==t.owner){if(!e||!e.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");r.owner=e.n}null==t.last_tx&&(r.last_tx=await this.transactions.getTransactionAnchor());const i=await this.silo.parseUri(n);if("string"==typeof t.data){const e=await this.crypto.encrypt(u.stringToBuffer(t.data),i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}if(t.data instanceof Uint8Array){const e=await this.crypto.encrypt(t.data,i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}const o=new l.default(r);return o.addTag("Silo-Name",i.getAccessKey()),o.addTag("Silo-Version","0.1.0"),o}arql(t){return this.api.post("/arql",t).then((t=>t.data||[]))}}e.default=p},386:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0});const o=n(536),s=n(118);o.default.init=function(t={}){const e={host:"arweave.net",port:443,protocol:"https"};if("object"!=typeof location||!location.protocol||!location.hostname)return new o.default({...t,...e});const n=location.protocol.replace(":",""),r=location.hostname,i=location.port?parseInt(location.port):"https"==n?443:80,a=(0,s.getDefaultConfig)(n,r),c=t.protocol||a.protocol,l=t.host||a.host,u=t.port||a.port||i;return new o.default({...t,host:l,protocol:c,port:u})},"object"==typeof globalThis?globalThis.Arweave=o.default:"object"==typeof self&&(self.Arweave=o.default),i(n(536),e),e.default=o.default},874:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{METHOD_GET="GET";METHOD_POST="POST";config;constructor(t){this.applyConfig(t)}applyConfig(t){this.config=this.mergeDefaults(t)}getConfig(){return this.config}mergeDefaults(t){const e=t.protocol||"http",n=t.port||("https"===e?443:80);return{host:t.host||"127.0.0.1",protocol:e,port:n,timeout:t.timeout||2e4,logging:t.logging||!1,logger:t.logger||console.log,network:t.network}}async get(t,e){return await this.request(t,{...e,method:this.METHOD_GET})}async post(t,e,n){const r=new Headers(n?.headers||{});return r.get("content-type")?.includes("application/json")||r.append("content-type","application/json"),r.append("accept","application/json, text/plain, */*"),await this.request(t,{...n,method:this.METHOD_POST,body:"string"!=typeof e?JSON.stringify(e):e,headers:r})}async request(t,e){const r=new Headers(e?.headers||{}),i=`${this.config.protocol}://${this.config.host}:${this.config.port}`,o=e?.responseType;delete e?.responseType,t.startsWith("/")&&(t=t.slice(1)),this.config.network&&r.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${i}/${t}`);let s=await fetch(`${i}/${t}`,{...e||{},headers:r});this.config.logging&&this.config.logger(`Response: ${s.url} - ${s.status}`);const a=s.headers.get("content-type"),c=a?.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i)?.[1],l=s,u=async()=>{if(c)try{l.data=new TextDecoder(c).decode(await s.arrayBuffer())}catch(t){l.data=await s.text()}else l.data=await s.text()};if("arraybuffer"===o)l.data=await s.arrayBuffer();else if("text"===o)await u();else if("webstream"===o)l.data=n(s.body);else try{let t=await s.clone().json();"object"!=typeof t?await u():l.data=await s.json(),t=null}catch{await u()}return l}};const n=t=>{const e=t;return void 0===e[Symbol.asyncIterator]?(e[Symbol.asyncIterator]=r(t),e):t},r=function(t){return async function*(){const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}}},363:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);e.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){const r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if("undefined"==typeof crypto)return!1;const t=crypto?.subtle;if(void 0===t)return!1;return["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);const a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return r.concatBuffers([s,a])}async decrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return r.concatBuffers([a])}}},921:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(536);async function i(t){if(Array.isArray(t)){const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("list"),r.default.utils.stringToBuffer(t.length.toString())]);return await o(t,await r.default.crypto.hash(e,"SHA-384"))}const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("blob"),r.default.utils.stringToBuffer(t.byteLength.toString())]),n=r.default.utils.concatBuffers([await r.default.crypto.hash(e,"SHA-384"),await r.default.crypto.hash(t,"SHA-384")]);return await r.default.crypto.hash(n,"SHA-384")}async function o(t,e){if(t.length<1)return e;const n=r.default.utils.concatBuffers([e,await i(t[0])]),s=await r.default.crypto.hash(n,"SHA-384");return await o(t.slice(1),s)}e.default=i},498:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getError=void 0;class n extends Error{type;response;constructor(t,e={}){e.message?super(e.message):super(),this.type=t,this.response=e.response}getType(){return this.type}}e.default=n,e.getError=function(t){let e=t.data;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(t){}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{e=JSON.parse(e.toString())}catch(t){}return e?e.error||e:t.statusText||"unknown"}},224:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.debug=e.validatePath=e.arrayCompare=e.bufferToInt=e.intToBuffer=e.arrayFlatten=e.generateProofs=e.buildLayers=e.generateTransactionChunks=e.generateTree=e.computeRootHash=e.generateLeaves=e.chunkData=e.MIN_CHUNK_SIZE=e.MAX_CHUNK_SIZE=void 0;const r=n(536),i=n(244);e.MAX_CHUNK_SIZE=262144,e.MIN_CHUNK_SIZE=32768;const o=32,s=32;async function a(t){let n=[],i=t,o=0;for(;i.byteLength>=e.MAX_CHUNK_SIZE;){let t=e.MAX_CHUNK_SIZE,s=i.byteLength-e.MAX_CHUNK_SIZE;s>0&&s<e.MIN_CHUNK_SIZE&&(t=Math.ceil(i.byteLength/2));const a=i.slice(0,t),c=await r.default.crypto.hash(a);o+=a.byteLength,n.push({dataHash:c,minByteRange:o-a.byteLength,maxByteRange:o}),i=i.slice(t)}return n.push({dataHash:await r.default.crypto.hash(i),minByteRange:o,maxByteRange:o+i.byteLength}),n}async function c(t){return Promise.all(t.map((async({dataHash:t,minByteRange:e,maxByteRange:n})=>({type:"leaf",id:await m(await Promise.all([m(t),m(g(n))])),dataHash:t,minByteRange:e,maxByteRange:n}))))}async function l(t){return await u(await c(await a(t)))}async function u(t,e=0){if(t.length<2){return t[0]}const n=[];for(let e=0;e<t.length;e+=2)n.push(await p(t[e],t[e+1]));return u(n,e+1)}function h(t){const e=d(t);return Array.isArray(e)?f(e):[e]}function d(t,e=new Uint8Array,n=0){if("leaf"==t.type)return{offset:t.maxByteRange-1,proof:(0,i.concatBuffers)([e,t.dataHash,g(t.maxByteRange)])};if("branch"==t.type){const r=(0,i.concatBuffers)([e,t.leftChild.id,t.rightChild.id,g(t.byteRange)]);return[d(t.leftChild,r,n+1),d(t.rightChild,r,n+1)]}throw new Error("Unexpected node type")}function f(t){const e=[];return t.forEach((t=>{Array.isArray(t)?e.push(...f(t)):e.push(t)})),e}async function p(t,e){if(!e)return t;return{type:"branch",id:await m([await m(t.id),await m(e.id),await m(g(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function m(t){return Array.isArray(t)&&(t=r.default.utils.concatBuffers(t)),new Uint8Array(await r.default.crypto.hash(t))}function g(t){const e=new Uint8Array(o);for(var n=e.length-1;n>=0;n--){var r=t%256;e[n]=r,t=(t-r)/256}return e}function y(t){let e=0;for(var n=0;n<t.length;n++)e*=256,e+=t[n];return e}e.chunkData=a,e.generateLeaves=c,e.computeRootHash=async function(t){return(await l(t)).id},e.generateTree=l,e.generateTransactionChunks=async function(t){const e=await a(t),n=await c(e),r=await u(n),i=await h(r),o=e.slice(-1)[0];return o.maxByteRange-o.minByteRange==0&&(e.splice(e.length-1,1),i.splice(i.length-1,1)),{data_root:r.id,chunks:e,proofs:i}},e.buildLayers=u,e.generateProofs=h,e.arrayFlatten=f,e.intToBuffer=g,e.bufferToInt=y;e.arrayCompare=(t,e)=>t.every(((t,n)=>e[n]===t)),e.validatePath=async function t(n,r,i,a,c){if(a<=0)return!1;if(r>=a)return t(n,0,a-1,a,c);if(r<0)return t(n,0,0,a,c);if(c.length==s+o){const t=c.slice(0,s),r=c.slice(t.length,t.length+o),l=await m([await m(t),await m(r)]);return!!(0,e.arrayCompare)(n,l)&&{offset:a-1,leftBound:i,rightBound:a,chunkSize:a-i}}const l=c.slice(0,s),u=c.slice(l.length,l.length+s),h=c.slice(l.length+u.length,l.length+u.length+o),d=y(h),f=c.slice(l.length+u.length+h.length),p=await m([await m(l),await m(u),await m(h)]);return!!(0,e.arrayCompare)(n,p)&&(r<d?await t(l,r,i,Math.min(a,d),f):await t(u,r,Math.max(i,d),a,f))},e.debug=async function t(e,n=""){if(e.byteLength<1)return n;const r=e.slice(0,s),i=e.slice(r.length,r.length+s),a=e.slice(r.length+i.length,r.length+i.length+o),c=y(a),l=e.slice(r.length+i.length+a.length),u=await m([await m(r),await m(i),await m(a)]);return t(l,`${n}\n${JSON.stringify(Buffer.from(r))},${JSON.stringify(Buffer.from(i))},${c} => ${JSON.stringify(u)}`)}},246:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionUploader=void 0;const r=n(825),i=n(244),o=n(498),s=n(224),a=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"];class c{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(t,e){if(this.api=t,!e.id)throw new Error("Transaction is not signed");if(!e.chunks)throw new Error("Transaction chunks not prepared");this.data=e.data,this.transaction=new r.default(Object.assign({},e,{data:new Uint8Array(0)}))}async uploadChunk(t){if(this.isComplete)throw new Error("Upload is already complete");if(""!==this.lastResponseError?this.totalErrors++:this.totalErrors=0,100===this.totalErrors)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let e=""===this.lastResponseError?0:Math.max(this.lastRequestTimeEnd+4e4-Date.now(),4e4);if(e>0&&(e-=e*Math.random()*.3,await new Promise((t=>setTimeout(t,e)))),this.lastResponseError="",!this.txPosted)return void await this.postTransaction();t&&(this.chunkIndex=t);const n=this.transaction.getChunk(t||this.chunkIndex,this.data);if(!await(0,s.validatePath)(this.transaction.chunks.data_root,parseInt(n.offset),0,parseInt(n.data_size),i.b64UrlToBuffer(n.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);const r=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch((t=>(console.error(t.message),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,200==this.lastResponseStatus)this.chunkIndex++;else if(this.lastResponseError=(0,o.getError)(r),a.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(t,e,n){if(!e||"number"!=typeof e.chunkIndex||"object"!=typeof e.transaction)throw new Error("Serialized object does not match expected format.");var i=new r.default(e.transaction);i.chunks||await i.prepareChunks(n);const o=new c(t,i);if(o.chunkIndex=e.chunkIndex,o.lastRequestTimeEnd=e.lastRequestTimeEnd,o.lastResponseError=e.lastResponseError,o.lastResponseStatus=e.lastResponseStatus,o.txPosted=e.txPosted,o.data=n,o.transaction.data_root!==e.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return o}static async fromTransactionId(t,e){const n=await t.get(`tx/${e}`);if(200!==n.status)throw new Error(`Tx ${e} not found: ${n.status}`);const r=n.data;r.data=new Uint8Array(0);return{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:r}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=1){this.transaction.data=this.data;const t=await this.api.post("tx",this.transaction).catch((t=>(console.error(t),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,this.transaction.data=new Uint8Array(0),t.status>=200&&t.status<300)return this.txPosted=!0,void(this.chunkIndex=1);throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`)}const t=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,!(t.status>=200&&t.status<300))throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`);this.txPosted=!0}}e.TransactionUploader=c},825:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Tag=void 0;const r=n(244),i=n(921),o=n(224);class s{get(t,e){if(!Object.getOwnPropertyNames(this).includes(t))throw new Error(`Field "${t}" is not a property of the Arweave Transaction class.`);if(this[t]instanceof Uint8Array)return e&&e.decode&&e.string?r.bufferToString(this[t]):e&&e.decode&&!e.string?this[t]:r.bufferTob64Url(this[t]);if(this[t]instanceof Array){if(void 0!==e?.decode||void 0!==e?.string)throw"tags"===t&&console.warn("Did you mean to use 'transaction[\"tags\"]' ?"),new Error("Cannot decode or stringify an array.");return this[t]}return e&&1==e.decode?e&&e.string?r.b64UrlToString(this[t]):r.b64UrlToBuffer(this[t]):this[t]}}class a extends s{name;value;constructor(t,e,n=!1){super(),this.name=t,this.value=e}}e.Tag=a;e.default=class extends s{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(t={}){super(),Object.assign(this,t),"string"==typeof this.data&&(this.data=r.b64UrlToBuffer(this.data)),t.tags&&(this.tags=t.tags.map((t=>new a(t.name,t.value))))}addTag(t,e){this.tags.push(new a(r.stringToB64Url(t),r.stringToB64Url(e)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:r.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(t){this.owner=t}setSignature({id:t,owner:e,reward:n,tags:r,signature:i}){this.id=t,this.owner=e,n&&(this.reward=n),r&&(this.tags=r),this.signature=i}async prepareChunks(t){!this.chunks&&t.byteLength>0&&(this.chunks=await(0,o.generateTransactionChunks)(t),this.data_root=r.bufferTob64Url(this.chunks.data_root)),this.chunks||0!==t.byteLength||(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(t,e){if(!this.chunks)throw new Error("Chunks have not been prepared");const n=this.chunks.proofs[t],i=this.chunks.chunks[t];return{data_root:this.data_root,data_size:this.data_size,data_path:r.bufferTob64Url(n.proof),offset:n.offset.toString(),chunk:r.bufferTob64Url(e.slice(i.minByteRange,i.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let t=this.tags.reduce(((t,e)=>r.concatBuffers([t,e.get("name",{decode:!0,string:!1}),e.get("value",{decode:!0,string:!1})])),new Uint8Array);return r.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),t]);case 2:this.data_root||await this.prepareChunks(this.data);const e=this.tags.map((t=>[t.get("name",{decode:!0,string:!1}),t.get("value",{decode:!0,string:!1})]));return await(0,i.default)([r.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),e,r.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}}},244:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.b64UrlDecode=e.b64UrlEncode=e.bufferTob64Url=e.bufferTob64=e.b64UrlToBuffer=e.stringToB64Url=e.stringToBuffer=e.bufferToString=e.b64UrlToString=e.concatBuffers=void 0;const r=n(742);function i(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function o(t){return(new TextEncoder).encode(t)}function s(t){return new Uint8Array(r.toByteArray(u(t)))}function a(t){return r.fromByteArray(new Uint8Array(t))}function c(t){return l(a(t))}function l(t){try{return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(t){throw new Error("Failed to encode string",{cause:t})}}function u(t){try{let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}catch(t){throw new Error("Failed to decode string",{cause:t})}}e.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},e.b64UrlToString=function(t){return i(s(t))},e.bufferToString=i,e.stringToBuffer=o,e.stringToB64Url=function(t){return c(o(t))},e.b64UrlToBuffer=s,e.bufferTob64=a,e.bufferTob64Url=c,e.b64UrlEncode=l,e.b64UrlDecode=u},118:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultConfig=void 0;e.getDefaultConfig=(t,e)=>{if(((t,e)=>{const n=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,r=e.split("."),i=r[r.length-1],o=["localhost","[::1]"];return o.includes(e)||"file"==t||o.includes(i)||!!e.match(n)||!!i.match(n)})(t,e))return{protocol:"https",host:"arweave.net",port:443};if(!(t=>{const e="["===t.charAt(0);return!!t.match(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/)||e})(e)){let n=e.split(".");if(n.length>=3){n.shift();return{protocol:t,host:n.join(".")}}}return{protocol:t,host:e}}},248:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{api;constructor(t){this.api=t}getInfo(){return this.api.get("info").then((t=>t.data))}getPeers(){return this.api.get("peers").then((t=>t.data))}}},243:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SiloResource=void 0;const r=n(244);e.default=class{api;crypto;transactions;constructor(t,e,n){this.api=t,this.crypto=e,this.transactions=n}async get(t){if(!t)throw new Error("No Silo URI specified");const e=await this.parseUri(t),n=await this.transactions.search("Silo-Name",e.getAccessKey());if(0==n.length)throw new Error(`No data could be found for the Silo URI: ${t}`);const r=await this.transactions.get(n[0]);if(!r)throw new Error(`No data could be found for the Silo URI: ${t}`);const i=r.get("data",{decode:!0,string:!1});return this.crypto.decrypt(i,e.getEncryptionKey())}async readTransactionData(t,e){if(!e)throw new Error("No Silo URI specified");const n=await this.parseUri(e),r=t.get("data",{decode:!0,string:!1});return this.crypto.decrypt(r,n.getEncryptionKey())}async parseUri(t){const e=t.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!e)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");const n=e[1],o=Math.pow(2,parseInt(e[2])),s=await this.hash(r.stringToBuffer(n),o),a=r.bufferTob64(s.slice(0,15)),c=await this.hash(s.slice(16,31),1);return new i(t,a,c)}async hash(t,e){let n=await this.crypto.hash(t);for(let t=0;t<e-1;t++)n=await this.crypto.hash(n);return n}};class i{uri;accessKey;encryptionKey;constructor(t,e,n){this.uri=t,this.accessKey=e,this.encryptionKey=n}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}}e.SiloResource=i},935:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(825),o=n(244),s=n(246);n(317);e.default=class{api;crypto;chunks;constructor(t,e,n){this.api=t,this.crypto=e,this.chunks=n}async getTransactionAnchor(){const t=await this.api.get("tx_anchor");if(!t.data.match(/^[a-z0-9_-]{43,}/i)||!t.ok)throw new Error(`Could not getTransactionAnchor. Received: ${t.data}. Status: ${t.status}, ${t.statusText}`);return t.data}async getPrice(t,e){let n=e?`price/${t}/${e}`:`price/${t}`;const r=await this.api.get(n);if(!/^\d+$/.test(r.data)||!r.ok)throw new Error(`Could not getPrice. Received: ${r.data}. Status: ${r.status}, ${r.statusText}`);return r.data}async get(t){const e=await this.api.get(`tx/${t}`);if(200==e.status){const n=parseInt(e.data.data_size);if(e.data.format>=2&&n>0&&n<=12582912){const n=await this.getData(t);return new i.default({...e.data,data:n})}return new i.default({...e.data,format:e.data.format||1})}if(404==e.status)throw new r.default("TX_NOT_FOUND");if(410==e.status)throw new r.default("TX_FAILED");throw new r.default("TX_INVALID")}fromRaw(t){return new i.default(t)}async search(t,e){return this.api.post("arql",{op:"equals",expr1:t,expr2:e}).then((t=>t.data?t.data:[]))}getStatus(t){return this.api.get(`tx/${t}/status`).then((t=>200==t.status?{status:200,confirmed:t.data}:{status:t.status,confirmed:null}))}async getData(t,e){let n;try{n=await this.chunks.downloadChunkedData(t)}catch(e){console.error(`Error while trying to download chunked data for ${t}`),console.error(e)}if(!n){console.warn(`Falling back to gateway cache for ${t}`);try{const{data:e,ok:r,status:i,statusText:o}=await this.api.get(`/${t}`,{responseType:"arraybuffer"});if(!r)throw new Error("Bad http status code",{cause:{status:i,statusText:o}});n=e}catch(e){console.error(`Error while trying to download contiguous data from gateway cache for ${t}`),console.error(e)}}if(!n)throw new Error(`${t} data was not found!`);return e&&e.decode&&!e.string?n:e&&e.decode&&e.string?o.bufferToString(n):o.bufferTob64Url(n)}async sign(t,e,n){const r="object"==typeof e&&(t=>{let e=!0;return["n","e","d","p","q","dp","dq","qi"].map((n=>!(n in t)&&(e=!1))),e})(e),i="object"==typeof arweaveWallet;if(!r&&!i)throw new Error("No valid JWK or external wallet found to sign transaction.");if(r){t.setOwner(e.n);let r=await t.getSignatureData(),i=await this.crypto.sign(e,r,n),s=await this.crypto.hash(i);t.setSignature({id:o.bufferTob64Url(s),owner:e.n,signature:o.bufferTob64Url(i)})}else{if(!i)throw new Error("An error occurred while signing. Check wallet is valid");{try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}const e=await arweaveWallet.sign(t,n);t.setSignature({id:e.id,owner:e.owner,reward:e.reward,tags:e.tags,signature:e.signature})}}}async verify(t){const e=await t.getSignatureData(),n=t.get("signature",{decode:!0,string:!1}),r=o.bufferTob64Url(await this.crypto.hash(n));if(t.id!==r)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(t.owner,e,n)}async post(t){if("string"==typeof t?t=new i.default(JSON.parse(t)):"function"==typeof t.readInt32BE?t=new i.default(JSON.parse(t.toString())):"object"!=typeof t||t instanceof i.default||(t=new i.default(t)),!(t instanceof i.default))throw new Error("Must be Transaction object");t.chunks||await t.prepareChunks(t.data);const e=await this.getUploader(t,t.data);try{for(;!e.isComplete;)await e.uploadChunk()}catch(t){if(e.lastResponseStatus>0)return{status:e.lastResponseStatus,statusText:e.lastResponseError,data:{error:e.lastResponseError}};throw t}return{status:200,statusText:"OK",data:{}}}async getUploader(t,e){let n;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t instanceof i.default){if(e||(e=t.data),!(e instanceof Uint8Array))throw new Error("Data format is invalid");t.chunks||await t.prepareChunks(e),n=new s.TransactionUploader(this.api,t),n.data&&0!==n.data.length||(n.data=e)}else{if("string"==typeof t&&(t=await s.TransactionUploader.fromTransactionId(this.api,t)),!(e&&e instanceof Uint8Array))throw new Error("Must provide data when resuming upload");n=await s.TransactionUploader.fromSerialized(this.api,t,e)}return n}async*upload(t,e){const n=await this.getUploader(t,e);for(;!n.isComplete;)await n.uploadChunk(),yield n;return n}}},927:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);n(317);e.default=class{api;crypto;constructor(t,e){this.api=t,this.crypto=e}getBalance(t){return this.api.get(`wallet/${t}/balance`).then((t=>t.data))}getLastTransactionID(t){return this.api.get(`wallet/${t}/last_tx`).then((t=>t.data))}generate(){return this.crypto.generateJWK()}async jwkToAddress(t){return t&&"use_wallet"!==t?this.getAddress(t):this.getAddress()}async getAddress(t){if(t&&"use_wallet"!==t)return this.ownerToAddress(t.n);try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}async ownerToAddress(t){return r.bufferTob64Url(await this.crypto.hash(r.b64UrlToBuffer(t)))}}},742:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),u=0,h=c>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e);return l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},431:function(t,e,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,l="[BigNumber Error] ",u=l+"Number primitive has more than 15 significant digits: ",h=1e14,d=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,g=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function w(t){for(var e,n,r=1,i=t.length,o=t[0]+"";r<i;){for(e=t[r++]+"",n=d-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(t,e){var n,r,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,l=e.e;if(!s||!a)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=c==l,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return c==l?0:c>l^n?1:-1}function b(t,e,n,r){if(t<e||t>n||t!==c(t))throw Error(l+(r||"Argument")+("number"==typeof t?t<e||t>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function E(t){var e=t.c.length-1;return y(t.e/d)==e&&t.c[e]%2!=0}function S(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function T(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var n,r,i,o,x,A,k,R,P,C,I=z.prototype={constructor:z,toString:null,valueOf:null},O=new z(1),B=20,U=4,L=-7,N=21,_=-1e7,j=1e7,D=!1,M=1,V=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",W=!0;function z(t,e){var n,o,a,l,h,p,m,g,y=this;if(!(y instanceof z))return new z(t,e);if(null==e){if(t&&!0===t._isBigNumber)return y.s=t.s,void(!t.c||t.e>j?y.c=y.e=null:t.e<_?y.c=[y.e=0]:(y.e=t.e,y.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(y.s=1/t<0?(t=-t,-1):1,t===~~t){for(l=0,h=t;h>=10;h/=10,l++);return void(l>j?y.c=y.e=null:(y.e=l,y.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(y,g,p);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(l<0&&(l=h),l+=+g.slice(h+1),g=g.substring(0,h)):l<0&&(l=g.length)}else{if(b(e,2,K.length,"Base"),10==e&&W)return X(y=new z(t),B+y.e+1,U);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(y,g,p,e);if(y.s=1/t<0?(g=g.slice(1),-1):1,z.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(u+t)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(n=K.slice(0,e),l=h=0,m=g.length;h<m;h++)if(n.indexOf(o=g.charAt(h))<0){if("."==o){if(h>l){l=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,l=0;continue}return i(y,String(t),p,e)}p=!1,(l=(g=r(g,e,10,y.s)).indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(h=0;48===g.charCodeAt(h);h++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(h,++m)){if(m-=h,p&&z.DEBUG&&m>15&&(t>f||t!==c(t)))throw Error(u+y.s*t);if((l=l-h-1)>j)y.c=y.e=null;else if(l<_)y.c=[y.e=0];else{if(y.e=l,y.c=[],h=(l+1)%d,l<0&&(h+=d),h<m){for(h&&y.c.push(+g.slice(0,h)),m-=d;h<m;)y.c.push(+g.slice(h,h+=d));h=d-(g=g.slice(h)).length}else h-=m;for(;h--;g+="0");y.c.push(+g)}}else y.c=[y.e=0]}function H(t,e,n,r){var i,o,s,a,c;if(null==n?n=U:b(n,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=w(t.c),c=1==r||2==r&&(s<=L||s>=N)?S(c,s):T(c,s,"0");else if(o=(t=X(new z(t),e,n)).e,a=(c=w(t.c)).length,1==r||2==r&&(e<=o||o<=L)){for(;a<e;c+="0",a++);c=S(c,o)}else if(e-=s,c=T(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function $(t,e){for(var n,r,i=1,o=new z(t[0]);i<t.length;i++)(!(r=new z(t[i])).s||(n=v(o,r))===e||0===n&&o.s===e)&&(o=r);return o}function Z(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*d-1)>j?t.c=t.e=null:n<_?t.c=[t.e=0]:(t.e=n,t.c=e),t}function X(t,e,n,r){var i,o,s,l,u,f,m,g=t.c,y=p;if(g){t:{for(i=1,l=g[0];l>=10;l/=10,i++);if((o=e-i)<0)o+=d,s=e,u=g[f=0],m=c(u/y[i-s-1]%10);else if((f=a((o+1)/d))>=g.length){if(!r)break t;for(;g.length<=f;g.push(0));u=m=0,i=1,s=(o%=d)-d+1}else{for(u=l=g[f],i=1;l>=10;l/=10,i++);m=(s=(o%=d)-d+i)<0?0:c(u/y[i-s-1]%10)}if(r=r||e<0||null!=g[f+1]||(s<0?u:u%y[i-s-1]),r=n<4?(m||r)&&(0==n||n==(t.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(o>0?s>0?u/y[i-s]:0:g[f-1])%10&1||n==(t.s<0?8:7)),e<1||!g[0])return g.length=0,r?(e-=t.e+1,g[0]=y[(d-e%d)%d],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=f,l=1,f--):(g.length=f+1,l=y[d-o],g[f]=s>0?c(u/y[i-s]%y[s])*l:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=l,l=1;s>=10;s/=10,l++);o!=l&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=l,g[f]!=h)break;g[f--]=0,l=1}for(o=g.length;0===g[--o];g.pop());}t.e>j?t.c=t.e=null:t.e<_&&(t.c=[t.e=0])}return t}function G(t){var e,n=t.e;return null===n?t.toString():(e=w(t.c),e=n<=L||n>=N?S(e,n):T(e,n,"0"),t.s<0?"-"+e:e)}return z.clone=t,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(l+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(n=t[e],0,g,e),B=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(n=t[e],0,8,e),U=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(b(n[0],-g,0,e),b(n[1],0,g,e),L=n[0],N=n[1]):(b(n,-g,g,e),L=-(N=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)b(n[0],-g,-1,e),b(n[1],1,g,e),_=n[0],j=n[1];else{if(b(n,-g,g,e),!n)throw Error(l+e+" cannot be zero: "+n);_=-(j=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(l+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!n,Error(l+"crypto unavailable");D=n}else D=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(b(n=t[e],0,9,e),M=n),t.hasOwnProperty(e="POW_PRECISION")&&(b(n=t[e],0,g,e),V=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(l+e+" not an object: "+n);F=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(l+e+" invalid: "+n);W="0123456789"==n.slice(0,10),K=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:U,EXPONENTIAL_AT:[L,N],RANGE:[_,j],CRYPTO:D,MODULO_MODE:M,POW_PRECISION:V,FORMAT:F,ALPHABET:K}},z.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!z.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%d)<1&&(e+=d),String(r[0]).length==e){for(e=0;e<r.length;e++)if((n=r[e])<0||n>=h||n!==c(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(l+"Invalid BigNumber: "+t)},z.maximum=z.max=function(){return $(arguments,-1)},z.minimum=z.min=function(){return $(arguments,1)},z.random=(o=9007199254740992,x=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,s=0,u=[],h=new z(O);if(null==t?t=B:b(t,0,g),i=a(t/d),D)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[s]=n[0],e[s+1]=n[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw D=!1,Error(l+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(u.push(o%1e14),s+=7);s=i/7}if(!D)for(;s<i;)(o=x())<9e15&&(u[s++]=o%1e14);for(i=u[--s],t%=d,i&&t&&(o=p[d-t],u[s]=c(i/o)*o);0===u[s];u.pop(),s--);if(s<0)u=[r=0];else{for(r=-1;0===u[0];u.splice(0,1),r-=d);for(s=1,o=u[0];o>=10;o/=10,s++);s<d&&(r-=d-s)}return h.e=r,h.c=u,h}),z.sum=function(){for(var t=1,e=arguments,n=new z(e[0]);t<e.length;)n=n.plus(e[t++]);return n},r=function(){var t="0123456789";function e(t,e,n,r){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=r.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var c,l,u,h,d,f,p,m,g=r.indexOf("."),y=B,v=U;for(g>=0&&(h=V,V=0,r=r.replace(".",""),f=(m=new z(i)).pow(r.length-g),V=h,m.c=e(T(w(f.c),f.e,"0"),10,o,t),m.e=m.c.length),u=h=(p=e(r,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--u:(f.c=p,f.e=u,f.s=s,p=(f=n(f,m,y,v,o)).c,d=f.r,u=f.e),g=p[l=u+y+1],h=o/2,d=d||l<0||null!=p[l+1],d=v<4?(null!=g||d)&&(0==v||v==(f.s<0?3:2)):g>h||g==h&&(4==v||d||6==v&&1&p[l-1]||v==(f.s<0?8:7)),l<1||!p[0])r=d?T(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(p.length=l,d)for(--o;++p[--l]>o;)p[l]=0,l||(++u,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,r="";g<=h;r+=c.charAt(p[g++]));r=T(r,u,c.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,c=t.length,l=e%m,u=e/m|0;for(t=t.slice();c--;)a=((i=l*(o=t[c]%m)+(r=u*o+(s=t[c]/m|0)*l)%m*m+a)/n|0)+(r/m|0)+u*s,t[c]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]<e[n]?1:0,t[n]=i*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(r,i,o,s,a){var l,u,f,p,m,g,w,v,b,E,S,T,x,A,k,R,P,C=r.s==i.s?1:-1,I=r.c,O=i.c;if(!(I&&I[0]&&O&&O[0]))return new z(r.s&&i.s&&(I?!O||I[0]!=O[0]:O)?I&&0==I[0]||!O?0*C:C/0:NaN);for(b=(v=new z(C)).c=[],C=o+(u=r.e-i.e)+1,a||(a=h,u=y(r.e/d)-y(i.e/d),C=C/d|0),f=0;O[f]==(I[f]||0);f++);if(O[f]>(I[f]||0)&&u--,C<0)b.push(1),p=!0;else{for(A=I.length,R=O.length,f=0,C+=2,(m=c(a/(O[0]+1)))>1&&(O=t(O,m,a),I=t(I,m,a),R=O.length,A=I.length),x=R,S=(E=I.slice(0,R)).length;S<R;E[S++]=0);P=O.slice(),P=[0].concat(P),k=O[0],O[1]>=a/2&&k++;do{if(m=0,(l=e(O,E,R,S))<0){if(T=E[0],R!=S&&(T=T*a+(E[1]||0)),(m=c(T/k))>1)for(m>=a&&(m=a-1),w=(g=t(O,m,a)).length,S=E.length;1==e(g,E,w,S);)m--,n(g,R<w?P:O,w,a),w=g.length,l=1;else 0==m&&(l=m=1),w=(g=O.slice()).length;if(w<S&&(g=[0].concat(g)),n(E,g,S,a),S=E.length,-1==l)for(;e(O,E,R,S)<1;)m++,n(E,R<S?P:O,S,a),S=E.length}else 0===l&&(m++,E=[0]);b[f++]=m,E[0]?E[S++]=I[x]||0:(E=[I[x]],S=1)}while((x++<A||null!=E[0])&&C--);p=null!=E[0],b[0]||b.splice(0,1)}if(a==h){for(f=1,C=b[0];C>=10;C/=10,f++);X(v,o+(v.e=f+u*d-1)+1,s,p)}else v.e=u,v.r=+p;return v}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,R=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(C,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(A,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(k,"$1").replace(R,"0.$1")),e!=o))return new z(o,i);if(z.DEBUG)throw Error(l+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},I.absoluteValue=I.abs=function(){var t=new z(this);return t.s<0&&(t.s=1),t},I.comparedTo=function(t,e){return v(this,new z(t,e))},I.decimalPlaces=I.dp=function(t,e){var n,r,i,o=this;if(null!=t)return b(t,0,g),null==e?e=U:b(e,0,8),X(new z(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/d))*d,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},I.dividedBy=I.div=function(t,e){return n(this,new z(t,e),B,U)},I.dividedToIntegerBy=I.idiv=function(t,e){return n(this,new z(t,e),0,1)},I.exponentiatedBy=I.pow=function(t,e){var n,r,i,o,s,u,h,f,p=this;if((t=new z(t)).c&&!t.isInteger())throw Error(l+"Exponent not an integer: "+G(t));if(null!=e&&(e=new z(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new z(Math.pow(+G(p),s?t.s*(2-E(t)):+G(t))),e?f.mod(e):f;if(u=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new z(NaN);(r=!u&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&E(t)?-0:0,p.e>-1&&(o=1/o),new z(u?1/o:o);V&&(o=a(V/d+2))}for(s?(n=new z(.5),u&&(t.s=1),h=E(t)):h=(i=Math.abs(+G(t)))%2,f=new z(O);;){if(h){if(!(f=f.times(p)).c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(X(t=t.times(n),t.e+1,1),t.e>14)h=E(t);else{if(0===(i=+G(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(e))}return r?f:(u&&(f=O.div(f)),e?f.mod(e):o?X(f,V,U,undefined):f)},I.integerValue=function(t){var e=new z(this);return null==t?t=U:b(t,0,8),X(e,e.e+1,t)},I.isEqualTo=I.eq=function(t,e){return 0===v(this,new z(t,e))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(t,e){return v(this,new z(t,e))>0},I.isGreaterThanOrEqualTo=I.gte=function(t,e){return 1===(e=v(this,new z(t,e)))||0===e},I.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},I.isLessThan=I.lt=function(t,e){return v(this,new z(t,e))<0},I.isLessThanOrEqualTo=I.lte=function(t,e){return-1===(e=v(this,new z(t,e)))||0===e},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new z(t,e)).s,!a||!e)return new z(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/d,l=t.e/d,u=s.c,f=t.c;if(!c||!l){if(!u||!f)return u?(t.s=-e,t):new z(f?s:NaN);if(!u[0]||!f[0])return f[0]?(t.s=-e,t):new z(u[0]?s:3==U?-0:0)}if(c=y(c),l=y(l),u=u.slice(),a=c-l){for((o=a<0)?(a=-a,i=u):(l=c,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=u.length)<(e=f.length))?a:e,a=e=0;e<r;e++)if(u[e]!=f[e]){o=u[e]<f[e];break}if(o&&(i=u,u=f,f=i,t.s=-t.s),(e=(r=f.length)-(n=u.length))>0)for(;e--;u[n++]=0);for(e=h-1;r>a;){if(u[--r]<f[r]){for(n=r;n&&!u[--n];u[n]=e);--u[n],u[r]+=h}u[r]-=f[r]}for(;0==u[0];u.splice(0,1),--l);return u[0]?Z(t,u,l):(t.s=3==U?-1:1,t.c=[t.e=0],t)},I.modulo=I.mod=function(t,e){var r,i,o=this;return t=new z(t,e),!o.c||!t.s||t.c&&!t.c[0]?new z(NaN):!t.c||o.c&&!o.c[0]?new z(o):(9==M?(i=t.s,t.s=1,r=n(o,t,0,3),t.s=i,r.s*=i):r=n(o,t,0,M),(t=o.minus(r.times(t))).c[0]||1!=M||(t.s=o.s),t)},I.multipliedBy=I.times=function(t,e){var n,r,i,o,s,a,c,l,u,f,p,g,w,v,b,E=this,S=E.c,T=(t=new z(t,e)).c;if(!(S&&T&&S[0]&&T[0]))return!E.s||!t.s||S&&!S[0]&&!T||T&&!T[0]&&!S?t.c=t.e=t.s=null:(t.s*=E.s,S&&T?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=y(E.e/d)+y(t.e/d),t.s*=E.s,(c=S.length)<(f=T.length)&&(w=S,S=T,T=w,i=c,c=f,f=i),i=c+f,w=[];i--;w.push(0));for(v=h,b=m,i=f;--i>=0;){for(n=0,p=T[i]%b,g=T[i]/b|0,o=i+(s=c);o>i;)n=((l=p*(l=S[--s]%b)+(a=g*l+(u=S[s]/b|0)*p)%b*b+w[o]+n)/v|0)+(a/b|0)+g*u,w[o--]=l%v;w[o]=n}return n?++r:w.splice(0,1),Z(t,w,r)},I.negated=function(){var t=new z(this);return t.s=-t.s||null,t},I.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new z(t,e)).s,!i||!e)return new z(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/d,s=t.e/d,a=r.c,c=t.c;if(!o||!s){if(!a||!c)return new z(i/0);if(!a[0]||!c[0])return c[0]?t:new z(a[0]?r:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=c.length)<0&&(n=c,c=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),Z(t,a,s)},I.precision=I.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return b(t,1,g),null==e?e=U:b(e,0,8),X(new z(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*d+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},I.shiftedBy=function(t){return b(t,-9007199254740991,f),this.times("1e"+t)},I.squareRoot=I.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,c=s.s,l=s.e,u=B+4,h=new z("0.5");if(1!==c||!a||!a[0])return new z(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+G(s)))||c==1/0?(((e=w(a)).length+l)%2==0&&(e+="0"),c=Math.sqrt(+e),l=y((l+1)/2)-(l<0||l%2),r=new z(e=c==1/0?"5e"+l:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+l)):r=new z(c+""),r.c[0])for((c=(l=r.e)+u)<3&&(c=0);;)if(o=r,r=h.times(o.plus(n(s,o,u,1))),w(o.c).slice(0,c)===(e=w(r.c)).slice(0,c)){if(r.e<l&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(X(r,r.e+B+2,1),t=!r.times(r).eq(s));break}if(!i&&(X(o,o.e+B+2,0),o.times(o).eq(s))){r=o;break}u+=4,c+=4,i=1}return X(r,r.e+B+1,U,t)},I.toExponential=function(t,e){return null!=t&&(b(t,0,g),t++),H(this,t,e,1)},I.toFixed=function(t,e){return null!=t&&(b(t,0,g),t=t+this.e+1),H(this,t,e)},I.toFormat=function(t,e,n){var r,i=this;if(null==n)null!=t&&e&&"object"==typeof e?(n=e,e=null):t&&"object"==typeof t?(n=t,t=e=null):n=F;else if("object"!=typeof n)throw Error(l+"Argument not an object: "+n);if(r=i.toFixed(t,e),i.c){var o,s=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",h=s[0],d=s[1],f=i.s<0,p=f?h.slice(1):h,m=p.length;if(c&&(o=a,a=c,c=o,m-=o),a>0&&m>0){for(o=m%a||a,h=p.substr(0,o);o<m;o+=a)h+=u+p.substr(o,a);c>0&&(h+=u+p.slice(o)),f&&(h="-"+h)}r=d?h+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):h}return(n.prefix||"")+r+(n.suffix||"")},I.toFraction=function(t){var e,r,i,o,s,a,c,u,h,f,m,g,y=this,v=y.c;if(null!=t&&(!(c=new z(t)).isInteger()&&(c.c||1!==c.s)||c.lt(O)))throw Error(l+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+G(c));if(!v)return new z(y);for(e=new z(O),h=r=new z(O),i=u=new z(O),g=w(v),s=e.e=g.length-y.e-1,e.c[0]=p[(a=s%d)<0?d+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=j,j=1/0,c=new z(g),u.c[0]=0;f=n(c,e,0,1),1!=(o=r.plus(f.times(i))).comparedTo(t);)r=i,i=o,h=u.plus(f.times(o=h)),u=o,e=c.minus(f.times(o=e)),c=o;return o=n(t.minus(r),i,0,1),u=u.plus(o.times(h)),r=r.plus(o.times(i)),u.s=h.s=y.s,m=n(h,i,s*=2,U).minus(y).abs().comparedTo(n(u,r,s,U).minus(y).abs())<1?[h,i]:[u,r],j=a,m},I.toNumber=function(){return+G(this)},I.toPrecision=function(t,e){return null!=t&&b(t,1,g),H(this,t,e,2)},I.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=L||o>=N?S(w(n.c),o):T(w(n.c),o,"0"):10===t&&W?e=T(w((n=X(new z(n),B+o+1,U)).c),n.e,"0"):(b(t,2,K.length,"Base"),e=r(T(w(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},I.valueOf=I.toJSON=function(){return G(this)},I._isBigNumber=!0,null!=e&&z.set(e),z}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}()},764:(t,e,n)=>{"use strict";const r=n(742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.lW=c,e.h2=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return l(t,e,n)}function l(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);const i=function(t){if(c.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||Y(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return u(t),a(t<0?0:0|p(t))}function d(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function f(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,c.prototype),r}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(t).length;default:if(i)return r?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return P(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function w(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function b(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(Y(r))return s;t[n+s]=r}return s}function E(t,e,n,r){return X($(e,t.length-n),t,n,r)}function S(t,e,n,r){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return X(Z(e),t,n,r)}function x(t,e,n,r){return X(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=R));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,n){return l(t,e,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,n){return function(t,e,n){return u(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(G(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),G(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).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}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=c.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(G(e,Uint8Array))i+e.length>r.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)y(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){let t="";const n=e.h2;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,i){if(G(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<a;++t)if(l[t]!==u[t]){o=l[t],s=u[t];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return w(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return w(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return S(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function I(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=q[t[r]];return i}function O(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function B(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function N(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function _(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function D(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),c.prototype.readBigInt64BE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),c.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=J((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return N(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=c.isBuffer(t)?t:c.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const M={};function V(t,e,n){M[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function F(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function K(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new M.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){W(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||z(e,t.length-(n+1))}(r,i,o)}function W(t,e){if("number"!=typeof t)throw new M.ERR_INVALID_ARG_TYPE(e,"number",t)}function z(t,e,n){if(Math.floor(t)!==t)throw W(t,n),new M.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=F(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function $(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},470:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===n.call(t)},s=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var r,i=e.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!i&&!o)return!1;for(r in t);return void 0===r||e.call(t,r)},a=function(t,e){r&&"__proto__"===e.name?r(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},c=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(i)return i(t,n).value}return t[n]};t.exports=function t(){var e,n,r,i,l,u,h=arguments[0],d=1,f=arguments.length,p=!1;for("boolean"==typeof h&&(p=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<f;++d)if(null!=(e=arguments[d]))for(n in e)r=c(h,n),h!==(i=c(e,n))&&(p&&i&&(s(i)||(l=o(i)))?(l?(l=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},a(h,{name:n,newValue:t(p,u,i)})):void 0!==i&&a(h,{name:n,newValue:i}));return h}},645:(t,e)=>{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}},703:(t,e,n)=>{"use strict";var r=n(414);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},697:(t,e,n)=>{t.exports=n(703)()},414:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},251:(t,e,n)=>{"use strict";var r=n(639),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(t,e,n){var r,o={},l=null,u=null;for(r in void 0!==n&&(l=""+n),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(u=e.ref),e)s.call(e,r)&&!c.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===o[r]&&(o[r]=e[r]);return{$$typeof:i,type:t,key:l,ref:u,props:o,_owner:a.current}}e.jsx=l,e.jsxs=l},893:(t,e,n)=>{"use strict";t.exports=n(251)},639:e=>{"use strict";e.exports=t}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return o[t].call(n.exports,n,n.exports,a),n.exports}a.m=o,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},n=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var i=Object.create(null);a.r(i);var o={};e=e||[null,n({}),n([]),n(n)];for(var s=2&r&&t;"object"==typeof s&&!~e.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,a.d(i,o),i},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,n)=>(a.f[n](t,e),e)),[])),a.u=t=>t+".onairos.bundle.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r={},i="onairos:",a.l=(t,e,n,o)=>{if(r[t])r[t].push(e);else{var s,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var h=l[u];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==i+n){s=h;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",i+n),s.src=t),r[t]=[e];var d=(e,n)=>{s.onerror=s.onload=null,clearTimeout(f);var i=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((t=>t(n))),e)return e(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&!t;)t=n[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={179:0};a.f.j=(e,n)=>{var r=a.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,i)=>r=t[e]=[n,i]));n.push(r[2]=i);var o=a.p+a.u(e),s=new Error;a.l(o,(n=>{if(a.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",s.name="ChunkLoadError",s.type=i,s.request=o,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,i,o=n[0],s=n[1],c=n[2],l=0;if(o.some((e=>0!==t[e]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(c)c(a)}for(e&&e(n);l<o.length;l++)i=o[l],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},n=this.webpackChunkonairos=this.webpackChunkonairos||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var c={};return(()=>{"use strict";a.r(c),a.d(c,{Onairos:()=>Gh});var t={};a.r(t),a.d(t,{hasBrowserEnv:()=>ee,hasStandardBrowserEnv:()=>ne,hasStandardBrowserWebWorkerEnv:()=>ie});var e=a(639),n=a.n(e),r=a(764);function i(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==a.g?a.g:"undefined"!=typeof self?self:{};function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function l(t,e){return t(e={exports:{}},e.exports),e.exports}var u=l((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){var t=this;this.locked=new Map,this.addToLocked=function(e,n){var r=t.locked.get(e);void 0===r?void 0===n?t.locked.set(e,[]):t.locked.set(e,[n]):void 0!==n&&(r.unshift(n),t.locked.set(e,r))},this.isLocked=function(e){return t.locked.has(e)},this.lock=function(e){return new Promise((function(n,r){t.isLocked(e)?t.addToLocked(e,n):(t.addToLocked(e),n())}))},this.unlock=function(e){var n=t.locked.get(e);if(void 0!==n&&0!==n.length){var r=n.pop();t.locked.set(e,n),void 0!==r&&setTimeout(r,0)}else t.locked.delete(e)}}return t.getInstance=function(){return void 0===t.instance&&(t.instance=new t),t.instance},t}();e.default=function(){return n.getInstance()}}));s(u);var h=s(l((function(t,e){var n=o&&o.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(s,a)}c((r=r.apply(t,e||[])).next())}))},r=o&&o.__generator||function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=o;Object.defineProperty(e,"__esModule",{value:!0});var s="browser-tabs-lock-key",a={key:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},getItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},clear:function(){return n(i,void 0,void 0,(function(){return r(this,(function(t){return[2,window.localStorage.clear()]}))}))},removeItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},setItem:function(t,e){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},keySync:function(t){return window.localStorage.key(t)},getItemSync:function(t){return window.localStorage.getItem(t)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(t){return window.localStorage.removeItem(t)},setItemSync:function(t,e){return window.localStorage.setItem(t,e)}};function c(t){return new Promise((function(e){return setTimeout(e,t)}))}function l(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",n="",r=0;r<t;r++)n+=e[Math.floor(61*Math.random())];return n}var h=function(){function t(e){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+l(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=e,void 0===t.waiters&&(t.waiters=[])}return t.prototype.acquireLock=function(e,i){return void 0===i&&(i=5e3),n(this,void 0,void 0,(function(){var n,o,u,h,d,f,p;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+l(4),o=Date.now()+i,u=s+"-"+e,h=void 0===this.storageHandler?a:this.storageHandler,r.label=1;case 1:return Date.now()<o?[4,c(30)]:[3,8];case 2:return r.sent(),null!==h.getItemSync(u)?[3,5]:(d=this.id+"-"+e+"-"+n,[4,c(Math.floor(25*Math.random()))]);case 3:return r.sent(),h.setItemSync(u,JSON.stringify({id:this.id,iat:n,timeoutKey:d,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:return r.sent(),null!==(f=h.getItemSync(u))&&(p=JSON.parse(f)).id===this.id&&p.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(u,n),[2,!0]):[3,7];case 5:return t.lockCorrector(void 0===this.storageHandler?a:this.storageHandler),[4,this.waitForSomethingToChange(o)];case 6:r.sent(),r.label=7;case 7:return n=Date.now()+l(4),[3,1];case 8:return[2,!1]}}))}))},t.prototype.refreshLockWhileAcquired=function(t,e){return n(this,void 0,void 0,(function(){var i=this;return r(this,(function(o){return setTimeout((function(){return n(i,void 0,void 0,(function(){var n,i,o;return r(this,(function(r){switch(r.label){case 0:return[4,u.default().lock(e)];case 1:return r.sent(),this.acquiredIatSet.has(e)?(n=void 0===this.storageHandler?a:this.storageHandler,null===(i=n.getItemSync(t))?(u.default().unlock(e),[2]):((o=JSON.parse(i)).timeRefreshed=Date.now(),n.setItemSync(t,JSON.stringify(o)),u.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2])):(u.default().unlock(e),[2])}}))}))}),1e3),[2]}))}))},t.prototype.waitForSomethingToChange=function(e){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){var r=!1,i=Date.now(),o=!1;function s(){if(o||(window.removeEventListener("storage",s),t.removeFromWaiting(s),clearTimeout(a),o=!0),!r){r=!0;var e=50-(Date.now()-i);e>0?setTimeout(n,e):n(null)}}window.addEventListener("storage",s),t.addToWaiting(s);var a=setTimeout(s,Math.max(0,e-Date.now()))}))];case 1:return n.sent(),[2]}}))}))},t.addToWaiting=function(e){this.removeFromWaiting(e),void 0!==t.waiters&&t.waiters.push(e)},t.removeFromWaiting=function(e){void 0!==t.waiters&&(t.waiters=t.waiters.filter((function(t){return t!==e})))},t.notifyWaiters=function(){void 0!==t.waiters&&t.waiters.slice().forEach((function(t){return t()}))},t.prototype.releaseLock=function(t){return n(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.releaseLock__private__(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.releaseLock__private__=function(e){return n(this,void 0,void 0,(function(){var n,i,o,c;return r(this,(function(r){switch(r.label){case 0:return n=void 0===this.storageHandler?a:this.storageHandler,i=s+"-"+e,null===(o=n.getItemSync(i))?[2]:(c=JSON.parse(o)).id!==this.id?[3,2]:[4,u.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(i),u.default().unlock(c.iat),t.notifyWaiters(),r.label=2;case 2:return[2]}}))}))},t.lockCorrector=function(e){for(var n=Date.now()-5e3,r=e,i=[],o=0;;){var a=r.keySync(o);if(null===a)break;i.push(a),o++}for(var c=!1,l=0;l<i.length;l++){var u=i[l];if(u.includes(s)){var h=r.getItemSync(u);if(null!==h){var d=JSON.parse(h);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(u),c=!0)}}}c&&t.notifyWaiters()},t.waiters=void 0,t}();e.default=h})));const d={timeoutInSeconds:60},f={name:"auth0-spa-js",version:"2.1.3"},p=()=>Date.now();class m extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,m.prototype)}static fromPayload({error:t,error_description:e}){return new m(t,e)}}class g extends m{constructor(t,e,n,r=null){super(t,e),this.state=n,this.appState=r,Object.setPrototypeOf(this,g.prototype)}}class y extends m{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,y.prototype)}}class w extends y{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,w.prototype)}}class v extends m{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,v.prototype)}}class b extends m{constructor(t,e,n){super(t,e),this.mfa_token=n,Object.setPrototypeOf(this,b.prototype)}}class E extends m{constructor(t,e){super("missing_refresh_token",`Missing Refresh Token (audience: '${S(t,["default"])}', scope: '${S(e)}')`),this.audience=t,this.scope=e,Object.setPrototypeOf(this,E.prototype)}}function S(t,e=[]){return t&&!e.includes(t)?t:""}const T=()=>window.crypto,x=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(T().getRandomValues(new Uint8Array(43))).forEach((n=>e+=t[n%66])),e},A=t=>btoa(t),k=t=>{var{clientId:e}=t,n=i(t,["clientId"]);return new URLSearchParams((t=>Object.keys(t).filter((e=>void 0!==t[e])).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t[n]})),{}))(Object.assign({client_id:e},n))).toString()},R=t=>(t=>decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),P=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},C=async(t,e,n,r,i,o,s=1e4)=>i?(async(t,e,n,r,i,o,s)=>{return a={auth:{audience:e,scope:n},timeout:i,fetchUrl:t,fetchOptions:r,useFormData:s},c=o,new Promise((function(t,e){const n=new MessageChannel;n.port1.onmessage=function(r){r.data.error?e(new Error(r.data.error)):t(r.data),n.port1.close()},c.postMessage(a,[n.port2])}));var a,c})(t,e,n,r,s,i,o):(async(t,e,n)=>{const r=new AbortController;let i;return e.signal=r.signal,Promise.race([P(t,e),new Promise(((t,e)=>{i=setTimeout((()=>{r.abort(),e(new Error("Timeout when executing 'fetch'"))}),n)}))]).finally((()=>{clearTimeout(i)}))})(t,r,s);async function I(t,e){var{baseUrl:n,timeout:r,audience:o,scope:s,auth0Client:a,useFormData:c}=t,l=i(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const u=c?k(l):JSON.stringify(l);return await async function(t,e,n,r,o,s,a){let c,l=null;for(let i=0;i<3;i++)try{c=await C(t,n,r,o,s,a,e),l=null;break}catch(t){l=t}if(l)throw l;const u=c.json,{error:h,error_description:d}=u,f=i(u,["error","error_description"]),{ok:p}=c;if(!p){const e=d||`HTTP error. Unable to fetch ${t}`;if("mfa_required"===h)throw new b(h,e,f.mfa_token);if("missing_refresh_token"===h)throw new E(n,r);throw new m(h||"request_error",e)}return f}(`${n}/oauth/token`,r,o||"default",s,{method:"POST",body:u,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||f))}},e,c)}const O=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class B{constructor(t,e="@@auth0spajs@@",n){this.prefix=e,this.suffix=n,this.clientId=t.clientId,this.scope=t.scope,this.audience=t.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(t){const[e,n,r,i]=t.split("::");return new B({clientId:n,scope:i,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:n,client_id:r}=t;return new B({scope:e,audience:n,clientId:r})}}class U{set(t,e){localStorage.setItem(t,JSON.stringify(e))}get(t){const e=window.localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return}}remove(t){localStorage.removeItem(t)}allKeys(){return Object.keys(window.localStorage).filter((t=>t.startsWith("@@auth0spajs@@")))}}class L{constructor(){this.enclosedCache=function(){let t={};return{set(e,n){t[e]=n},get(e){const n=t[e];if(n)return n},remove(e){delete t[e]},allKeys:()=>Object.keys(t)}}()}}class N{constructor(t,e,n){this.cache=t,this.keyManifest=e,this.nowProvider=n||p}async setIdToken(t,e,n){var r;const i=this.getIdTokenCacheKey(t);await this.cache.set(i,{id_token:e,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(i))}async getIdToken(t){const e=await this.cache.get(this.getIdTokenCacheKey(t.clientId));if(!e&&t.scope&&t.audience){const e=await this.get(t);if(!e)return;if(!e.id_token||!e.decodedToken)return;return{id_token:e.id_token,decodedToken:e.decodedToken}}if(e)return{id_token:e.id_token,decodedToken:e.decodedToken}}async get(t,e=0){var n;let r=await this.cache.get(t.toKey());if(!r){const e=await this.getCacheKeys();if(!e)return;const n=this.matchExistingCacheKey(t,e);n&&(r=await this.cache.get(n))}if(!r)return;const i=await this.nowProvider(),o=Math.floor(i/1e3);return r.expiresAt-e<o?r.body.refresh_token?(r.body={refresh_token:r.body.refresh_token},await this.cache.set(t.toKey(),r),r.body):(await this.cache.remove(t.toKey()),void await(null===(n=this.keyManifest)||void 0===n?void 0:n.remove(t.toKey()))):r.body}async set(t){var e;const n=new B({clientId:t.client_id,scope:t.scope,audience:t.audience}),r=await this.wrapCacheEntry(t);await this.cache.set(n.toKey(),r),await(null===(e=this.keyManifest)||void 0===e?void 0:e.add(n.toKey()))}async clear(t){var e;const n=await this.getCacheKeys();n&&(await n.filter((e=>!t||e.includes(t))).reduce((async(t,e)=>{await t,await this.cache.remove(e)}),Promise.resolve()),await(null===(e=this.keyManifest)||void 0===e?void 0:e.clear()))}async wrapCacheEntry(t){const e=await this.nowProvider();return{body:t,expiresAt:Math.floor(e/1e3)+t.expires_in}}async getCacheKeys(){var t;return this.keyManifest?null===(t=await this.keyManifest.get())||void 0===t?void 0:t.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(t){return new B({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter((e=>{var n;const r=B.fromKey(e),i=new Set(r.scope&&r.scope.split(" ")),o=(null===(n=t.scope)||void 0===n?void 0:n.split(" "))||[],s=r.scope&&o.reduce(((t,e)=>t&&i.has(e)),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===t.clientId&&r.audience===t.audience&&s}))[0]}}class _{constructor(t,e,n){this.storage=t,this.clientId=e,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(t){this.storage.save(this.storageKey,t,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const j=t=>"number"==typeof t,D=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var M=l((function(t,e){var n=o&&o.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t,e){if(!e)return"";var n="; "+t;return!0===e?n:n+"="+e}function i(t,e,n){return encodeURIComponent(t).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(e).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(t){if("number"==typeof t.expires){var e=new Date;e.setMilliseconds(e.getMilliseconds()+864e5*t.expires),t.expires=e}return r("Expires",t.expires?t.expires.toUTCString():"")+r("Domain",t.domain)+r("Path",t.path)+r("Secure",t.secure)+r("SameSite",t.sameSite)}(n)}function s(t){for(var e={},n=t?t.split("; "):[],r=/(%[\dA-F]{2})+/gi,i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");'"'===s.charAt(0)&&(s=s.slice(1,-1));try{e[o[0].replace(r,decodeURIComponent)]=s.replace(r,decodeURIComponent)}catch(t){}}return e}function a(){return s(document.cookie)}function c(t,e,r){document.cookie=i(t,e,n({path:"/"},r))}e.__esModule=!0,e.encode=i,e.parse=s,e.getAll=a,e.get=function(t){return a()[t]},e.set=c,e.remove=function(t,e){c(t,"",n(n({},e),{expires:-1}))}}));s(M),M.encode,M.parse,M.getAll;var V=M.get,F=M.set,K=M.remove;const W={get(t){const e=V(t);if(void 0!==e)return JSON.parse(e)},save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(t,JSON.stringify(e),r)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n)}},z={get:t=>W.get(t)||W.get(`_legacy_${t}`),save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(`_legacy_${t}`,JSON.stringify(e),r),W.save(t,e,n)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n),W.remove(t,e),W.remove(`_legacy_${t}`,e)}},H={get(t){if("undefined"==typeof sessionStorage)return;const e=sessionStorage.getItem(t);return null!=e?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};var $,Z=("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,!1,function(t){return $=$||function(t,e,n){var r=void 0===e?null:e,i=function(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(t,void 0!==n&&n),o=i.indexOf("\n",10)+1,s=i.substring(o)+(r?"//# sourceMappingURL="+r:""),a=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(a)}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,false),new Worker($,t)});const X={};class G{constructor(t,e){this.cache=t,this.clientId=e,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(t){var e;const n=new Set((null===(e=await this.cache.get(this.manifestKey))||void 0===e?void 0:e.keys)||[]);n.add(t),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(t){const e=await this.cache.get(this.manifestKey);if(e){const n=new Set(e.keys);return n.delete(t),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(t){return`@@auth0spajs@@::${t}`}}const Y={memory:()=>(new L).enclosedCache,localstorage:()=>new U},q=t=>Y[t],J=t=>{const{openUrl:e,onRedirect:n}=t,r=i(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===e||e?e:n})},Q=new h;class tt{constructor(t){let e,n;if(this.userCache=(new L).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),t.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!T())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===T().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),t.cache&&t.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),t.cache)n=t.cache;else{if(e=t.cacheLocation||"memory",!q(e))throw new Error(`Invalid cache location "${e}"`);n=q(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===t.legacySameSiteCookie?W:z,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(t=>`auth0.${this.options.clientId}.is.authenticated`)(),this.sessionCheckExpiryDays=t.sessionCheckExpiryDays||1;const r=t.useCookiesForTransactions?this.cookieStorage:H;var i;this.scope=O("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new _(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||p,this.cacheManager=new N(n,n.allKeys?void 0:new G(n,this.options.clientId),this.nowProvider),this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((t,e)=>t?t.startsWith("https://")?t:`https://${t}/`:`${e}/`)(this.options.issuer,this.domainUrl),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===e&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Z)}_url(t){const e=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||f)));return`${this.domainUrl}${t}&auth0Client=${e}`}_authorizeUrl(t){return this._url(`/authorize?${k(t)}`)}async _verifyIdToken(t,e,n){const r=await this.nowProvider();return(t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(t=>{const e=t.split("."),[n,r,i]=e;if(3!==e.length||!n||!r||!i)throw new Error("ID token could not be decoded");const o=JSON.parse(R(r)),s={__raw:t},a={};return Object.keys(o).forEach((t=>{s[t]=o[t],D.includes(t)||(a[t]=o[t])})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(R(n)),claims:s,user:a}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==e.header.alg)throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||"string"!=typeof e.claims.aud&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!j(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==e.claims.exp||!j(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!j(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=t.leeway||60,r=new Date(t.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+n),r>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);if(null!=e.claims.nbf&&j(e.claims.nbf)){const t=new Date(0);if(t.setUTCSeconds(e.claims.nbf-n),r<t)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${t}`)}if(null!=e.claims.auth_time&&j(e.claims.auth_time)){const i=new Date(0);if(i.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+n),r>i)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${r}) is after last auth at ${i}`)}if(t.organization){const n=t.organization.trim();if(n.startsWith("org_")){const t=n;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(t!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_id}"`)}else{const t=n.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(t!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_name}"`)}}return e})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:t,nonce:e,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,"string"!=typeof i?i:parseInt(i,10)||void 0),now:r});var i}_processOrgHint(t){t?this.cookieStorage.save(this.orgHintCookieName,t,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(t,e,n){const r=A(x()),i=A(x()),o=x(),s=(t=>{const e=new Uint8Array(t);return(t=>{const e={"+":"-","/":"_","=":""};return t.replace(/[+/=]/g,(t=>e[t]))})(window.btoa(String.fromCharCode(...Array.from(e))))})(await(async t=>{const e=T().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(t));return await e})(o)),a=((t,e,n,r,i,o,s,a)=>Object.assign(Object.assign(Object.assign({client_id:t.clientId},t.authorizationParams),n),{scope:O(e,n.scope),response_type:"code",response_mode:a||"query",state:r,nonce:i,redirect_uri:s||t.authorizationParams.redirect_uri,code_challenge:o,code_challenge_method:"S256"}))(this.options,this.scope,t,r,i,s,t.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==e?void 0:e.response_mode),c=this._authorizeUrl(a);return{nonce:i,code_verifier:o,scope:a.scope,audience:a.audience||"default",redirect_uri:a.redirect_uri,state:r,url:c}}async loginWithPopup(t,e){var n;if(t=t||{},!(e=e||{}).popup&&(e.popup=(t=>{const e=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup",`left=${e},top=${n},width=400,height=600,resizable,scrollbars=yes,status=1`)})(),!e.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const r=await this._prepareAuthorizeUrl(t.authorizationParams||{},{response_mode:"web_message"},window.location.origin);e.popup.location.href=r.url;const i=await(t=>new Promise(((e,n)=>{let r;const i=setInterval((()=>{t.popup&&t.popup.closed&&(clearInterval(i),clearTimeout(o),window.removeEventListener("message",r,!1),n(new v(t.popup)))}),1e3),o=setTimeout((()=>{clearInterval(i),n(new w(t.popup)),window.removeEventListener("message",r,!1)}),1e3*(t.timeoutInSeconds||60));r=function(s){if(s.data&&"authorization_response"===s.data.type){if(clearTimeout(o),clearInterval(i),window.removeEventListener("message",r,!1),t.popup.close(),s.data.response.error)return n(m.fromPayload(s.data.response));e(s.data.response)}},window.addEventListener("message",r)})))(Object.assign(Object.assign({},e),{timeoutInSeconds:e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==i.state)throw new m("state_mismatch","Invalid state");const o=(null===(n=t.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:o})}async getUser(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.user}async getIdTokenClaims(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.claims}async loginWithRedirect(t={}){var e;const n=J(t),{openUrl:r,fragment:o,appState:s}=n,a=i(n,["openUrl","fragment","appState"]),c=(null===(e=a.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,l=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:u}=l,h=i(l,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:s}),c&&{organization:c}));const d=o?`${u}#${o}`:u;r?await r(d):window.location.assign(d)}async handleRedirectCallback(t=window.location.href){const e=t.split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const{state:n,code:r,error:i,error_description:o}=(t=>{t.indexOf("#")>-1&&(t=t.substring(0,t.indexOf("#")));const e=new URLSearchParams(t);return{state:e.get("state"),code:e.get("code")||void 0,error:e.get("error")||void 0,error_description:e.get("error_description")||void 0}})(e.join("")),s=this.transactionManager.get();if(!s)throw new m("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new g(i,o||i,n,s.appState);if(!s.code_verifier||s.state&&s.state!==n)throw new m("state_mismatch","Invalid state");const a=s.organization,c=s.nonce,l=s.redirect_uri;return await this._requestToken(Object.assign({audience:s.audience,scope:s.scope,code_verifier:s.code_verifier,grant_type:"authorization_code",code:r},l?{redirect_uri:l}:{}),{nonceIn:c,organization:a}),{appState:s.appState}}async checkSession(t){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(t)}catch(t){}}async getTokenSilently(t={}){var e;const n=Object.assign(Object.assign({cacheMode:"on"},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:O(this.scope,null===(e=t.authorizationParams)||void 0===e?void 0:e.scope)})}),r=await((t,e)=>{let n=X[e];return n||(n=t().finally((()=>{delete X[e],n=null})),X[e]=n),n})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return t.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(t){const{cacheMode:e}=t,n=i(t,["cacheMode"]);if("off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}if("cache-only"!==e){if(!await(async(t,e=3)=>{for(let n=0;n<e;n++)if(await t())return!0;return!1})((()=>Q.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new y;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),"off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}const t=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,access_token:i,oauthTokenScope:o,expires_in:s}=t;return Object.assign(Object.assign({id_token:r,access_token:i},o?{scope:o}:null),{expires_in:s})}finally{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(t={},e={}){var n;const r=Object.assign(Object.assign({},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:O(this.scope,null===(n=t.authorizationParams)||void 0===n?void 0:n.scope)})});return e=Object.assign(Object.assign({},d),e),await this.loginWithPopup(r,e),(await this.cacheManager.get(new B({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){null!==t.clientId?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const e=t.logoutParams||{},{federated:n}=e,r=i(e,["federated"]),o=n?"&federated":"";return this._url(`/v2/logout?${k(Object.assign({clientId:t.clientId},r))}`)+o}async logout(t={}){const e=J(t),{openUrl:n}=e,r=i(e,["openUrl"]);null===t.clientId?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const o=this._buildLogoutUrl(r);n?await n(o):!1!==n&&window.location.assign(o)}async _getTokenFromIFrame(t){const e=Object.assign(Object.assign({},t.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!e.organization&&(e.organization=n);const{url:r,state:i,nonce:o,code_verifier:s,redirect_uri:a,scope:c,audience:l}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new m("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const n=t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,u=await((t,e,n=60)=>new Promise(((r,i)=>{const o=window.document.createElement("iframe");o.setAttribute("width","0"),o.setAttribute("height","0"),o.style.display="none";const s=()=>{window.document.body.contains(o)&&(window.document.body.removeChild(o),window.removeEventListener("message",a,!1))};let a;const c=setTimeout((()=>{i(new y),s()}),1e3*n);a=function(t){if(t.origin!=e)return;if(!t.data||"authorization_response"!==t.data.type)return;const n=t.source;n&&n.close(),t.data.response.error?i(m.fromPayload(t.data.response)):r(t.data.response),clearTimeout(c),window.removeEventListener("message",a,!1),setTimeout(s,2e3)},window.addEventListener("message",a,!1),window.document.body.appendChild(o),o.setAttribute("src",t)})))(r,this.domainUrl,n);if(i!==u.state)throw new m("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:s,code:u.code,grant_type:"authorization_code",redirect_uri:a,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:o,organization:e.organization});return Object.assign(Object.assign({},h),{scope:c,oauthTokenScope:h.scope,audience:l})}catch(t){throw"login_required"===t.error&&this.logout({openUrl:!1}),t}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new B({scope:t.authorizationParams.scope,audience:t.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(e&&e.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw new E(t.authorizationParams.audience||"default",t.authorizationParams.scope)}const n=t.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,r="number"==typeof t.timeoutInSeconds?1e3*t.timeoutInSeconds:null;try{const i=await this._requestToken(Object.assign(Object.assign(Object.assign({},t.authorizationParams),{grant_type:"refresh_token",refresh_token:e&&e.refresh_token,redirect_uri:n}),r&&{timeout:r}));return Object.assign(Object.assign({},i),{scope:t.authorizationParams.scope,oauthTokenScope:i.scope,audience:t.authorizationParams.audience||"default"})}catch(e){if((e.message.indexOf("Missing Refresh Token")>-1||e.message&&e.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw e}}async _saveEntryInCache(t){const{id_token:e,decodedToken:n}=t,r=i(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:e,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const t=this.options.authorizationParams.audience||"default",e=await this.cacheManager.getIdToken(new B({clientId:this.options.clientId,audience:t,scope:this.scope})),n=this.userCache.get("@@user@@");return e&&e.id_token===(null==n?void 0:n.id_token)?n:(this.userCache.set("@@user@@",e),e)}async _getEntryFromCache({scope:t,audience:e,clientId:n}){const r=await this.cacheManager.get(new B({scope:t,audience:e,clientId:n}),60);if(r&&r.access_token){const{access_token:t,oauthTokenScope:e,expires_in:n}=r,i=await this._getIdTokenFromCache();return i&&Object.assign(Object.assign({id_token:i.id_token,access_token:t},e?{scope:e}:null),{expires_in:n})}}async _requestToken(t,e){const{nonceIn:n,organization:r}=e||{},i=await I(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},t),this.worker),o=await this._verifyIdToken(i.id_token,n,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},i),{decodedToken:o,scope:t.scope,audience:t.audience||"default"}),i.scope?{oauthTokenScope:i.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||o.claims.org_id),Object.assign(Object.assign({},i),{decodedToken:o})}}var et=a(470);function nt(t,e){return function(){return t.apply(e,arguments)}}const{toString:rt}=Object.prototype,{getPrototypeOf:it}=Object,ot=(st=Object.create(null),t=>{const e=rt.call(t);return st[e]||(st[e]=e.slice(8,-1).toLowerCase())});var st;const at=t=>(t=t.toLowerCase(),e=>ot(e)===t),ct=t=>e=>typeof e===t,{isArray:lt}=Array,ut=ct("undefined");const ht=at("ArrayBuffer");const dt=ct("string"),ft=ct("function"),pt=ct("number"),mt=t=>null!==t&&"object"==typeof t,gt=t=>{if("object"!==ot(t))return!1;const e=it(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},yt=at("Date"),wt=at("File"),vt=at("Blob"),bt=at("FileList"),Et=at("URLSearchParams");function St(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),lt(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let s;for(r=0;r<o;r++)s=i[r],e.call(null,t[s],s,t)}}function Tt(t,e){e=e.toLowerCase();const n=Object.keys(t);let r,i=n.length;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,At=t=>!ut(t)&&t!==xt;const kt=(Rt="undefined"!=typeof Uint8Array&&it(Uint8Array),t=>Rt&&t instanceof Rt);var Rt;const Pt=at("HTMLFormElement"),Ct=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),It=at("RegExp"),Ot=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};St(n,((n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)})),Object.defineProperties(t,r)},Bt="abcdefghijklmnopqrstuvwxyz",Ut="0123456789",Lt={DIGIT:Ut,ALPHA:Bt,ALPHA_DIGIT:Bt+Bt.toUpperCase()+Ut};const Nt=at("AsyncFunction"),_t={isArray:lt,isArrayBuffer:ht,isBuffer:function(t){return null!==t&&!ut(t)&&null!==t.constructor&&!ut(t.constructor)&&ft(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||ft(t.append)&&("formdata"===(e=ot(t))||"object"===e&&ft(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&ht(t.buffer),e},isString:dt,isNumber:pt,isBoolean:t=>!0===t||!1===t,isObject:mt,isPlainObject:gt,isUndefined:ut,isDate:yt,isFile:wt,isBlob:vt,isRegExp:It,isFunction:ft,isStream:t=>mt(t)&&ft(t.pipe),isURLSearchParams:Et,isTypedArray:kt,isFileList:bt,forEach:St,merge:function t(){const{caseless:e}=At(this)&&this||{},n={},r=(r,i)=>{const o=e&&Tt(n,i)||i;gt(n[o])&>(r)?n[o]=t(n[o],r):gt(r)?n[o]=t({},r):lt(r)?n[o]=r.slice():n[o]=r};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&St(arguments[t],r);return n},extend:(t,e,n,{allOwnKeys:r}={})=>(St(e,((e,r)=>{n&&ft(e)?t[r]=nt(e,n):t[r]=e}),{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&it(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:ot,kindOfTest:at,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(lt(t))return t;let e=t.length;if(!pt(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:Pt,hasOwnProperty:Ct,hasOwnProp:Ct,reduceDescriptors:Ot,freezeMethods:t=>{Ot(t,((e,n)=>{if(ft(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];ft(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach((t=>{n[t]=!0}))};return lt(t)?r(t):r(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Tt,global:xt,isContextDefined:At,ALPHABET:Lt,generateString:(t=16,e=Lt.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n},isSpecCompliantForm:function(t){return!!(t&&ft(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(mt(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const i=lt(t)?[]:{};return St(t,((t,e)=>{const o=n(t,r+1);!ut(o)&&(i[e]=o)})),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Nt,isThenable:t=>t&&(mt(t)||ft(t))&&ft(t.then)&&ft(t.catch)};function jt(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}_t.inherits(jt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_t.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Dt=jt.prototype,Mt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Mt[t]={value:t}})),Object.defineProperties(jt,Mt),Object.defineProperty(Dt,"isAxiosError",{value:!0}),jt.from=(t,e,n,r,i,o)=>{const s=Object.create(Dt);return _t.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),jt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Vt=jt;function Ft(t){return _t.isPlainObject(t)||_t.isArray(t)}function Kt(t){return _t.endsWith(t,"[]")?t.slice(0,-2):t}function Wt(t,e,n){return t?t.concat(e).map((function(t,e){return t=Kt(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const zt=_t.toFlatObject(_t,{},null,(function(t){return/^is[A-Z]/.test(t)}));const Ht=function(t,e,n){if(!_t.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=_t.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!_t.isUndefined(e[t])}))).metaTokens,i=n.visitor||l,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&_t.isSpecCompliantForm(e);if(!_t.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(_t.isDate(t))return t.toISOString();if(!a&&_t.isBlob(t))throw new Vt("Blob is not supported. Use a Buffer instead.");return _t.isArrayBuffer(t)||_t.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function l(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(_t.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(_t.isArray(t)&&function(t){return _t.isArray(t)&&!t.some(Ft)}(t)||(_t.isFileList(t)||_t.endsWith(n,"[]"))&&(a=_t.toArray(t)))return n=Kt(n),a.forEach((function(t,r){!_t.isUndefined(t)&&null!==t&&e.append(!0===s?Wt([n],r,o):null===s?n:n+"[]",c(t))})),!1;return!!Ft(t)||(e.append(Wt(i,n,o),c(t)),!1)}const u=[],h=Object.assign(zt,{defaultVisitor:l,convertValue:c,isVisitable:Ft});if(!_t.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!_t.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),_t.forEach(n,(function(n,o){!0===(!(_t.isUndefined(n)||null===n)&&i.call(e,n,_t.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])})),u.pop()}}(t),e};function $t(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function Zt(t,e){this._pairs=[],t&&Ht(t,this,e)}const Xt=Zt.prototype;Xt.append=function(t,e){this._pairs.push([t,e])},Xt.toString=function(t){const e=t?function(e){return t.call(this,e,$t)}:$t;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const Gt=Zt;function Yt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qt(t,e,n){if(!e)return t;const r=n&&n.encode||Yt,i=n&&n.serialize;let o;if(o=i?i(e,n):_t.isURLSearchParams(e)?e.toString():new Gt(e,n).toString(r),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}const Jt=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_t.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},Qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},te={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Gt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ee="undefined"!=typeof window&&"undefined"!=typeof document,ne=(re="undefined"!=typeof navigator&&navigator.product,ee&&["ReactNative","NativeScript","NS"].indexOf(re)<0);var re;const ie="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,oe={...t,...te};const se=function(t){function e(t,n,r,i){let o=t[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=t.length;if(o=!o&&_t.isArray(r)?r.length:o,a)return _t.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&_t.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&_t.isArray(r[o])&&(r[o]=function(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}(r[o])),!s}if(_t.isFormData(t)&&_t.isFunction(t.entries)){const n={};return _t.forEachEntry(t,((t,r)=>{e(function(t){return _t.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),r,n,0)})),n}return null};const ae={transitional:Qt,adapter:["xhr","http"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=_t.isObject(t);i&&_t.isHTMLForm(t)&&(t=new FormData(t));if(_t.isFormData(t))return r&&r?JSON.stringify(se(t)):t;if(_t.isArrayBuffer(t)||_t.isBuffer(t)||_t.isStream(t)||_t.isFile(t)||_t.isBlob(t))return t;if(_t.isArrayBufferView(t))return t.buffer;if(_t.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Ht(t,new oe.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return oe.isNode&&_t.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=_t.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Ht(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||ae.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(t&&_t.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw Vt.from(t,Vt.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oe.classes.FormData,Blob:oe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_t.forEach(["delete","get","head","post","put","patch"],(t=>{ae.headers[t]={}}));const ce=ae,le=_t.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ue=Symbol("internals");function he(t){return t&&String(t).trim().toLowerCase()}function de(t){return!1===t||null==t?t:_t.isArray(t)?t.map(de):String(t)}function fe(t,e,n,r,i){return _t.isFunction(r)?r.call(this,e,n):(i&&(e=n),_t.isString(e)?_t.isString(r)?-1!==e.indexOf(r):_t.isRegExp(r)?r.test(e):void 0:void 0)}class pe{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=he(e);if(!i)throw new Error("header name must be a non-empty string");const o=_t.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=de(t))}const o=(t,e)=>_t.forEach(t,((t,n)=>i(t,n,e)));return _t.isPlainObject(t)||t instanceof this.constructor?o(t,e):_t.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?o((t=>{const e={};let n,r,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!n||e[n]&&le[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)})),e})(t),e):null!=t&&i(e,t,n),this}get(t,e){if(t=he(t)){const n=_t.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(_t.isFunction(e))return e.call(this,t,n);if(_t.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=he(t)){const n=_t.findKey(this,t);return!(!n||void 0===this[n]||e&&!fe(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=he(t)){const i=_t.findKey(n,t);!i||e&&!fe(0,n[i],i,e)||(delete n[i],r=!0)}}return _t.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];t&&!fe(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return _t.forEach(this,((r,i)=>{const o=_t.findKey(n,i);if(o)return e[o]=de(r),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(i):String(i).trim();s!==i&&delete e[i],e[s]=de(r),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return _t.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&_t.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[ue]=this[ue]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=he(t);e[r]||(!function(t,e){const n=_t.toCamelCase(" "+e);["get","set","has"].forEach((r=>{Object.defineProperty(t,r+n,{value:function(t,n,i){return this[r].call(this,e,t,n,i)},configurable:!0})}))}(n,t),e[r]=!0)}return _t.isArray(t)?t.forEach(r):r(t),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_t.reduceDescriptors(pe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),_t.freezeMethods(pe);const me=pe;function ge(t,e){const n=this||ce,r=e||n,i=me.from(r.headers);let o=r.data;return _t.forEach(t,(function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)})),i.normalize(),o}function ye(t){return!(!t||!t.__CANCEL__)}function we(t,e,n){Vt.call(this,null==t?"canceled":t,Vt.ERR_CANCELED,e,n),this.name="CanceledError"}_t.inherits(we,Vt,{__CANCEL__:!0});const ve=we;const be=oe.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];_t.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),_t.isString(r)&&s.push("path="+r),_t.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ee(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Se=oe.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function r(n){let r=n;return t&&(e.setAttribute("href",r),r=e.href),e.setAttribute("href",r),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return n=r(window.location.href),function(t){const e=_t.isString(t)?r(t):t;return e.protocol===n.protocol&&e.host===n.host}}():function(){return!0};const Te=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),l=r[s];i||(i=c),n[o]=a,r[o]=c;let u=s,h=0;for(;u!==o;)h+=n[u++],u%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const d=l&&c-l;return d?Math.round(1e3*h/d):void 0}};function xe(t,e){let n=0;const r=Te(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-n,c=r(a);n=o;const l={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:i};l[e?"download":"upload"]=!0,t(l)}}const Ae={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){let r=t.data;const i=me.from(t.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=t;function l(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}if(_t.isFormData(r))if(oe.hasStandardBrowserEnv||oe.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(s=i.getContentType())){const[t,...e]=s?s.split(";").map((t=>t.trim())).filter(Boolean):[];i.setContentType([t||"multipart/form-data",...e].join("; "))}let u=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",n=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(e+":"+n))}const h=Ee(t.baseURL,t.url);function d(){if(!u)return;const r=me.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new Vt("Request failed with status code "+n.status,[Vt.ERR_BAD_REQUEST,Vt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}((function(t){e(t),l()}),(function(t){n(t),l()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:t,request:u}),u=null}if(u.open(t.method.toUpperCase(),qt(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=function(){u&&(n(new Vt("Request aborted",Vt.ECONNABORTED,t,u)),u=null)},u.onerror=function(){n(new Vt("Network Error",Vt.ERR_NETWORK,t,u)),u=null},u.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const r=t.transitional||Qt;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new Vt(e,r.clarifyTimeoutError?Vt.ETIMEDOUT:Vt.ECONNABORTED,t,u)),u=null},oe.hasStandardBrowserEnv&&(c&&_t.isFunction(c)&&(c=c(t)),c||!1!==c&&Se(h))){const e=t.xsrfHeaderName&&t.xsrfCookieName&&be.read(t.xsrfCookieName);e&&i.set(t.xsrfHeaderName,e)}void 0===r&&i.setContentType(null),"setRequestHeader"in u&&_t.forEach(i.toJSON(),(function(t,e){u.setRequestHeader(e,t)})),_t.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),a&&"json"!==a&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",xe(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",xe(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=e=>{u&&(n(!e||e.type?new ve(null,t,u):e),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const f=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(h);f&&-1===oe.protocols.indexOf(f)?n(new Vt("Unsupported protocol "+f+":",Vt.ERR_BAD_REQUEST,t)):u.send(r||null)}))}};_t.forEach(Ae,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const ke=t=>`- ${t}`,Re=t=>_t.isFunction(t)||null===t||!1===t,Pe=t=>{t=_t.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o<e;o++){let e;if(n=t[o],r=n,!Re(n)&&(r=Ae[(e=String(n)).toLowerCase()],void 0===r))throw new Vt(`Unknown adapter '${e}'`);if(r)break;i[e||"#"+o]=r}if(!r){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let n=e?t.length>1?"since :\n"+t.map(ke).join("\n"):" "+ke(t[0]):"as no adapter specified";throw new Vt("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r};function Ce(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ve(null,t)}function Ie(t){Ce(t),t.headers=me.from(t.headers),t.data=ge.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Pe(t.adapter||ce.adapter)(t).then((function(e){return Ce(t),e.data=ge.call(t,t.transformResponse,e),e.headers=me.from(e.headers),e}),(function(e){return ye(e)||(Ce(t),e&&e.response&&(e.response.data=ge.call(t,t.transformResponse,e.response),e.response.headers=me.from(e.response.headers))),Promise.reject(e)}))}const Oe=t=>t instanceof me?t.toJSON():t;function Be(t,e){e=e||{};const n={};function r(t,e,n){return _t.isPlainObject(t)&&_t.isPlainObject(e)?_t.merge.call({caseless:n},t,e):_t.isPlainObject(e)?_t.merge({},e):_t.isArray(e)?e.slice():e}function i(t,e,n){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t,n):r(t,e,n)}function o(t,e){if(!_t.isUndefined(e))return r(void 0,e)}function s(t,e){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,i,o){return o in e?r(n,i):o in t?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e)=>i(Oe(t),Oe(e),!0)};return _t.forEach(Object.keys(Object.assign({},t,e)),(function(r){const o=c[r]||i,s=o(t[r],e[r],r);_t.isUndefined(s)&&o!==a||(n[r]=s)})),n}const Ue="1.6.5",Le={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Le[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const Ne={};Le.transitional=function(t,e,n){function r(t,e){return"[Axios v1.6.5] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,i,o)=>{if(!1===t)throw new Vt(r(i," has been removed"+(e?" in "+e:"")),Vt.ERR_DEPRECATED);return e&&!Ne[i]&&(Ne[i]=!0,console.warn(r(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,i,o)}};const _e={assertOptions:function(t,e,n){if("object"!=typeof t)throw new Vt("options must be an object",Vt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new Vt("option "+o+" must be "+n,Vt.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Vt("Unknown option "+o,Vt.ERR_BAD_OPTION)}},validators:Le},je=_e.validators;class De{constructor(t){this.defaults=t,this.interceptors={request:new Jt,response:new Jt}}request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Be(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&_e.assertOptions(n,{silentJSONParsing:je.transitional(je.boolean),forcedJSONParsing:je.transitional(je.boolean),clarifyTimeoutError:je.transitional(je.boolean)},!1),null!=r&&(_t.isFunction(r)?e.paramsSerializer={serialize:r}:_e.assertOptions(r,{encode:je.function,serialize:je.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&_t.merge(i.common,i[e.method]);i&&_t.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=me.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let u,h=0;if(!a){const t=[Ie.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),u=t.length,l=Promise.resolve(e);h<u;)l=l.then(t[h++],t[h++]);return l}u=s.length;let d=e;for(h=0;h<u;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{l=Ie.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(t){return qt(Ee((t=Be(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}_t.forEach(["delete","get","head","options"],(function(t){De.prototype[t]=function(e,n){return this.request(Be(n||{},{method:t,url:e,data:(n||{}).data}))}})),_t.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(Be(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}De.prototype[t]=e(),De.prototype[t+"Form"]=e(!0)}));const Me=De;class Ve{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const r=new Promise((t=>{n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t,r,i){n.reason||(n.reason=new ve(t,r,i),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;const e=new Ve((function(e){t=e}));return{token:e,cancel:t}}}const Fe=Ve;const Ke={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ke).forEach((([t,e])=>{Ke[e]=t}));const We=Ke;const ze=function t(e){const n=new Me(e),r=nt(Me.prototype.request,n);return _t.extend(r,Me.prototype,n,{allOwnKeys:!0}),_t.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Be(e,n))},r}(ce);ze.Axios=Me,ze.CanceledError=ve,ze.CancelToken=Fe,ze.isCancel=ye,ze.VERSION=Ue,ze.toFormData=Ht,ze.AxiosError=Vt,ze.Cancel=ze.CanceledError,ze.all=function(t){return Promise.all(t)},ze.spread=function(t){return function(e){return t.apply(null,e)}},ze.isAxiosError=function(t){return _t.isObject(t)&&!0===t.isAxiosError},ze.mergeConfig=Be,ze.AxiosHeaders=me,ze.formToJSON=t=>se(_t.isHTMLForm(t)?new FormData(t):t),ze.getAdapter=Pe,ze.HttpStatusCode=We,ze.default=ze;const He=ze;var $e=a(742),Ze=Object.create,Xe=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Ye=Object.getOwnPropertyNames,qe=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty,Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),tn=(t,e,n)=>(n=null!=t?Ze(qe(t)):{},((t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of Ye(e))!Je.call(t,i)&&i!==n&&Xe(t,i,{get:()=>e[i],enumerable:!(r=Ge(e,i))||r.enumerable});return t})(!e&&t&&t.__esModule?n:Xe(n,"default",{value:t,enumerable:!0}),t)),en=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e=t.length,n=e%4;if(!n)return t;var r=e,i=4-n,o=e+i,s=Buffer.alloc(o);for(s.write(t);i--;)s.write("=",r++);return s.toString()}})),nn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=en();function n(t,e){return void 0===e&&(e="utf8"),Buffer.isBuffer(t)?i(t.toString("base64")):i(Buffer.from(t,e).toString("base64"))}function r(t){return t=t.toString(),e.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function i(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var o=n;o.encode=n,o.decode=function(t,e){return void 0===e&&(e="utf8"),Buffer.from(r(t),"base64").toString(e)},o.toBase64=r,o.fromBase64=i,o.toBuffer=function(t){return Buffer.from(r(t),"base64")},t.default=o})),rn=Qe(((t,e)=>{e.exports=nn().default,e.exports.default=e.exports})),on=Qe((t=>{t.byteLength=function(t){var e=s(t),n=e[0],r=e[1];return 3*(n+r)/4-r},t.toByteArray=function(t){var e,n,o=s(t),a=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,c)),u=0,h=c>0?a-4:a;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e),l},t.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};var e,n=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(e=0,64;e<64;++e)n[e]=o[e],r[o.charCodeAt(e)]=e;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function a(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function c(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(a(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63})),sn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=on();function n(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function r(t){return(new TextEncoder).encode(t)}function i(t){return new Uint8Array(e.toByteArray(c(t)))}function o(t){return e.fromByteArray(new Uint8Array(t))}function s(t){return a(o(t))}function a(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}function c(t){let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}t.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},t.b64UrlToString=function(t){return n(i(t))},t.bufferToString=n,t.stringToBuffer=r,t.stringToB64Url=function(t){return s(r(t))},t.b64UrlToBuffer=i,t.bufferTob64=o,t.bufferTob64Url=s,t.b64UrlEncode=a,t.b64UrlDecode=c})),an=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=sn();t.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){let r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let t=crypto?.subtle;return void 0!==t&&["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);let a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return e.concatBuffers([s,a])}async decrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return e.concatBuffers([a])}}})),cn=Qe((t=>{t.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},t.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}})),ln=Qe((t=>{var e=on(),n=cn(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;var i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if(("string"!=typeof e||""===e)&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=0|f(t,e),r=o(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){let e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);let i=function(t){if(s.isBuffer(t)){let e=0|d(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||X(t.length)?o(0):u(t);if("Buffer"===t.type&&Array.isArray(t.data))return u(t.data)}(t);if(i)return i;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return c(t),o(t<0?0:0|d(t))}function u(t){let e=t.length<0?0:0|d(t.length),n=o(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,s.prototype),r}function d(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function f(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:z(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return x(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return R(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function w(t,e,n,r){n=Number(n)||0;let i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;let o,s=e.length;for(r>s/2&&(r=s/2),o=0;o<r;++o){let r=parseInt(e.substr(2*o,2),16);if(X(r))return o;t[n+o]=r}return o}function v(t,e,n,r){return $(z(e,t.length-n),t,n,r)}function b(t,e,n,r){return $(function(t){let e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function E(t,e,n,r){return $(H(e),t,n,r)}function S(t,e,n,r){return $(function(t,e){let n,r,i,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function T(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function x(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i<n;){let e=t[i],o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){let e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=A));return n}(r)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch{return!1}}(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,n){return a(t,e,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,n){return function(t,e,n){return c(t),t<=0?o(t):void 0!==e?"string"==typeof n?o(t).fill(e,n):o(t).fill(e):o(t)}(t,e,n)},s.allocUnsafe=function(t){return l(t)},s.allocUnsafeSlow=function(t){return l(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(t){switch(String(t).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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let r=s.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){let e=t[n];if(Z(e,Uint8Array))i+e.length>r.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},s.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},s.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},s.prototype.toString=function(){let t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(o,a),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<c;++t)if(l[t]!==u[t]){o=l[t],a=u[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},s.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}let i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function k(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function R(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function P(t,e,n){let r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=G[t[r]];return i}function C(t,e,n){let r=t.slice(e,n),i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function B(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function U(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function L(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function _(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){let n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);let r=this.subarray(t,e);return Object.setPrototypeOf(r,s.prototype),r},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);let n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);let n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){O(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){O(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Y((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Y((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);O(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);O(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=Y((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Y((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return _(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return _(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&0!==r&&(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);let i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},s.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){let e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{let o=s.isBuffer(t)?t:s.from(t,r),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%a]}return this};var j={};function D(t,e,n){j[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function M(t){let e="",n=t.length,r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function V(t,e,n,r,i,o){if(t>n||t<e){let r,i="bigint"==typeof e?"n":"";throw r=o>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new j.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){F(e,"offset"),(void 0===t[e]||void 0===t[e+n])&&K(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,n){throw Math.floor(t)!==t?(F(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new j.ERR_BUFFER_OUT_OF_BOUNDS:new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=M(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=M(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);var W=/[^+/0-9A-Za-z-_]/g;function z(t,e){e=e||1/0;let n,r=t.length,i=null,o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}var G=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Y(t){return typeof BigInt>"u"?q:t}function q(){throw new Error("BigInt not supported")}})),un=Qe(((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:ln().Buffer,Crypto:window.crypto}):e.exports={Buffer:ln().Buffer,Crypto:crypto}})),hn={};((t,e)=>{for(var n in e)Xe(t,n,{get:e[n],enumerable:!0})})(hn,{AVSCTap:()=>Cn,ArweaveSigner:()=>xn,DataItem:()=>Mn,MAX_TAG_BYTES:()=>jn,MIN_BINARY_SIZE:()=>Dn,SIG_CONFIG:()=>Tn,SignatureConfig:()=>wn,Signer:()=>dn,createData:()=>Fn,deserializeTags:()=>Bn,indexToType:()=>An,serializeTags:()=>In,tagsExceedLimit:()=>On});var dn=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,n,r){throw new Error("You must implement verify method on child")}},fn=tn(rn(),1),pn=tn(sn(),1);async function mn(t){if(Array.isArray(t)){let e=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("list"),(0,pn.stringToBuffer)(t.length.toString())]);return await gn(t,await Sn().hash(e,"SHA-384"))}let e=t,n=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("blob"),(0,pn.stringToBuffer)(e.byteLength.toString())]),r=(0,pn.concatBuffers)([await Sn().hash(n,"SHA-384"),await Sn().hash(e,"SHA-384")]);return await Sn().hash(r,"SHA-384")}async function gn(t,e){if(t.length<1)return e;let n=(0,pn.concatBuffers)([e,await mn(t[0])]),r=await Sn().hash(n,"SHA-384");return await gn(t.slice(1),r)}var yn,wn,vn=tn(an(),1),bn=vn.default.default?vn.default.default:vn.default,En=class extends bn{getPublicKey(t){throw new Error("Unimplemented")}};function Sn(){return yn??=new En}!function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"}(wn||(wn={}));var Tn={[wn.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[wn.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[wn.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[wn.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[wn.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[wn.MULTIAPTOS]:{sigLength:2052,pubLength:1025,sigName:"multiAptos"},[wn.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},xn=class{signatureType=1;ownerLength=Tn[1].pubLength;signatureLength=Tn[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return fn.default.toBuffer(this.pk)}sign(t){return Sn().sign(this.jwk,t)}static async verify(t,e,n){return await Sn().verify(t,e,n)}},An={1:xn},kn=tn(rn(),1);async function Rn(t){return mn([(0,pn.stringToBuffer)("dataitem"),(0,pn.stringToBuffer)("1"),(0,pn.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Pn(t,e){let{signature:n,id:r}=await async function(t,e){let n=await Rn(t),r=await e.sign(n),i=await Sn().hash(r);return{signature:Buffer.from(r),id:Buffer.from(i)}}(t,e);return t.getRaw().set(n,2),r}var Cn=class{buf;pos;constructor(t=Buffer.alloc(jn),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e,n=t.length;if(n)for(this.writeLong(n),e=0;e<n;e++){let n=t[e];if(void 0===n?.name||void 0===n?.value)throw new Error(`Invalid tag format for ${n}, expected {name:string, value: string}`);this.writeString(n.name),this.writeString(n.value)}this.writeLong(0)}toBuffer(){let t=Buffer.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e,n,r=this.buf;if(t>=-1073741824&&t<1073741824){n=t>=0?t<<1:~t<<1|1;do{r[this.pos]=127&n,n>>=7}while(n&&(r[this.pos++]|=128))}else{e=t>=0?2*t:2*-t-1;do{r[this.pos]=127&e,e/=128}while(e>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(t){let e=Buffer.byteLength(t),n=this.buf;this.writeLong(e);let r=this.pos;if(this.pos+=e,!(this.pos>n.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,o,s,a;for(i=0,o=e;i<o;i++)s=t.charCodeAt(i),s<128?n[r++]=s:s<2048?(n[r++]=s>>6|192,n[r++]=63&s|128):55296==(64512&s)&&56320==(64512&(a=t.charCodeAt(i+1)))?(s=65536+((1023&s)<<10)+(1023&a),i++,n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}this.buf=n}}readLong(){let t,e,n,r,i=0,o=0,s=this.buf;do{t=s[this.pos++],e=128&t,i|=(127&t)<<o,o+=7}while(e&&o<28);if(e){n=i,r=268435456;do{t=s[this.pos++],n+=(127&t)*r,r*=128}while(128&t);return(n%2?-(n+1):n)/2}return i>>1^-(1&i)}skipLong(){let t=this.buf;for(;128&t[this.pos++];);}readTags(){let t,e=[];for(;t=this.readLong();)for(t<0&&(t=-t,this.skipLong());t--;){let t=this.readString(),n=this.readString();e.push({name:t,value:n})}return e}readString(){let t=this.readLong(),e=this.pos,n=this.buf;if(this.pos+=t,!(this.pos>n.length))return this.buf.slice(e,e+t).toString()}};function In(t){let e=new Cn;return e.writeTags(t),e.toBuffer()}function On(t){let e=new Cn;return e.writeTags(t),e.tagsExceedLimit()}function Bn(t){return new Cn(t).readTags()}function Un(t){let e=0;for(let n=t.length-1;n>=0;n--)e=256*e+t[n];return e}function Ln(t){let e=[0,0,0,0,0,0,0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}var Nn=tn(un(),1),_n=tn(ln(),1),jn=4096,Dn=80,Mn=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){let t=Un(this.binary.subarray(0,2));if(void 0!==wn?.[t])return t;throw new Error("Unknown signature type: "+t)}async isValid(){return Mn.verify(this.binary)}get id(){return(async()=>kn.default.encode(await this.rawId))()}set id(t){this._id=kn.default.toBuffer(t)}get rawId(){return(async()=>_n.Buffer.from(await Nn.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return kn.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Tn[this.signatureType].sigLength}get owner(){return kn.default.encode(this.rawOwner)}get ownerLength(){return Tn[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get target(){return kn.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(0==Un(this.binary.subarray(t,t+8)))return[];let e=Un(this.binary.subarray(t+8,t+16));return Bn(_n.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)})))}getStartOfData(){let t=this.getTagsStart();return t+16+Un(this.binary.subarray(t+8,t+16))}get rawData(){let t=this.getTagsStart(),e=t+16+Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(e,this.binary.length)}get data(){return kn.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Pn(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=_n.Buffer.from(await Sn().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)}))),data:this.data}}static async verify(t){if(t.byteLength<Dn)return!1;let e=new Mn(t),n=e.signatureType,r=e.getTagsStart(),i=Un(t.subarray(r,r+8)),o=Un(t.subarray(r+8,r+16));if(o>jn)return!1;if(i>0)try{if(Bn(_n.Buffer.from(t.subarray(r+16,r+16+o))).length!==i)return!1}catch{return!1}let s=An[n],a=await Rn(e);return await s.verify(e.rawOwner,a,e.rawSignature)}async getSignatureData(){return Rn(this)}getTagsStart(){let t=this.getTargetStart(),e=t+(1==this.binary[t]?33:1);return e+=1==this.binary[e]?33:1,e}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1;return t+=1==this.binary[this.getTargetStart()]?32:0,t}},Vn=tn(rn(),1);function Fn(t,e,n){let r=e.publicKey,i=n?.target?Vn.default.toBuffer(n.target):null,o=1+(i?.byteLength??0),s=n?.anchor?Buffer.from(n.anchor):null,a=1+(s?.byteLength??0),c=(n?.tags?.length??0)>0?In(n.tags):null,l=16+(c?c.byteLength:0),u=Buffer.from(t),h=u.byteLength,d=2+e.signatureLength+e.ownerLength+o+a+l+h,f=Buffer.alloc(d);if(f.set(function(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}(e.signatureType),0),f.set(new Uint8Array(e.signatureLength).fill(0),2),r.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${r.byteLength}`);f.set(r,2+e.signatureLength);let p=2+e.signatureLength+e.ownerLength;if(f[p]=i?1:0,i){if(32!==i.byteLength)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);f.set(i,p+1)}let m=p+o,g=m+1;if(f[m]=s?1:0,s){if(g+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");f.set(s,m+1)}f.set(Ln(n?.tags?.length??0),g);let y=Ln(c?.byteLength??0);f.set(y,g+8),c&&f.set(c,g+16);let w=g+l;return f.set(u,w),new Mn(f)}var Kn={...hn};globalThis.arbundles??=Kn;const{Axios:Wn,AxiosError:zn,CanceledError:Hn,isCancel:$n,CancelToken:Zn,VERSION:Xn,all:Gn,Cancel:Yn,isAxiosError:qn,spread:Jn,toFormData:Qn,AxiosHeaders:tr,HttpStatusCode:er,formToJSON:nr,getAdapter:rr,mergeConfig:ir}=He;var or=a(386),sr={debug:!1,inject:!1,auth0Domain:"auth.othent.io",auth0ClientId:"uXkRmJoIa0NfzYgYEDAgj6Rss4wR1tIc",auth0Strategy:"refresh-tokens",auth0Cache:"memory",auth0RefreshTokenExpirationMs:1296e6,auth0LogInMethod:"popup",auth0RedirectURI:null,auth0ReturnToURI:null,serverBaseURL:"https://kms-server.othent.io",autoConnect:"lazy",cookieKey:null,localStorageKey:null,throwErrors:!0,tags:[]},ar={...sr,appName:"",appVersion:"",persistCookie:!1,persistLocalStorage:!1,auth0Cache:"memory"},cr={host:"arweave.net",protocol:"https",port:443},lr="othentUserDetails",ur="Othent KMS",hr="2.0.0-beta.10",dr=[{name:"Client",value:ur},{name:"Client-Version",value:hr}],fr=class{constructor(t){this.listeners=new Set,this.initializedListeners=new Set,this.lastEmittedUpdateId="",this.lastEmittedParams=null,this.options={diffParams:!1,replyOnListen:!1},this.options={...this.options,...t}}getUpdateId(t){const{getUpdateIdTransform:e}=this.options,n=e?e(t):t;return JSON.stringify(n,((t,e)=>e&&"oject"===e&&!Array.isArray(e)?Object.entries(e).sort(((t,e)=>t[0].localeCompare(e[0]))):e))}get hasListeners(){return this.listeners.size>0}add(t){this.listeners.add(t),this.options.replyOnListen&&this.lastEmittedParams&&this.emit(...this.lastEmittedParams)}delete(t){this.listeners.add(t)}emit(...t){const{initializedListeners:e,lastEmittedUpdateId:n}=this,r=this.getUpdateId(t),i=n===r;return this.lastEmittedUpdateId=r,this.lastEmittedParams=t,this.listeners.forEach((n=>{if(!i||!e.has(n)){e.add(n);try{n(...t)}catch(t){}}})),i}};function pr(t,e){return et(!0,{},e,t)}var mr={secure:!0,domain:!0,ttlHours:360},gr=class t{constructor(e=mr){this.secureParam=null,this.domainParam=null,this.ttlMs=1296e6;const{secureParam:n,domainParam:r,ttlMs:i}=this.parseCookieOptions(pr(e,mr));return this.secureParam=n,this.domainParam=r,this.ttlMs=i,new Proxy(this,{get:(t,e)=>e in t||"string"!=typeof e?t[e]:t.getItem(e),ownKeys:e=>document.cookie.split(t.COOKIE_SEPARATOR).map((e=>e.split(t.COOKIE_VALUE_SEPARATOR)[0])),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})})}parseCookieOptions({secure:t,domain:e,ttlHours:n}={}){return{secureParam:t?"secure":void 0===t?this.secureParam:null,domainParam:e?`domain=${!0===e?location.host:e}`:void 0===e?this.domainParam:null,ttlMs:n?36e5*n:void 0===n?this.ttlMs:0}}getCookieParams(t){const{secureParam:e,domainParam:n,ttlMs:r}=this.parseCookieOptions(t),i=[`expires=${new Date(Date.now()+r).toUTCString()}`,e,n,"path=/"].filter(Boolean).join("; ");return i?` ${i};`:""}get length(){return document.cookie?document.cookie.split(t.COOKIE_SEPARATOR).length:0}key(e){return(document.cookie.split(t.COOKIE_SEPARATOR)[e]||"").split(t.COOKIE_VALUE_SEPARATOR)[0]||null}getItem(e){const n=document.cookie.split(t.COOKIE_SEPARATOR).find((n=>n.split(t.COOKIE_VALUE_SEPARATOR)[0]===e));return n&&n.split(t.COOKIE_VALUE_SEPARATOR)[1]||null}setItem(t,e,n){const r=`${t}=${"string"==typeof e?e:JSON.stringify(e)};${this.getCookieParams(n)}`;return document.cookie=r,r}removeItem(t,e){return this.setItem(t,"",{...e,ttlHours:-1})}clear(){document.cookie.split(t.COOKIE_SEPARATOR).forEach((e=>{this.removeItem(e.split(t.COOKIE_VALUE_SEPARATOR)[0])}))}};gr.COOKIE_SEPARATOR=/\s*;\s*/,gr.COOKIE_VALUE_SEPARATOR=/\s*=\s*/;var yr=gr,wr=null;var vr=class t{constructor({debug:t,domain:e,clientId:n,strategy:r,cache:i,refreshTokenExpirationMs:o,loginMethod:s,redirectURI:a,returnToURI:c,appInfo:l,initialUserDetails:u,cookieKey:h,localStorageKey:d}){this.debug=!1,this.auth0ClientPromise=Promise.resolve(null),this.authEventListenerHandler=new fr({diffParams:!0,replyOnListen:!0}),this.userDetails=null,this.userDetailsExpirationTimeoutID=0,this.cookieKey=null,this.localStorageKey=null,this.refreshTokenExpirationMs=+sr.auth0RefreshTokenExpirationMs,this.appInfo={name:"",version:""},this.isReady=!1,this.isAuthenticated=!1,this.debug=t,this.loginMethod=s,this.redirectURI=a,this.returnToURI=c,this.auth0ClientPromise=async function(t){const e=new tt(t);return await e.checkSession(),e}({domain:e,clientId:n,useRefreshTokens:"refresh-tokens"===r,cacheLocation:"string"==typeof i?i:void 0,cache:"object"==typeof i?i:void 0,authorizationParams:{redirect_uri:this.redirectURI}}).then((t=>(this.isReady=!0,t))),this.cookieKey=h,this.localStorageKey=d,this.refreshTokenExpirationMs=o,this.appInfo=l,this.restoreUserDetails(u||null),this.handleStorage=this.handleStorage.bind(this)}static isIdTokenValidUser(t){return!!(t&&t.sub&&t.owner&&t.walletAddress&&"KMS"===t.authSystem)}static async getUserDetails(e){const{email:n="",walletAddress:r}=e,i=e.sub||"",o=i.split("|")[0];let s=await async function(t){try{const e=(await He.get("https://api.mem.tech/api/state/Tih8T1uESATJNzdwBIY3rpe25kWTzjw8uNiMRYe9I5M",{timeout:2e3})).data.balances.find((e=>e.address===t)),n=e&&(e.primary_domain||e.ownedDomains[0].domain)||null;return n?`${n}.ar`:null}catch(e){return console.warn(`Error resolving ANS domain for ${t} =\n`,e),null}}(r);if(!s){s=`${t.PROVIDER_LABELS[o]||"Unknown Provider"} (${n})`}return{sub:i,name:e.name||"",givenName:e.given_name||"",middleName:e.middle_name||"",familyName:e.family_name||"",nickname:e.nickname||"",preferredUsername:e.preferred_username||"",profile:e.profile||"",picture:e.picture||"",website:e.website||"",locale:e.locale||"",updatedAt:e.updated_at||"",email:n,emailVerified:!!e.email_verified,owner:e.owner,walletAddress:e.walletAddress,walletAddressLabel:s,authSystem:e.authSystem,authProvider:o}}getAuthEventListenerHandler(){return this.authEventListenerHandler}setAppInfo(t){this.appInfo=t}initStorageSyncing(){this.localStorageKey&&window.addEventListener("storage",this.handleStorage)}stopStorageSyncing(){window.removeEventListener("storage",this.handleStorage)}handleStorage(t){t.key===this.localStorageKey&&(t.newValue?this.restoreUserDetails():this.logOut())}persistUserDetails(t){const{cookieKey:e,localStorageKey:n}=this;if(e){const n=function(){if(!wr){const t=!1;wr=new yr({secure:!t&&void 0,domain:!t&&void 0})}return wr}();t?n.setItem(e,JSON.stringify(t)):null!==n.getItem(e)&&n.removeItem(e)}if(n)if(t){const e=new Date,r=JSON.stringify({userDetails:t,createdAt:e.toUTCString(),expiredBy:new Date(e.getTime()+this.refreshTokenExpirationMs).toUTCString()});localStorage.setItem(n,r)}else this.clearStoredUserDetails()}setUserDetails(t,e=!0){window.clearTimeout(this.userDetailsExpirationTimeoutID),t&&(this.userDetailsExpirationTimeoutID=window.setTimeout(this.logOut,this.refreshTokenExpirationMs));return this.authEventListenerHandler.emit(t,e?!!t:this.isAuthenticated)||(this.userDetails=t),e&&(this.isAuthenticated=!!t,this.persistUserDetails(t)),t}restoreUserDetails(t){let e=t||null;if(!e&&this.localStorageKey)try{const t=JSON.parse(localStorage.getItem(this.localStorageKey)||"null");if(t){const n=new Date(t.expiredBy).getTime();!isNaN(n)&&n>Date.now()?e=t.userDetails:this.clearStoredUserDetails()}}catch(t){}this.setUserDetails(e,!1)}clearStoredUserDetails(){Object.keys(localStorage).forEach((t=>{t.startsWith("othent")&&localStorage.removeItem(t)}))}async updateUserDetails(e){const n=e&&t.isIdTokenValidUser(e)?await t.getUserDetails(e):null;return this.setUserDetails(n)}getAuthorizationParams(t={}){const{authorizationParams:e,data:n}=t.hasOwnProperty("keyName")?{authorizationParams:null,data:t}:{authorizationParams:t,data:null},r={othentFunction:"KMS",othentSDKVersion:ur,othentAPIVersion:hr,appName:this.appInfo.name,appVersion:this.appInfo.version};return n&&(r.data=n),{...e,transaction_input:JSON.stringify(r,((t,e)=>{let n=[];if(e instanceof Buffer||e instanceof DataView||ArrayBuffer.isView(e))n=Array.from(new Uint8Array(e.buffer));else{if(!(e instanceof ArrayBuffer))return e;n=Array.from(new Uint8Array(e))}return"data"===t?Object.fromEntries(Object.entries(n)):{type:"Buffer",data:n}}))}}async getTokenSilently(t){const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");const n=this.getAuthorizationParams(t);if(this.debug)try{console.log("getTokenSilently() =",{...n,transaction_input:JSON.parse(n.transaction_input)})}catch(t){console.error("Error logging/parsing `authorizationParams`:",t)}try{const t=await e.getTokenSilently({detailedResponse:!0,authorizationParams:n,cacheMode:"off"}),r=await e.getUser();if(!r)throw new Error("Could not get the user's details");const i=await this.updateUserDetails(r);return{...t,idToken:r,userDetails:i}}catch(t){throw t}}async logIn(){const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");this.debug&&console.log("logIn()");if(await t.isAuthenticated())throw new Error("Already logged in");const e=this.getAuthorizationParams({redirect_uri:this.redirectURI});if("popup"!==this.loginMethod)throw t.loginWithRedirect({authorizationParams:e}),new Error("Redirecting...");return await t.loginWithPopup({authorizationParams:e},{}),this.getTokenSilently()}async handleRedirectCallback(t){this.debug&&console.log(`handleRedirectCallback(${t})`);const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");await e.handleRedirectCallback(t);const n=await e.getUser();if(!n)throw new Error("Could not get the user's details");return this.updateUserDetails(n)}async logOut(){this.setUserDetails(null);const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");return t.logout({logoutParams:{returnTo:this.returnToURI}}).catch((t=>{console.warn(t instanceof Error?t.message:t),"undefined"!=typeof location&&location.reload()}))}async encodeToken(t){return(await this.getTokenSilently(t)).id_token}getCachedUserDetails(){return this.userDetails}getCachedUserPublicKey(){var t;return(null==(t=this.userDetails)?void 0:t.owner)||null}getCachedUserSub(){var t;return(null==(t=this.userDetails)?void 0:t.sub)||null}getCachedUserAddress(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddress)||null}getCachedUserAddressLabel(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddressLabel)||null}getCachedUserEmail(){var t;return(null==(t=this.userDetails)?void 0:t.email)||null}};vr.PROVIDER_LABELS={apple:"Apple",auth0:"E-Mail","google-oauth2":"Google","<LinkedIn>":"LinkedIn","<X>":"X","<Meta>":"Meta","<Twitch>":"Twitch",github:"GitHub"};var br=vr;function Er(t){return"string"==typeof t?Sr(t):t}function Sr(t){return(new TextEncoder).encode(t)}function Tr(t){return e=function(t){return $e.fromByteArray(new Uint8Array(t))}(t),e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");var e}async function xr(t,e="SHA-256"){let n=await crypto.subtle.digest(e,t);return new Uint8Array(n)}var Ar=(t=>(t.Unexpected="Unexpected",t.Validation="Validation",t.UserCreation="UserCreation",t.Encryption="Encryption",t.Decryption="Decryption",t.Signing="Signing",t.PublicKey="PublicKey",t))(Ar||{}),kr=class extends Error{constructor(t,e,n,r=!1){super(),this.name=t,this.message=e||"",r?this.stack=`${t} (from server): ${e}\n`:Error.captureStackTrace(this),this.id=t,this.developerMessage=e,n instanceof Error?this.cause=n:"string"!=typeof n&&"number"!=typeof n||(this.cause=new Error(`${n}`))}};function Rr(t){var e;if(qn(t)){const n=null==(e=t.response)?void 0:e.data;if(!function(t){return"object"==typeof t&&!0===t.error&&!!t.id&&!!Ar[t.id]}(n))return t;const{id:r,developerMessage:i,cause:o}=n;let s;return o&&(s=new Error(o.message),s.name=o.name,s.stack=o.stack),new kr(r,i||"",s,!0)}return t instanceof Error?t:new Error("Unknown error")}async function Pr(t,e,n,r){var i;const o=await e.encodeToken({ciphertext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/decrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error decrypting on server.");return"string"==typeof s?s:(a=new Uint8Array(s.data),(new TextDecoder).decode(a));var a}var Cr=class{constructor(t,e){this.api=He.create({baseURL:t}),this.auth0=e}async createUser(t){return async function(t,e){let n=!1;try{n=(await t.post("/create-user",{encodedData:e})).data.data}catch(t){throw Rr(t)}if(!n)throw new Error("Error creating user on server.");return!0}(this.api,t)}async decrypt(t,e){return Pr(this.api,this.auth0,t,e)}async encrypt(t,e){return async function(t,e,n,r){var i;const o=await e.encodeToken({plaintext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/encrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error encrypting on server.");return"string"==typeof s?Sr(s):new Uint8Array(s.data)}(this.api,this.auth0,t,e)}async sign(t,e){return async function(t,e,n,r){const i=await e.encodeToken({data:n,keyName:r});let o=null;try{o=(await t.post("/sign",{encodedData:i})).data.data}catch(t){throw Rr(t)}if(null===o)throw new Error("Error signing data on server.");return"string"==typeof o?Sr(o):new Uint8Array(o.data)}(this.api,this.auth0,t,e)}getSignerSignFn(t){return async e=>await this.sign(e,t)}};function Ir(t,e="utf8"){return r.lW.isBuffer(t)?Br(t.toString("base64")):Br(r.lW.from(t,e).toString("base64"))}function Or(t){return function(t){let e=t.length,n=e%4;if(!n)return t;let i=e,o=4-n,s=e+o,a=r.lW.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}(t=t.toString()).replace(/\-/g,"+").replace(/_/g,"/")}function Br(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ur(t){return r.lW.from(Or(t),"base64")}var Lr=Ir;function Nr(t){return or.default.init(t)}Lr.encode=Ir,Lr.decode=function(t,e="utf8"){return r.lW.from(Or(t),"base64").toString(e)},Lr.toBase64=Or,Lr.fromBase64=Br,Lr.toBuffer=Ur;var _r=class t{constructor(t=ar){this.errorEventListenerHandler=new fr,this.tokens=new Set,this.walletName=ur,this.walletVersion=hr,this.config=sr,this.appInfo={name:"",version:""},this.gatewayConfig=cr;let{appName:e,appVersion:n,persistCookie:r,persistLocalStorage:i,auth0Cache:o=sr.auth0Cache,auth0RedirectURI:s,auth0ReturnToURI:a,gatewayConfig:c,initialUserDetails:l,...u}=t;const h="undefined"==typeof location?null:location.origin;this.config={...pr(u,sr),cookieKey:"string"==typeof r?r:r?lr:null,localStorageKey:"string"==typeof i?i:i?lr:null,auth0Cache:"object"==typeof o?"custom":o,auth0RedirectURI:s||h,auth0ReturnToURI:a||h};const{config:d}=this,{cookieKey:f,localStorageKey:p}=d;if("string"==typeof f&&!f.startsWith("othent"))throw new Error('`persistCookie` / `cookieKey` must start with "othent".');if("string"==typeof p&&!p.startsWith("othent"))throw new Error('`persistLocalStorage` / `localStorageKey` must start with "othent".');if(!d.auth0RedirectURI)throw new Error("`auth0RedirectURI` is required.");if(!d.auth0ReturnToURI)throw new Error("`auth0ReturnToURI` is required.");this.appInfo={name:e,version:n},this.gatewayConfig=c||cr;let m=null;if("undefined"!=typeof window)m=window.crypto;else{if("undefined"==typeof global)throw new Error("A Crypto module is needed for Othent to work. If your environment doesn't natively provide one, you should polyfill it.");m=global.crypto}if(this.crypto=m,"eager"===d.autoConnect&&"popup"===d.auth0LogInMethod&&"refresh-tokens"===d.auth0Strategy&&"memory"===o)throw new Error('The browser cannot open the authentication modal automatically before an user interaction. Use `autoConnect = "lazy"` or change any of these other options: `auth0LogInMethod`, `auth0Strategy` or `auth0Cache`.');if(this.auth0=new br({debug:d.debug,domain:d.auth0Domain,clientId:d.auth0ClientId,strategy:d.auth0Strategy,cache:o,refreshTokenExpirationMs:d.auth0RefreshTokenExpirationMs,redirectURI:d.auth0RedirectURI,returnToURI:d.auth0ReturnToURI,loginMethod:d.auth0LogInMethod,appInfo:this.appInfo,initialUserDetails:l,cookieKey:d.cookieKey,localStorageKey:d.localStorageKey}),"eager"===this.config.autoConnect){let t="undefined"==typeof location;if(!t){const e=new URL(location.href),{searchParams:n}=e;n.has("code")||n.has("state")||(t=!0)}t&&this.connect()}if(d.inject&&(window.arweaveWallet=this),!d.throwErrors){["connect","disconnect","getActiveAddress","getActivePublicKey","getAllAddresses","getWalletNames","getUserDetails","getSyncActiveAddress","getSyncActivePublicKey","getSyncAllAddresses","getSyncWalletNames","getSyncUserDetails","sign","dispatch","encrypt","decrypt","signature","signDataItem","signMessage","verifyMessage","privateHash","getArweaveConfig","getPermissions"].forEach((t=>{let e=this[t];"function"==typeof e&&(e=e.bind(this),this[t]=(...t)=>{try{let r=e(...t);return!(n=r)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then||(r=r.catch((t=>(this.onError(t),null)))),r}catch(t){this.onError(t)}var n;return null})}))}this.api=new Cr(this.config.serverBaseURL,this.auth0)}startTabSynching(){return this.config.localStorageKey||console.warn("Calling `Othent.startTabSynching()` is a NOOP unless the `persistLocalStorage` option is used."),this.auth0.initStorageSyncing(),()=>{this.auth0.stopStorageSyncing()}}async completeConnectionAfterRedirect(t){"redirect"!==this.config.auth0LogInMethod&&console.warn('Calling `Othent.completeConnectionAfterRedirect()` is a NOOP unless the `auth0LogInMethod` options is `"redirect"`.');const e=t||("undefined"==typeof location?"":location.href),n=new URL(e.replace(/.+\.auth0:\/\//,"https://")),{searchParams:r}=n;if(!r.has("code")||!r.has("state")||!e)return null;let i=null;try{i=await this.auth0.handleRedirectCallback(e)}finally{"undefined"!=typeof location&&"undefined"!=typeof history&&(r.delete("code"),r.delete("state"),history.replaceState(null,"",n))}return i}get isReady(){return this.auth0.isReady}onError(t){t instanceof Error?this.errorEventListenerHandler.hasListeners?this.errorEventListenerHandler.emit(t):console.warn("Unhandled unthrown error:\n",t,'\nWhen using `throwErrors = false`, you must add at least one error event listener with `othent.addEventListener("error", () => { ... })`'):console.warn("Unknown error type",t)}addEventListener(t,e){let n=null;if("auth"===t)n=this.auth0.getAuthEventListenerHandler();else if("error"===t){if(this.config.throwErrors)throw new Error("You can only listen for `error` events if `throwErrors = false`.");n=this.errorEventListenerHandler}if(!n)throw new Error("Unknown event type");return n.add(e),()=>{n.delete(e)}}removeEventListener(t,e){let n=null;if("auth"===t?n=this.auth0.getAuthEventListenerHandler():"error"===t&&(n=this.errorEventListenerHandler),!n)throw new Error("Unknown event type");n.delete(e)}get isAuthenticated(){return this.auth0.isAuthenticated}requireAuth(){return this.requireUserDataOrThrow().then((()=>{}))}async requireUserDataOrThrow(){"off"===this.config.autoConnect||this.auth0.isAuthenticated||await this.connect(void 0,void 0,this.gatewayConfig);const{sub:t,owner:e}=this.auth0.getCachedUserDetails()||{};if(!t||!e)throw new Error("Missing cached user.");return{sub:t,publicKey:e}}async connect(e,n,r){if(e&&e.toSorted().join("-")!==t.ALL_PERMISSIONS.join("-"))throw new Error("Othent implicitly has access to all available permissions. You should pass `permissions = undefined` or include all of them.");n&&(this.appInfo=n,this.auth0.setAppInfo(n)),this.gatewayConfig=r||cr;let i="",o=null;try{const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Login required"!==t.message&&!(t instanceof E))throw t;console.warn(t.message)}if(!i)try{const t=await this.auth0.logIn();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Redirecting..."===t.message&&await new Promise((()=>{})),t.message.startsWith("Unable to open a popup")||t instanceof v||t instanceof w)return t instanceof w&&t.popup.close(),console.warn(t.message),null;throw t}if(i&&!o){await this.api.createUser(i);const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}if(i&&o)return o;throw this.auth0.logOut(),new Error("Unexpected authentication error")}async disconnect(){return this.auth0.logOut()}getActiveAddress(){return Promise.resolve(this.getSyncActiveAddress())}getActivePublicKey(){return Promise.resolve(this.getSyncActivePublicKey())}getAllAddresses(){return Promise.resolve(this.getSyncAllAddresses())}getWalletNames(){return Promise.resolve(this.getSyncWalletNames())}getUserDetails(){return Promise.resolve(this.getSyncUserDetails())}getSyncActiveAddress(){return this.auth0.getCachedUserAddress()||""}getSyncActivePublicKey(){return this.auth0.getCachedUserPublicKey()||""}getSyncAllAddresses(){const t=this.auth0.getCachedUserAddress();return t?[t]:[]}getSyncWalletNames(){const t=this.auth0.getCachedUserAddress(),e=this.auth0.getCachedUserAddressLabel();return Promise.resolve(t&&e?{[t]:e}:{})}getSyncUserDetails(){return this.auth0.getCachedUserDetails()}addCommonTags(t=[]){if(Array.isArray(t)){const e=[{name:"App-Name",value:this.appInfo.name},{name:"App-Version",value:this.appInfo.version}];return[...t,...this.config.tags,...e,...dr]}for(const{name:e,value:n}of this.config.tags)t.addTag(e,n);t.addTag("App-Name",this.appInfo.name),t.addTag("App-Version",this.appInfo.version);for(const{name:e,value:n}of dr)t.addTag(e,n)}async sign(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),r=Nr(this.gatewayConfig),i=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),o=this.addCommonTags(i),s=await r.createTransaction({data:t.data,owner:n,reward:t.reward});o.forEach((t=>{s.addTag(t.name,t.value)}));const a=await s.getSignatureData(),c=await this.api.sign(a,e),l=await xr(c);return s.setSignature({id:Tr(l),owner:n,signature:Tr(c),tags:s.tags,reward:s.reward}),s}async dispatch(t,e){var n;const r=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),i=await this.signDataItem({data:t.data,tags:r,target:t.target}),o=`${(null==e?void 0:e.node)||"https://turbo.ardrive.io"}/tx`;try{const t=await He.post(o,i,{headers:{"Content-Type":"application/octet-stream"},maxBodyLength:1/0,maxContentLength:1/0,responseType:"json"});if(t.status>=400)throw new Error(`${t.status} - ${JSON.stringify(t.data)}`);return{...t.data,type:"BUNDLED"}}catch(r){console.warn(`Error dispatching transaction to ${o} =\n`,r);const i=await this.sign(t),s=null!=(n=null==e?void 0:e.arweave)?n:Nr(this.gatewayConfig),a=await s.transactions.getUploader(i);for(;!a.isComplete;)await a.uploadChunk();return{id:i.id,signature:i.signature,owner:i.owner,type:"BASE"}}}async encrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.encrypt(t,e)}async decrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.decrypt(t,e)}async signature(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.sign(t,e)}async signDataItem(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),{data:r,tags:i,...o}=t,s={publicKey:Ur(n),signatureType:1,signatureLength:512,ownerLength:512,sign:this.api.getSignerSignFn(e)},a=Fn(r,s,{...o,tags:this.addCommonTags(i)});return await a.sign(s),a.getRaw().buffer}async signMessage(t,e){const{sub:n}=await this.requireUserDataOrThrow(),r=(null==e?void 0:e.hashAlgorithm)||"SHA-256",i=await this.crypto.subtle.digest(r,Er(t));return await this.api.sign(i,n)}async verifyMessage(t,e,n,r={hashAlgorithm:"SHA-256"}){if(!n){const t=await this.requireUserDataOrThrow();n||(n=t.publicKey)}const i=(null==r?void 0:r.hashAlgorithm)||"SHA-256",o=await this.crypto.subtle.digest(i,Er(t)),s={e:"AQAB",ext:!0,kty:"RSA",n},a=await this.crypto.subtle.importKey("jwk",s,{name:"RSA-PSS",hash:r.hashAlgorithm},!1,["verify"]);return await this.crypto.subtle.verify({name:"RSA-PSS",saltLength:32},a,Er(e),o)}async privateHash(t,e){return xr(Er(t),null==e?void 0:e.hashAlgorithm)}getArweaveConfig(){return Promise.resolve(this.gatewayConfig)}getPermissions(){return Promise.resolve(t.ALL_PERMISSIONS)}addToken(t,e,n){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),this.tokens.add(t),Promise.resolve()}isTokenAdded(t){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),Promise.resolve(this.tokens.has(t))}};_r.walletName=ur,_r.walletVersion=hr,_r.ALL_PERMISSIONS=["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_ARWEAVE_CONFIG","ACCESS_PUBLIC_KEY","DECRYPT","DISPATCH","ENCRYPT","SIGN_TRANSACTION","SIGNATURE"];var jr=_r;async function Dr(t,e){try{const n=function(t){const e=t.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=window.atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;t++)r[t]=n.charCodeAt(t);return r.buffer}(t),r=await window.crypto.subtle.importKey("spki",n,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"]);return function(t){try{let e="";const n=new Uint8Array(t),r=n.byteLength;for(let t=0;t<r;t++)e+=String.fromCharCode(n[t]);return window.btoa(e)}catch(t){console.error("Eror in buffertoBase64 : ",t)}}(await window.crypto.subtle.encrypt({name:"RSA-OAEP"},r,(new TextEncoder).encode(e)))}catch(t){return console.error("rsaEncrypt error:",t),null}}async function Mr(t){const e={Info:{hashedOthentSub:t},request:"PIN"};return await fetch("https://api2.onairos.uk/getAccountInfoFromOthentSub",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((t=>t.json())).then((t=>t)).catch((t=>console.error(t)))}window.Buffer=r.lW;(0,e.createContext)(null);class Vr extends Error{}Vr.prototype.name="InvalidTokenError";const Fr=async()=>{if(!window.PublicKeyCredential)throw new Error("WebAuthn not supported");try{if(!await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())throw new Error("Biometric authentication not available");return!!await navigator.credentials.get({publicKey:{challenge:new Uint8Array(32),rpId:window.location.hostname,userVerification:"required"}})}catch(t){return console.error("Biometric authentication failed:",t),!1}};function Kr(t){let{onLoginSuccess:n}=t;const[r,i]=(0,e.useState)(!1);return React.createElement("div",{className:"flex flex-col items-center"},React.createElement("button",{onClick:async()=>{i(!0);try{const t=await(async()=>{const t=localStorage.getItem("onairosCredentials");if(!t)return null;try{const e=JSON.parse(t);return(await fetch("https://api2.onairos.uk/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e.username,token:e.token})})).ok?e:(localStorage.removeItem("onairosCredentials"),null)}catch(t){return console.error("Verification failed:",t),null}})();if(t){if(await Fr())return void await n(t.username)}const e=Date.now(),r=encodeURIComponent(window.location.origin+"/auth/callback"),i="onairos://authenticate?nonce=".concat(e,"&callback=").concat(r,"&appName=google");window.location.href=i,setTimeout((()=>{window.location.href="https://apps.apple.com/app/onairos/id123456789"}),2500)}catch(t){console.error("App login failed:",t)}finally{i(!1)}},disabled:r,className:"w-12 h-12 rounded-full shadow-md hover:shadow-lg transition-shadow duration-200 flex items-center justify-center bg-white"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-6 h-6"})),React.createElement("span",{className:"text-xs mt-2 text-gray-600"},"Login with App"))}function Wr(t){let{onSuccess:n,onLoginSuccess:r}=t;const[i,o]=(0,e.useState)(!1);return React.createElement("div",{className:"flex flex-col items-center"},React.createElement("button",{onClick:async()=>{o(!0);try{const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href});if(!await t.connect())throw new Error("Othent connection failed")}catch(t){console.error("Othent login failed:",t)}finally{o(!1)}},disabled:i,className:"w-12 h-12 rounded-full shadow-md hover:shadow-lg transition-shadow duration-200 flex items-center justify-center bg-white"},React.createElement("img",{src:"https://imagepng.org/google-icone-icon/google-icon/",alt:"Othent",className:"w-6 h-6"}),i&&React.createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-50 rounded-full"},React.createElement("div",{className:"animate-spin h-4 w-4 border-2 border-blue-500 rounded-full border-t-transparent"}))),React.createElement("span",{className:"text-xs mt-2 text-gray-600"},"Google"))}function zr(t){let{onLoginSuccess:n,setOthent:r,setHashedOthentSub:i,setEncryptedPin:o}=t;const[s,a]=(0,e.useState)(!1);(0,e.useEffect)((()=>{c()}),[]);const c=async()=>{const t=localStorage.getItem("onairosCredentials");a(!!t)};return React.createElement("div",{className:"flex flex-row justify-center items-center space-x-4"},React.createElement(Wr,{onSuccess:async t=>{r(!0),i(t.hashedOthentSub),o(t.encryptedPin),await n(t.userDetails)},onLoginSuccess:async t=>{n(t,!0)}}),React.createElement(Kr,{hasSavedCredentials:s,onSuccess:n}))}var Hr=a(697),$r=a.n(Hr);function Zr(t){const[r,i]=(0,e.useState)(!1);return n().createElement("div",{className:"bg-white rounded-lg p-4 shadow border border-gray-200"},n().createElement("div",{className:"flex items-center justify-between"},n().createElement("div",{className:"flex items-center space-x-4"},n().createElement("div",{className:"group"},n().createElement("div",null,n().createElement("input",{disabled:!t.active,type:"checkbox",checked:r,onChange:e=>{var n;n=e.target.checked,i(n),console.log("Following has been clicked :",t.title),console.log("With new Checked state now being: ",n),console.log("Current number of selection: ",t.number+1)}})))),n().createElement("div",{className:"flex items-center"}),t.descriptions&&"Avatar"!==t.title&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Intent: ",t.descriptions),t.rewards&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Rewards: ",t.rewards)))}function Xr(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}function Gr(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}Zr.propTypes={active:$r().bool.isRequired,title:$r().string.isRequired,id:$r().any.isRequired,number:$r().number.isRequired,descriptions:$r().string,rewards:$r().string,size:$r().string.isRequired,changeGranted:$r().func.isRequired,onSelectionChange:$r().func.isRequired};const Yr=t=>Array.isArray(t);function qr(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Jr(t){return"string"==typeof t||Array.isArray(t)}function Qr(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function ti(t,e,n,r){if("function"==typeof e){const[i,o]=Qr(r);e=e(void 0!==n?n:t.custom,i,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,o]=Qr(r);e=e(void 0!==n?n:t.custom,i,o)}return e}function ei(t,e,n){const r=t.getProps();return ti(r,e,void 0!==n?n:r.custom,t)}const ni=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ri=["initial",...ni],ii=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],oi=new Set(ii),si=t=>1e3*t,ai=t=>t/1e3,ci={type:"spring",stiffness:500,damping:25,restSpeed:10},li={type:"keyframes",duration:.8},ui={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},hi=(t,{keyframes:e})=>e.length>2?li:oi.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ci:ui;function di(t,e){return t?t[e]||t.default||t:void 0}const fi=!1,pi=!1,mi=!1,gi=t=>null!==t;function yi(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(gi),o=e&&"loop"!==n&&e%2==1?0:i.length-1;return o&&void 0!==r?r:i[o]}const wi=t=>t;const vi=["read","resolveKeyframes","update","preRender","render","postRender"];function bi(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=vi.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,i=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function a(e){o.has(e)&&(c.schedule(e),t()),e(s)}const c={schedule:(t,i=!1,s=!1)=>{const a=s&&r?e:n;return i&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{s=t,r?i=!0:(r=!0,[e,n]=[n,e],e.forEach(a),e.clear(),r=!1,i&&(i=!1,c.process(t)))}};return c}(o),t)),{}),{read:a,resolveKeyframes:c,update:l,preRender:u,render:h,postRender:d}=s,f=()=>{const o=pi?i.timestamp:performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,40),1),i.timestamp=o,i.isProcessing=!0,a.process(i),c.process(i),l.process(i),u.process(i),h.process(i),d.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(f))};return{schedule:vi.reduce(((e,o)=>{const a=s[o];return e[o]=(e,o=!1,s=!1)=>(n||(n=!0,r=!0,i.isProcessing||t(f)),a.schedule(e,o,s)),e}),{}),cancel:t=>{for(let e=0;e<vi.length;e++)s[vi[e]].cancel(t)},state:i,steps:s}}const{schedule:Ei,cancel:Si,state:Ti,steps:xi}=bi("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:wi,!0),Ai=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,ki=1e-7,Ri=12;function Pi(t,e,n,r){if(t===e&&n===r)return wi;const i=e=>function(t,e,n,r,i){let o,s,a=0;do{s=e+(n-e)/2,o=Ai(s,r,i)-t,o>0?n=s:e=s}while(Math.abs(o)>ki&&++a<Ri);return s}(e,0,1,t,n);return t=>0===t||1===t?t:Ai(i(t),e,r)}const Ci=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ii=t=>e=>1-t(1-e),Oi=Pi(.33,1.53,.69,.99),Bi=Ii(Oi),Ui=Ci(Bi),Li=t=>(t*=2)<1?.5*Bi(t):.5*(2-Math.pow(2,-10*(t-1))),Ni=t=>1-Math.sin(Math.acos(t)),_i=Ii(Ni),ji=Ci(Ni),Di=t=>/^0[^.\s]+$/u.test(t);let Mi=wi,Vi=wi;const Fi=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Ki=t=>e=>"string"==typeof e&&e.startsWith(t),Wi=Ki("--"),zi=Ki("var(--"),Hi=t=>!!zi(t)&&$i.test(t.split("/*")[0].trim()),$i=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zi=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Xi(t,e,n=1){Vi(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,i]=function(t){const e=Zi.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${null!=n?n:r}`,i]}(t);if(!r)return;const o=window.getComputedStyle(e).getPropertyValue(r);if(o){const t=o.trim();return Fi(t)?parseFloat(t):t}return Hi(i)?Xi(i,e,n+1):i}const Gi=(t,e,n)=>n>e?e:n<t?t:n,Yi={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},qi={...Yi,transform:t=>Gi(0,1,t)},Ji={...Yi,default:1},Qi=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),to=Qi("deg"),eo=Qi("%"),no=Qi("px"),ro=Qi("vh"),io=Qi("vw"),oo={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(100*t)},so=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),ao=t=>t===Yi||t===no,co=(t,e)=>parseFloat(t.split(", ")[e]),lo=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return co(i[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?co(e[1],t):0}},uo=new Set(["x","y","z"]),ho=ii.filter((t=>!uo.has(t)));const fo={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:lo(4,13),y:lo(5,14)};fo.translateX=fo.x,fo.translateY=fo.y;const po=t=>e=>e.test(t),mo=[Yi,no,eo,to,io,ro,{test:t=>"auto"===t,parse:t=>t}],go=t=>mo.find(po(t)),yo=new Set;let wo=!1,vo=!1;function bo(){if(vo){const t=Array.from(yo).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return ho.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}vo=!1,wo=!1,yo.forEach((t=>t.complete())),yo.clear()}function Eo(){yo.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(vo=!0)}))}class So{constructor(t,e,n,r,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yo.add(this),wo||(wo=!0,Ei.read(Eo),Ei.resolveKeyframes(bo))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let i=0;i<t.length;i++)if(null===t[i])if(0===i){const i=null==r?void 0:r.get(),o=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const r=n.readValue(e,o);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=o),r&&void 0===i&&r.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),yo.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,yo.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const To=t=>Math.round(1e5*t)/1e5,xo=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ao=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ko=(t,e)=>n=>Boolean("string"==typeof n&&Ao.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Ro=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[i,o,s,a]=r.match(xo);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},Po={...Yi,transform:t=>Math.round((t=>Gi(0,255,t))(t))},Co={test:ko("rgb","red"),parse:Ro("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Po.transform(t)+", "+Po.transform(e)+", "+Po.transform(n)+", "+To(qi.transform(r))+")"};const Io={test:ko("#"),parse:function(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:Co.transform},Oo={test:ko("hsl","hue"),parse:Ro("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+eo.transform(To(e))+", "+eo.transform(To(n))+", "+To(qi.transform(r))+")"},Bo={test:t=>Co.test(t)||Io.test(t)||Oo.test(t),parse:t=>Co.test(t)?Co.parse(t):Oo.test(t)?Oo.parse(t):Io.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Co.transform(t):Oo.transform(t)},Uo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Lo="number",No="color",_o="var",jo="var(",Do="${}",Mo=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Vo(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const s=e.replace(Mo,(t=>(Bo.test(t)?(r.color.push(o),i.push(No),n.push(Bo.parse(t))):t.startsWith(jo)?(r.var.push(o),i.push(_o),n.push(t)):(r.number.push(o),i.push(Lo),n.push(parseFloat(t))),++o,Do))).split(Do);return{values:n,split:s,indexes:r,types:i}}function Fo(t){return Vo(t).values}function Ko(t){const{split:e,types:n}=Vo(t),r=e.length;return t=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],void 0!==t[o]){const e=n[o];i+=e===Lo?To(t[o]):e===No?Bo.transform(t[o]):t[o]}return i}}const Wo=t=>"number"==typeof t?0:t;const zo={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(xo))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Uo))||void 0===n?void 0:n.length)||0)>0},parse:Fo,createTransformer:Ko,getAnimatableNone:function(t){const e=Fo(t);return Ko(t)(e.map(Wo))}},Ho=new Set(["brightness","contrast","saturate","opacity"]);function $o(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(xo)||[];if(!r)return t;const i=n.replace(r,"");let o=Ho.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const Zo=/\b([a-z-]*)\(.*?\)/gu,Xo={...zo,getAnimatableNone:t=>{const e=t.match(Zo);return e?e.map($o).join(" "):t}},Go={borderWidth:no,borderTopWidth:no,borderRightWidth:no,borderBottomWidth:no,borderLeftWidth:no,borderRadius:no,radius:no,borderTopLeftRadius:no,borderTopRightRadius:no,borderBottomRightRadius:no,borderBottomLeftRadius:no,width:no,maxWidth:no,height:no,maxHeight:no,top:no,right:no,bottom:no,left:no,padding:no,paddingTop:no,paddingRight:no,paddingBottom:no,paddingLeft:no,margin:no,marginTop:no,marginRight:no,marginBottom:no,marginLeft:no,backgroundPositionX:no,backgroundPositionY:no},Yo={rotate:to,rotateX:to,rotateY:to,rotateZ:to,scale:Ji,scaleX:Ji,scaleY:Ji,scaleZ:Ji,skew:to,skewX:to,skewY:to,distance:no,translateX:no,translateY:no,translateZ:no,x:no,y:no,z:no,perspective:no,transformPerspective:no,opacity:qi,originX:oo,originY:oo,originZ:no},qo={...Yi,transform:Math.round},Jo={...Go,...Yo,zIndex:qo,size:no,fillOpacity:qi,strokeOpacity:qi,numOctaves:qo},Qo={...Jo,color:Bo,backgroundColor:Bo,outlineColor:Bo,fill:Bo,stroke:Bo,borderColor:Bo,borderTopColor:Bo,borderRightColor:Bo,borderBottomColor:Bo,borderLeftColor:Bo,filter:Xo,WebkitFilter:Xo},ts=t=>Qo[t];function es(t,e){let n=ts(t);return n!==Xo&&(n=zo),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ns=new Set(["auto","none","0"]);class rs extends So{constructor(t,e,n,r,i){super(t,e,n,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),Hi(r))){const i=Xi(r,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!so.has(n)||2!==t.length)return;const[r,i]=t,o=go(r),s=go(i);if(o!==s)if(ao(o)&&ao(s))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||Di(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,i=0;for(;i<t.length&&!r;){const e=t[i];"string"==typeof e&&!ns.has(e)&&Vo(e).values.length&&(r=t[i]),i++}if(r&&n)for(const i of e)t[i]=es(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=fo[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,s=r[o];r[o]=fo[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}function is(t){return"function"==typeof t}let os;function ss(){os=void 0}const as={now:()=>(void 0===os&&as.set(Ti.isProcessing||pi?Ti.timestamp:performance.now()),os),set:t=>{os=t,queueMicrotask(ss)}},cs=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!zo.test(t)&&"0"!==t||t.startsWith("url(")));function ls(t,e,n,r){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],s=cs(i,e),a=cs(o,e);return Mi(s===a,`You are trying to animate ${e} from "${i}" to "${o}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${o} via the \`style\` property.`),!(!s||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||is(n))&&r)}class us{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",...s}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=as.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:i,repeatType:o,...s},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Eo(),bo()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=as.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:i,delay:o,onComplete:s,onUpdate:a,isGenerator:c}=this.options;if(!c&&!ls(t,n,r,i)){if(mi||!o)return null==a||a(yi(t,this.options,e)),null==s||s(),void this.resolveFinishedPromise();this.options.duration=0}const l=this.initPlayback(t,e);!1!==l&&(this._resolved={keyframes:t,finalKeyframe:e,...l},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}const hs=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},ds=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)r+=t(hs(0,i-1,e))+", ";return`linear(${r.substring(0,r.length-2)})`};function fs(t,e){return e?t*(1e3/e):0}const ps=5;function ms(t,e,n){const r=Math.max(e-ps,0);return fs(n-t(r),e-r)}const gs={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ys=.001;function ws({duration:t=gs.duration,bounce:e=gs.bounce,velocity:n=gs.velocity,mass:r=gs.mass}){let i,o;Mi(t<=si(gs.maxDuration),"Spring duration must be 10 seconds or less");let s=1-e;s=Gi(gs.minDamping,gs.maxDamping,s),t=Gi(gs.minDuration,gs.maxDuration,ai(t)),s<1?(i=e=>{const r=e*s,i=r*t,o=r-n,a=bs(e,s),c=Math.exp(-i);return ys-o/a*c},o=e=>{const r=e*s*t,o=r*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,c=Math.exp(-r),l=bs(Math.pow(e,2),s);return(-i(e)+ys>0?-1:1)*((o-a)*c)/l}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-ys,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let n=1;n<vs;n++)r-=t(r)/e(r);return r}(i,o,5/t);if(t=si(t),isNaN(a))return{stiffness:gs.stiffness,damping:gs.damping,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*s*Math.sqrt(r*e),duration:t}}}const vs=12;function bs(t,e){return t*Math.sqrt(1-e*e)}const Es=2e4;function Ss(t){let e=0;let n=t.next(e);for(;!n.done&&e<Es;)e+=50,n=t.next(e);return e>=Es?1/0:e}const Ts=["duration","bounce"],xs=["stiffness","damping","mass"];function As(t,e){return e.some((e=>void 0!==t[e]))}function ks(t=gs.visualDuration,e=gs.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:c,damping:l,mass:u,duration:h,velocity:d,isResolvedFromDuration:f}=function(t){let e={velocity:gs.velocity,stiffness:gs.stiffness,damping:gs.damping,mass:gs.mass,isResolvedFromDuration:!1,...t};if(!As(t,xs)&&As(t,Ts))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),i=r*r,o=2*Gi(.05,1,1-t.bounce)*Math.sqrt(i);e={...e,mass:gs.mass,stiffness:i,damping:o}}else{const n=ws(t);e={...e,...n,mass:gs.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-ai(n.velocity||0)}),p=d||0,m=l/(2*Math.sqrt(c*u)),g=s-o,y=ai(Math.sqrt(c/u)),w=Math.abs(g)<5;let v;if(r||(r=w?gs.restSpeed.granular:gs.restSpeed.default),i||(i=w?gs.restDelta.granular:gs.restDelta.default),m<1){const t=bs(y,m);v=e=>{const n=Math.exp(-m*y*e);return s-n*((p+m*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===m)v=t=>s-Math.exp(-y*t)*(g+(p+y*g)*t);else{const t=y*Math.sqrt(m*m-1);v=e=>{const n=Math.exp(-m*y*e),r=Math.min(t*e,300);return s-n*((p+m*y*g)*Math.sinh(r)+t*g*Math.cosh(r))/t}}const b={calculatedDuration:f&&h||null,next:t=>{const e=v(t);if(f)a.done=t>=h;else{let n=0;m<1&&(n=0===t?si(p):ms(v,t,e));const o=Math.abs(n)<=r,c=Math.abs(s-e)<=i;a.done=o&&c}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(Ss(b),Es),e=ds((e=>b.next(t*e).value),t,30);return t+"ms "+e}};return b}function Rs({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:l=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},f=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let p=n*e;const m=h+p,g=void 0===s?m:s(m);g!==m&&(p=g-h);const y=t=>-p*Math.exp(-t/r),w=t=>g+y(t),v=t=>{const e=y(t),n=w(t);d.done=Math.abs(e)<=l,d.value=d.done?g:n};let b,E;const S=t=>{(t=>void 0!==a&&t<a||void 0!==c&&t>c)(d.value)&&(b=t,E=ks({keyframes:[d.value,f(d.value)],velocity:ms(w,t,d.value),damping:i,stiffness:o,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return E||void 0!==b||(e=!0,v(t),S(t)),void 0!==b&&t>=b?E.next(t-b):(!e&&v(t),d)}}}const Ps=Pi(.42,0,1,1),Cs=Pi(0,0,.58,1),Is=Pi(.42,0,.58,1),Os=t=>Array.isArray(t)&&"number"==typeof t[0],Bs={linear:wi,easeIn:Ps,easeInOut:Is,easeOut:Cs,circIn:Ni,circInOut:ji,circOut:_i,backIn:Bi,backInOut:Ui,backOut:Oi,anticipate:Li},Us=t=>{if(Os(t)){Vi(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,i]=t;return Pi(e,n,r,i)}return"string"==typeof t?(Vi(void 0!==Bs[t],`Invalid easing type '${t}'`),Bs[t]):t},Ls=(t,e)=>n=>e(t(n)),Ns=(...t)=>t.reduce(Ls),_s=(t,e,n)=>t+(e-t)*n;function js(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Ds(t,e){return n=>n>0?e:t}const Ms=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Vs=[Io,Co,Oo];function Fs(t){const e=(t=>Vs.find((e=>e.test(t))))(t);if(Mi(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let n=e.parse(t);return e===Oo&&(n=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let i=0,o=0,s=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;i=js(a,r,t+1/3),o=js(a,r,t),s=js(a,r,t-1/3)}else i=o=s=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*s),alpha:r}}(n)),n}const Ks=(t,e)=>{const n=Fs(t),r=Fs(e);if(!n||!r)return Ds(t,e);const i={...n};return t=>(i.red=Ms(n.red,r.red,t),i.green=Ms(n.green,r.green,t),i.blue=Ms(n.blue,r.blue,t),i.alpha=_s(n.alpha,r.alpha,t),Co.transform(i))},Ws=new Set(["none","hidden"]);function zs(t,e){return n=>_s(t,e,n)}function Hs(t){return"number"==typeof t?zs:"string"==typeof t?Hi(t)?Ds:Bo.test(t)?Ks:Xs:Array.isArray(t)?$s:"object"==typeof t?Bo.test(t)?Ks:Zs:Ds}function $s(t,e){const n=[...t],r=n.length,i=t.map(((t,n)=>Hs(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=i[e](t);return n}}function Zs(t,e){const n={...t,...e},r={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(r[i]=Hs(t[i])(t[i],e[i]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Xs=(t,e)=>{const n=zo.createTransformer(e),r=Vo(t),i=Vo(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ws.has(t)&&!i.values.length||Ws.has(e)&&!r.values.length?function(t,e){return Ws.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Ns($s(function(t,e){var n;const r=[],i={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const s=e.types[o],a=t.indexes[s][i[s]],c=null!==(n=t.values[a])&&void 0!==n?n:0;r[o]=c,i[s]++}return r}(r,i),i.values),n):(Mi(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Ds(t,e))};function Gs(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return _s(t,e,n);return Hs(t)(t,e)}function Ys(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const o=t.length;if(Vi(o===e.length,"Both input and output ranges must be the same length"),1===o)return()=>e[0];if(2===o&&t[0]===t[1])return()=>e[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=function(t,e,n){const r=[],i=n||Gs,o=t.length-1;for(let n=0;n<o;n++){let o=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||wi:e;o=Ns(t,o)}r.push(o)}return r}(e,r,i),a=s.length,c=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=hs(t[n],t[n+1],e);return s[n](r)};return n?e=>c(Gi(t[0],t[o-1],e)):c}function qs(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=hs(0,e,r);t.push(_s(n,1,i))}}(e,t.length-1),e}function Js({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(Us):Us(r),o={done:!1,value:e[0]},s=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:qs(e),t),a=Ys(s,e,{ease:Array.isArray(i)?i:(c=e,l=i,c.map((()=>l||Is)).splice(0,c.length-1))});var c,l;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const Qs=t=>{const e=({timestamp:e})=>t(e);return{start:()=>Ei.update(e,!0),stop:()=>Si(e),now:()=>Ti.isProcessing?Ti.timestamp:as.now()}},ta={decay:Rs,inertia:Rs,tween:Js,keyframes:Js,spring:ks},ea=t=>t/100;class na extends us{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:i}=this.options,o=(null==r?void 0:r.KeyframeResolver)||So;this.resolver=new o(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=this.options,s=is(e)?e:ta[e]||Js;let a,c;s!==Js&&"number"!=typeof t[0]&&(a=Ns(ea,Gs(t[0],t[1])),t=[0,100]);const l=s({...this.options,keyframes:t});"mirror"===i&&(c=s({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=Ss(l));const{calculatedDuration:u}=l,h=u+r;return{generator:l,mirroredGenerator:c,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:h,totalDuration:h*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:i,mirroredGenerator:o,mapPercentToKeyframes:s,keyframes:a,calculatedDuration:c,totalDuration:l,resolvedDuration:u}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:d,repeatType:f,repeatDelay:p,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=l);let w=this.currentTime,v=i;if(d){const t=Math.min(this.currentTime,l)/u;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===f?(n=1-n,p&&(n-=p/u)):"mirror"===f&&(v=o)),w=Gi(0,1,n)*u}const b=y?{done:!1,value:a[0]}:v.next(w);s&&(b.value=s(b.value));let{done:E}=b;y||null===c||(E=this.speed>=0?this.currentTime>=l:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&E);return S&&void 0!==r&&(b.value=yi(a,this.options,r)),m&&m(b.value),S&&this.finish(),b}get duration(){const{resolved:t}=this;return t?ai(t.calculatedDuration):0}get time(){return ai(this.currentTime)}set time(t){t=si(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=ai(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Qs,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const ra=new Set(["opacity","clipPath","filter","transform"]);function ia(t){let e;return()=>(void 0===e&&(e=t()),e)}const oa={linearEasing:void 0};function sa(t,e){const n=ia(t);return()=>{var t;return null!==(t=oa[e])&&void 0!==t?t:n()}}const aa=sa((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function ca(t){return Boolean("function"==typeof t&&aa()||!t||"string"==typeof t&&(t in ua||aa())||Os(t)||Array.isArray(t)&&t.every(ca))}const la=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,ua={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:la([0,.65,.55,1]),circOut:la([.55,0,1,.45]),backIn:la([.31,.01,.66,-.59]),backOut:la([.33,1.53,.69,.99])};function ha(t,e){return t?"function"==typeof t&&aa()?ds(t,e):Os(t)?la(t):Array.isArray(t)?t.map((t=>ha(t,e)||ua.easeOut)):ua[t]:void 0}function da(t,e,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeInOut",times:c}={}){const l={[e]:n};c&&(l.offset=c);const u=ha(a,i);return Array.isArray(u)&&(l.easing=u),t.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}function fa(t,e){t.timeline=e,t.onfinish=null}const pa=ia((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const ma={anticipate:Li,backInOut:Ui,circInOut:ji};class ga extends us{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new rs(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:i,ease:o,type:s,motionValue:a,name:c,startTime:l}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var u;if("string"==typeof o&&aa()&&o in ma&&(o=ma[o]),is((u=this.options).type)||"spring"===u.type||!ca(u.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:c,...l}=this.options,u=function(t,e){const n=new na({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const i=[];let o=0;for(;!r.done&&o<2e4;)r=n.sample(o),i.push(r.value),o+=10;return{times:void 0,keyframes:i,duration:o-10,ease:"linear"}}(t,l);1===(t=u.keyframes).length&&(t[1]=t[0]),r=u.duration,i=u.times,o=u.ease,s="keyframes"}const h=da(a.owner.current,c,t,{...this.options,duration:r,times:i,ease:o});return h.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(fa(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(yi(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:r,times:i,type:s,ease:o,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return ai(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return ai(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=si(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return wi;const{animation:n}=e;fa(n,t)}else this.pendingTimeline=t;return wi}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:i,ease:o,times:s}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:c,...l}=this.options,u=new na({...l,keyframes:n,duration:r,type:i,ease:o,times:s,isGenerator:!0}),h=si(this.time);t.setWithVelocity(u.sample(h-10).value,u.sample(h).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:o,type:s}=t;return pa()&&n&&ra.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==i&&0!==o&&"inertia"!==s}}const ya=ia((()=>void 0!==window.ScrollTimeline));class wa{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>ya()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const va=(t,e,n,r={},i,o)=>s=>{const a=di(r,t)||{},c=a.delay||r.delay||0;let{elapsed:l=0}=r;l-=si(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:i};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:s,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length})(a)||(u={...u,...hi(t,u)}),u.duration&&(u.duration=si(u.duration)),u.repeatDelay&&(u.repeatDelay=si(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let h=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(u.duration=0,0===u.delay&&(h=!0)),(mi||fi)&&(h=!0,u.duration=0,u.delay=0),h&&!o&&void 0!==e.get()){const t=yi(u.keyframes,a);if(void 0!==t)return Ei.update((()=>{u.onUpdate(t),u.onComplete()})),new wa([])}return!o&&ga.supports(u)?new ga(u):new na(u)},ba=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Ea=t=>Yr(t)?t[t.length-1]||0:t;function Sa(t,e){-1===t.indexOf(e)&&t.push(e)}function Ta(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class xa{constructor(){this.subscriptions=[]}add(t){return Sa(this.subscriptions,t),()=>Ta(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let i=0;i<r;i++){const r=this.subscriptions[i];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Aa={current:void 0};class ka{constructor(t,e={}){this.version="11.15.0",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=as.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=as.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new xa);const n=this.events[t].add(e);return"change"===t?()=>{n(),Ei.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return Aa.current&&Aa.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=as.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return fs(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ra(t,e){return new ka(t,e)}function Pa(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ra(n))}const Ca=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ia="data-"+Ca("framerAppearId");function Oa(t){return t.props[Ia]}const Ba=t=>Boolean(t&&t.getVelocity);function Ua(t,e){const n=t.getValue("willChange");if(r=n,Boolean(Ba(r)&&r.add))return n.add(e);var r}function La({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Na(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var o;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...c}=e;r&&(s=r);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const e in c){const r=t.getValue(e,null!==(o=t.latestValues[e])&&void 0!==o?o:null),i=c[e];if(void 0===i||u&&La(u,e))continue;const a={delay:n,...di(s||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Oa(t);if(n){const t=window.MotionHandoffAnimation(n,e,Ei);null!==t&&(a.startTime=t,h=!0)}}Ua(t,e),r.start(va(e,r,i,t.shouldReduceMotion&&oi.has(e)?{type:!1}:a,t,h));const d=r.animation;d&&l.push(d)}return a&&Promise.all(l).then((()=>{Ei.update((()=>{a&&function(t,e){const n=ei(t,e);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const e in o)Pa(t,e,Ea(o[e]))}(t,a)}))})),l}function _a(t,e,n={}){var r;const i=ei(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(o=n.transitionOverride);const s=i?()=>Promise.all(Na(t,i,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:i=0,staggerChildren:s,staggerDirection:a}=o;return function(t,e,n=0,r=0,i=1,o){const s=[],a=(t.variantChildren.size-1)*r,c=1===i?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(ja).forEach(((t,r)=>{t.notify("AnimationStart",e),s.push(_a(t,e,{...o,delay:n+c(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(s)}(t,e,i+r,s,a,n)}:()=>Promise.resolve(),{when:c}=o;if(c){const[t,e]="beforeChildren"===c?[s,a]:[a,s];return t().then((()=>e()))}return Promise.all([s(),a(n.delay)])}function ja(t,e){return t.sortNodePosition(e)}const Da=ri.length;function Ma(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Ma(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Da;n++){const r=ri[n],i=t.props[r];(Jr(i)||!1===i)&&(e[r]=i)}return e}const Va=[...ni].reverse(),Fa=ni.length;function Ka(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map((e=>_a(t,e,n)));r=Promise.all(i)}else if("string"==typeof e)r=_a(t,e,n);else{const i="function"==typeof e?ei(t,e,n.custom):e;r=Promise.all(Na(t,i,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Wa(t){let e=Ka(t),n=$a(),r=!0;const i=e=>(n,r)=>{var i;const o=ei(t,r,"exit"===e?null===(i=t.presenceContext)||void 0===i?void 0:i.custom:void 0);if(o){const{transition:t,transitionEnd:e,...r}=o;n={...n,...r,...e}}return n};function o(o){const{props:s}=t,a=Ma(t.parent)||{},c=[],l=new Set;let u={},h=1/0;for(let e=0;e<Fa;e++){const d=Va[e],f=n[d],p=void 0!==s[d]?s[d]:a[d],m=Jr(p),g=d===o?f.isActive:null;!1===g&&(h=e);let y=p===a[d]&&p!==s[d]&&m;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),f.protectedKeys={...u},!f.isActive&&null===g||!p&&!f.prevProp||Gr(p)||"boolean"==typeof p)continue;const w=za(f.prevProp,p);let v=w||d===o&&f.isActive&&!y&&m||e>h&&m,b=!1;const E=Array.isArray(p)?p:[p];let S=E.reduce(i(d),{});!1===g&&(S={});const{prevResolvedValues:T={}}=f,x={...T,...S},A=e=>{v=!0,l.has(e)&&(b=!0,l.delete(e)),f.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=T[t];if(u.hasOwnProperty(t))continue;let r=!1;r=Yr(e)&&Yr(n)?!qr(e,n):e!==n,r?null!=e?A(t):l.add(t):void 0!==e&&l.has(t)?A(t):f.protectedKeys[t]=!0}f.prevProp=p,f.prevResolvedValues=S,f.isActive&&(u={...u,...S}),r&&t.blockInitialAnimation&&(v=!1);v&&(!(y&&w)||b)&&c.push(...E.map((t=>({animation:t,options:{type:d}}))))}if(l.size){const e={};l.forEach((n=>{const r=t.getBaseTarget(n),i=t.getValue(n);i&&(i.liveStyle=!0),e[n]=null!=r?r:null})),c.push({animation:e})}let d=Boolean(c.length);return!r||!1!==s.initial&&s.initial!==s.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?e(c):Promise.resolve()}return{animateChanges:o,setActive:function(e,r){var i;if(n[e].isActive===r)return Promise.resolve();null===(i=t.variantChildren)||void 0===i||i.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=$a(),r=!0}}}function za(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!qr(e,t)}function Ha(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function $a(){return{animate:Ha(!0),whileInView:Ha(),whileHover:Ha(),whileTap:Ha(),whileDrag:Ha(),whileFocus:Ha(),exit:Ha()}}class Za{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Xa=0;const Ga={animation:{Feature:class extends Za{constructor(t){super(t),t.animationState||(t.animationState=Wa(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Gr(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Za{constructor(){super(...arguments),this.id=Xa++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}},Ya={x:!1,y:!1};function qa(){return Ya.x||Ya.y}function Ja(t,e){const n=function(t,e,n){var r;if(t instanceof Element)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const o=null!==(r=null==n?void 0:n[t])&&void 0!==r?r:i.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}(t),r=new AbortController;return[n,{passive:!0,...e,signal:r.signal},()=>r.abort()]}function Qa(t){return e=>{"touch"===e.pointerType||qa()||t(e)}}const tc=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,ec=new WeakSet;function nc(t){return e=>{"Enter"===e.key&&t(e)}}function rc(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const ic=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const oc=(t,e)=>!!e&&(t===e||oc(t,e.parentElement));function sc(t){return tc(t)&&!qa()}function ac(t,e,n={}){const[r,i,o]=Ja(t,n),s=t=>{const r=t.currentTarget;if(!sc(t)||ec.has(r))return;ec.add(r);const o=e(t),s=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",c),sc(t)&&ec.has(r)&&(ec.delete(r),o&&o(t,{success:e}))},a=t=>{s(t,n.useGlobalTarget||oc(r,t.target))},c=t=>{s(t,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",c,i)};return r.forEach((t=>{(function(t){return ic.has(t.tagName)||-1!==t.tabIndex})(t)||(t.tabIndex=0);(n.useGlobalTarget?window:t).addEventListener("pointerdown",s,i),t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const r=nc((()=>{if(ec.has(n))return;rc(n,"down");const t=nc((()=>{rc(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>rc(n,"cancel")),e)}));n.addEventListener("keydown",r,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",r)),e)})(t,i)),i)})),o}function cc(t){return{point:{x:t.pageX,y:t.pageY}}}function lc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function uc(t,e,n,r){return lc(t,e,(t=>e=>tc(e)&&t(e,cc(e)))(n),r)}const hc=(t,e)=>Math.abs(t-e);class dc{constructor(t,e,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=mc(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=hc(t.x,e.x),r=hc(t.y,e.y);return Math.sqrt(n**2+r**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:r}=t,{timestamp:i}=Ti;this.history.push({...r,timestamp:i});const{onStart:o,onMove:s}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=fc(e,this.transformPagePoint),Ei.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=mc("pointercancel"===t.type?this.lastMoveEventInfo:fc(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),r&&r(t,o)},!tc(t))return;this.dragSnapToOrigin=i,this.handlers=e,this.transformPagePoint=n,this.contextWindow=r||window;const o=fc(cc(t),this.transformPagePoint),{point:s}=o,{timestamp:a}=Ti;this.history=[{...s,timestamp:a}];const{onSessionStart:c}=e;c&&c(t,mc(o,this.history)),this.removeListeners=Ns(uc(this.contextWindow,"pointermove",this.handlePointerMove),uc(this.contextWindow,"pointerup",this.handlePointerUp),uc(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Si(this.updatePoint)}}function fc(t,e){return e?{point:e(t.point)}:t}function pc(t,e){return{x:t.x-e.x,y:t.y-e.y}}function mc({point:t},e){return{point:t,delta:pc(t,yc(e)),offset:pc(t,gc(e)),velocity:wc(e,.1)}}function gc(t){return t[0]}function yc(t){return t[t.length-1]}function wc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=yc(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>si(e)));)n--;if(!r)return{x:0,y:0};const o=ai(i.timestamp-r.timestamp);if(0===o)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function vc(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const bc=.9999,Ec=1.0001,Sc=-.01,Tc=.01;function xc(t){return t.max-t.min}function Ac(t,e,n,r=.5){t.origin=r,t.originPoint=_s(e.min,e.max,t.origin),t.scale=xc(n)/xc(e),t.translate=_s(n.min,n.max,t.origin)-t.originPoint,(t.scale>=bc&&t.scale<=Ec||isNaN(t.scale))&&(t.scale=1),(t.translate>=Sc&&t.translate<=Tc||isNaN(t.translate))&&(t.translate=0)}function kc(t,e,n,r){Ac(t.x,e.x,n.x,r?r.originX:void 0),Ac(t.y,e.y,n.y,r?r.originY:void 0)}function Rc(t,e,n){t.min=n.min+e.min,t.max=t.min+xc(e)}function Pc(t,e,n){t.min=e.min-n.min,t.max=t.min+xc(e)}function Cc(t,e,n){Pc(t.x,e.x,n.x),Pc(t.y,e.y,n.y)}function Ic(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function Oc(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}const Bc=.35;function Uc(t,e,n){return{min:Lc(t,e),max:Lc(t,n)}}function Lc(t,e){return"number"==typeof t?t:t[e]||0}const Nc=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),_c=()=>({x:{min:0,max:0},y:{min:0,max:0}});function jc(t){return[t("x"),t("y")]}function Dc({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Mc(t){return void 0===t||1===t}function Vc({scale:t,scaleX:e,scaleY:n}){return!Mc(t)||!Mc(e)||!Mc(n)}function Fc(t){return Vc(t)||Kc(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Kc(t){return Wc(t.x)||Wc(t.y)}function Wc(t){return t&&"0%"!==t}function zc(t,e,n){return n+e*(t-n)}function Hc(t,e,n,r,i){return void 0!==i&&(t=zc(t,i,r)),zc(t,n,r)+e}function $c(t,e=0,n=1,r,i){t.min=Hc(t.min,e,n,r,i),t.max=Hc(t.max,e,n,r,i)}function Zc(t,{x:e,y:n}){$c(t.x,e.translate,e.scale,e.originPoint),$c(t.y,n.translate,n.scale,n.originPoint)}const Xc=.999999999999,Gc=1.0000000000001;function Yc(t,e){t.min=t.min+e,t.max=t.max+e}function qc(t,e,n,r,i=.5){$c(t,e,n,_s(t.min,t.max,i),r)}function Jc(t,e){qc(t.x,e.x,e.scaleX,e.scale,e.originX),qc(t.y,e.y,e.scaleY,e.scale,e.originY)}function Qc(t,e){return Dc(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}const tl=({current:t})=>t?t.ownerDocument.defaultView:null,el=new WeakMap;class nl{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_c(),this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:r}=this.getProps();this.panSession=new dc(t,{onSessionStart:t=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(cc(t).point)},onStart:(t,e)=>{const{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=n)||"y"===o?Ya[o]?null:(Ya[o]=!0,()=>{Ya[o]=!1}):Ya.x||Ya.y?null:(Ya.x=Ya.y=!0,()=>{Ya.x=Ya.y=!1}),!this.openDragLock))return;var o;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),jc((t=>{let e=this.getAxisMotionValue(t).get()||0;if(eo.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[t];if(r){e=xc(r)*(parseFloat(e)/100)}}}this.originPoint[t]=e})),i&&Ei.postRender((()=>i(t,e))),Ua(this.visualElement,"transform");const{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:s}=e;if(r&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(s),void(null!==this.currentDirection&&i&&i(this.currentDirection));this.updateAxis("x",e.point,s),this.updateAxis("y",e.point,s),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>jc((t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())}))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:r,contextWindow:tl(this.visualElement)})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:r}=e;this.startAnimation(r);const{onDragEnd:i}=this.getProps();i&&Ei.postRender((()=>i(t,e)))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,n){const{drag:r}=this.getProps();if(!n||!rl(t,r,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:n},r){return void 0!==e&&t<e?t=r?_s(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?_s(n,t,r.max):Math.min(t,n)),t}(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,i=this.constraints;e&&vc(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(t,{top:e,left:n,bottom:r,right:i}){return{x:Ic(t.x,n,i),y:Ic(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=Bc){return!1===t?t=0:!0===t&&(t=Bc),{x:Uc(t,"left","right"),y:Uc(t,"top","bottom")}}(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&jc((t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(r.layoutBox[t],this.constraints[t]))}))}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!vc(t))return!1;const n=t.current;Vi(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=function(t,e,n){const r=Qc(t,n),{scroll:i}=e;return i&&(Yc(r.x,i.offset.x),Yc(r.y,i.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Oc(t.x,e.x),y:Oc(t.y,e.y)}}(r.layout.layoutBox,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=Dc(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},c=jc((s=>{if(!rl(s,e,this.currentDirection))return;let c=a&&a[s]||{};o&&(c={min:0,max:0});const l=r?200:1e6,u=r?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(s,h)}));return Promise.all(c).then(s)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return Ua(this.visualElement,t),n.start(va(t,n,0,e,this.visualElement,!1))}stopAnimation(){jc((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){jc((t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()}))}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),r=n[e];return r||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){jc((e=>{const{drag:n}=this.getProps();if(!rl(e,n,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(e);if(r&&r.layout){const{min:n,max:o}=r.layout.layoutBox[e];i.set(t[e]-_s(n,o,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!vc(e)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};jc((t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const n=e.get();r[t]=function(t,e){let n=.5;const r=xc(t),i=xc(e);return i>r?n=hs(e.min,e.max-r,t.min):r>i&&(n=hs(t.min,t.max-i,e.min)),Gi(0,1,n)}({min:n,max:n},this.constraints[t])}}));const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),jc((e=>{if(!rl(e,t,null))return;const n=this.getAxisMotionValue(e),{min:i,max:o}=this.constraints[e];n.set(_s(i,o,r[e]))}))}addListeners(){if(!this.visualElement.current)return;el.set(this.visualElement,this);const t=uc(this.visualElement.current,"pointerdown",(t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)})),e=()=>{const{dragConstraints:t}=this.getProps();vc(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,r=n.addEventListener("measure",e);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Ei.read(e);const i=lc(window,"resize",(()=>this.scalePositionWithinConstraints())),o=n.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(jc((e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))})),this.visualElement.render())}));return()=>{i(),t(),r(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=Bc,dragMomentum:s=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function rl(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const il=t=>(e,n)=>{t&&Ei.postRender((()=>t(e,n)))};var ol=a(893);const sl=(0,e.createContext)(null);const al=(0,e.createContext)({}),cl=(0,e.createContext)({}),ll={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ul(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const hl={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!no.test(t))return t;t=parseFloat(t)}return`${ul(t,e.target.x)}% ${ul(t,e.target.y)}%`}},dl={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=zo.parse(t);if(i.length>5)return r;const o=zo.createTransformer(t),s="number"!=typeof i[0]?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;i[0+s]/=a,i[1+s]/=c;const l=_s(a,c,.5);return"number"==typeof i[2+s]&&(i[2+s]/=l),"number"==typeof i[3+s]&&(i[3+s]/=l),o(i)}},fl={};const{schedule:pl,cancel:ml}=bi(queueMicrotask,!1);class gl extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=t;var o;o=wl,Object.assign(fl,o),i&&(e.group&&e.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",(()=>{this.safeToRemove()})),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),ll.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:r,isPresent:i}=this.props,o=n.projection;return o?(o.isPresent=i,r||t.layoutDependency!==e||void 0===e?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Ei.postRender((()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),pl.postRender((()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function yl(t){const[n,r]=function(){const t=(0,e.useContext)(sl);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=(0,e.useId)();(0,e.useEffect)((()=>i(o)),[]);const s=(0,e.useCallback)((()=>r&&r(o)),[o,r]);return!n&&r?[!1,s]:[!0]}(),i=(0,e.useContext)(al);return(0,ol.jsx)(gl,{...t,layoutGroup:i,switchLayoutGroup:(0,e.useContext)(cl),isPresent:n,safeToRemove:r})}const wl={borderRadius:{...hl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:hl,borderTopRightRadius:hl,borderBottomLeftRadius:hl,borderBottomRightRadius:hl,boxShadow:dl},vl=["TopLeft","TopRight","BottomLeft","BottomRight"],bl=vl.length,El=t=>"string"==typeof t?parseFloat(t):t,Sl=t=>"number"==typeof t||no.test(t);function Tl(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const xl=kl(0,.5,_i),Al=kl(.5,.95,wi);function kl(t,e,n){return r=>r<t?0:r>e?1:n(hs(t,e,r))}function Rl(t,e){t.min=e.min,t.max=e.max}function Pl(t,e){Rl(t.x,e.x),Rl(t.y,e.y)}function Cl(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Il(t,e,n,r,i){return t=zc(t-=e,1/n,r),void 0!==i&&(t=zc(t,1/i,r)),t}function Ol(t,e,[n,r,i],o,s){!function(t,e=0,n=1,r=.5,i,o=t,s=t){eo.test(e)&&(e=parseFloat(e),e=_s(s.min,s.max,e/100)-s.min);if("number"!=typeof e)return;let a=_s(o.min,o.max,r);t===o&&(a-=e),t.min=Il(t.min,e,n,a,i),t.max=Il(t.max,e,n,a,i)}(t,e[n],e[r],e[i],e.scale,o,s)}const Bl=["x","scaleX","originX"],Ul=["y","scaleY","originY"];function Ll(t,e,n,r){Ol(t.x,e,Bl,n?n.x:void 0,r?r.x:void 0),Ol(t.y,e,Ul,n?n.y:void 0,r?r.y:void 0)}function Nl(t){return 0===t.translate&&1===t.scale}function _l(t){return Nl(t.x)&&Nl(t.y)}function jl(t,e){return t.min===e.min&&t.max===e.max}function Dl(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Ml(t,e){return Dl(t.x,e.x)&&Dl(t.y,e.y)}function Vl(t){return xc(t.x)/xc(t.y)}function Fl(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Kl{constructor(){this.members=[]}add(t){Sa(this.members,t),t.scheduleRender()}remove(t){if(Ta(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex((e=>t===e));if(0===e)return!1;let n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach((t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((t=>{t.instance&&t.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Wl=(t,e)=>t.depth-e.depth;class zl{constructor(){this.children=[],this.isDirty=!1}add(t){Sa(this.children,t),this.isDirty=!0}remove(t){Ta(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Wl),this.isDirty=!1,this.children.forEach(t)}}function Hl(t){const e=Ba(t)?t.get():t;return ba(e)?e.toValue():e}function $l(t,e){const n=as.now(),r=({timestamp:i})=>{const o=i-n;o>=e&&(Si(r),t(o-e))};return Ei.read(r,!0),()=>Si(r)}const Zl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Xl="undefined"!=typeof window&&void 0!==window.MotionDebug,Gl=["","X","Y","Z"],Yl={visibility:"hidden"};let ql=0;function Jl(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Ql(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Oa(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Ei,!(e||r))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Ql(r)}function tu({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=ql++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Xl&&(Zl.totalNodes=Zl.resolvedTargetDeltas=Zl.recalculatedProjection=0),this.nodes.forEach(ru),this.nodes.forEach(uu),this.nodes.forEach(hu),this.nodes.forEach(iu),Xl&&window.MotionDebug.record(Zl)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new zl)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new xa),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const n=this.eventHandlers.get(t);n&&n.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,n=this.root.hasTreeAnimated){if(this.instance)return;var r;this.isSVG=(r=e)instanceof SVGElement&&"svg"!==r.tagName,this.instance=e;const{layoutId:i,layout:o,visualElement:s}=this.options;if(s&&!s.current&&s.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(o||i)&&(this.isLayoutDirty=!0),t){let n;const r=()=>this.root.updateBlockedByResize=!1;t(e,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=$l(r,250),ll.hasAnimatedSinceResize&&(ll.hasAnimatedSinceResize=!1,this.nodes.forEach(lu))}))}i&&this.root.registerSharedNode(i,this),!1!==this.options.animate&&s&&(i||o)&&this.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const i=this.options.transition||s.getDefaultTransition()||yu,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=s.getProps(),c=!this.targetLayout||!Ml(this.targetLayout,r)||n,l=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||l||e&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,l);const e={...di(i,"layout"),onPlay:o,onComplete:a};(s.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||lu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Si(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(du),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ql(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:n}=this.options;if(void 0===e&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(su);this.isUpdating||this.nodes.forEach(au),this.isUpdating=!1,this.nodes.forEach(cu),this.nodes.forEach(eu),this.nodes.forEach(nu),this.clearAllSnapshots();const t=as.now();Ti.delta=Gi(0,1e3/60,t-Ti.timestamp),Ti.timestamp=t,Ti.isProcessing=!0,xi.update.process(Ti),xi.preRender.process(Ti),xi.render.process(Ti),Ti.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ou),this.sharedNodes.forEach(fu)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ei.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ei.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutCorrected=_c(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=r(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!i)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!_l(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,o=r!==this.prevTransformTemplateValue;t&&(e||Fc(this.latestValues)||o)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var r;return t&&(n=this.removeTransform(n)),bu((r=n).x),bu(r.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return _c();const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(Su))){const{scroll:t}=this.root;t&&(Yc(n.x,t.offset.x),Yc(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n=_c();if(Pl(n,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return n;for(let e=0;e<this.path.length;e++){const r=this.path[e],{scroll:i,options:o}=r;r!==this.root&&i&&o.layoutScroll&&(i.wasRoot&&Pl(n,t),Yc(n.x,i.offset.x),Yc(n.y,i.offset.y))}return n}applyTransform(t,e=!1){const n=_c();Pl(n,t);for(let t=0;t<this.path.length;t++){const r=this.path[t];!e&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Jc(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Fc(r.latestValues)&&Jc(n,r.latestValues)}return Fc(this.latestValues)&&Jc(n,this.latestValues),n}removeTransform(t){const e=_c();Pl(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!Fc(n.latestValues))continue;Vc(n.latestValues)&&n.updateSnapshot();const r=_c();Pl(r,n.measurePageBox()),Ll(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Fc(this.latestValues)&&Ll(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ti.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(t||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:i,layoutId:o}=this.options;if(this.layout&&(i||o)){if(this.resolvedRelativeTargetAt=Ti.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_c(),this.relativeTargetOrigin=_c(),Cc(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),Pl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var s,a,c;if(this.target||(this.target=_c(),this.targetWithTransforms=_c()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,c=this.relativeParent.target,Rc(s.x,a.x,c.x),Rc(s.y,a.y,c.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Pl(this.target,this.layout.layoutBox),Zc(this.target,this.targetDelta)):Pl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_c(),this.relativeTargetOrigin=_c(),Cc(this.relativeTargetOrigin,this.target,t.target),Pl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Xl&&Zl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!Vc(this.parent.latestValues)&&!Kc(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),n=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===Ti.timestamp&&(r=!1),r)return;const{layout:i,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!i&&!o)return;Pl(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,a=this.treeScale.y;!function(t,e,n,r=!1){const i=n.length;if(!i)return;let o,s;e.x=e.y=1;for(let a=0;a<i;a++){o=n[a],s=o.projectionDelta;const{visualElement:i}=o.options;i&&i.props.style&&"contents"===i.props.style.display||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Jc(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,Zc(t,s)),r&&Fc(o.latestValues)&&Jc(t,o.latestValues))}e.x<Gc&&e.x>Xc&&(e.x=1),e.y<Gc&&e.y>Xc&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms=_c());const{target:c}=e;c?(this.projectionDelta&&this.prevProjectionDelta?(Cl(this.prevProjectionDelta.x,this.projectionDelta.x),Cl(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),kc(this.projectionDelta,this.layoutCorrected,c,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&Fl(this.projectionDelta.x,this.prevProjectionDelta.x)&&Fl(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",c)),Xl&&Zl.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Nc(),this.projectionDelta=Nc(),this.projectionDeltaWithTransform=Nc()}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},o=Nc();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const s=_c(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=Boolean(a&&!l&&!0===this.options.crossfade&&!this.path.some(gu));let h;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;pu(o.x,t.x,n),pu(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(t,e,n,r){mu(t.x,e.x,n.x,r),mu(t.y,e.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,s,n),h&&function(t,e){return jl(t.x,e.x)&&jl(t.y,e.y)}(this.relativeTarget,h)&&(this.isProjectionDirty=!1),h||(h=_c()),Pl(h,this.relativeTarget)),a&&(this.animationValues=i,function(t,e,n,r,i,o){i?(t.opacity=_s(0,void 0!==n.opacity?n.opacity:1,xl(r)),t.opacityExit=_s(void 0!==e.opacity?e.opacity:1,0,Al(r))):o&&(t.opacity=_s(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let i=0;i<bl;i++){const o=`border${vl[i]}Radius`;let s=Tl(e,o),a=Tl(n,o);void 0===s&&void 0===a||(s||(s=0),a||(a=0),0===s||0===a||Sl(s)===Sl(a)?(t[o]=Math.max(_s(El(s),El(a),r),0),(eo.test(a)||eo.test(s))&&(t[o]+="%")):t[o]=a)}(e.rotate||n.rotate)&&(t.rotate=_s(e.rotate||0,n.rotate||0,r))}(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Si(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ei.update((()=>{ll.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n){const r=Ba(t)?t:Ra(t);return r.start(va("",r,e,n)),r.animation}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:n,layout:r,latestValues:i}=t;if(e&&n&&r){if(this!==t&&this.layout&&r&&Eu(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||_c();const e=xc(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const r=xc(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+r}Pl(e,n),Jc(e,i),kc(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Kl);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(e=!0),!e)return;const r={};n.z&&Jl("z",t,r,this.animationValues);for(let e=0;e<Gl.length;e++)Jl(`rotate${Gl[e]}`,t,r,this.animationValues),Jl(`skew${Gl[e]}`,t,r,this.animationValues);t.render();for(const e in r)t.setStaticValue(e,r[e]),this.animationValues&&(this.animationValues[e]=r[e]);t.scheduleRender()}getProjectionStyles(t){var e,n;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Yl;const r={visibility:""},i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=Hl(null==t?void 0:t.pointerEvents)||"",r.transform=i?i(this.latestValues,""):"none",r;const o=this.getLead();if(!this.projectionDelta||!this.layout||!o.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=Hl(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!Fc(this.latestValues)&&(e.transform=i?i({},""):"none",this.hasProjected=!1),e}const s=o.animationValues||o.latestValues;this.applyTransformsToTarget(),r.transform=function(t,e,n){let r="";const i=t.x.translate/e.x,o=t.y.translate/e.y,s=(null==n?void 0:n.z)||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),1===e.x&&1===e.y||(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:t,rotate:e,rotateX:i,rotateY:o,skewX:s,skewY:a}=n;t&&(r=`perspective(${t}px) ${r}`),e&&(r+=`rotate(${e}deg) `),i&&(r+=`rotateX(${i}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),a&&(r+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return 1===a&&1===c||(r+=`scale(${a}, ${c})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,s),i&&(r.transform=i(s,r.transform));const{x:a,y:c}=this.projectionDelta;r.transformOrigin=`${100*a.origin}% ${100*c.origin}% 0`,o.animationValues?r.opacity=o===this?null!==(n=null!==(e=s.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:r.opacity=o===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const t in fl){if(void 0===s[t])continue;const{correct:e,applyTo:n}=fl[t],i="none"===r.transform?s[t]:e(s[t],o);if(n){const t=n.length;for(let e=0;e<t;e++)r[n[e]]=i}else r[t]=i}return this.options.layoutId&&(r.pointerEvents=o===this?Hl(null==t?void 0:t.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()})),this.root.nodes.forEach(su),this.root.sharedNodes.clear()}}}function eu(t){t.updateLayout()}function nu(t){var e;const n=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:r}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;"size"===i?jc((t=>{const r=o?n.measuredBox[t]:n.layoutBox[t],i=xc(r);r.min=e[t].min,r.max=r.min+i})):Eu(i,n.layoutBox,e)&&jc((r=>{const i=o?n.measuredBox[r]:n.layoutBox[r],s=xc(e[r]);i.max=i.min+s,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[r].max=t.relativeTarget[r].min+s)}));const s=Nc();kc(s,e,n.layoutBox);const a=Nc();o?kc(a,t.applyTransform(r,!0),n.measuredBox):kc(a,e,n.layoutBox);const c=!_l(s);let l=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:i,layout:o}=r;if(i&&o){const s=_c();Cc(s,n.layoutBox,i.layoutBox);const a=_c();Cc(a,e,o.layoutBox),Ml(s,a)||(l=!0),r.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=s,t.relativeParent=r)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:a,layoutDelta:s,hasLayoutChanged:c,hasRelativeTargetChanged:l})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function ru(t){Xl&&Zl.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function iu(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function ou(t){t.clearSnapshot()}function su(t){t.clearMeasurements()}function au(t){t.isLayoutDirty=!1}function cu(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function lu(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function uu(t){t.resolveTargetDelta()}function hu(t){t.calcProjection()}function du(t){t.resetSkewAndRotation()}function fu(t){t.removeLeadSnapshot()}function pu(t,e,n){t.translate=_s(e.translate,0,n),t.scale=_s(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function mu(t,e,n,r){t.min=_s(e.min,n.min,r),t.max=_s(e.max,n.max,r)}function gu(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const yu={duration:.45,ease:[.4,0,.1,1]},wu=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),vu=wu("applewebkit/")&&!wu("chrome/")?Math.round:wi;function bu(t){t.min=vu(t.min),t.max=vu(t.max)}function Eu(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=Vl(e),i=Vl(n),o=.2,!(Math.abs(r-i)<=o));var r,i,o}function Su(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Tu=tu({attachResizeListener:(t,e)=>lc(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),xu={current:void 0},Au=tu({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!xu.current){const t=new Tu({});t.mount(window),t.setOptions({layoutScroll:!0}),xu.current=t}return xu.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),ku={pan:{Feature:class extends Za{constructor(){super(...arguments),this.removePointerDownListener=wi}onPointerDown(t){this.session=new dc(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:tl(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:il(t),onStart:il(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&Ei.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=uc(this.node.current,"pointerdown",(t=>this.onPointerDown(t)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends Za{constructor(t){super(t),this.removeGroupControls=wi,this.removeListeners=wi,this.controls=new nl(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||wi}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Au,MeasureLayout:yl}};function Ru(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover","Start"===n);const i=r["onHover"+n];i&&Ei.postRender((()=>i(e,cc(e))))}function Pu(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap","Start"===n);const i=r["onTap"+("End"===n?"":n)];i&&Ei.postRender((()=>i(e,cc(e))))}const Cu=new WeakMap,Iu=new WeakMap,Ou=t=>{const e=Cu.get(t.target);e&&e(t)},Bu=t=>{t.forEach(Ou)};function Uu(t,e,n){const r=function({root:t,...e}){const n=t||document;Iu.has(n)||Iu.set(n,{});const r=Iu.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Bu,{root:t,...e})),r[i]}(e);return Cu.set(t,n),r.observe(t),()=>{Cu.delete(t),r.unobserve(t)}}const Lu={some:0,all:1};const Nu={inView:{Feature:class extends Za{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:i}=t,o={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Lu[r]};return Uu(this.node.current,o,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),o=e?n:r;o&&o(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Za{mount(){const{current:t}=this.node;t&&(this.unmount=ac(t,(t=>(Pu(this.node,t,"Start"),(t,{success:e})=>Pu(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends Za{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ns(lc(this.node.current,"focus",(()=>this.onFocus())),lc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Za{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,i,o]=Ja(t,n),s=Qa((t=>{const{target:n}=t,r=e(t);if(!r||!n)return;const o=Qa((t=>{r(t),n.removeEventListener("pointerleave",o)}));n.addEventListener("pointerleave",o,i)}));return r.forEach((t=>{t.addEventListener("pointerenter",s,i)})),o}(t,(t=>(Ru(this.node,t,"Start"),t=>Ru(this.node,t,"End")))))}unmount(){}}}},_u={layout:{ProjectionNode:Au,MeasureLayout:yl}},ju=(0,e.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Du=(0,e.createContext)({}),Mu="undefined"!=typeof window,Vu=Mu?e.useLayoutEffect:e.useEffect,Fu=(0,e.createContext)({strict:!1});function Ku(t,n,r,i,o){var s,a;const{visualElement:c}=(0,e.useContext)(Du),l=(0,e.useContext)(Fu),u=(0,e.useContext)(sl),h=(0,e.useContext)(ju).reducedMotion,d=(0,e.useRef)(null);i=i||l.renderer,!d.current&&i&&(d.current=i(t,{visualState:n,parent:c,props:r,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:h}));const f=d.current,p=(0,e.useContext)(cl);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:l}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Wu(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:Boolean(s)||a&&vc(a),visualElement:t,animationType:"string"==typeof o?o:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:l})}(d.current,r,o,p);const m=(0,e.useRef)(!1);(0,e.useInsertionEffect)((()=>{f&&m.current&&f.update(r,u)}));const g=r[Ia],y=(0,e.useRef)(Boolean(g)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,g))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,g)));return Vu((()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),pl.render(f.render),y.current&&f.animationState&&f.animationState.animateChanges())})),(0,e.useEffect)((()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,g)})),y.current=!1))})),f}function Wu(t){if(t)return!1!==t.options.allowProjection?t.projection:Wu(t.parent)}function zu(t,n,r){return(0,e.useCallback)((e=>{e&&t.mount&&t.mount(e),n&&(e?n.mount(e):n.unmount()),r&&("function"==typeof r?r(e):vc(r)&&(r.current=e))}),[n])}function Hu(t){return Gr(t.animate)||ri.some((e=>Jr(t[e])))}function $u(t){return Boolean(Hu(t)||t.variants)}function Zu(t){const{initial:n,animate:r}=function(t,e){if(Hu(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Jr(e)?e:void 0,animate:Jr(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,e.useContext)(Du));return(0,e.useMemo)((()=>({initial:n,animate:r})),[Xu(n),Xu(r)])}function Xu(t){return Array.isArray(t)?t.join(" "):t}const Gu={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Yu={};for(const t in Gu)Yu[t]={isEnabled:e=>Gu[t].some((t=>!!e[t]))};const qu=Symbol.for("motionComponentSymbol");function Ju({preloadedFeatures:t,createVisualElement:n,useRender:r,useVisualState:i,Component:o}){t&&function(t){for(const e in t)Yu[e]={...Yu[e],...t[e]}}(t);const s=(0,e.forwardRef)((function(t,s){let a;const c={...(0,e.useContext)(ju),...t,layoutId:Qu(t)},{isStatic:l}=c,u=Zu(t),h=i(t,l);if(!l&&Mu){!function(t,n){(0,e.useContext)(Fu).strict;0}();const t=function(t){const{drag:e,layout:n}=Yu;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(c);a=t.MeasureLayout,u.visualElement=Ku(o,h,c,n,t.ProjectionNode)}return(0,ol.jsxs)(Du.Provider,{value:u,children:[a&&u.visualElement?(0,ol.jsx)(a,{visualElement:u.visualElement,...c}):null,r(o,t,zu(h,u.visualElement,s),h,l,u.visualElement)]})}));return s[qu]=o,s}function Qu({layoutId:t}){const n=(0,e.useContext)(al).id;return n&&void 0!==t?n+"-"+t:t}const th=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function eh(t){return"string"==typeof t&&!t.includes("-")&&!!(th.indexOf(t)>-1||/[A-Z]/u.test(t))}function nh(t,{style:e,vars:n},r,i){Object.assign(t.style,e,i&&i.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}const rh=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ih(t,e,n,r){nh(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(rh.has(n)?n:Ca(n),e.attrs[n])}function oh(t,{layout:e,layoutId:n}){return oi.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!fl[t]||"opacity"===t)}function sh(t,e,n){var r;const{style:i}=t,o={};for(const s in i)(Ba(i[s])||e.style&&Ba(e.style[s])||oh(s,t)||void 0!==(null===(r=null==n?void 0:n.getValue(s))||void 0===r?void 0:r.liveStyle))&&(o[s]=i[s]);return o}function ah(t,e,n){const r=sh(t,e,n);for(const n in t)if(Ba(t[n])||Ba(e[n])){r[-1!==ii.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const ch=t=>(n,r)=>{const i=(0,e.useContext)(Du),o=(0,e.useContext)(sl),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,i,o){const s={latestValues:lh(r,i,o,t),renderState:e()};return n&&(s.mount=t=>n(r,t,s)),s}(t,n,i,o);return r?s():function(t){const n=(0,e.useRef)(null);return null===n.current&&(n.current=t()),n.current}(s)};function lh(t,e,n,r){const i={},o=r(t,{});for(const t in o)i[t]=Hl(o[t]);let{initial:s,animate:a}=t;const c=Hu(t),l=$u(t);e&&l&&!c&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const h=u?a:s;if(h&&"boolean"!=typeof h&&!Gr(h)){const e=Array.isArray(h)?h:[h];for(let n=0;n<e.length;n++){const r=ti(t,e[n]);if(r){const{transitionEnd:t,transition:e,...n}=r;for(const t in n){let e=n[t];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(i[t]=e)}for(const e in t)i[e]=t[e]}}}return i}const uh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),hh=()=>({...uh(),attrs:{}}),dh=(t,e)=>e&&"number"==typeof t?e.transform(t):t,fh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ph=ii.length;function mh(t,e,n){const{style:r,vars:i,transformOrigin:o}=t;let s=!1,a=!1;for(const t in e){const n=e[t];if(oi.has(t))s=!0;else if(Wi(t))i[t]=n;else{const e=dh(n,Jo[t]);t.startsWith("origin")?(a=!0,o[t]=e):r[t]=e}}if(e.transform||(s||n?r.transform=function(t,e,n){let r="",i=!0;for(let o=0;o<ph;o++){const s=ii[o],a=t[s];if(void 0===a)continue;let c=!0;if(c="number"==typeof a?a===(s.startsWith("scale")?1:0):0===parseFloat(a),!c||n){const t=dh(a,Jo[s]);c||(i=!1,r+=`${fh[s]||s}(${t}) `),n&&(e[s]=t)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=o;r.transformOrigin=`${t} ${e} ${n}`}}function gh(t,e,n){return"string"==typeof t?t:no.transform(e+n*t)}const yh={offset:"stroke-dashoffset",array:"stroke-dasharray"},wh={offset:"strokeDashoffset",array:"strokeDasharray"};function vh(t,{attrX:e,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:c=0,...l},u,h){if(mh(t,l,h),u)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:f,dimensions:p}=t;d.transform&&(p&&(f.transform=d.transform),delete d.transform),p&&(void 0!==i||void 0!==o||f.transform)&&(f.transformOrigin=function(t,e,n){return`${gh(e,t.x,t.width)} ${gh(n,t.y,t.height)}`}(p,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==s&&function(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?yh:wh;t[o.offset]=no.transform(-r);const s=no.transform(e),a=no.transform(n);t[o.array]=`${s} ${a}`}(d,s,a,c,!1)}const bh=t=>"string"==typeof t&&"svg"===t.toLowerCase(),Eh={useVisualState:ch({scrapeMotionValuesFromProps:ah,createRenderState:hh,onMount:(t,e,{renderState:n,latestValues:r})=>{Ei.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),Ei.render((()=>{vh(n,r,bh(e.tagName),t.transformTemplate),ih(e,n)}))}})},Sh={useVisualState:ch({scrapeMotionValuesFromProps:sh,createRenderState:uh})};function Th(t,e,n){for(const r in e)Ba(e[r])||oh(r,n)||(t[r]=e[r])}function xh(t,n){const r={};return Th(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return(0,e.useMemo)((()=>{const e=uh();return mh(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),r}function Ah(t,e){const n={},r=xh(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const kh=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Rh(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||kh.has(t)}let Ph=t=>!Rh(t);try{(Ch=require("@emotion/is-prop-valid").default)&&(Ph=t=>t.startsWith("on")?!Rh(t):Ch(t))}catch(t){}var Ch;function Ih(t,n,r,i){const o=(0,e.useMemo)((()=>{const e=hh();return vh(e,n,bh(i),t.transformTemplate),{...e.attrs,style:{...e.style}}}),[n]);if(t.style){const e={};Th(e,t.style,t),o.style={...e,...o.style}}return o}function Oh(t=!1){return(n,r,i,{latestValues:o},s)=>{const a=(eh(n)?Ih:Ah)(r,o,s,n),c=function(t,e,n){const r={};for(const i in t)"values"===i&&"object"==typeof t.values||(Ph(i)||!0===n&&Rh(i)||!e&&!Rh(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}(r,"string"==typeof n,t),l=n!==e.Fragment?{...c,...a,ref:i}:{},{children:u}=r,h=(0,e.useMemo)((()=>Ba(u)?u.get():u),[u]);return(0,e.createElement)(n,{...l,children:h})}}function Bh(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Ju({...eh(n)?Eh:Sh,preloadedFeatures:t,useRender:Oh(r),createVisualElement:e,Component:n})}}const Uh={current:null},Lh={current:!1};const Nh=new WeakMap,_h=[...mo,Bo,zo],jh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Dh{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=So,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=as.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Ei.render(this.render,!1,!0))};const{latestValues:a,renderState:c}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=c,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=s,this.blockInitialAnimation=Boolean(i),this.isControllingVariants=Hu(e),this.isVariantNode=$u(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in u){const e=u[t];void 0!==a[t]&&Ba(e)&&e.set(a[t],!1)}}mount(t){this.current=t,Nh.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),Lh.current||function(){if(Lh.current=!0,Mu)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Uh.current=t.matches;t.addListener(e),e()}else Uh.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Uh.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Nh.delete(this.current),this.projection&&this.projection.unmount(),Si(this.notifyUpdate),Si(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=oi.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&Ei.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),i=e.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),i(),o&&o(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Yu){const e=Yu[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_c()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<jh.length;e++){const n=jh[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const i=e[r],o=n[r];if(Ba(i))t.addValue(r,i);else if(Ba(o))t.addValue(r,Ra(i,{owner:t}));else if(o!==i)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(r);t.addValue(r,Ra(void 0!==e?e:i,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Ra(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];return null!=r&&("string"==typeof r&&(Fi(r)||Di(r))?r=parseFloat(r):!(t=>_h.find(po(t)))(r)&&zo.test(e)&&(r=es(t,e)),this.setBaseTarget(t,Ba(r)?r.get():r)),Ba(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const i=ti(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);i&&(r=i[t])}if(n&&void 0!==r)return r;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||Ba(i)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new xa),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Mh extends Dh{constructor(){super(...arguments),this.KeyframeResolver=rs}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ba(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class Vh extends Mh{constructor(){super(...arguments),this.type="html",this.renderInstance=nh}readValueFromInstance(t,e){if(oi.has(e)){const t=ts(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),i=(Wi(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Qc(t,e)}build(t,e,n){mh(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return sh(t,e,n)}}class Fh extends Mh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_c}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(oi.has(e)){const t=ts(e);return t&&t.default||0}return e=rh.has(e)?e:Ca(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return ah(t,e,n)}build(t,e,n){vh(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){ih(t,e,0,r)}mount(t){this.isSVGTag=bh(t.tagName),super.mount(t)}}const Kh=Xr(Bh({...Ga,...Nu,...ku,..._u},((t,n)=>eh(t)?new Fh(n):new Vh(n,{allowProjection:t!==e.Fragment}))));function Wh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(""),[s,a]=(0,e.useState)(null),[c,l]=(0,e.useState)({length:!1,capital:!1,number:!1,symbol:!1});(0,e.useEffect)((()=>{l({length:i.length>=8,capital:/[A-Z]/.test(i),number:/[0-9]/.test(i),symbol:/[!@#$%^&*(),.?":{}|<>]/.test(i)})}),[i]);const u=Object.values(c).every((t=>t));return n().createElement(Kh.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Secure Your Account"),n().createElement("p",{className:"text-gray-600 text-center"},"Choose how you want to secure your data"),s?"pin"===s?n().createElement(Kh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md space-y-4"},n().createElement("input",{type:"password",value:i,onChange:t=>o(t.target.value),placeholder:"Enter your PIN",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"}),n().createElement("div",{className:"space-y-2"},Object.entries(c).map((t=>{let[e,r]=t;return n().createElement("div",{key:e,className:"flex items-center"},n().createElement("span",{className:"material-icons text-sm ".concat(r?"text-green-500":"text-gray-400")},r?"check_circle":"radio_button_unchecked"),n().createElement("span",{className:"ml-2 text-sm ".concat(r?"text-green-600":"text-gray-600")},"length"===e?"At least 8 characters":"capital"===e?"One capital letter":"number"===e?"One number":"One special character"))}))),n().createElement("button",{onClick:async()=>{u&&r({method:"pin",value:i})},disabled:!u,className:"w-full py-3 px-4 rounded-lg font-semibold ".concat(u?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Set PIN")):n().createElement(Kh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md"},n().createElement("button",{onClick:()=>{r({method:"othent"})},className:"w-full py-3 px-4 rounded-lg font-semibold bg-blue-500 text-white hover:bg-blue-600"},"Continue with Othent")):n().createElement("div",{className:"grid grid-cols-1 gap-4 w-full max-w-md"},n().createElement(Kh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("othent"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("img",{src:"https://onairos.sirv.com/Images/othent-icon.png",alt:"Othent",className:"w-8 h-8 mr-3"}),n().createElement("span",{className:"text-gray-700"},"Secure with Google (Othent)")),n().createElement(Kh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("pin"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("span",{className:"material-icons mr-3"},"lock"),n().createElement("span",{className:"text-gray-700"},"Set up PIN"))))}const zh=[{name:"YouTube",icon:"https://onairos.sirv.com/Images/youtube-icon.png",connected:!1},{name:"Reddit",icon:"https://onairos.sirv.com/Images/reddit-icon.png",connected:!1},{name:"Instagram",icon:"https://onairos.sirv.com/Images/instagram-icon.png",connected:!1},{name:"Pinterest",icon:"https://onairos.sirv.com/Images/pinterest-icon.png",connected:!1}];function Hh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(zh),[s,a]=(0,e.useState)(!1),[c,l]=(0,e.useState)(0);(0,e.useEffect)((()=>{if(s){const t=setInterval((()=>{l((e=>e>=100?(clearInterval(t),a(!1),r(),100):e+2))}),100);return()=>clearInterval(t)}}),[s,r]);return s?n().createElement(Kh.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Unifying Your Data"),n().createElement("p",{className:"text-gray-600 text-center"},"Please wait while we process your information"),n().createElement("div",{className:"w-full max-w-md"},n().createElement("div",{className:"relative pt-1"},n().createElement("div",{className:"flex mb-2 items-center justify-between"},n().createElement("div",null,n().createElement("span",{className:"text-xs font-semibold inline-block py-1 px-2 uppercase rounded-full text-blue-600 bg-blue-200"},"Progress")),n().createElement("div",{className:"text-right"},n().createElement("span",{className:"text-xs font-semibold inline-block text-blue-600"},c,"%"))),n().createElement(Kh.div,{className:"overflow-hidden h-2 mb-4 text-xs flex rounded bg-blue-200"},n().createElement(Kh.div,{initial:{width:0},animate:{width:"".concat(c,"%")},transition:{duration:.5},className:"shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-500"})))),n().createElement(Kh.div,{animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},className:"w-12 h-12"},n().createElement("svg",{className:"w-full h-full text-blue-500",viewBox:"0 0 24 24"},n().createElement("path",{fill:"currentColor",d:"M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"})))):n().createElement("div",{className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Connect Your Accounts"),n().createElement("p",{className:"text-gray-600 text-center"},"Connect at least one account to create your personality model"),n().createElement("div",{className:"grid grid-cols-2 gap-4 w-full max-w-md"},i.map((t=>n().createElement("button",{key:t.name,onClick:()=>(async t=>{try{(await fetch("https://api2.onairos.uk/connect/".concat(t.toLowerCase()),{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&o(i.map((e=>e.name===t?{...e,connected:!0}:e)))}catch(e){console.error("Failed to connect to ".concat(t,":"),e)}})(t.name),className:"flex items-center justify-center p-4 rounded-lg border ".concat(t.connected?"bg-green-50 border-green-500":"border-gray-300 hover:border-blue-500")},n().createElement("img",{src:t.icon,alt:t.name,className:"w-8 h-8 mr-2"}),n().createElement("span",{className:t.connected?"text-green-600":"text-gray-700"},t.connected?"Connected":"Connect ".concat(t.name)))))),n().createElement("button",{onClick:async()=>{if(i.some((t=>t.connected))){a(!0);try{(await fetch("https://api2.onairos.uk/unify",{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&r()}catch(t){console.error("Failed to unify data:",t)}}},disabled:!i.some((t=>t.connected)),className:"w-full max-w-md py-3 px-4 rounded-lg font-semibold ".concat(i.some((t=>t.connected))?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Unify and Create Model"))}function $h(t){let{onSignUpSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}=t;const[a,c]=(0,e.useState)({email:"",username:"",password:"",confirmPassword:""}),[l,u]=(0,e.useState)(null),h=t=>{c({...a,[t.target.name]:t.target.value})};return n().createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},l&&n().createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},l),n().createElement(zr,{onLoginSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}),n().createElement("div",{className:"w-full flex items-center justify-center space-x-4"},n().createElement("hr",{className:"flex-grow border-gray-300"}),n().createElement("span",{className:"text-gray-500"},"or"),n().createElement("hr",{className:"flex-grow border-gray-300"})),n().createElement("form",{onSubmit:async t=>{if(t.preventDefault(),a.password===a.confirmPassword)try{const t=await fetch("https://api2.onairos.uk/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a.email,username:a.username,password:a.password})}),e=await t.json();t.ok?(localStorage.setItem("onairosToken",e.token),localStorage.setItem("username",a.username),r(a.username)):u(e.message||"Sign up failed")}catch(t){u("Sign up failed. Please try again.")}else u("Passwords don't match")},className:"w-full space-y-4"},n().createElement("input",{type:"email",name:"email",value:a.email,onChange:h,placeholder:"Email",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"text",name:"username",value:a.username,onChange:h,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"password",value:a.password,onChange:h,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"confirmPassword",value:a.confirmPassword,onChange:h,placeholder:"Confirm Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign Up")))}function Zh(t){let{setOthentConnected:n,dataRequester:r,NoAccount:i,NoModel:o,activeModels:s,avatar:a,setAvatar:c,traits:l,setTraits:u,requestData:h,handleConnectionSelection:d,changeGranted:f,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,isAuthenticated:w,onClose:v,onLoginSuccess:b,setOthent:E,setHashedOthentSub:S,setEncryptedPin:T,accountInfo:x}=t;const[A,k]=(0,e.useState)(null),[R,P]=(0,e.useState)(!1),C=(0,e.useRef)(null),[I,O]=(0,e.useState)((()=>{var t;return w?x&&(null===(t=x.models)||void 0===t?void 0:t.length)>0?"datarequests":"onboarding":"login"})),[B,U]=(0,e.useState)({username:"",password:""}),[L,N]=(0,e.useState)(!1),_="https://api2.onairos.uk";(0,e.useEffect)((()=>{const t=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(t,"px"))};return t(),window.addEventListener("resize",t),window.addEventListener("orientationchange",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("orientationchange",t)}}),[]);const j=()=>{v()};(0,e.useEffect)((()=>{const t=t=>{C.current&&!C.current.contains(t.target)&&(null==j||j())};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[j]);const D=t=>{U({...B,[t.target.name]:t.target.value})},M=async t=>{t.preventDefault();try{k(null);const t={details:{username:B.username,password:B.password}},e=await fetch("".concat(_,"/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await e.json();if("Accepted"!==n.authentication)throw new Error("Invalid credentials");localStorage.setItem("onairosToken",n.token),localStorage.setItem("username",B.username),await V(B.username)}catch(t){console.error("Login failed:",t),k("Invalid username or password")}},V=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];P(!0);try{await b(t,e);k(null)}catch(t){console.error("Login process failed:",t),k("Failed to complete login process")}finally{P(!1)}},F=()=>{O("security")},K=t=>{"othent"===t.method?E(!0):"pin"===t.method&&T(t.value),O("datarequests")},W=t=>{let{dataRequester:e,granted:n,allowSubmit:r,rejectDataRequest:i,sendDataRequest:o,activeModels:s,requestData:a,handleConnectionSelection:c,changeGranted:l,avatar:u,traits:h}=t;return React.createElement("div",{className:"flex flex-col h-full"},React.createElement("div",{className:"px-6"},React.createElement("h1",{className:"text-lg font-semibold text-gray-900 mb-6"},"Data Requests from ",e),React.createElement("div",{className:"flex items-center justify-between mb-6"},React.createElement("button",{className:"bg-gray-500 hover:bg-gray-600 text-white font-bold py-2 px-8 rounded-full",onClick:i},"Reject All"),React.createElement("button",{disabled:!r||0===n,className:"".concat(r&&n>0?"bg-blue-500 hover:bg-blue-600":"bg-gray-300 cursor-not-allowed"," text-white font-bold py-2 px-8 rounded-full"),onClick:o},"Confirm (",n,")"))),React.createElement("div",{className:"flex-1 overflow-y-auto px-6"},0===s.length?React.createElement("div",{className:"flex flex-col items-center justify-center py-8"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosWhite.png",alt:"Onairos Logo",className:"w-24 h-24 mb-4"}),React.createElement("p",{className:"text-center text-gray-800 font-medium"},"Please connect ",React.createElement("a",{href:"https://onairos.uk/connections",className:"text-blue-500 hover:underline"},"Onairos")," Personality to send ",e," your data")):React.createElement("div",{className:"space-y-4"},Object.keys(a).sort(((t,e)=>{const n=s.includes(a[t].type),r=s.includes(a[e].type);return"Avatar"===a[t].type?1:"Avatar"===a[e].type?-1:"Traits"===a[e].type?1:"Traits"===a[t].type||n&&!r?-1:r&&!n?1:0})).map(((t,n)=>{const r=a[t],i="Personality"===r.type?s.includes(r.type):"Avatar"===r.type?u:"Traits"===r.type&&h;return React.createElement(Zr,{key:t,active:i,title:r.type,id:r,number:n,descriptions:r.descriptions,rewards:r.reward,size:t,changeGranted:l,onSelectionChange:i=>c(e,t,n,r.type,r.reward,i)})})))))};return(0,e.useEffect)((()=>{var t;w&&x&&((null===(t=x.models)||void 0===t?void 0:t.length)>0?O("datarequests"):O("onboarding"))}),[w,x]),(0,e.useEffect)((()=>()=>{N(!1)}),[]),(0,e.useEffect)((()=>{}),[w,x]),R?React.createElement(React.Fragment,null,React.createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50"}),React.createElement("div",{ref:C,className:"fixed bottom-0 left-0 right-0 w-full bg-white rounded-t-3xl shadow-2xl transform transition-transform duration-300 ease-out flex items-center justify-center",style:{height:"calc(var(--vh, 1vh) * 50)"}},React.createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}))):React.createElement(React.Fragment,null,React.createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:j,style:{touchAction:"none"}}),React.createElement("div",{ref:C,className:"fixed bottom-0 left-0 right-0 w-full bg-white rounded-t-3xl shadow-2xl transform transition-transform duration-300 ease-out flex flex-col",style:{maxHeight:"60vh",minHeight:"45vh",height:"auto",touchAction:"none"}},React.createElement("div",{className:"sticky top-0 bg-white z-10 px-6 pt-3 pb-2"},React.createElement("div",{className:"w-12 h-1.5 bg-gray-300 rounded-full mx-auto"})),React.createElement("div",{className:"flex-1 overflow-y-auto px-6 pb-8",style:{touchAction:"pan-y"}},(()=>{switch(I){case"signup":return React.createElement($h,{onSignUpSuccess:V,setOthent:E,setHashedOthentSub:S,setEncryptedPin:T});case"onboarding":return React.createElement(Hh,{onComplete:F});case"security":return React.createElement(Wh,{onComplete:K});case"datarequests":return React.createElement(W,{dataRequester:r,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,activeModels:s,requestData:h,handleConnectionSelection:d,changeGranted:f,avatar:a,traits:l});default:return React.createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},A&&React.createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},A),React.createElement(zr,{onLoginSuccess:V,setOthent:E,setHashedOthentSub:S,setEncryptedPin:T}),React.createElement("div",{className:"w-full flex items-center justify-center space-x-4"},React.createElement("hr",{className:"flex-grow border-gray-300"}),React.createElement("span",{className:"text-gray-500"},"or"),React.createElement("hr",{className:"flex-grow border-gray-300"})),React.createElement("form",{onSubmit:M,className:"w-full space-y-4"},React.createElement("input",{type:"text",name:"username",value:B.username,onChange:D,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("input",{type:"password",name:"password",value:B.password,onChange:D,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign In")),React.createElement("button",{onClick:()=>O("signup"),className:"w-full text-center text-blue-500 hover:text-blue-600"},"Don't have an account? Sign up"))}})())))}const Xh=async()=>(await a.e(423).then(a.t.bind(a,153,23))).default;function Gh(t){var r,i;let{requestData:o,webpageName:s,inferenceData:a=null,onComplete:c=null,autoFetch:l=!0,proofMode:u=!1,textLayout:h="below",textColor:d="white",login:f=!1,buttonType:p="pill",loginReturn:m=null,loginType:g="signIn",visualType:y="full"}=t;const[w,v]=(0,e.useState)(null),[b,E]=(0,e.useState)(!1),[S,T]=(0,e.useState)([]),[x,A]=(0,e.useState)(0),[k,R]=(0,e.useState)({}),[P,C]=(0,e.useState)(!1),[I,O]=(0,e.useState)(!1),[B,U]=(0,e.useState)(!1),[L,N]=(0,e.useState)(!1),_=(0,e.useRef)(!1),j=(0,e.useRef)(!1),[D,M]=(0,e.useState)(!1),[V,F]=(0,e.useState)(null),[K,W]=(0,e.useState)(!0),[z,H]=(0,e.useState)(null),[$,Z]=(0,e.useState)(null),[X,G]=(0,e.useState)({show:!1,type:null,data:null}),[Y,q]=(0,e.useState)(null),[J,Q]=(0,e.useState)(!1),[tt,et]=(0,e.useState)(!1),nt=(0,e.useRef)(!1),[rt,it]=(0,e.useState)(null),[ot,st]=(0,e.useState)({show:!1,color:null,message:null}),at="https://api2.onairos.uk";(0,e.useEffect)((()=>{(async()=>{const t=new URL(window.location.href),e=t.searchParams.get("code"),n=t.searchParams.get("state");if(e&&n&&!nt.current&&!tt){nt.current=!0,et(!0);try{await ct(t.toString()),N(!0),window.history.replaceState({},document.title,window.location.pathname)}catch(t){console.error("Auth callback processing failed:",t),it(t.message)}finally{et(!1)}}})()}),[]);const ct=async t=>{try{const e=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!0,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href}),n=await e.completeConnectionAfterRedirect(t);if(!e)throw new Error("Failed to initialize Othent");if(!n||!n.sub)throw new Error("Invalid user details received from Othent");M(!0);const r=(await Xh())(n.sub).toString();H(r);const i=await Mr(r);Z(i.result),F(i.token),await mt(n.email,!0),E(!0),localStorage.setItem("othentToken",r),localStorage.setItem("onairosToken",n.token)}catch(t){throw st({show:!0,color:"red",message:"An error has occured, please try again"}),console.error("Authentication failed:",t),t}};(0,e.useEffect)((()=>{rt&&console.error("Authentication error:",rt)}),[rt]);const lt=()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(t)};(0,e.useEffect)((()=>{if(l&&a&&"function"==typeof c){const t=async t=>{if(t.data&&"content-script"===t.data.source&&"API_URL_RESPONSE"===t.data.type&&"Onairos-Response"===t.data.unique){const{APIurl:e,approved:n,accessToken:r}=t.data,i=(t=>{const e={Small:16,Medium:32,Large:64};let n=null,r=0;return t.forEach((t=>{const i=e[t.data];i>r&&(r=i,n=t)})),r})(n),o={Input:a.slice(0,i)};try{const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(o)}),n=await t.json();c(n)}catch(t){console.error(t),c(null,t)}}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}}),[]);const ut=window.location.href,ht=async()=>{try{if(lt())return void await(async()=>{lt()&&E(!0)})();const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await Xh())(e.sub).toString();function r(t){try{const e=window.atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n.buffer}catch(t){console.error("Error converting to Buffer :",t)}}const i=r((await Mr(n)).result);Dr("\n -----BEGIN PUBLIC KEY-----\n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4wkWvRPaJiY8CwQ5BoJI\n amcGAYV91Bk8NrvWq4PXM+J/RJugfgTNCYKQ/c6g4xa1YES/tJEzFS7nf0Kdoqxm\n 5aav0ru5vS4fc4vCOLTI9W1T7nj02NY91rogsQm2/KMxUQ8DaLeTZKi+0Wjsa9YO\n 6XGGd1wh4azgQkj04MWW5J1EBCcBavKoY+C85oA9jkkklQ8nGWgbugmZs7eXHNQb\n qH8/ZHcB9Kx1CZ6XjQuVd6YE/A+swV+DksbkXANcYjr6SY/2TbB8GfpcOMM3bkyN\n Q8e0A51q5a8abfuAkDZXe67MwKMWu/626abwPZhJrKr5HhRZZDwPtnXlktYHhOK6\n lQIDAQAB\n -----END PUBLIC KEY-----\n ",await t.decrypt(i)).then((t=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:s,domain:ut,requestData:o,proofMode:u,HashedOthentSub:n,EncryptedUserPin:t})})).catch((t=>{console.error("Encryption failed:",t)}))}catch(a){console.error({fix:"Please ensure you have stored your model"}),console.error("Error Sending Data to Terminal: ",a)}},dt="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," ").concat(f?"bg-white border border-gray-300":"bg-transparent","\n ").concat(lt()?"":"OnairosConnect","\n "),ft={flexDirection:"below"===h?"column":"row",backgroundColor:f?"#ffffff":"transparent",color:f?"black":d,border:f?"1px solid #ddd":"1px solid transparent"},pt={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"},mt=(process.env.REACT_APP_GOOGLE_CLIENT_ID,async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=e?{Info:{identifier:t}}:{Info:{userName:t}},r=e?"/getAccountInfo/email":"/getAccountInfo",i=await fetch("".concat(at).concat(r),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("onairosToken"))},body:JSON.stringify(n)});if(!i.ok)throw new Error("Failed to fetch account info");const o=await i.json();return"No Account Found"===o.AccountInfo?(_.current=!0,q(null),null):(q(o.AccountInfo),o.AccountInfo.models?T(o.AccountInfo.models):j.current=!0,o.AccountInfo.avatar&&C(!0),o.AccountInfo.UserTraits&&O(!0),o.AccountInfo)}catch(t){throw console.error("Error fetching account info:",t),t}});(0,e.useEffect)((()=>{lt()&&(async()=>{try{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("token"),n=t||e;if(n){const t=await fetch("http://localhost:8080/verifyToken",{headers:{Authorization:"Bearer ".concat(n)}});if(t.ok)if((await t.json()).valid){F(n),M(!0);const t=localStorage.getItem("username");await mt(t)}else localStorage.removeItem("onairosToken"),localStorage.removeItem("token")}}catch(t){console.error("Token verification failed:",t)}finally{W(!1)}})()}),[]);(0,e.useEffect)((()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username");t&&e&&mt(e,!1)}),[]);return(0,e.useEffect)((()=>{(async()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username"),n=localStorage.getItem("othentToken");if(t)try{if((await fetch("".concat(at,"/verifyToken"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).ok){if(M(!0),e)await mt(e,!1);else if(n){const t=JSON.parse(n);await mt(t.email,!0)}}else localStorage.removeItem("onairosToken"),localStorage.removeItem("username"),localStorage.removeItem("othentToken")}catch(t){console.error("Token verification failed:",t)}})()}),[]),n().createElement(n().Fragment,null,n().createElement("div",{className:"flex items-center justify-center"},n().createElement("button",{className:dt,onClick:ht,style:ft},("full"===y||"icon"===y)&&n().createElement("img",{src:f?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:pt,className:"".concat("pill"===p?"w-6 h-6":"w-8 h-8"," object-contain")}),("full"===y||"textOnly"===y)&&n().createElement("span",{className:"".concat(f||"black"===d?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===h?"ml-2":"left"===h?"mr-2":"")},(()=>{switch(g){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})()))),ot.show&&n().createElement(Notification,{message:ot.message,color:ot.color}),X.show&&n().createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center"},n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>G({show:!1,type:null,data:null})}),n().createElement("div",{className:"relative bg-white rounded-lg p-6 max-w-lg w-full mx-4 max-h-[80vh] overflow-y-auto"},n().createElement("button",{onClick:()=>G({show:!1,type:null,data:null}),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600"},n().createElement("span",{className:"sr-only"},"Close"),n().createElement("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},n().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"callback"===X.type?"Callback Details":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"apiURL"===X.type?"API Url Returned":"Authentication Result"),n().createElement("div",{className:"bg-gray-50 rounded p-4 overflow-x-auto"},n().createElement("pre",{className:"text-sm"},JSON.stringify(X.data,null,2))),"auth"===X.type&&n().createElement("div",{className:"mt-4 p-3 rounded ".concat(null!==(r=X.data)&&void 0!==r&&r.success?"bg-green-100 text-green-700":"bg-red-100 text-red-700")},null!==(i=X.data)&&void 0!==i&&i.success?"Authentication successful!":"Authentication failed"))),J&&n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},n().createElement("div",{className:"bg-white p-6 rounded-lg shadow-xl"},n().createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),n().createElement("p",{className:"mt-4 text-gray-600"},"Loading your account..."))),b&&!J&&n().createElement(Zh,{setOthentConnected:N,dataRequester:s,NoAccount:_,NoModel:j,accountInfo:Y,activeModels:S,avatar:P,traits:I,requestData:o,handleConnectionSelection:(t,e,n,r,i,o)=>{R((s=>({...s,["".concat(t,"-").concat(e,"-").concat(n)]:{type:r,reward:i,isSelected:o}})))},changeGranted:t=>{A((e=>Math.max(e+t,0)))},granted:x,allowSubmit:x>0,rejectDataRequest:()=>{E(!1),c&&c("rejected")},sendDataRequest:async()=>{if(x>0){try{if(B&&!L){G({show:!0,type:"callback",data:{code:"Connecting Othent Details",state:""}});const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await Xh())(e.sub).toString();H(n);const r=await Mr(n);Z(r.result),F(r.token),N(!0)}const t=Object.values(k).filter((t=>t.isSelected)).map((t=>({type:t.type,reward:t.reward})));G({show:!0,type:"callback",data:{code:"Retrieving API URL",state:t}});const e={Info:{EncryptedUserPin:$,confirmations:t,web3Type:"othent",Domain:window.location.href,proofMode:"false",OthentSub:z}};try{const t=await fetch("https://api2.onairos.uk/getAPIurl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();l&&c?c(n):(G({show:!0,type:"apiURL",data:{code:t.body.apiUrl,state:approved}}),chrome.runtime.sendMessage({source:"dataRequestPage",type:"returnedAPIurl",APIurl:t.body.apiUrl,accessToken:t.body.token,approved:selectedConnections.current}))}catch(t){console.error(t),c&&c(null,t)}}catch(t){console.error(t)}E(!1)}},isAuthenticated:D,onLoginSuccess:async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=await mt(t,e);return M(!0),E(!0),n}catch(t){throw console.error("Login process failed:",t),t}},onClose:()=>{A(0),E(!1)},setOthent:U,setHashedOthentSub:H,setEncryptedPin:Z}))}})(),c})()));
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["React"],e);else{var n="object"==typeof exports?e(require("react")):e(t.React);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e,n,r,i,o={317:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>r});const r={}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(431);e.default=class{BigNum;constructor(){this.BigNum=(t,e)=>new(r.BigNumber.clone({DECIMAL_PLACES:e}))(t)}winstonToAr(t,{formatted:e=!1,decimals:n=12,trim:r=!0}={}){let i=this.stringToBigNum(t,n).shiftedBy(-12);return e?i.toFormat(n):i.toFixed(n)}arToWinston(t,{formatted:e=!1}={}){let n=this.stringToBigNum(t).shiftedBy(12);return e?n.toFormat():n.toFixed(0)}compare(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.comparedTo(r)}isEqual(t,e){return 0===this.compare(t,e)}isLessThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isLessThan(r)}isGreaterThan(t,e){let n=this.stringToBigNum(t),r=this.stringToBigNum(e);return n.isGreaterThan(r)}add(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.plus(e).toFixed(0)}sub(t,e){let n=this.stringToBigNum(t);this.stringToBigNum(e);return n.minus(e).toFixed(0)}stringToBigNum(t,e=12){return this.BigNum(t,e)}}},759:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498);n(317);class i{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(t,e){this.api=t,this.network=e}async get(t){const e=await this.api.get(`${i.HASH_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getByHeight(t){const e=await this.api.get(`${i.HEIGHT_ENDPOINT}${t}`);if(200===e.status)return e.data;throw 404===e.status?new r.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${e}`)}async getCurrent(){const{current:t}=await this.network.getInfo();return await this.get(t)}}e.default=i},879:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(244);e.default=class{api;constructor(t){this.api=t}async getTransactionOffset(t){const e=await this.api.get(`tx/${t}/offset`);if(200===e.status)return e.data;throw new Error(`Unable to get transaction offset: ${(0,r.getError)(e)}`)}async getChunk(t){const e=await this.api.get(`chunk/${t}`);if(200===e.status)return e.data;throw new Error(`Unable to get chunk: ${(0,r.getError)(e)}`)}async getChunkData(t){const e=await this.getChunk(t);return i.b64UrlToBuffer(e.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t){const e=await this.getTransactionOffset(t),n=parseInt(e.size),r=parseInt(e.offset)-n+1,i=new Uint8Array(n);let o=0;for(;o<n;){let t;this.api.config.logging&&console.log(`[chunk] ${o}/${n}`);try{t=await this.getChunkData(r+o)}catch(t){console.error(`[chunk] Failed to fetch chunk at offset ${r+o}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(!t)throw new Error(`Couldn't complete data download at ${o}/${n}`);i.set(t,o),o+=t.length}return i}}},536:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(586),i=n(874),o=n(363),s=n(248),a=n(935),c=n(927),l=n(825),u=n(244),h=n(243),d=n(879),f=n(759);class p{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new o.default;static utils=u;constructor(t){this.api=new i.default(t),this.wallets=new c.default(this.api,p.crypto),this.chunks=new d.default(this.api),this.transactions=new a.default(this.api,p.crypto,this.chunks),this.silo=new h.default(this.api,this.crypto,this.transactions),this.network=new s.default(this.api),this.blocks=new f.default(this.api,this.network),this.ar=new r.default}get crypto(){return p.crypto}get utils(){return p.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(t,e){const n={};if(Object.assign(n,t),!(t.data||t.target&&t.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(null==t.owner&&e&&"use_wallet"!==e&&(n.owner=e.n),null==t.last_tx&&(n.last_tx=await this.transactions.getTransactionAnchor()),"string"==typeof t.data&&(t.data=u.stringToBuffer(t.data)),t.data instanceof ArrayBuffer&&(t.data=new Uint8Array(t.data)),t.data&&!(t.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(null==t.reward){const e=t.data?t.data.byteLength:0;n.reward=await this.transactions.getPrice(e,n.target)}n.data_root="",n.data_size=t.data?t.data.byteLength.toString():"0",n.data=t.data||new Uint8Array(0);const r=new l.default(n);return await r.getSignatureData(),r}async createSiloTransaction(t,e,n){const r={};if(Object.assign(r,t),!t.data)throw new Error("Silo transactions must have a 'data' value");if(!n)throw new Error("No Silo URI specified.");if(t.target||t.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(null==t.owner){if(!e||!e.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");r.owner=e.n}null==t.last_tx&&(r.last_tx=await this.transactions.getTransactionAnchor());const i=await this.silo.parseUri(n);if("string"==typeof t.data){const e=await this.crypto.encrypt(u.stringToBuffer(t.data),i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}if(t.data instanceof Uint8Array){const e=await this.crypto.encrypt(t.data,i.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=u.bufferTob64Url(e)}const o=new l.default(r);return o.addTag("Silo-Name",i.getAccessKey()),o.addTag("Silo-Version","0.1.0"),o}arql(t){return this.api.post("/arql",t).then((t=>t.data||[]))}}e.default=p},386:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0});const o=n(536),s=n(118);o.default.init=function(t={}){const e={host:"arweave.net",port:443,protocol:"https"};if("object"!=typeof location||!location.protocol||!location.hostname)return new o.default({...t,...e});const n=location.protocol.replace(":",""),r=location.hostname,i=location.port?parseInt(location.port):"https"==n?443:80,a=(0,s.getDefaultConfig)(n,r),c=t.protocol||a.protocol,l=t.host||a.host,u=t.port||a.port||i;return new o.default({...t,host:l,protocol:c,port:u})},"object"==typeof globalThis?globalThis.Arweave=o.default:"object"==typeof self&&(self.Arweave=o.default),i(n(536),e),e.default=o.default},874:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{METHOD_GET="GET";METHOD_POST="POST";config;constructor(t){this.applyConfig(t)}applyConfig(t){this.config=this.mergeDefaults(t)}getConfig(){return this.config}mergeDefaults(t){const e=t.protocol||"http",n=t.port||("https"===e?443:80);return{host:t.host||"127.0.0.1",protocol:e,port:n,timeout:t.timeout||2e4,logging:t.logging||!1,logger:t.logger||console.log,network:t.network}}async get(t,e){return await this.request(t,{...e,method:this.METHOD_GET})}async post(t,e,n){const r=new Headers(n?.headers||{});return r.get("content-type")?.includes("application/json")||r.append("content-type","application/json"),r.append("accept","application/json, text/plain, */*"),await this.request(t,{...n,method:this.METHOD_POST,body:"string"!=typeof e?JSON.stringify(e):e,headers:r})}async request(t,e){const r=new Headers(e?.headers||{}),i=`${this.config.protocol}://${this.config.host}:${this.config.port}`,o=e?.responseType;delete e?.responseType,t.startsWith("/")&&(t=t.slice(1)),this.config.network&&r.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${i}/${t}`);let s=await fetch(`${i}/${t}`,{...e||{},headers:r});this.config.logging&&this.config.logger(`Response: ${s.url} - ${s.status}`);const a=s.headers.get("content-type"),c=a?.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i)?.[1],l=s,u=async()=>{if(c)try{l.data=new TextDecoder(c).decode(await s.arrayBuffer())}catch(t){l.data=await s.text()}else l.data=await s.text()};if("arraybuffer"===o)l.data=await s.arrayBuffer();else if("text"===o)await u();else if("webstream"===o)l.data=n(s.body);else try{let t=await s.clone().json();"object"!=typeof t?await u():l.data=await s.json(),t=null}catch{await u()}return l}};const n=t=>{const e=t;return void 0===e[Symbol.asyncIterator]?(e[Symbol.asyncIterator]=r(t),e):t},r=function(t){return async function*(){const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}}},363:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);e.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){const r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if("undefined"==typeof crypto)return!1;const t=crypto?.subtle;if(void 0===t)return!1;return["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);const a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return r.concatBuffers([s,a])}async decrypt(t,e,n){const i=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return r.concatBuffers([a])}}},921:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(536);async function i(t){if(Array.isArray(t)){const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("list"),r.default.utils.stringToBuffer(t.length.toString())]);return await o(t,await r.default.crypto.hash(e,"SHA-384"))}const e=r.default.utils.concatBuffers([r.default.utils.stringToBuffer("blob"),r.default.utils.stringToBuffer(t.byteLength.toString())]),n=r.default.utils.concatBuffers([await r.default.crypto.hash(e,"SHA-384"),await r.default.crypto.hash(t,"SHA-384")]);return await r.default.crypto.hash(n,"SHA-384")}async function o(t,e){if(t.length<1)return e;const n=r.default.utils.concatBuffers([e,await i(t[0])]),s=await r.default.crypto.hash(n,"SHA-384");return await o(t.slice(1),s)}e.default=i},498:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getError=void 0;class n extends Error{type;response;constructor(t,e={}){e.message?super(e.message):super(),this.type=t,this.response=e.response}getType(){return this.type}}e.default=n,e.getError=function(t){let e=t.data;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(t){}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{e=JSON.parse(e.toString())}catch(t){}return e?e.error||e:t.statusText||"unknown"}},224:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.debug=e.validatePath=e.arrayCompare=e.bufferToInt=e.intToBuffer=e.arrayFlatten=e.generateProofs=e.buildLayers=e.generateTransactionChunks=e.generateTree=e.computeRootHash=e.generateLeaves=e.chunkData=e.MIN_CHUNK_SIZE=e.MAX_CHUNK_SIZE=void 0;const r=n(536),i=n(244);e.MAX_CHUNK_SIZE=262144,e.MIN_CHUNK_SIZE=32768;const o=32,s=32;async function a(t){let n=[],i=t,o=0;for(;i.byteLength>=e.MAX_CHUNK_SIZE;){let t=e.MAX_CHUNK_SIZE,s=i.byteLength-e.MAX_CHUNK_SIZE;s>0&&s<e.MIN_CHUNK_SIZE&&(t=Math.ceil(i.byteLength/2));const a=i.slice(0,t),c=await r.default.crypto.hash(a);o+=a.byteLength,n.push({dataHash:c,minByteRange:o-a.byteLength,maxByteRange:o}),i=i.slice(t)}return n.push({dataHash:await r.default.crypto.hash(i),minByteRange:o,maxByteRange:o+i.byteLength}),n}async function c(t){return Promise.all(t.map((async({dataHash:t,minByteRange:e,maxByteRange:n})=>({type:"leaf",id:await m(await Promise.all([m(t),m(g(n))])),dataHash:t,minByteRange:e,maxByteRange:n}))))}async function l(t){return await u(await c(await a(t)))}async function u(t,e=0){if(t.length<2){return t[0]}const n=[];for(let e=0;e<t.length;e+=2)n.push(await p(t[e],t[e+1]));return u(n,e+1)}function h(t){const e=d(t);return Array.isArray(e)?f(e):[e]}function d(t,e=new Uint8Array,n=0){if("leaf"==t.type)return{offset:t.maxByteRange-1,proof:(0,i.concatBuffers)([e,t.dataHash,g(t.maxByteRange)])};if("branch"==t.type){const r=(0,i.concatBuffers)([e,t.leftChild.id,t.rightChild.id,g(t.byteRange)]);return[d(t.leftChild,r,n+1),d(t.rightChild,r,n+1)]}throw new Error("Unexpected node type")}function f(t){const e=[];return t.forEach((t=>{Array.isArray(t)?e.push(...f(t)):e.push(t)})),e}async function p(t,e){if(!e)return t;return{type:"branch",id:await m([await m(t.id),await m(e.id),await m(g(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function m(t){return Array.isArray(t)&&(t=r.default.utils.concatBuffers(t)),new Uint8Array(await r.default.crypto.hash(t))}function g(t){const e=new Uint8Array(o);for(var n=e.length-1;n>=0;n--){var r=t%256;e[n]=r,t=(t-r)/256}return e}function y(t){let e=0;for(var n=0;n<t.length;n++)e*=256,e+=t[n];return e}e.chunkData=a,e.generateLeaves=c,e.computeRootHash=async function(t){return(await l(t)).id},e.generateTree=l,e.generateTransactionChunks=async function(t){const e=await a(t),n=await c(e),r=await u(n),i=await h(r),o=e.slice(-1)[0];return o.maxByteRange-o.minByteRange==0&&(e.splice(e.length-1,1),i.splice(i.length-1,1)),{data_root:r.id,chunks:e,proofs:i}},e.buildLayers=u,e.generateProofs=h,e.arrayFlatten=f,e.intToBuffer=g,e.bufferToInt=y;e.arrayCompare=(t,e)=>t.every(((t,n)=>e[n]===t)),e.validatePath=async function t(n,r,i,a,c){if(a<=0)return!1;if(r>=a)return t(n,0,a-1,a,c);if(r<0)return t(n,0,0,a,c);if(c.length==s+o){const t=c.slice(0,s),r=c.slice(t.length,t.length+o),l=await m([await m(t),await m(r)]);return!!(0,e.arrayCompare)(n,l)&&{offset:a-1,leftBound:i,rightBound:a,chunkSize:a-i}}const l=c.slice(0,s),u=c.slice(l.length,l.length+s),h=c.slice(l.length+u.length,l.length+u.length+o),d=y(h),f=c.slice(l.length+u.length+h.length),p=await m([await m(l),await m(u),await m(h)]);return!!(0,e.arrayCompare)(n,p)&&(r<d?await t(l,r,i,Math.min(a,d),f):await t(u,r,Math.max(i,d),a,f))},e.debug=async function t(e,n=""){if(e.byteLength<1)return n;const r=e.slice(0,s),i=e.slice(r.length,r.length+s),a=e.slice(r.length+i.length,r.length+i.length+o),c=y(a),l=e.slice(r.length+i.length+a.length),u=await m([await m(r),await m(i),await m(a)]);return t(l,`${n}\n${JSON.stringify(Buffer.from(r))},${JSON.stringify(Buffer.from(i))},${c} => ${JSON.stringify(u)}`)}},246:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionUploader=void 0;const r=n(825),i=n(244),o=n(498),s=n(224),a=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"];class c{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(t,e){if(this.api=t,!e.id)throw new Error("Transaction is not signed");if(!e.chunks)throw new Error("Transaction chunks not prepared");this.data=e.data,this.transaction=new r.default(Object.assign({},e,{data:new Uint8Array(0)}))}async uploadChunk(t){if(this.isComplete)throw new Error("Upload is already complete");if(""!==this.lastResponseError?this.totalErrors++:this.totalErrors=0,100===this.totalErrors)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let e=""===this.lastResponseError?0:Math.max(this.lastRequestTimeEnd+4e4-Date.now(),4e4);if(e>0&&(e-=e*Math.random()*.3,await new Promise((t=>setTimeout(t,e)))),this.lastResponseError="",!this.txPosted)return void await this.postTransaction();t&&(this.chunkIndex=t);const n=this.transaction.getChunk(t||this.chunkIndex,this.data);if(!await(0,s.validatePath)(this.transaction.chunks.data_root,parseInt(n.offset),0,parseInt(n.data_size),i.b64UrlToBuffer(n.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);const r=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch((t=>(console.error(t.message),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,200==this.lastResponseStatus)this.chunkIndex++;else if(this.lastResponseError=(0,o.getError)(r),a.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(t,e,n){if(!e||"number"!=typeof e.chunkIndex||"object"!=typeof e.transaction)throw new Error("Serialized object does not match expected format.");var i=new r.default(e.transaction);i.chunks||await i.prepareChunks(n);const o=new c(t,i);if(o.chunkIndex=e.chunkIndex,o.lastRequestTimeEnd=e.lastRequestTimeEnd,o.lastResponseError=e.lastResponseError,o.lastResponseStatus=e.lastResponseStatus,o.txPosted=e.txPosted,o.data=n,o.transaction.data_root!==e.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return o}static async fromTransactionId(t,e){const n=await t.get(`tx/${e}`);if(200!==n.status)throw new Error(`Tx ${e} not found: ${n.status}`);const r=n.data;r.data=new Uint8Array(0);return{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:r}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=1){this.transaction.data=this.data;const t=await this.api.post("tx",this.transaction).catch((t=>(console.error(t),{status:-1,data:{error:t.message}})));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,this.transaction.data=new Uint8Array(0),t.status>=200&&t.status<300)return this.txPosted=!0,void(this.chunkIndex=1);throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`)}const t=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=t.status,!(t.status>=200&&t.status<300))throw this.lastResponseError=(0,o.getError)(t),new Error(`Unable to upload transaction: ${t.status}, ${this.lastResponseError}`);this.txPosted=!0}}e.TransactionUploader=c},825:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Tag=void 0;const r=n(244),i=n(921),o=n(224);class s{get(t,e){if(!Object.getOwnPropertyNames(this).includes(t))throw new Error(`Field "${t}" is not a property of the Arweave Transaction class.`);if(this[t]instanceof Uint8Array)return e&&e.decode&&e.string?r.bufferToString(this[t]):e&&e.decode&&!e.string?this[t]:r.bufferTob64Url(this[t]);if(this[t]instanceof Array){if(void 0!==e?.decode||void 0!==e?.string)throw"tags"===t&&console.warn("Did you mean to use 'transaction[\"tags\"]' ?"),new Error("Cannot decode or stringify an array.");return this[t]}return e&&1==e.decode?e&&e.string?r.b64UrlToString(this[t]):r.b64UrlToBuffer(this[t]):this[t]}}class a extends s{name;value;constructor(t,e,n=!1){super(),this.name=t,this.value=e}}e.Tag=a;e.default=class extends s{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(t={}){super(),Object.assign(this,t),"string"==typeof this.data&&(this.data=r.b64UrlToBuffer(this.data)),t.tags&&(this.tags=t.tags.map((t=>new a(t.name,t.value))))}addTag(t,e){this.tags.push(new a(r.stringToB64Url(t),r.stringToB64Url(e)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:r.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(t){this.owner=t}setSignature({id:t,owner:e,reward:n,tags:r,signature:i}){this.id=t,this.owner=e,n&&(this.reward=n),r&&(this.tags=r),this.signature=i}async prepareChunks(t){!this.chunks&&t.byteLength>0&&(this.chunks=await(0,o.generateTransactionChunks)(t),this.data_root=r.bufferTob64Url(this.chunks.data_root)),this.chunks||0!==t.byteLength||(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(t,e){if(!this.chunks)throw new Error("Chunks have not been prepared");const n=this.chunks.proofs[t],i=this.chunks.chunks[t];return{data_root:this.data_root,data_size:this.data_size,data_path:r.bufferTob64Url(n.proof),offset:n.offset.toString(),chunk:r.bufferTob64Url(e.slice(i.minByteRange,i.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let t=this.tags.reduce(((t,e)=>r.concatBuffers([t,e.get("name",{decode:!0,string:!1}),e.get("value",{decode:!0,string:!1})])),new Uint8Array);return r.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),t]);case 2:this.data_root||await this.prepareChunks(this.data);const e=this.tags.map((t=>[t.get("name",{decode:!0,string:!1}),t.get("value",{decode:!0,string:!1})]));return await(0,i.default)([r.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),r.stringToBuffer(this.quantity),r.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),e,r.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}}},244:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.b64UrlDecode=e.b64UrlEncode=e.bufferTob64Url=e.bufferTob64=e.b64UrlToBuffer=e.stringToB64Url=e.stringToBuffer=e.bufferToString=e.b64UrlToString=e.concatBuffers=void 0;const r=n(742);function i(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function o(t){return(new TextEncoder).encode(t)}function s(t){return new Uint8Array(r.toByteArray(u(t)))}function a(t){return r.fromByteArray(new Uint8Array(t))}function c(t){return l(a(t))}function l(t){try{return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(t){throw new Error("Failed to encode string",{cause:t})}}function u(t){try{let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}catch(t){throw new Error("Failed to decode string",{cause:t})}}e.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},e.b64UrlToString=function(t){return i(s(t))},e.bufferToString=i,e.stringToBuffer=o,e.stringToB64Url=function(t){return c(o(t))},e.b64UrlToBuffer=s,e.bufferTob64=a,e.bufferTob64Url=c,e.b64UrlEncode=l,e.b64UrlDecode=u},118:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultConfig=void 0;e.getDefaultConfig=(t,e)=>{if(((t,e)=>{const n=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,r=e.split("."),i=r[r.length-1],o=["localhost","[::1]"];return o.includes(e)||"file"==t||o.includes(i)||!!e.match(n)||!!i.match(n)})(t,e))return{protocol:"https",host:"arweave.net",port:443};if(!(t=>{const e="["===t.charAt(0);return!!t.match(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/)||e})(e)){let n=e.split(".");if(n.length>=3){n.shift();return{protocol:t,host:n.join(".")}}}return{protocol:t,host:e}}},248:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=class{api;constructor(t){this.api=t}getInfo(){return this.api.get("info").then((t=>t.data))}getPeers(){return this.api.get("peers").then((t=>t.data))}}},243:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SiloResource=void 0;const r=n(244);e.default=class{api;crypto;transactions;constructor(t,e,n){this.api=t,this.crypto=e,this.transactions=n}async get(t){if(!t)throw new Error("No Silo URI specified");const e=await this.parseUri(t),n=await this.transactions.search("Silo-Name",e.getAccessKey());if(0==n.length)throw new Error(`No data could be found for the Silo URI: ${t}`);const r=await this.transactions.get(n[0]);if(!r)throw new Error(`No data could be found for the Silo URI: ${t}`);const i=r.get("data",{decode:!0,string:!1});return this.crypto.decrypt(i,e.getEncryptionKey())}async readTransactionData(t,e){if(!e)throw new Error("No Silo URI specified");const n=await this.parseUri(e),r=t.get("data",{decode:!0,string:!1});return this.crypto.decrypt(r,n.getEncryptionKey())}async parseUri(t){const e=t.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!e)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");const n=e[1],o=Math.pow(2,parseInt(e[2])),s=await this.hash(r.stringToBuffer(n),o),a=r.bufferTob64(s.slice(0,15)),c=await this.hash(s.slice(16,31),1);return new i(t,a,c)}async hash(t,e){let n=await this.crypto.hash(t);for(let t=0;t<e-1;t++)n=await this.crypto.hash(n);return n}};class i{uri;accessKey;encryptionKey;constructor(t,e,n){this.uri=t,this.accessKey=e,this.encryptionKey=n}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}}e.SiloResource=i},935:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),i=n(825),o=n(244),s=n(246);n(317);e.default=class{api;crypto;chunks;constructor(t,e,n){this.api=t,this.crypto=e,this.chunks=n}async getTransactionAnchor(){const t=await this.api.get("tx_anchor");if(!t.data.match(/^[a-z0-9_-]{43,}/i)||!t.ok)throw new Error(`Could not getTransactionAnchor. Received: ${t.data}. Status: ${t.status}, ${t.statusText}`);return t.data}async getPrice(t,e){let n=e?`price/${t}/${e}`:`price/${t}`;const r=await this.api.get(n);if(!/^\d+$/.test(r.data)||!r.ok)throw new Error(`Could not getPrice. Received: ${r.data}. Status: ${r.status}, ${r.statusText}`);return r.data}async get(t){const e=await this.api.get(`tx/${t}`);if(200==e.status){const n=parseInt(e.data.data_size);if(e.data.format>=2&&n>0&&n<=12582912){const n=await this.getData(t);return new i.default({...e.data,data:n})}return new i.default({...e.data,format:e.data.format||1})}if(404==e.status)throw new r.default("TX_NOT_FOUND");if(410==e.status)throw new r.default("TX_FAILED");throw new r.default("TX_INVALID")}fromRaw(t){return new i.default(t)}async search(t,e){return this.api.post("arql",{op:"equals",expr1:t,expr2:e}).then((t=>t.data?t.data:[]))}getStatus(t){return this.api.get(`tx/${t}/status`).then((t=>200==t.status?{status:200,confirmed:t.data}:{status:t.status,confirmed:null}))}async getData(t,e){let n;try{n=await this.chunks.downloadChunkedData(t)}catch(e){console.error(`Error while trying to download chunked data for ${t}`),console.error(e)}if(!n){console.warn(`Falling back to gateway cache for ${t}`);try{const{data:e,ok:r,status:i,statusText:o}=await this.api.get(`/${t}`,{responseType:"arraybuffer"});if(!r)throw new Error("Bad http status code",{cause:{status:i,statusText:o}});n=e}catch(e){console.error(`Error while trying to download contiguous data from gateway cache for ${t}`),console.error(e)}}if(!n)throw new Error(`${t} data was not found!`);return e&&e.decode&&!e.string?n:e&&e.decode&&e.string?o.bufferToString(n):o.bufferTob64Url(n)}async sign(t,e,n){const r="object"==typeof e&&(t=>{let e=!0;return["n","e","d","p","q","dp","dq","qi"].map((n=>!(n in t)&&(e=!1))),e})(e),i="object"==typeof arweaveWallet;if(!r&&!i)throw new Error("No valid JWK or external wallet found to sign transaction.");if(r){t.setOwner(e.n);let r=await t.getSignatureData(),i=await this.crypto.sign(e,r,n),s=await this.crypto.hash(i);t.setSignature({id:o.bufferTob64Url(s),owner:e.n,signature:o.bufferTob64Url(i)})}else{if(!i)throw new Error("An error occurred while signing. Check wallet is valid");{try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}const e=await arweaveWallet.sign(t,n);t.setSignature({id:e.id,owner:e.owner,reward:e.reward,tags:e.tags,signature:e.signature})}}}async verify(t){const e=await t.getSignatureData(),n=t.get("signature",{decode:!0,string:!1}),r=o.bufferTob64Url(await this.crypto.hash(n));if(t.id!==r)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(t.owner,e,n)}async post(t){if("string"==typeof t?t=new i.default(JSON.parse(t)):"function"==typeof t.readInt32BE?t=new i.default(JSON.parse(t.toString())):"object"!=typeof t||t instanceof i.default||(t=new i.default(t)),!(t instanceof i.default))throw new Error("Must be Transaction object");t.chunks||await t.prepareChunks(t.data);const e=await this.getUploader(t,t.data);try{for(;!e.isComplete;)await e.uploadChunk()}catch(t){if(e.lastResponseStatus>0)return{status:e.lastResponseStatus,statusText:e.lastResponseError,data:{error:e.lastResponseError}};throw t}return{status:200,statusText:"OK",data:{}}}async getUploader(t,e){let n;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t instanceof i.default){if(e||(e=t.data),!(e instanceof Uint8Array))throw new Error("Data format is invalid");t.chunks||await t.prepareChunks(e),n=new s.TransactionUploader(this.api,t),n.data&&0!==n.data.length||(n.data=e)}else{if("string"==typeof t&&(t=await s.TransactionUploader.fromTransactionId(this.api,t)),!(e&&e instanceof Uint8Array))throw new Error("Must provide data when resuming upload");n=await s.TransactionUploader.fromSerialized(this.api,t,e)}return n}async*upload(t,e){const n=await this.getUploader(t,e);for(;!n.isComplete;)await n.uploadChunk(),yield n;return n}}},927:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(244);n(317);e.default=class{api;crypto;constructor(t,e){this.api=t,this.crypto=e}getBalance(t){return this.api.get(`wallet/${t}/balance`).then((t=>t.data))}getLastTransactionID(t){return this.api.get(`wallet/${t}/last_tx`).then((t=>t.data))}generate(){return this.crypto.generateJWK()}async jwkToAddress(t){return t&&"use_wallet"!==t?this.getAddress(t):this.getAddress()}async getAddress(t){if(t&&"use_wallet"!==t)return this.ownerToAddress(t.n);try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}async ownerToAddress(t){return r.bufferTob64Url(await this.crypto.hash(r.b64UrlToBuffer(t)))}}},742:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),u=0,h=c>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e);return l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},431:function(t,e,n){var r;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,l="[BigNumber Error] ",u=l+"Number primitive has more than 15 significant digits: ",h=1e14,d=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,g=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function w(t){for(var e,n,r=1,i=t.length,o=t[0]+"";r<i;){for(e=t[r++]+"",n=d-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(t,e){var n,r,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,l=e.e;if(!s||!a)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=c==l,!i||!o)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return c==l?0:c>l^n?1:-1}function b(t,e,n,r){if(t<e||t>n||t!==c(t))throw Error(l+(r||"Argument")+("number"==typeof t?t<e||t>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function E(t){var e=t.c.length-1;return y(t.e/d)==e&&t.c[e]%2!=0}function S(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function T(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}o=function t(e){var n,r,i,o,x,A,k,R,P,C,I=z.prototype={constructor:z,toString:null,valueOf:null},O=new z(1),B=20,U=4,L=-7,N=21,_=-1e7,j=1e7,D=!1,M=1,V=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",W=!0;function z(t,e){var n,o,a,l,h,p,m,g,y=this;if(!(y instanceof z))return new z(t,e);if(null==e){if(t&&!0===t._isBigNumber)return y.s=t.s,void(!t.c||t.e>j?y.c=y.e=null:t.e<_?y.c=[y.e=0]:(y.e=t.e,y.c=t.c.slice()));if((p="number"==typeof t)&&0*t==0){if(y.s=1/t<0?(t=-t,-1):1,t===~~t){for(l=0,h=t;h>=10;h/=10,l++);return void(l>j?y.c=y.e=null:(y.e=l,y.c=[t]))}g=String(t)}else{if(!s.test(g=String(t)))return i(y,g,p);y.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(l=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(l<0&&(l=h),l+=+g.slice(h+1),g=g.substring(0,h)):l<0&&(l=g.length)}else{if(b(e,2,K.length,"Base"),10==e&&W)return X(y=new z(t),B+y.e+1,U);if(g=String(t),p="number"==typeof t){if(0*t!=0)return i(y,g,p,e);if(y.s=1/t<0?(g=g.slice(1),-1):1,z.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(u+t)}else y.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(n=K.slice(0,e),l=h=0,m=g.length;h<m;h++)if(n.indexOf(o=g.charAt(h))<0){if("."==o){if(h>l){l=m;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,l=0;continue}return i(y,String(t),p,e)}p=!1,(l=(g=r(g,e,10,y.s)).indexOf("."))>-1?g=g.replace(".",""):l=g.length}for(h=0;48===g.charCodeAt(h);h++);for(m=g.length;48===g.charCodeAt(--m););if(g=g.slice(h,++m)){if(m-=h,p&&z.DEBUG&&m>15&&(t>f||t!==c(t)))throw Error(u+y.s*t);if((l=l-h-1)>j)y.c=y.e=null;else if(l<_)y.c=[y.e=0];else{if(y.e=l,y.c=[],h=(l+1)%d,l<0&&(h+=d),h<m){for(h&&y.c.push(+g.slice(0,h)),m-=d;h<m;)y.c.push(+g.slice(h,h+=d));h=d-(g=g.slice(h)).length}else h-=m;for(;h--;g+="0");y.c.push(+g)}}else y.c=[y.e=0]}function H(t,e,n,r){var i,o,s,a,c;if(null==n?n=U:b(n,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)c=w(t.c),c=1==r||2==r&&(s<=L||s>=N)?S(c,s):T(c,s,"0");else if(o=(t=X(new z(t),e,n)).e,a=(c=w(t.c)).length,1==r||2==r&&(e<=o||o<=L)){for(;a<e;c+="0",a++);c=S(c,o)}else if(e-=s,c=T(c,o,"0"),o+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=o-a)>0)for(o+1==a&&(c+=".");e--;c+="0");return t.s<0&&i?"-"+c:c}function $(t,e){for(var n,r,i=1,o=new z(t[0]);i<t.length;i++)(!(r=new z(t[i])).s||(n=v(o,r))===e||0===n&&o.s===e)&&(o=r);return o}function Z(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*d-1)>j?t.c=t.e=null:n<_?t.c=[t.e=0]:(t.e=n,t.c=e),t}function X(t,e,n,r){var i,o,s,l,u,f,m,g=t.c,y=p;if(g){t:{for(i=1,l=g[0];l>=10;l/=10,i++);if((o=e-i)<0)o+=d,s=e,u=g[f=0],m=c(u/y[i-s-1]%10);else if((f=a((o+1)/d))>=g.length){if(!r)break t;for(;g.length<=f;g.push(0));u=m=0,i=1,s=(o%=d)-d+1}else{for(u=l=g[f],i=1;l>=10;l/=10,i++);m=(s=(o%=d)-d+i)<0?0:c(u/y[i-s-1]%10)}if(r=r||e<0||null!=g[f+1]||(s<0?u:u%y[i-s-1]),r=n<4?(m||r)&&(0==n||n==(t.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(o>0?s>0?u/y[i-s]:0:g[f-1])%10&1||n==(t.s<0?8:7)),e<1||!g[0])return g.length=0,r?(e-=t.e+1,g[0]=y[(d-e%d)%d],t.e=-e||0):g[0]=t.e=0,t;if(0==o?(g.length=f,l=1,f--):(g.length=f+1,l=y[d-o],g[f]=s>0?c(u/y[i-s]%y[s])*l:0),r)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=l,l=1;s>=10;s/=10,l++);o!=l&&(t.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=l,g[f]!=h)break;g[f--]=0,l=1}for(o=g.length;0===g[--o];g.pop());}t.e>j?t.c=t.e=null:t.e<_&&(t.c=[t.e=0])}return t}function G(t){var e,n=t.e;return null===n?t.toString():(e=w(t.c),e=n<=L||n>=N?S(e,n):T(e,n,"0"),t.s<0?"-"+e:e)}return z.clone=t,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(l+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(b(n=t[e],0,g,e),B=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(b(n=t[e],0,8,e),U=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(b(n[0],-g,0,e),b(n[1],0,g,e),L=n[0],N=n[1]):(b(n,-g,g,e),L=-(N=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)b(n[0],-g,-1,e),b(n[1],1,g,e),_=n[0],j=n[1];else{if(b(n,-g,g,e),!n)throw Error(l+e+" cannot be zero: "+n);_=-(j=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(l+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!n,Error(l+"crypto unavailable");D=n}else D=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(b(n=t[e],0,9,e),M=n),t.hasOwnProperty(e="POW_PRECISION")&&(b(n=t[e],0,g,e),V=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(l+e+" not an object: "+n);F=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(l+e+" invalid: "+n);W="0123456789"==n.slice(0,10),K=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:U,EXPONENTIAL_AT:[L,N],RANGE:[_,j],CRYPTO:D,MODULO_MODE:M,POW_PRECISION:V,FORMAT:F,ALPHABET:K}},z.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!z.DEBUG)return!0;var e,n,r=t.c,i=t.e,o=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break t}if((e=(i+1)%d)<1&&(e+=d),String(r[0]).length==e){for(e=0;e<r.length;e++)if((n=r[e])<0||n>=h||n!==c(n))break t;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(l+"Invalid BigNumber: "+t)},z.maximum=z.max=function(){return $(arguments,-1)},z.minimum=z.min=function(){return $(arguments,1)},z.random=(o=9007199254740992,x=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,o,s=0,u=[],h=new z(O);if(null==t?t=B:b(t,0,g),i=a(t/d),D)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)(o=131072*e[s]+(e[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[s]=n[0],e[s+1]=n[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw D=!1,Error(l+"crypto unavailable");for(e=crypto.randomBytes(i*=7);s<i;)(o=281474976710656*(31&e[s])+1099511627776*e[s+1]+4294967296*e[s+2]+16777216*e[s+3]+(e[s+4]<<16)+(e[s+5]<<8)+e[s+6])>=9e15?crypto.randomBytes(7).copy(e,s):(u.push(o%1e14),s+=7);s=i/7}if(!D)for(;s<i;)(o=x())<9e15&&(u[s++]=o%1e14);for(i=u[--s],t%=d,i&&t&&(o=p[d-t],u[s]=c(i/o)*o);0===u[s];u.pop(),s--);if(s<0)u=[r=0];else{for(r=-1;0===u[0];u.splice(0,1),r-=d);for(s=1,o=u[0];o>=10;o/=10,s++);s<d&&(r-=d-s)}return h.e=r,h.c=u,h}),z.sum=function(){for(var t=1,e=arguments,n=new z(e[0]);t<e.length;)n=n.plus(e[t++]);return n},r=function(){var t="0123456789";function e(t,e,n,r){for(var i,o,s=[0],a=0,c=t.length;a<c;){for(o=s.length;o--;s[o]*=e);for(s[0]+=r.indexOf(t.charAt(a++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,i,o,s,a){var c,l,u,h,d,f,p,m,g=r.indexOf("."),y=B,v=U;for(g>=0&&(h=V,V=0,r=r.replace(".",""),f=(m=new z(i)).pow(r.length-g),V=h,m.c=e(T(w(f.c),f.e,"0"),10,o,t),m.e=m.c.length),u=h=(p=e(r,i,o,a?(c=K,t):(c=t,K))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--u:(f.c=p,f.e=u,f.s=s,p=(f=n(f,m,y,v,o)).c,d=f.r,u=f.e),g=p[l=u+y+1],h=o/2,d=d||l<0||null!=p[l+1],d=v<4?(null!=g||d)&&(0==v||v==(f.s<0?3:2)):g>h||g==h&&(4==v||d||6==v&&1&p[l-1]||v==(f.s<0?8:7)),l<1||!p[0])r=d?T(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(p.length=l,d)for(--o;++p[--l]>o;)p[l]=0,l||(++u,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,r="";g<=h;r+=c.charAt(p[g++]));r=T(r,u,c.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,i,o,s,a=0,c=t.length,l=e%m,u=e/m|0;for(t=t.slice();c--;)a=((i=l*(o=t[c]%m)+(r=u*o+(s=t[c]/m|0)*l)%m*m+a)/n|0)+(r/m|0)+u*s,t[c]=i%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]<e[n]?1:0,t[n]=i*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(r,i,o,s,a){var l,u,f,p,m,g,w,v,b,E,S,T,x,A,k,R,P,C=r.s==i.s?1:-1,I=r.c,O=i.c;if(!(I&&I[0]&&O&&O[0]))return new z(r.s&&i.s&&(I?!O||I[0]!=O[0]:O)?I&&0==I[0]||!O?0*C:C/0:NaN);for(b=(v=new z(C)).c=[],C=o+(u=r.e-i.e)+1,a||(a=h,u=y(r.e/d)-y(i.e/d),C=C/d|0),f=0;O[f]==(I[f]||0);f++);if(O[f]>(I[f]||0)&&u--,C<0)b.push(1),p=!0;else{for(A=I.length,R=O.length,f=0,C+=2,(m=c(a/(O[0]+1)))>1&&(O=t(O,m,a),I=t(I,m,a),R=O.length,A=I.length),x=R,S=(E=I.slice(0,R)).length;S<R;E[S++]=0);P=O.slice(),P=[0].concat(P),k=O[0],O[1]>=a/2&&k++;do{if(m=0,(l=e(O,E,R,S))<0){if(T=E[0],R!=S&&(T=T*a+(E[1]||0)),(m=c(T/k))>1)for(m>=a&&(m=a-1),w=(g=t(O,m,a)).length,S=E.length;1==e(g,E,w,S);)m--,n(g,R<w?P:O,w,a),w=g.length,l=1;else 0==m&&(l=m=1),w=(g=O.slice()).length;if(w<S&&(g=[0].concat(g)),n(E,g,S,a),S=E.length,-1==l)for(;e(O,E,R,S)<1;)m++,n(E,R<S?P:O,S,a),S=E.length}else 0===l&&(m++,E=[0]);b[f++]=m,E[0]?E[S++]=I[x]||0:(E=[I[x]],S=1)}while((x++<A||null!=E[0])&&C--);p=null!=E[0],b[0]||b.splice(0,1)}if(a==h){for(f=1,C=b[0];C>=10;C/=10,f++);X(v,o+(v.e=f+u*d-1)+1,s,p)}else v.e=u,v.r=+p;return v}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,k=/^([^.]+)\.$/,R=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,o=n?e:e.replace(C,"");if(P.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(A,(function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e})),r&&(i=r,o=o.replace(k,"$1").replace(R,"0.$1")),e!=o))return new z(o,i);if(z.DEBUG)throw Error(l+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},I.absoluteValue=I.abs=function(){var t=new z(this);return t.s<0&&(t.s=1),t},I.comparedTo=function(t,e){return v(this,new z(t,e))},I.decimalPlaces=I.dp=function(t,e){var n,r,i,o=this;if(null!=t)return b(t,0,g),null==e?e=U:b(e,0,8),X(new z(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-y(this.e/d))*d,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},I.dividedBy=I.div=function(t,e){return n(this,new z(t,e),B,U)},I.dividedToIntegerBy=I.idiv=function(t,e){return n(this,new z(t,e),0,1)},I.exponentiatedBy=I.pow=function(t,e){var n,r,i,o,s,u,h,f,p=this;if((t=new z(t)).c&&!t.isInteger())throw Error(l+"Exponent not an integer: "+G(t));if(null!=e&&(e=new z(e)),s=t.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!t.c||!t.c[0])return f=new z(Math.pow(+G(p),s?t.s*(2-E(t)):+G(t))),e?f.mod(e):f;if(u=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new z(NaN);(r=!u&&p.isInteger()&&e.isInteger())&&(p=p.mod(e))}else{if(t.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&E(t)?-0:0,p.e>-1&&(o=1/o),new z(u?1/o:o);V&&(o=a(V/d+2))}for(s?(n=new z(.5),u&&(t.s=1),h=E(t)):h=(i=Math.abs(+G(t)))%2,f=new z(O);;){if(h){if(!(f=f.times(p)).c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(e))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(X(t=t.times(n),t.e+1,1),t.e>14)h=E(t);else{if(0===(i=+G(t)))break;h=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(e))}return r?f:(u&&(f=O.div(f)),e?f.mod(e):o?X(f,V,U,undefined):f)},I.integerValue=function(t){var e=new z(this);return null==t?t=U:b(t,0,8),X(e,e.e+1,t)},I.isEqualTo=I.eq=function(t,e){return 0===v(this,new z(t,e))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(t,e){return v(this,new z(t,e))>0},I.isGreaterThanOrEqualTo=I.gte=function(t,e){return 1===(e=v(this,new z(t,e)))||0===e},I.isInteger=function(){return!!this.c&&y(this.e/d)>this.c.length-2},I.isLessThan=I.lt=function(t,e){return v(this,new z(t,e))<0},I.isLessThanOrEqualTo=I.lte=function(t,e){return-1===(e=v(this,new z(t,e)))||0===e},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(t,e){var n,r,i,o,s=this,a=s.s;if(e=(t=new z(t,e)).s,!a||!e)return new z(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/d,l=t.e/d,u=s.c,f=t.c;if(!c||!l){if(!u||!f)return u?(t.s=-e,t):new z(f?s:NaN);if(!u[0]||!f[0])return f[0]?(t.s=-e,t):new z(u[0]?s:3==U?-0:0)}if(c=y(c),l=y(l),u=u.slice(),a=c-l){for((o=a<0)?(a=-a,i=u):(l=c,i=f),i.reverse(),e=a;e--;i.push(0));i.reverse()}else for(r=(o=(a=u.length)<(e=f.length))?a:e,a=e=0;e<r;e++)if(u[e]!=f[e]){o=u[e]<f[e];break}if(o&&(i=u,u=f,f=i,t.s=-t.s),(e=(r=f.length)-(n=u.length))>0)for(;e--;u[n++]=0);for(e=h-1;r>a;){if(u[--r]<f[r]){for(n=r;n&&!u[--n];u[n]=e);--u[n],u[r]+=h}u[r]-=f[r]}for(;0==u[0];u.splice(0,1),--l);return u[0]?Z(t,u,l):(t.s=3==U?-1:1,t.c=[t.e=0],t)},I.modulo=I.mod=function(t,e){var r,i,o=this;return t=new z(t,e),!o.c||!t.s||t.c&&!t.c[0]?new z(NaN):!t.c||o.c&&!o.c[0]?new z(o):(9==M?(i=t.s,t.s=1,r=n(o,t,0,3),t.s=i,r.s*=i):r=n(o,t,0,M),(t=o.minus(r.times(t))).c[0]||1!=M||(t.s=o.s),t)},I.multipliedBy=I.times=function(t,e){var n,r,i,o,s,a,c,l,u,f,p,g,w,v,b,E=this,S=E.c,T=(t=new z(t,e)).c;if(!(S&&T&&S[0]&&T[0]))return!E.s||!t.s||S&&!S[0]&&!T||T&&!T[0]&&!S?t.c=t.e=t.s=null:(t.s*=E.s,S&&T?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=y(E.e/d)+y(t.e/d),t.s*=E.s,(c=S.length)<(f=T.length)&&(w=S,S=T,T=w,i=c,c=f,f=i),i=c+f,w=[];i--;w.push(0));for(v=h,b=m,i=f;--i>=0;){for(n=0,p=T[i]%b,g=T[i]/b|0,o=i+(s=c);o>i;)n=((l=p*(l=S[--s]%b)+(a=g*l+(u=S[s]/b|0)*p)%b*b+w[o]+n)/v|0)+(a/b|0)+g*u,w[o--]=l%v;w[o]=n}return n?++r:w.splice(0,1),Z(t,w,r)},I.negated=function(){var t=new z(this);return t.s=-t.s||null,t},I.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new z(t,e)).s,!i||!e)return new z(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/d,s=t.e/d,a=r.c,c=t.c;if(!o||!s){if(!a||!c)return new z(i/0);if(!a[0]||!c[0])return c[0]?t:new z(a[0]?r:0*i)}if(o=y(o),s=y(s),a=a.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(e=c.length)<0&&(n=c,c=a,a=n,e=i),i=0;e;)i=(a[--e]=a[e]+c[e]+i)/h|0,a[e]=h===a[e]?0:a[e]%h;return i&&(a=[i].concat(a),++s),Z(t,a,s)},I.precision=I.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return b(t,1,g),null==e?e=U:b(e,0,8),X(new z(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*d+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},I.shiftedBy=function(t){return b(t,-9007199254740991,f),this.times("1e"+t)},I.squareRoot=I.sqrt=function(){var t,e,r,i,o,s=this,a=s.c,c=s.s,l=s.e,u=B+4,h=new z("0.5");if(1!==c||!a||!a[0])return new z(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+G(s)))||c==1/0?(((e=w(a)).length+l)%2==0&&(e+="0"),c=Math.sqrt(+e),l=y((l+1)/2)-(l<0||l%2),r=new z(e=c==1/0?"5e"+l:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+l)):r=new z(c+""),r.c[0])for((c=(l=r.e)+u)<3&&(c=0);;)if(o=r,r=h.times(o.plus(n(s,o,u,1))),w(o.c).slice(0,c)===(e=w(r.c)).slice(0,c)){if(r.e<l&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(X(r,r.e+B+2,1),t=!r.times(r).eq(s));break}if(!i&&(X(o,o.e+B+2,0),o.times(o).eq(s))){r=o;break}u+=4,c+=4,i=1}return X(r,r.e+B+1,U,t)},I.toExponential=function(t,e){return null!=t&&(b(t,0,g),t++),H(this,t,e,1)},I.toFixed=function(t,e){return null!=t&&(b(t,0,g),t=t+this.e+1),H(this,t,e)},I.toFormat=function(t,e,n){var r,i=this;if(null==n)null!=t&&e&&"object"==typeof e?(n=e,e=null):t&&"object"==typeof t?(n=t,t=e=null):n=F;else if("object"!=typeof n)throw Error(l+"Argument not an object: "+n);if(r=i.toFixed(t,e),i.c){var o,s=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,u=n.groupSeparator||"",h=s[0],d=s[1],f=i.s<0,p=f?h.slice(1):h,m=p.length;if(c&&(o=a,a=c,c=o,m-=o),a>0&&m>0){for(o=m%a||a,h=p.substr(0,o);o<m;o+=a)h+=u+p.substr(o,a);c>0&&(h+=u+p.slice(o)),f&&(h="-"+h)}r=d?h+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):h}return(n.prefix||"")+r+(n.suffix||"")},I.toFraction=function(t){var e,r,i,o,s,a,c,u,h,f,m,g,y=this,v=y.c;if(null!=t&&(!(c=new z(t)).isInteger()&&(c.c||1!==c.s)||c.lt(O)))throw Error(l+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+G(c));if(!v)return new z(y);for(e=new z(O),h=r=new z(O),i=u=new z(O),g=w(v),s=e.e=g.length-y.e-1,e.c[0]=p[(a=s%d)<0?d+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=j,j=1/0,c=new z(g),u.c[0]=0;f=n(c,e,0,1),1!=(o=r.plus(f.times(i))).comparedTo(t);)r=i,i=o,h=u.plus(f.times(o=h)),u=o,e=c.minus(f.times(o=e)),c=o;return o=n(t.minus(r),i,0,1),u=u.plus(o.times(h)),r=r.plus(o.times(i)),u.s=h.s=y.s,m=n(h,i,s*=2,U).minus(y).abs().comparedTo(n(u,r,s,U).minus(y).abs())<1?[h,i]:[u,r],j=a,m},I.toNumber=function(){return+G(this)},I.toPrecision=function(t,e){return null!=t&&b(t,1,g),H(this,t,e,2)},I.toString=function(t){var e,n=this,i=n.s,o=n.e;return null===o?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=o<=L||o>=N?S(w(n.c),o):T(w(n.c),o,"0"):10===t&&W?e=T(w((n=X(new z(n),B+o+1,U)).c),n.e,"0"):(b(t,2,K.length,"Base"),e=r(T(w(n.c),o,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},I.valueOf=I.toJSON=function(){return G(this)},I._isBigNumber=!0,null!=e&&z.set(e),z}(),o.default=o.BigNumber=o,void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}()},764:(t,e,n)=>{"use strict";const r=n(742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.lW=c,e.h2=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return l(t,e,n)}function l(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return f(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return f(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return f(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);const i=function(t){if(c.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||Y(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return u(t),a(t<0?0:0|p(t))}function d(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function f(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,c.prototype),r}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(t).length;default:if(i)return r?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return P(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function w(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function b(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(Y(r))return s;t[n+s]=r}return s}function E(t,e,n,r){return X($(e,t.length-n),t,n,r)}function S(t,e,n,r){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return X(Z(e),t,n,r)}function x(t,e,n,r){return X(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=R));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.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(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,n){return l(t,e,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,n){return function(t,e,n){return u(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(G(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),G(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).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}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=c.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(G(e,Uint8Array))i+e.length>r.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)y(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){let t="";const n=e.h2;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,i){if(G(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<a;++t)if(l[t]!==u[t]){o=l[t],s=u[t];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return w(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return w(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return S(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function P(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function I(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=q[t[r]];return i}function O(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function B(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function N(t,e,n,r,i){K(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function _(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function D(t,e,n,r,o){return e=+e,n>>>=0,o||_(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),c.prototype.readBigInt64BE=J((function(t){W(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),c.prototype.readFloatLE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){U(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=J((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return N(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);U(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=c.isBuffer(t)?t:c.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const M={};function V(t,e,n){M[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function F(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function K(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new M.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){W(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||z(e,t.length-(n+1))}(r,i,o)}function W(t,e){if("number"!=typeof t)throw new M.ERR_INVALID_ARG_TYPE(e,"number",t)}function z(t,e,n){if(Math.floor(t)!==t)throw W(t,n),new M.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=F(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function $(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Z(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(t){return t!=t}const q=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},470:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===n.call(t)},s=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var r,i=e.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!i&&!o)return!1;for(r in t);return void 0===r||e.call(t,r)},a=function(t,e){r&&"__proto__"===e.name?r(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},c=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(i)return i(t,n).value}return t[n]};t.exports=function t(){var e,n,r,i,l,u,h=arguments[0],d=1,f=arguments.length,p=!1;for("boolean"==typeof h&&(p=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<f;++d)if(null!=(e=arguments[d]))for(n in e)r=c(h,n),h!==(i=c(e,n))&&(p&&i&&(s(i)||(l=o(i)))?(l?(l=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},a(h,{name:n,newValue:t(p,u,i)})):void 0!==i&&a(h,{name:n,newValue:i}));return h}},645:(t,e)=>{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}},703:(t,e,n)=>{"use strict";var r=n(414);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},697:(t,e,n)=>{t.exports=n(703)()},414:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},251:(t,e,n)=>{"use strict";var r=n(639),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(t,e,n){var r,o={},l=null,u=null;for(r in void 0!==n&&(l=""+n),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(u=e.ref),e)s.call(e,r)&&!c.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===o[r]&&(o[r]=e[r]);return{$$typeof:i,type:t,key:l,ref:u,props:o,_owner:a.current}}e.jsx=l,e.jsxs=l},893:(t,e,n)=>{"use strict";t.exports=n(251)},639:e=>{"use strict";e.exports=t}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return o[t].call(n.exports,n,n.exports,a),n.exports}a.m=o,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},n=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var i=Object.create(null);a.r(i);var o={};e=e||[null,n({}),n([]),n(n)];for(var s=2&r&&t;"object"==typeof s&&!~e.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,a.d(i,o),i},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,n)=>(a.f[n](t,e),e)),[])),a.u=t=>t+".onairos.bundle.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r={},i="onairos:",a.l=(t,e,n,o)=>{if(r[t])r[t].push(e);else{var s,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var h=l[u];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==i+n){s=h;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",i+n),s.src=t),r[t]=[e];var d=(e,n)=>{s.onerror=s.onload=null,clearTimeout(f);var i=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((t=>t(n))),e)return e(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&!t;)t=n[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={179:0};a.f.j=(e,n)=>{var r=a.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,i)=>r=t[e]=[n,i]));n.push(r[2]=i);var o=a.p+a.u(e),s=new Error;a.l(o,(n=>{if(a.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",s.name="ChunkLoadError",s.type=i,s.request=o,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,i,o=n[0],s=n[1],c=n[2],l=0;if(o.some((e=>0!==t[e]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(c)c(a)}for(e&&e(n);l<o.length;l++)i=o[l],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},n=this.webpackChunkonairos=this.webpackChunkonairos||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var c={};return(()=>{"use strict";a.r(c),a.d(c,{Onairos:()=>Gh});var t={};a.r(t),a.d(t,{hasBrowserEnv:()=>ee,hasStandardBrowserEnv:()=>ne,hasStandardBrowserWebWorkerEnv:()=>ie});var e=a(639),n=a.n(e),r=a(764);function i(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==a.g?a.g:"undefined"!=typeof self?self:{};function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function l(t,e){return t(e={exports:{}},e.exports),e.exports}var u=l((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){var t=this;this.locked=new Map,this.addToLocked=function(e,n){var r=t.locked.get(e);void 0===r?void 0===n?t.locked.set(e,[]):t.locked.set(e,[n]):void 0!==n&&(r.unshift(n),t.locked.set(e,r))},this.isLocked=function(e){return t.locked.has(e)},this.lock=function(e){return new Promise((function(n,r){t.isLocked(e)?t.addToLocked(e,n):(t.addToLocked(e),n())}))},this.unlock=function(e){var n=t.locked.get(e);if(void 0!==n&&0!==n.length){var r=n.pop();t.locked.set(e,n),void 0!==r&&setTimeout(r,0)}else t.locked.delete(e)}}return t.getInstance=function(){return void 0===t.instance&&(t.instance=new t),t.instance},t}();e.default=function(){return n.getInstance()}}));s(u);var h=s(l((function(t,e){var n=o&&o.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(s,a)}c((r=r.apply(t,e||[])).next())}))},r=o&&o.__generator||function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},i=o;Object.defineProperty(e,"__esModule",{value:!0});var s="browser-tabs-lock-key",a={key:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},getItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},clear:function(){return n(i,void 0,void 0,(function(){return r(this,(function(t){return[2,window.localStorage.clear()]}))}))},removeItem:function(t){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},setItem:function(t,e){return n(i,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},keySync:function(t){return window.localStorage.key(t)},getItemSync:function(t){return window.localStorage.getItem(t)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(t){return window.localStorage.removeItem(t)},setItemSync:function(t,e){return window.localStorage.setItem(t,e)}};function c(t){return new Promise((function(e){return setTimeout(e,t)}))}function l(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",n="",r=0;r<t;r++)n+=e[Math.floor(61*Math.random())];return n}var h=function(){function t(e){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+l(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=e,void 0===t.waiters&&(t.waiters=[])}return t.prototype.acquireLock=function(e,i){return void 0===i&&(i=5e3),n(this,void 0,void 0,(function(){var n,o,u,h,d,f,p;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+l(4),o=Date.now()+i,u=s+"-"+e,h=void 0===this.storageHandler?a:this.storageHandler,r.label=1;case 1:return Date.now()<o?[4,c(30)]:[3,8];case 2:return r.sent(),null!==h.getItemSync(u)?[3,5]:(d=this.id+"-"+e+"-"+n,[4,c(Math.floor(25*Math.random()))]);case 3:return r.sent(),h.setItemSync(u,JSON.stringify({id:this.id,iat:n,timeoutKey:d,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:return r.sent(),null!==(f=h.getItemSync(u))&&(p=JSON.parse(f)).id===this.id&&p.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(u,n),[2,!0]):[3,7];case 5:return t.lockCorrector(void 0===this.storageHandler?a:this.storageHandler),[4,this.waitForSomethingToChange(o)];case 6:r.sent(),r.label=7;case 7:return n=Date.now()+l(4),[3,1];case 8:return[2,!1]}}))}))},t.prototype.refreshLockWhileAcquired=function(t,e){return n(this,void 0,void 0,(function(){var i=this;return r(this,(function(o){return setTimeout((function(){return n(i,void 0,void 0,(function(){var n,i,o;return r(this,(function(r){switch(r.label){case 0:return[4,u.default().lock(e)];case 1:return r.sent(),this.acquiredIatSet.has(e)?(n=void 0===this.storageHandler?a:this.storageHandler,null===(i=n.getItemSync(t))?(u.default().unlock(e),[2]):((o=JSON.parse(i)).timeRefreshed=Date.now(),n.setItemSync(t,JSON.stringify(o)),u.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2])):(u.default().unlock(e),[2])}}))}))}),1e3),[2]}))}))},t.prototype.waitForSomethingToChange=function(e){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){var r=!1,i=Date.now(),o=!1;function s(){if(o||(window.removeEventListener("storage",s),t.removeFromWaiting(s),clearTimeout(a),o=!0),!r){r=!0;var e=50-(Date.now()-i);e>0?setTimeout(n,e):n(null)}}window.addEventListener("storage",s),t.addToWaiting(s);var a=setTimeout(s,Math.max(0,e-Date.now()))}))];case 1:return n.sent(),[2]}}))}))},t.addToWaiting=function(e){this.removeFromWaiting(e),void 0!==t.waiters&&t.waiters.push(e)},t.removeFromWaiting=function(e){void 0!==t.waiters&&(t.waiters=t.waiters.filter((function(t){return t!==e})))},t.notifyWaiters=function(){void 0!==t.waiters&&t.waiters.slice().forEach((function(t){return t()}))},t.prototype.releaseLock=function(t){return n(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.releaseLock__private__(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.releaseLock__private__=function(e){return n(this,void 0,void 0,(function(){var n,i,o,c;return r(this,(function(r){switch(r.label){case 0:return n=void 0===this.storageHandler?a:this.storageHandler,i=s+"-"+e,null===(o=n.getItemSync(i))?[2]:(c=JSON.parse(o)).id!==this.id?[3,2]:[4,u.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(i),u.default().unlock(c.iat),t.notifyWaiters(),r.label=2;case 2:return[2]}}))}))},t.lockCorrector=function(e){for(var n=Date.now()-5e3,r=e,i=[],o=0;;){var a=r.keySync(o);if(null===a)break;i.push(a),o++}for(var c=!1,l=0;l<i.length;l++){var u=i[l];if(u.includes(s)){var h=r.getItemSync(u);if(null!==h){var d=JSON.parse(h);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(u),c=!0)}}}c&&t.notifyWaiters()},t.waiters=void 0,t}();e.default=h})));const d={timeoutInSeconds:60},f={name:"auth0-spa-js",version:"2.1.3"},p=()=>Date.now();class m extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,m.prototype)}static fromPayload({error:t,error_description:e}){return new m(t,e)}}class g extends m{constructor(t,e,n,r=null){super(t,e),this.state=n,this.appState=r,Object.setPrototypeOf(this,g.prototype)}}class y extends m{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,y.prototype)}}class w extends y{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,w.prototype)}}class v extends m{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,v.prototype)}}class b extends m{constructor(t,e,n){super(t,e),this.mfa_token=n,Object.setPrototypeOf(this,b.prototype)}}class E extends m{constructor(t,e){super("missing_refresh_token",`Missing Refresh Token (audience: '${S(t,["default"])}', scope: '${S(e)}')`),this.audience=t,this.scope=e,Object.setPrototypeOf(this,E.prototype)}}function S(t,e=[]){return t&&!e.includes(t)?t:""}const T=()=>window.crypto,x=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(T().getRandomValues(new Uint8Array(43))).forEach((n=>e+=t[n%66])),e},A=t=>btoa(t),k=t=>{var{clientId:e}=t,n=i(t,["clientId"]);return new URLSearchParams((t=>Object.keys(t).filter((e=>void 0!==t[e])).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t[n]})),{}))(Object.assign({client_id:e},n))).toString()},R=t=>(t=>decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),P=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},C=async(t,e,n,r,i,o,s=1e4)=>i?(async(t,e,n,r,i,o,s)=>{return a={auth:{audience:e,scope:n},timeout:i,fetchUrl:t,fetchOptions:r,useFormData:s},c=o,new Promise((function(t,e){const n=new MessageChannel;n.port1.onmessage=function(r){r.data.error?e(new Error(r.data.error)):t(r.data),n.port1.close()},c.postMessage(a,[n.port2])}));var a,c})(t,e,n,r,s,i,o):(async(t,e,n)=>{const r=new AbortController;let i;return e.signal=r.signal,Promise.race([P(t,e),new Promise(((t,e)=>{i=setTimeout((()=>{r.abort(),e(new Error("Timeout when executing 'fetch'"))}),n)}))]).finally((()=>{clearTimeout(i)}))})(t,r,s);async function I(t,e){var{baseUrl:n,timeout:r,audience:o,scope:s,auth0Client:a,useFormData:c}=t,l=i(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const u=c?k(l):JSON.stringify(l);return await async function(t,e,n,r,o,s,a){let c,l=null;for(let i=0;i<3;i++)try{c=await C(t,n,r,o,s,a,e),l=null;break}catch(t){l=t}if(l)throw l;const u=c.json,{error:h,error_description:d}=u,f=i(u,["error","error_description"]),{ok:p}=c;if(!p){const e=d||`HTTP error. Unable to fetch ${t}`;if("mfa_required"===h)throw new b(h,e,f.mfa_token);if("missing_refresh_token"===h)throw new E(n,r);throw new m(h||"request_error",e)}return f}(`${n}/oauth/token`,r,o||"default",s,{method:"POST",body:u,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||f))}},e,c)}const O=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class B{constructor(t,e="@@auth0spajs@@",n){this.prefix=e,this.suffix=n,this.clientId=t.clientId,this.scope=t.scope,this.audience=t.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(t){const[e,n,r,i]=t.split("::");return new B({clientId:n,scope:i,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:n,client_id:r}=t;return new B({scope:e,audience:n,clientId:r})}}class U{set(t,e){localStorage.setItem(t,JSON.stringify(e))}get(t){const e=window.localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return}}remove(t){localStorage.removeItem(t)}allKeys(){return Object.keys(window.localStorage).filter((t=>t.startsWith("@@auth0spajs@@")))}}class L{constructor(){this.enclosedCache=function(){let t={};return{set(e,n){t[e]=n},get(e){const n=t[e];if(n)return n},remove(e){delete t[e]},allKeys:()=>Object.keys(t)}}()}}class N{constructor(t,e,n){this.cache=t,this.keyManifest=e,this.nowProvider=n||p}async setIdToken(t,e,n){var r;const i=this.getIdTokenCacheKey(t);await this.cache.set(i,{id_token:e,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(i))}async getIdToken(t){const e=await this.cache.get(this.getIdTokenCacheKey(t.clientId));if(!e&&t.scope&&t.audience){const e=await this.get(t);if(!e)return;if(!e.id_token||!e.decodedToken)return;return{id_token:e.id_token,decodedToken:e.decodedToken}}if(e)return{id_token:e.id_token,decodedToken:e.decodedToken}}async get(t,e=0){var n;let r=await this.cache.get(t.toKey());if(!r){const e=await this.getCacheKeys();if(!e)return;const n=this.matchExistingCacheKey(t,e);n&&(r=await this.cache.get(n))}if(!r)return;const i=await this.nowProvider(),o=Math.floor(i/1e3);return r.expiresAt-e<o?r.body.refresh_token?(r.body={refresh_token:r.body.refresh_token},await this.cache.set(t.toKey(),r),r.body):(await this.cache.remove(t.toKey()),void await(null===(n=this.keyManifest)||void 0===n?void 0:n.remove(t.toKey()))):r.body}async set(t){var e;const n=new B({clientId:t.client_id,scope:t.scope,audience:t.audience}),r=await this.wrapCacheEntry(t);await this.cache.set(n.toKey(),r),await(null===(e=this.keyManifest)||void 0===e?void 0:e.add(n.toKey()))}async clear(t){var e;const n=await this.getCacheKeys();n&&(await n.filter((e=>!t||e.includes(t))).reduce((async(t,e)=>{await t,await this.cache.remove(e)}),Promise.resolve()),await(null===(e=this.keyManifest)||void 0===e?void 0:e.clear()))}async wrapCacheEntry(t){const e=await this.nowProvider();return{body:t,expiresAt:Math.floor(e/1e3)+t.expires_in}}async getCacheKeys(){var t;return this.keyManifest?null===(t=await this.keyManifest.get())||void 0===t?void 0:t.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(t){return new B({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter((e=>{var n;const r=B.fromKey(e),i=new Set(r.scope&&r.scope.split(" ")),o=(null===(n=t.scope)||void 0===n?void 0:n.split(" "))||[],s=r.scope&&o.reduce(((t,e)=>t&&i.has(e)),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===t.clientId&&r.audience===t.audience&&s}))[0]}}class _{constructor(t,e,n){this.storage=t,this.clientId=e,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(t){this.storage.save(this.storageKey,t,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const j=t=>"number"==typeof t,D=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var M=l((function(t,e){var n=o&&o.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function r(t,e){if(!e)return"";var n="; "+t;return!0===e?n:n+"="+e}function i(t,e,n){return encodeURIComponent(t).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(e).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(t){if("number"==typeof t.expires){var e=new Date;e.setMilliseconds(e.getMilliseconds()+864e5*t.expires),t.expires=e}return r("Expires",t.expires?t.expires.toUTCString():"")+r("Domain",t.domain)+r("Path",t.path)+r("Secure",t.secure)+r("SameSite",t.sameSite)}(n)}function s(t){for(var e={},n=t?t.split("; "):[],r=/(%[\dA-F]{2})+/gi,i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");'"'===s.charAt(0)&&(s=s.slice(1,-1));try{e[o[0].replace(r,decodeURIComponent)]=s.replace(r,decodeURIComponent)}catch(t){}}return e}function a(){return s(document.cookie)}function c(t,e,r){document.cookie=i(t,e,n({path:"/"},r))}e.__esModule=!0,e.encode=i,e.parse=s,e.getAll=a,e.get=function(t){return a()[t]},e.set=c,e.remove=function(t,e){c(t,"",n(n({},e),{expires:-1}))}}));s(M),M.encode,M.parse,M.getAll;var V=M.get,F=M.set,K=M.remove;const W={get(t){const e=V(t);if(void 0!==e)return JSON.parse(e)},save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(t,JSON.stringify(e),r)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n)}},z={get:t=>W.get(t)||W.get(`_legacy_${t}`),save(t,e,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),F(`_legacy_${t}`,JSON.stringify(e),r),W.save(t,e,n)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),K(t,n),W.remove(t,e),W.remove(`_legacy_${t}`,e)}},H={get(t){if("undefined"==typeof sessionStorage)return;const e=sessionStorage.getItem(t);return null!=e?JSON.parse(e):void 0},save(t,e){sessionStorage.setItem(t,JSON.stringify(e))},remove(t){sessionStorage.removeItem(t)}};var $,Z=("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,!1,function(t){return $=$||function(t,e,n){var r=void 0===e?null:e,i=function(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(t,void 0!==n&&n),o=i.indexOf("\n",10)+1,s=i.substring(o)+(r?"//# sourceMappingURL="+r:""),a=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(a)}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,false),new Worker($,t)});const X={};class G{constructor(t,e){this.cache=t,this.clientId=e,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(t){var e;const n=new Set((null===(e=await this.cache.get(this.manifestKey))||void 0===e?void 0:e.keys)||[]);n.add(t),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(t){const e=await this.cache.get(this.manifestKey);if(e){const n=new Set(e.keys);return n.delete(t),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(t){return`@@auth0spajs@@::${t}`}}const Y={memory:()=>(new L).enclosedCache,localstorage:()=>new U},q=t=>Y[t],J=t=>{const{openUrl:e,onRedirect:n}=t,r=i(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===e||e?e:n})},Q=new h;class tt{constructor(t){let e,n;if(this.userCache=(new L).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),t.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!T())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===T().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),t.cache&&t.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),t.cache)n=t.cache;else{if(e=t.cacheLocation||"memory",!q(e))throw new Error(`Invalid cache location "${e}"`);n=q(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===t.legacySameSiteCookie?W:z,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(t=>`auth0.${this.options.clientId}.is.authenticated`)(),this.sessionCheckExpiryDays=t.sessionCheckExpiryDays||1;const r=t.useCookiesForTransactions?this.cookieStorage:H;var i;this.scope=O("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new _(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||p,this.cacheManager=new N(n,n.allKeys?void 0:new G(n,this.options.clientId),this.nowProvider),this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((t,e)=>t?t.startsWith("https://")?t:`https://${t}/`:`${e}/`)(this.options.issuer,this.domainUrl),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===e&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Z)}_url(t){const e=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||f)));return`${this.domainUrl}${t}&auth0Client=${e}`}_authorizeUrl(t){return this._url(`/authorize?${k(t)}`)}async _verifyIdToken(t,e,n){const r=await this.nowProvider();return(t=>{if(!t.id_token)throw new Error("ID token is required but missing");const e=(t=>{const e=t.split("."),[n,r,i]=e;if(3!==e.length||!n||!r||!i)throw new Error("ID token could not be decoded");const o=JSON.parse(R(r)),s={__raw:t},a={};return Object.keys(o).forEach((t=>{s[t]=o[t],D.includes(t)||(a[t]=o[t])})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(R(n)),claims:s,user:a}})(t.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==t.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${t.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==e.header.alg)throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||"string"!=typeof e.claims.aud&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(t.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==t.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${t.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==t.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${t.aud}" but found "${e.claims.aud}"`);if(t.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==t.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${t.nonce}", found "${e.claims.nonce}"`)}if(t.max_age&&!j(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==e.claims.exp||!j(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!j(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=t.leeway||60,r=new Date(t.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+n),r>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);if(null!=e.claims.nbf&&j(e.claims.nbf)){const t=new Date(0);if(t.setUTCSeconds(e.claims.nbf-n),r<t)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${t}`)}if(null!=e.claims.auth_time&&j(e.claims.auth_time)){const i=new Date(0);if(i.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+n),r>i)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${r}) is after last auth at ${i}`)}if(t.organization){const n=t.organization.trim();if(n.startsWith("org_")){const t=n;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(t!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_id}"`)}else{const t=n.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(t!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${t}", found "${e.claims.org_name}"`)}}return e})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:t,nonce:e,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,"string"!=typeof i?i:parseInt(i,10)||void 0),now:r});var i}_processOrgHint(t){t?this.cookieStorage.save(this.orgHintCookieName,t,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(t,e,n){const r=A(x()),i=A(x()),o=x(),s=(t=>{const e=new Uint8Array(t);return(t=>{const e={"+":"-","/":"_","=":""};return t.replace(/[+/=]/g,(t=>e[t]))})(window.btoa(String.fromCharCode(...Array.from(e))))})(await(async t=>{const e=T().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(t));return await e})(o)),a=((t,e,n,r,i,o,s,a)=>Object.assign(Object.assign(Object.assign({client_id:t.clientId},t.authorizationParams),n),{scope:O(e,n.scope),response_type:"code",response_mode:a||"query",state:r,nonce:i,redirect_uri:s||t.authorizationParams.redirect_uri,code_challenge:o,code_challenge_method:"S256"}))(this.options,this.scope,t,r,i,s,t.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==e?void 0:e.response_mode),c=this._authorizeUrl(a);return{nonce:i,code_verifier:o,scope:a.scope,audience:a.audience||"default",redirect_uri:a.redirect_uri,state:r,url:c}}async loginWithPopup(t,e){var n;if(t=t||{},!(e=e||{}).popup&&(e.popup=(t=>{const e=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup",`left=${e},top=${n},width=400,height=600,resizable,scrollbars=yes,status=1`)})(),!e.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const r=await this._prepareAuthorizeUrl(t.authorizationParams||{},{response_mode:"web_message"},window.location.origin);e.popup.location.href=r.url;const i=await(t=>new Promise(((e,n)=>{let r;const i=setInterval((()=>{t.popup&&t.popup.closed&&(clearInterval(i),clearTimeout(o),window.removeEventListener("message",r,!1),n(new v(t.popup)))}),1e3),o=setTimeout((()=>{clearInterval(i),n(new w(t.popup)),window.removeEventListener("message",r,!1)}),1e3*(t.timeoutInSeconds||60));r=function(s){if(s.data&&"authorization_response"===s.data.type){if(clearTimeout(o),clearInterval(i),window.removeEventListener("message",r,!1),t.popup.close(),s.data.response.error)return n(m.fromPayload(s.data.response));e(s.data.response)}},window.addEventListener("message",r)})))(Object.assign(Object.assign({},e),{timeoutInSeconds:e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==i.state)throw new m("state_mismatch","Invalid state");const o=(null===(n=t.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:o})}async getUser(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.user}async getIdTokenClaims(){var t;const e=await this._getIdTokenFromCache();return null===(t=null==e?void 0:e.decodedToken)||void 0===t?void 0:t.claims}async loginWithRedirect(t={}){var e;const n=J(t),{openUrl:r,fragment:o,appState:s}=n,a=i(n,["openUrl","fragment","appState"]),c=(null===(e=a.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,l=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:u}=l,h=i(l,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:s}),c&&{organization:c}));const d=o?`${u}#${o}`:u;r?await r(d):window.location.assign(d)}async handleRedirectCallback(t=window.location.href){const e=t.split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const{state:n,code:r,error:i,error_description:o}=(t=>{t.indexOf("#")>-1&&(t=t.substring(0,t.indexOf("#")));const e=new URLSearchParams(t);return{state:e.get("state"),code:e.get("code")||void 0,error:e.get("error")||void 0,error_description:e.get("error_description")||void 0}})(e.join("")),s=this.transactionManager.get();if(!s)throw new m("missing_transaction","Invalid state");if(this.transactionManager.remove(),i)throw new g(i,o||i,n,s.appState);if(!s.code_verifier||s.state&&s.state!==n)throw new m("state_mismatch","Invalid state");const a=s.organization,c=s.nonce,l=s.redirect_uri;return await this._requestToken(Object.assign({audience:s.audience,scope:s.scope,code_verifier:s.code_verifier,grant_type:"authorization_code",code:r},l?{redirect_uri:l}:{}),{nonceIn:c,organization:a}),{appState:s.appState}}async checkSession(t){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(t)}catch(t){}}async getTokenSilently(t={}){var e;const n=Object.assign(Object.assign({cacheMode:"on"},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:O(this.scope,null===(e=t.authorizationParams)||void 0===e?void 0:e.scope)})}),r=await((t,e)=>{let n=X[e];return n||(n=t().finally((()=>{delete X[e],n=null})),X[e]=n),n})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return t.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(t){const{cacheMode:e}=t,n=i(t,["cacheMode"]);if("off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}if("cache-only"!==e){if(!await(async(t,e=3)=>{for(let n=0;n<e;n++)if(await t())return!0;return!1})((()=>Q.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new y;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),"off"!==e){const t=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(t)return t}const t=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,access_token:i,oauthTokenScope:o,expires_in:s}=t;return Object.assign(Object.assign({id_token:r,access_token:i},o?{scope:o}:null),{expires_in:s})}finally{await Q.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(t={},e={}){var n;const r=Object.assign(Object.assign({},t),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),t.authorizationParams),{scope:O(this.scope,null===(n=t.authorizationParams)||void 0===n?void 0:n.scope)})});return e=Object.assign(Object.assign({},d),e),await this.loginWithPopup(r,e),(await this.cacheManager.get(new B({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){null!==t.clientId?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const e=t.logoutParams||{},{federated:n}=e,r=i(e,["federated"]),o=n?"&federated":"";return this._url(`/v2/logout?${k(Object.assign({clientId:t.clientId},r))}`)+o}async logout(t={}){const e=J(t),{openUrl:n}=e,r=i(e,["openUrl"]);null===t.clientId?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const o=this._buildLogoutUrl(r);n?await n(o):!1!==n&&window.location.assign(o)}async _getTokenFromIFrame(t){const e=Object.assign(Object.assign({},t.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!e.organization&&(e.organization=n);const{url:r,state:i,nonce:o,code_verifier:s,redirect_uri:a,scope:c,audience:l}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new m("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const n=t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,u=await((t,e,n=60)=>new Promise(((r,i)=>{const o=window.document.createElement("iframe");o.setAttribute("width","0"),o.setAttribute("height","0"),o.style.display="none";const s=()=>{window.document.body.contains(o)&&(window.document.body.removeChild(o),window.removeEventListener("message",a,!1))};let a;const c=setTimeout((()=>{i(new y),s()}),1e3*n);a=function(t){if(t.origin!=e)return;if(!t.data||"authorization_response"!==t.data.type)return;const n=t.source;n&&n.close(),t.data.response.error?i(m.fromPayload(t.data.response)):r(t.data.response),clearTimeout(c),window.removeEventListener("message",a,!1),setTimeout(s,2e3)},window.addEventListener("message",a,!1),window.document.body.appendChild(o),o.setAttribute("src",t)})))(r,this.domainUrl,n);if(i!==u.state)throw new m("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:s,code:u.code,grant_type:"authorization_code",redirect_uri:a,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:o,organization:e.organization});return Object.assign(Object.assign({},h),{scope:c,oauthTokenScope:h.scope,audience:l})}catch(t){throw"login_required"===t.error&&this.logout({openUrl:!1}),t}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new B({scope:t.authorizationParams.scope,audience:t.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(e&&e.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw new E(t.authorizationParams.audience||"default",t.authorizationParams.scope)}const n=t.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,r="number"==typeof t.timeoutInSeconds?1e3*t.timeoutInSeconds:null;try{const i=await this._requestToken(Object.assign(Object.assign(Object.assign({},t.authorizationParams),{grant_type:"refresh_token",refresh_token:e&&e.refresh_token,redirect_uri:n}),r&&{timeout:r}));return Object.assign(Object.assign({},i),{scope:t.authorizationParams.scope,oauthTokenScope:i.scope,audience:t.authorizationParams.audience||"default"})}catch(e){if((e.message.indexOf("Missing Refresh Token")>-1||e.message&&e.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(t);throw e}}async _saveEntryInCache(t){const{id_token:e,decodedToken:n}=t,r=i(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:e,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const t=this.options.authorizationParams.audience||"default",e=await this.cacheManager.getIdToken(new B({clientId:this.options.clientId,audience:t,scope:this.scope})),n=this.userCache.get("@@user@@");return e&&e.id_token===(null==n?void 0:n.id_token)?n:(this.userCache.set("@@user@@",e),e)}async _getEntryFromCache({scope:t,audience:e,clientId:n}){const r=await this.cacheManager.get(new B({scope:t,audience:e,clientId:n}),60);if(r&&r.access_token){const{access_token:t,oauthTokenScope:e,expires_in:n}=r,i=await this._getIdTokenFromCache();return i&&Object.assign(Object.assign({id_token:i.id_token,access_token:t},e?{scope:e}:null),{expires_in:n})}}async _requestToken(t,e){const{nonceIn:n,organization:r}=e||{},i=await I(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},t),this.worker),o=await this._verifyIdToken(i.id_token,n,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},i),{decodedToken:o,scope:t.scope,audience:t.audience||"default"}),i.scope?{oauthTokenScope:i.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||o.claims.org_id),Object.assign(Object.assign({},i),{decodedToken:o})}}var et=a(470);function nt(t,e){return function(){return t.apply(e,arguments)}}const{toString:rt}=Object.prototype,{getPrototypeOf:it}=Object,ot=(st=Object.create(null),t=>{const e=rt.call(t);return st[e]||(st[e]=e.slice(8,-1).toLowerCase())});var st;const at=t=>(t=t.toLowerCase(),e=>ot(e)===t),ct=t=>e=>typeof e===t,{isArray:lt}=Array,ut=ct("undefined");const ht=at("ArrayBuffer");const dt=ct("string"),ft=ct("function"),pt=ct("number"),mt=t=>null!==t&&"object"==typeof t,gt=t=>{if("object"!==ot(t))return!1;const e=it(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},yt=at("Date"),wt=at("File"),vt=at("Blob"),bt=at("FileList"),Et=at("URLSearchParams");function St(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,i;if("object"!=typeof t&&(t=[t]),lt(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let s;for(r=0;r<o;r++)s=i[r],e.call(null,t[s],s,t)}}function Tt(t,e){e=e.toLowerCase();const n=Object.keys(t);let r,i=n.length;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}const xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,At=t=>!ut(t)&&t!==xt;const kt=(Rt="undefined"!=typeof Uint8Array&&it(Uint8Array),t=>Rt&&t instanceof Rt);var Rt;const Pt=at("HTMLFormElement"),Ct=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),It=at("RegExp"),Ot=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};St(n,((n,i)=>{let o;!1!==(o=e(n,i,t))&&(r[i]=o||n)})),Object.defineProperties(t,r)},Bt="abcdefghijklmnopqrstuvwxyz",Ut="0123456789",Lt={DIGIT:Ut,ALPHA:Bt,ALPHA_DIGIT:Bt+Bt.toUpperCase()+Ut};const Nt=at("AsyncFunction"),_t={isArray:lt,isArrayBuffer:ht,isBuffer:function(t){return null!==t&&!ut(t)&&null!==t.constructor&&!ut(t.constructor)&&ft(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||ft(t.append)&&("formdata"===(e=ot(t))||"object"===e&&ft(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&ht(t.buffer),e},isString:dt,isNumber:pt,isBoolean:t=>!0===t||!1===t,isObject:mt,isPlainObject:gt,isUndefined:ut,isDate:yt,isFile:wt,isBlob:vt,isRegExp:It,isFunction:ft,isStream:t=>mt(t)&&ft(t.pipe),isURLSearchParams:Et,isTypedArray:kt,isFileList:bt,forEach:St,merge:function t(){const{caseless:e}=At(this)&&this||{},n={},r=(r,i)=>{const o=e&&Tt(n,i)||i;gt(n[o])&>(r)?n[o]=t(n[o],r):gt(r)?n[o]=t({},r):lt(r)?n[o]=r.slice():n[o]=r};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&St(arguments[t],r);return n},extend:(t,e,n,{allOwnKeys:r}={})=>(St(e,((e,r)=>{n&&ft(e)?t[r]=nt(e,n):t[r]=e}),{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let i,o,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&it(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:ot,kindOfTest:at,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(lt(t))return t;let e=t.length;if(!pt(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:Pt,hasOwnProperty:Ct,hasOwnProp:Ct,reduceDescriptors:Ot,freezeMethods:t=>{Ot(t,((e,n)=>{if(ft(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];ft(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach((t=>{n[t]=!0}))};return lt(t)?r(t):r(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Tt,global:xt,isContextDefined:At,ALPHABET:Lt,generateString:(t=16,e=Lt.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n},isSpecCompliantForm:function(t){return!!(t&&ft(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(mt(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const i=lt(t)?[]:{};return St(t,((t,e)=>{const o=n(t,r+1);!ut(o)&&(i[e]=o)})),e[r]=void 0,i}}return t};return n(t,0)},isAsyncFn:Nt,isThenable:t=>t&&(mt(t)||ft(t))&&ft(t.then)&&ft(t.catch)};function jt(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}_t.inherits(jt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_t.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Dt=jt.prototype,Mt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Mt[t]={value:t}})),Object.defineProperties(jt,Mt),Object.defineProperty(Dt,"isAxiosError",{value:!0}),jt.from=(t,e,n,r,i,o)=>{const s=Object.create(Dt);return _t.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),jt.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Vt=jt;function Ft(t){return _t.isPlainObject(t)||_t.isArray(t)}function Kt(t){return _t.endsWith(t,"[]")?t.slice(0,-2):t}function Wt(t,e,n){return t?t.concat(e).map((function(t,e){return t=Kt(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const zt=_t.toFlatObject(_t,{},null,(function(t){return/^is[A-Z]/.test(t)}));const Ht=function(t,e,n){if(!_t.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=_t.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!_t.isUndefined(e[t])}))).metaTokens,i=n.visitor||l,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&_t.isSpecCompliantForm(e);if(!_t.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(_t.isDate(t))return t.toISOString();if(!a&&_t.isBlob(t))throw new Vt("Blob is not supported. Use a Buffer instead.");return _t.isArrayBuffer(t)||_t.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function l(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(_t.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(_t.isArray(t)&&function(t){return _t.isArray(t)&&!t.some(Ft)}(t)||(_t.isFileList(t)||_t.endsWith(n,"[]"))&&(a=_t.toArray(t)))return n=Kt(n),a.forEach((function(t,r){!_t.isUndefined(t)&&null!==t&&e.append(!0===s?Wt([n],r,o):null===s?n:n+"[]",c(t))})),!1;return!!Ft(t)||(e.append(Wt(i,n,o),c(t)),!1)}const u=[],h=Object.assign(zt,{defaultVisitor:l,convertValue:c,isVisitable:Ft});if(!_t.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!_t.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),_t.forEach(n,(function(n,o){!0===(!(_t.isUndefined(n)||null===n)&&i.call(e,n,_t.isString(o)?o.trim():o,r,h))&&t(n,r?r.concat(o):[o])})),u.pop()}}(t),e};function $t(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function Zt(t,e){this._pairs=[],t&&Ht(t,this,e)}const Xt=Zt.prototype;Xt.append=function(t,e){this._pairs.push([t,e])},Xt.toString=function(t){const e=t?function(e){return t.call(this,e,$t)}:$t;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const Gt=Zt;function Yt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qt(t,e,n){if(!e)return t;const r=n&&n.encode||Yt,i=n&&n.serialize;let o;if(o=i?i(e,n):_t.isURLSearchParams(e)?e.toString():new Gt(e,n).toString(r),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}const Jt=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_t.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},Qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},te={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Gt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ee="undefined"!=typeof window&&"undefined"!=typeof document,ne=(re="undefined"!=typeof navigator&&navigator.product,ee&&["ReactNative","NativeScript","NS"].indexOf(re)<0);var re;const ie="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,oe={...t,...te};const se=function(t){function e(t,n,r,i){let o=t[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=t.length;if(o=!o&&_t.isArray(r)?r.length:o,a)return _t.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&_t.isObject(r[o])||(r[o]=[]);return e(t,n,r[o],i)&&_t.isArray(r[o])&&(r[o]=function(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}(r[o])),!s}if(_t.isFormData(t)&&_t.isFunction(t.entries)){const n={};return _t.forEachEntry(t,((t,r)=>{e(function(t){return _t.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),r,n,0)})),n}return null};const ae={transitional:Qt,adapter:["xhr","http"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,i=_t.isObject(t);i&&_t.isHTMLForm(t)&&(t=new FormData(t));if(_t.isFormData(t))return r&&r?JSON.stringify(se(t)):t;if(_t.isArrayBuffer(t)||_t.isBuffer(t)||_t.isStream(t)||_t.isFile(t)||_t.isBlob(t))return t;if(_t.isArrayBufferView(t))return t.buffer;if(_t.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Ht(t,new oe.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return oe.isNode&&_t.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=_t.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Ht(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||r?(e.setContentType("application/json",!1),function(t,e,n){if(_t.isString(t))try{return(e||JSON.parse)(t),_t.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||ae.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(t&&_t.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw Vt.from(t,Vt.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oe.classes.FormData,Blob:oe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_t.forEach(["delete","get","head","post","put","patch"],(t=>{ae.headers[t]={}}));const ce=ae,le=_t.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ue=Symbol("internals");function he(t){return t&&String(t).trim().toLowerCase()}function de(t){return!1===t||null==t?t:_t.isArray(t)?t.map(de):String(t)}function fe(t,e,n,r,i){return _t.isFunction(r)?r.call(this,e,n):(i&&(e=n),_t.isString(e)?_t.isString(r)?-1!==e.indexOf(r):_t.isRegExp(r)?r.test(e):void 0:void 0)}class pe{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function i(t,e,n){const i=he(e);if(!i)throw new Error("header name must be a non-empty string");const o=_t.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||e]=de(t))}const o=(t,e)=>_t.forEach(t,((t,n)=>i(t,n,e)));return _t.isPlainObject(t)||t instanceof this.constructor?o(t,e):_t.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?o((t=>{const e={};let n,r,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!n||e[n]&&le[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)})),e})(t),e):null!=t&&i(e,t,n),this}get(t,e){if(t=he(t)){const n=_t.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(_t.isFunction(e))return e.call(this,t,n);if(_t.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=he(t)){const n=_t.findKey(this,t);return!(!n||void 0===this[n]||e&&!fe(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function i(t){if(t=he(t)){const i=_t.findKey(n,t);!i||e&&!fe(0,n[i],i,e)||(delete n[i],r=!0)}}return _t.isArray(t)?t.forEach(i):i(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const i=e[n];t&&!fe(0,this[i],i,t,!0)||(delete this[i],r=!0)}return r}normalize(t){const e=this,n={};return _t.forEach(this,((r,i)=>{const o=_t.findKey(n,i);if(o)return e[o]=de(r),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(i):String(i).trim();s!==i&&delete e[i],e[s]=de(r),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return _t.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&_t.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[ue]=this[ue]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=he(t);e[r]||(!function(t,e){const n=_t.toCamelCase(" "+e);["get","set","has"].forEach((r=>{Object.defineProperty(t,r+n,{value:function(t,n,i){return this[r].call(this,e,t,n,i)},configurable:!0})}))}(n,t),e[r]=!0)}return _t.isArray(t)?t.forEach(r):r(t),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_t.reduceDescriptors(pe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),_t.freezeMethods(pe);const me=pe;function ge(t,e){const n=this||ce,r=e||n,i=me.from(r.headers);let o=r.data;return _t.forEach(t,(function(t){o=t.call(n,o,i.normalize(),e?e.status:void 0)})),i.normalize(),o}function ye(t){return!(!t||!t.__CANCEL__)}function we(t,e,n){Vt.call(this,null==t?"canceled":t,Vt.ERR_CANCELED,e,n),this.name="CanceledError"}_t.inherits(we,Vt,{__CANCEL__:!0});const ve=we;const be=oe.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];_t.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),_t.isString(r)&&s.push("path="+r),_t.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ee(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Se=oe.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function r(n){let r=n;return t&&(e.setAttribute("href",r),r=e.href),e.setAttribute("href",r),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return n=r(window.location.href),function(t){const e=_t.isString(t)?r(t):t;return e.protocol===n.protocol&&e.host===n.host}}():function(){return!0};const Te=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),l=r[s];i||(i=c),n[o]=a,r[o]=c;let u=s,h=0;for(;u!==o;)h+=n[u++],u%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-i<e)return;const d=l&&c-l;return d?Math.round(1e3*h/d):void 0}};function xe(t,e){let n=0;const r=Te(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-n,c=r(a);n=o;const l={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:i};l[e?"download":"upload"]=!0,t(l)}}const Ae={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){let r=t.data;const i=me.from(t.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=t;function l(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}if(_t.isFormData(r))if(oe.hasStandardBrowserEnv||oe.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(s=i.getContentType())){const[t,...e]=s?s.split(";").map((t=>t.trim())).filter(Boolean):[];i.setContentType([t||"multipart/form-data",...e].join("; "))}let u=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",n=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(e+":"+n))}const h=Ee(t.baseURL,t.url);function d(){if(!u)return;const r=me.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new Vt("Request failed with status code "+n.status,[Vt.ERR_BAD_REQUEST,Vt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}((function(t){e(t),l()}),(function(t){n(t),l()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:t,request:u}),u=null}if(u.open(t.method.toUpperCase(),qt(h,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=function(){u&&(n(new Vt("Request aborted",Vt.ECONNABORTED,t,u)),u=null)},u.onerror=function(){n(new Vt("Network Error",Vt.ERR_NETWORK,t,u)),u=null},u.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const r=t.transitional||Qt;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new Vt(e,r.clarifyTimeoutError?Vt.ETIMEDOUT:Vt.ECONNABORTED,t,u)),u=null},oe.hasStandardBrowserEnv&&(c&&_t.isFunction(c)&&(c=c(t)),c||!1!==c&&Se(h))){const e=t.xsrfHeaderName&&t.xsrfCookieName&&be.read(t.xsrfCookieName);e&&i.set(t.xsrfHeaderName,e)}void 0===r&&i.setContentType(null),"setRequestHeader"in u&&_t.forEach(i.toJSON(),(function(t,e){u.setRequestHeader(e,t)})),_t.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),a&&"json"!==a&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",xe(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",xe(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=e=>{u&&(n(!e||e.type?new ve(null,t,u):e),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));const f=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(h);f&&-1===oe.protocols.indexOf(f)?n(new Vt("Unsupported protocol "+f+":",Vt.ERR_BAD_REQUEST,t)):u.send(r||null)}))}};_t.forEach(Ae,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const ke=t=>`- ${t}`,Re=t=>_t.isFunction(t)||null===t||!1===t,Pe=t=>{t=_t.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o<e;o++){let e;if(n=t[o],r=n,!Re(n)&&(r=Ae[(e=String(n)).toLowerCase()],void 0===r))throw new Vt(`Unknown adapter '${e}'`);if(r)break;i[e||"#"+o]=r}if(!r){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let n=e?t.length>1?"since :\n"+t.map(ke).join("\n"):" "+ke(t[0]):"as no adapter specified";throw new Vt("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r};function Ce(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ve(null,t)}function Ie(t){Ce(t),t.headers=me.from(t.headers),t.data=ge.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Pe(t.adapter||ce.adapter)(t).then((function(e){return Ce(t),e.data=ge.call(t,t.transformResponse,e),e.headers=me.from(e.headers),e}),(function(e){return ye(e)||(Ce(t),e&&e.response&&(e.response.data=ge.call(t,t.transformResponse,e.response),e.response.headers=me.from(e.response.headers))),Promise.reject(e)}))}const Oe=t=>t instanceof me?t.toJSON():t;function Be(t,e){e=e||{};const n={};function r(t,e,n){return _t.isPlainObject(t)&&_t.isPlainObject(e)?_t.merge.call({caseless:n},t,e):_t.isPlainObject(e)?_t.merge({},e):_t.isArray(e)?e.slice():e}function i(t,e,n){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t,n):r(t,e,n)}function o(t,e){if(!_t.isUndefined(e))return r(void 0,e)}function s(t,e){return _t.isUndefined(e)?_t.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,i,o){return o in e?r(n,i):o in t?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e)=>i(Oe(t),Oe(e),!0)};return _t.forEach(Object.keys(Object.assign({},t,e)),(function(r){const o=c[r]||i,s=o(t[r],e[r],r);_t.isUndefined(s)&&o!==a||(n[r]=s)})),n}const Ue="1.6.5",Le={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Le[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const Ne={};Le.transitional=function(t,e,n){function r(t,e){return"[Axios v1.6.5] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,i,o)=>{if(!1===t)throw new Vt(r(i," has been removed"+(e?" in "+e:"")),Vt.ERR_DEPRECATED);return e&&!Ne[i]&&(Ne[i]=!0,console.warn(r(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,i,o)}};const _e={assertOptions:function(t,e,n){if("object"!=typeof t)throw new Vt("options must be an object",Vt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new Vt("option "+o+" must be "+n,Vt.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Vt("Unknown option "+o,Vt.ERR_BAD_OPTION)}},validators:Le},je=_e.validators;class De{constructor(t){this.defaults=t,this.interceptors={request:new Jt,response:new Jt}}request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Be(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:i}=e;void 0!==n&&_e.assertOptions(n,{silentJSONParsing:je.transitional(je.boolean),forcedJSONParsing:je.transitional(je.boolean),clarifyTimeoutError:je.transitional(je.boolean)},!1),null!=r&&(_t.isFunction(r)?e.paramsSerializer={serialize:r}:_e.assertOptions(r,{encode:je.function,serialize:je.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=i&&_t.merge(i.common,i[e.method]);i&&_t.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=me.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let u,h=0;if(!a){const t=[Ie.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),u=t.length,l=Promise.resolve(e);h<u;)l=l.then(t[h++],t[h++]);return l}u=s.length;let d=e;for(h=0;h<u;){const t=s[h++],e=s[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{l=Ie.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(t){return qt(Ee((t=Be(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}_t.forEach(["delete","get","head","options"],(function(t){De.prototype[t]=function(e,n){return this.request(Be(n||{},{method:t,url:e,data:(n||{}).data}))}})),_t.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(Be(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}De.prototype[t]=e(),De.prototype[t+"Form"]=e(!0)}));const Me=De;class Ve{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const r=new Promise((t=>{n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t,r,i){n.reason||(n.reason=new ve(t,r,i),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;const e=new Ve((function(e){t=e}));return{token:e,cancel:t}}}const Fe=Ve;const Ke={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ke).forEach((([t,e])=>{Ke[e]=t}));const We=Ke;const ze=function t(e){const n=new Me(e),r=nt(Me.prototype.request,n);return _t.extend(r,Me.prototype,n,{allOwnKeys:!0}),_t.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Be(e,n))},r}(ce);ze.Axios=Me,ze.CanceledError=ve,ze.CancelToken=Fe,ze.isCancel=ye,ze.VERSION=Ue,ze.toFormData=Ht,ze.AxiosError=Vt,ze.Cancel=ze.CanceledError,ze.all=function(t){return Promise.all(t)},ze.spread=function(t){return function(e){return t.apply(null,e)}},ze.isAxiosError=function(t){return _t.isObject(t)&&!0===t.isAxiosError},ze.mergeConfig=Be,ze.AxiosHeaders=me,ze.formToJSON=t=>se(_t.isHTMLForm(t)?new FormData(t):t),ze.getAdapter=Pe,ze.HttpStatusCode=We,ze.default=ze;const He=ze;var $e=a(742),Ze=Object.create,Xe=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Ye=Object.getOwnPropertyNames,qe=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty,Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),tn=(t,e,n)=>(n=null!=t?Ze(qe(t)):{},((t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of Ye(e))!Je.call(t,i)&&i!==n&&Xe(t,i,{get:()=>e[i],enumerable:!(r=Ge(e,i))||r.enumerable});return t})(!e&&t&&t.__esModule?n:Xe(n,"default",{value:t,enumerable:!0}),t)),en=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e=t.length,n=e%4;if(!n)return t;var r=e,i=4-n,o=e+i,s=Buffer.alloc(o);for(s.write(t);i--;)s.write("=",r++);return s.toString()}})),nn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=en();function n(t,e){return void 0===e&&(e="utf8"),Buffer.isBuffer(t)?i(t.toString("base64")):i(Buffer.from(t,e).toString("base64"))}function r(t){return t=t.toString(),e.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function i(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var o=n;o.encode=n,o.decode=function(t,e){return void 0===e&&(e="utf8"),Buffer.from(r(t),"base64").toString(e)},o.toBase64=r,o.fromBase64=i,o.toBuffer=function(t){return Buffer.from(r(t),"base64")},t.default=o})),rn=Qe(((t,e)=>{e.exports=nn().default,e.exports.default=e.exports})),on=Qe((t=>{t.byteLength=function(t){var e=s(t),n=e[0],r=e[1];return 3*(n+r)/4-r},t.toByteArray=function(t){var e,n,o=s(t),a=o[0],c=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,c)),u=0,h=c>0?a-4:a;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[u++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e),l},t.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(t,a,a+s>l?l:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};var e,n=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(e=0,64;e<64;++e)n[e]=o[e],r[o.charCodeAt(e)]=e;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function a(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function c(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(a(r));return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63})),sn=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=on();function n(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function r(t){return(new TextEncoder).encode(t)}function i(t){return new Uint8Array(e.toByteArray(c(t)))}function o(t){return e.fromByteArray(new Uint8Array(t))}function s(t){return a(o(t))}function a(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}function c(t){let e;return e=(t=t.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-t.length%4,t.concat("=".repeat(e))}t.concatBuffers=function(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;let n=new Uint8Array(e),r=0;n.set(new Uint8Array(t[0]),r),r+=t[0].byteLength;for(let e=1;e<t.length;e++)n.set(new Uint8Array(t[e]),r),r+=t[e].byteLength;return n},t.b64UrlToString=function(t){return n(i(t))},t.bufferToString=n,t.stringToBuffer=r,t.stringToB64Url=function(t){return s(r(t))},t.b64UrlToBuffer=i,t.bufferTob64=o,t.bufferTob64Url=s,t.b64UrlEncode=a,t.b64UrlDecode=c})),an=Qe((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=sn();t.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let t=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),e=await this.driver.exportKey("jwk",t.privateKey);return{kty:e.kty,e:e.e,n:e.n,d:e.d,p:e.p,q:e.q,dp:e.dp,dq:e.dq,qi:e.qi}}async sign(t,e,{saltLength:n}={}){let r=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(t),e);return new Uint8Array(r)}async hash(t,e="SHA-256"){let n=await this.driver.digest(e,t);return new Uint8Array(n)}async verify(t,e,n){let r={kty:"RSA",e:"AQAB",n:t},i=await this.jwkToPublicCryptoKey(r),o=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-o.byteLength-2},i,n,e);return s||a||c}async jwkToCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(t){return this.driver.importKey("jwk",t,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let t=crypto?.subtle;return void 0!==t&&["generateKey","importKey","exportKey","digest","sign"].every((e=>"function"==typeof t[e]))}async encrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);let a=await this.driver.encrypt({name:"AES-CBC",iv:s},o,t);return e.concatBuffers([s,a])}async decrypt(t,n,r){let i=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),o=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},o,t.slice(16));return e.concatBuffers([a])}}})),cn=Qe((t=>{t.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)},t.write=function(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=p,s/=256,l-=8);t[n+f-p]|=128*m}})),ln=Qe((t=>{var e=on(),n=cn(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;var i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){if(("string"!=typeof e||""===e)&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=0|f(t,e),r=o(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){let e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return s.from(r,e,n);let i=function(t){if(s.isBuffer(t)){let e=0|d(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||X(t.length)?o(0):u(t);if("Buffer"===t.type&&Array.isArray(t.data))return u(t.data)}(t);if(i)return i;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return c(t),o(t<0?0:0|d(t))}function u(t){let e=t.length<0?0:0|d(t.length),n=o(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,s.prototype),r}function d(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function f(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:z(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return x(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return R(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(t,o+r)!==l(e,r)){n=!1;break}if(n)return o}return-1}function w(t,e,n,r){n=Number(n)||0;let i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;let o,s=e.length;for(r>s/2&&(r=s/2),o=0;o<r;++o){let r=parseInt(e.substr(2*o,2),16);if(X(r))return o;t[n+o]=r}return o}function v(t,e,n,r){return $(z(e,t.length-n),t,n,r)}function b(t,e,n,r){return $(function(t){let e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function E(t,e,n,r){return $(H(e),t,n,r)}function S(t,e,n,r){return $(function(t,e){let n,r,i,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function T(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function x(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i<n;){let e=t[i],o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){let e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=A));return n}(r)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch{return!1}}(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,n){return a(t,e,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,n){return function(t,e,n){return c(t),t<=0?o(t):void 0!==e?"string"==typeof n?o(t).fill(e,n):o(t).fill(e):o(t)}(t,e,n)},s.allocUnsafe=function(t){return l(t)},s.allocUnsafeSlow=function(t){return l(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(t){switch(String(t).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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let r=s.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){let e=t[n];if(Z(e,Uint8Array))i+e.length>r.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},s.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},s.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},s.prototype.toString=function(){let t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(t,e,n,r,i){if(Z(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(o,a),l=this.slice(r,i),u=t.slice(e,n);for(let t=0;t<c;++t)if(l[t]!==u[t]){o=l[t],a=u[t];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},s.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}let i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function k(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function R(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function P(t,e,n){let r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=G[t[r]];return i}function C(t,e,n){let r=t.slice(e,n),i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,n,r,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function B(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function U(t,e,n,r,i){V(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function L(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function _(t,e,r,i,o){return e=+e,r>>>=0,o||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){let n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);let r=this.subarray(t,e);return Object.setPrototypeOf(r,s.prototype),r},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);let n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);let n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=Y((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&K(t,this.length-8);let r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){O(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){O(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Y((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Y((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);O(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){let r=Math.pow(2,8*n-1);O(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigInt64LE=Y((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Y((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return N(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return _(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return _(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&0!==r&&(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);let i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},s.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){let e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{let o=s.isBuffer(t)?t:s.from(t,r),a=o.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%a]}return this};var j={};function D(t,e,n){j[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function M(t){let e="",n=t.length,r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function V(t,e,n,r,i,o){if(t>n||t<e){let r,i="bigint"==typeof e?"n":"";throw r=o>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new j.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){F(e,"offset"),(void 0===t[e]||void 0===t[e+n])&&K(e,t.length-(n+1))}(r,i,o)}function F(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,n){throw Math.floor(t)!==t?(F(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new j.ERR_BUFFER_OUT_OF_BOUNDS:new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=M(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=M(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);var W=/[^+/0-9A-Za-z-_]/g;function z(t,e){e=e||1/0;let n,r=t.length,i=null,o=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}var G=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Y(t){return typeof BigInt>"u"?q:t}function q(){throw new Error("BigInt not supported")}})),un=Qe(((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:ln().Buffer,Crypto:window.crypto}):e.exports={Buffer:ln().Buffer,Crypto:crypto}})),hn={};((t,e)=>{for(var n in e)Xe(t,n,{get:e[n],enumerable:!0})})(hn,{AVSCTap:()=>Cn,ArweaveSigner:()=>xn,DataItem:()=>Mn,MAX_TAG_BYTES:()=>jn,MIN_BINARY_SIZE:()=>Dn,SIG_CONFIG:()=>Tn,SignatureConfig:()=>wn,Signer:()=>dn,createData:()=>Fn,deserializeTags:()=>Bn,indexToType:()=>An,serializeTags:()=>In,tagsExceedLimit:()=>On});var dn=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,n,r){throw new Error("You must implement verify method on child")}},fn=tn(rn(),1),pn=tn(sn(),1);async function mn(t){if(Array.isArray(t)){let e=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("list"),(0,pn.stringToBuffer)(t.length.toString())]);return await gn(t,await Sn().hash(e,"SHA-384"))}let e=t,n=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("blob"),(0,pn.stringToBuffer)(e.byteLength.toString())]),r=(0,pn.concatBuffers)([await Sn().hash(n,"SHA-384"),await Sn().hash(e,"SHA-384")]);return await Sn().hash(r,"SHA-384")}async function gn(t,e){if(t.length<1)return e;let n=(0,pn.concatBuffers)([e,await mn(t[0])]),r=await Sn().hash(n,"SHA-384");return await gn(t.slice(1),r)}var yn,wn,vn=tn(an(),1),bn=vn.default.default?vn.default.default:vn.default,En=class extends bn{getPublicKey(t){throw new Error("Unimplemented")}};function Sn(){return yn??=new En}!function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"}(wn||(wn={}));var Tn={[wn.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[wn.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[wn.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[wn.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[wn.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[wn.MULTIAPTOS]:{sigLength:2052,pubLength:1025,sigName:"multiAptos"},[wn.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},xn=class{signatureType=1;ownerLength=Tn[1].pubLength;signatureLength=Tn[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return fn.default.toBuffer(this.pk)}sign(t){return Sn().sign(this.jwk,t)}static async verify(t,e,n){return await Sn().verify(t,e,n)}},An={1:xn},kn=tn(rn(),1);async function Rn(t){return mn([(0,pn.stringToBuffer)("dataitem"),(0,pn.stringToBuffer)("1"),(0,pn.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function Pn(t,e){let{signature:n,id:r}=await async function(t,e){let n=await Rn(t),r=await e.sign(n),i=await Sn().hash(r);return{signature:Buffer.from(r),id:Buffer.from(i)}}(t,e);return t.getRaw().set(n,2),r}var Cn=class{buf;pos;constructor(t=Buffer.alloc(jn),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e,n=t.length;if(n)for(this.writeLong(n),e=0;e<n;e++){let n=t[e];if(void 0===n?.name||void 0===n?.value)throw new Error(`Invalid tag format for ${n}, expected {name:string, value: string}`);this.writeString(n.name),this.writeString(n.value)}this.writeLong(0)}toBuffer(){let t=Buffer.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e,n,r=this.buf;if(t>=-1073741824&&t<1073741824){n=t>=0?t<<1:~t<<1|1;do{r[this.pos]=127&n,n>>=7}while(n&&(r[this.pos++]|=128))}else{e=t>=0?2*t:2*-t-1;do{r[this.pos]=127&e,e/=128}while(e>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(t){let e=Buffer.byteLength(t),n=this.buf;this.writeLong(e);let r=this.pos;if(this.pos+=e,!(this.pos>n.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,o,s,a;for(i=0,o=e;i<o;i++)s=t.charCodeAt(i),s<128?n[r++]=s:s<2048?(n[r++]=s>>6|192,n[r++]=63&s|128):55296==(64512&s)&&56320==(64512&(a=t.charCodeAt(i+1)))?(s=65536+((1023&s)<<10)+(1023&a),i++,n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}this.buf=n}}readLong(){let t,e,n,r,i=0,o=0,s=this.buf;do{t=s[this.pos++],e=128&t,i|=(127&t)<<o,o+=7}while(e&&o<28);if(e){n=i,r=268435456;do{t=s[this.pos++],n+=(127&t)*r,r*=128}while(128&t);return(n%2?-(n+1):n)/2}return i>>1^-(1&i)}skipLong(){let t=this.buf;for(;128&t[this.pos++];);}readTags(){let t,e=[];for(;t=this.readLong();)for(t<0&&(t=-t,this.skipLong());t--;){let t=this.readString(),n=this.readString();e.push({name:t,value:n})}return e}readString(){let t=this.readLong(),e=this.pos,n=this.buf;if(this.pos+=t,!(this.pos>n.length))return this.buf.slice(e,e+t).toString()}};function In(t){let e=new Cn;return e.writeTags(t),e.toBuffer()}function On(t){let e=new Cn;return e.writeTags(t),e.tagsExceedLimit()}function Bn(t){return new Cn(t).readTags()}function Un(t){let e=0;for(let n=t.length-1;n>=0;n--)e=256*e+t[n];return e}function Ln(t){let e=[0,0,0,0,0,0,0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}var Nn=tn(un(),1),_n=tn(ln(),1),jn=4096,Dn=80,Mn=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){let t=Un(this.binary.subarray(0,2));if(void 0!==wn?.[t])return t;throw new Error("Unknown signature type: "+t)}async isValid(){return Mn.verify(this.binary)}get id(){return(async()=>kn.default.encode(await this.rawId))()}set id(t){this._id=kn.default.toBuffer(t)}get rawId(){return(async()=>_n.Buffer.from(await Nn.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return kn.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Tn[this.signatureType].sigLength}get owner(){return kn.default.encode(this.rawOwner)}get ownerLength(){return Tn[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get target(){return kn.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):_n.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(0==Un(this.binary.subarray(t,t+8)))return[];let e=Un(this.binary.subarray(t+8,t+16));return Bn(_n.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)})))}getStartOfData(){let t=this.getTagsStart();return t+16+Un(this.binary.subarray(t+8,t+16))}get rawData(){let t=this.getTagsStart(),e=t+16+Un(this.binary.subarray(t+8,t+16));return this.binary.subarray(e,this.binary.length)}get data(){return kn.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Pn(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=_n.Buffer.from(await Sn().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map((t=>({name:kn.default.encode(t.name),value:kn.default.encode(t.value)}))),data:this.data}}static async verify(t){if(t.byteLength<Dn)return!1;let e=new Mn(t),n=e.signatureType,r=e.getTagsStart(),i=Un(t.subarray(r,r+8)),o=Un(t.subarray(r+8,r+16));if(o>jn)return!1;if(i>0)try{if(Bn(_n.Buffer.from(t.subarray(r+16,r+16+o))).length!==i)return!1}catch{return!1}let s=An[n],a=await Rn(e);return await s.verify(e.rawOwner,a,e.rawSignature)}async getSignatureData(){return Rn(this)}getTagsStart(){let t=this.getTargetStart(),e=t+(1==this.binary[t]?33:1);return e+=1==this.binary[e]?33:1,e}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1;return t+=1==this.binary[this.getTargetStart()]?32:0,t}},Vn=tn(rn(),1);function Fn(t,e,n){let r=e.publicKey,i=n?.target?Vn.default.toBuffer(n.target):null,o=1+(i?.byteLength??0),s=n?.anchor?Buffer.from(n.anchor):null,a=1+(s?.byteLength??0),c=(n?.tags?.length??0)>0?In(n.tags):null,l=16+(c?c.byteLength:0),u=Buffer.from(t),h=u.byteLength,d=2+e.signatureLength+e.ownerLength+o+a+l+h,f=Buffer.alloc(d);if(f.set(function(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let n=0;n<e.length;n++){let r=255&t;e[n]=r,t=(t-r)/256}return Uint8Array.from(e)}(e.signatureType),0),f.set(new Uint8Array(e.signatureLength).fill(0),2),r.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${r.byteLength}`);f.set(r,2+e.signatureLength);let p=2+e.signatureLength+e.ownerLength;if(f[p]=i?1:0,i){if(32!==i.byteLength)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);f.set(i,p+1)}let m=p+o,g=m+1;if(f[m]=s?1:0,s){if(g+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");f.set(s,m+1)}f.set(Ln(n?.tags?.length??0),g);let y=Ln(c?.byteLength??0);f.set(y,g+8),c&&f.set(c,g+16);let w=g+l;return f.set(u,w),new Mn(f)}var Kn={...hn};globalThis.arbundles??=Kn;const{Axios:Wn,AxiosError:zn,CanceledError:Hn,isCancel:$n,CancelToken:Zn,VERSION:Xn,all:Gn,Cancel:Yn,isAxiosError:qn,spread:Jn,toFormData:Qn,AxiosHeaders:tr,HttpStatusCode:er,formToJSON:nr,getAdapter:rr,mergeConfig:ir}=He;var or=a(386),sr={debug:!1,inject:!1,auth0Domain:"auth.othent.io",auth0ClientId:"uXkRmJoIa0NfzYgYEDAgj6Rss4wR1tIc",auth0Strategy:"refresh-tokens",auth0Cache:"memory",auth0RefreshTokenExpirationMs:1296e6,auth0LogInMethod:"popup",auth0RedirectURI:null,auth0ReturnToURI:null,serverBaseURL:"https://kms-server.othent.io",autoConnect:"lazy",cookieKey:null,localStorageKey:null,throwErrors:!0,tags:[]},ar={...sr,appName:"",appVersion:"",persistCookie:!1,persistLocalStorage:!1,auth0Cache:"memory"},cr={host:"arweave.net",protocol:"https",port:443},lr="othentUserDetails",ur="Othent KMS",hr="2.0.0-beta.10",dr=[{name:"Client",value:ur},{name:"Client-Version",value:hr}],fr=class{constructor(t){this.listeners=new Set,this.initializedListeners=new Set,this.lastEmittedUpdateId="",this.lastEmittedParams=null,this.options={diffParams:!1,replyOnListen:!1},this.options={...this.options,...t}}getUpdateId(t){const{getUpdateIdTransform:e}=this.options,n=e?e(t):t;return JSON.stringify(n,((t,e)=>e&&"oject"===e&&!Array.isArray(e)?Object.entries(e).sort(((t,e)=>t[0].localeCompare(e[0]))):e))}get hasListeners(){return this.listeners.size>0}add(t){this.listeners.add(t),this.options.replyOnListen&&this.lastEmittedParams&&this.emit(...this.lastEmittedParams)}delete(t){this.listeners.add(t)}emit(...t){const{initializedListeners:e,lastEmittedUpdateId:n}=this,r=this.getUpdateId(t),i=n===r;return this.lastEmittedUpdateId=r,this.lastEmittedParams=t,this.listeners.forEach((n=>{if(!i||!e.has(n)){e.add(n);try{n(...t)}catch(t){}}})),i}};function pr(t,e){return et(!0,{},e,t)}var mr={secure:!0,domain:!0,ttlHours:360},gr=class t{constructor(e=mr){this.secureParam=null,this.domainParam=null,this.ttlMs=1296e6;const{secureParam:n,domainParam:r,ttlMs:i}=this.parseCookieOptions(pr(e,mr));return this.secureParam=n,this.domainParam=r,this.ttlMs=i,new Proxy(this,{get:(t,e)=>e in t||"string"!=typeof e?t[e]:t.getItem(e),ownKeys:e=>document.cookie.split(t.COOKIE_SEPARATOR).map((e=>e.split(t.COOKIE_VALUE_SEPARATOR)[0])),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})})}parseCookieOptions({secure:t,domain:e,ttlHours:n}={}){return{secureParam:t?"secure":void 0===t?this.secureParam:null,domainParam:e?`domain=${!0===e?location.host:e}`:void 0===e?this.domainParam:null,ttlMs:n?36e5*n:void 0===n?this.ttlMs:0}}getCookieParams(t){const{secureParam:e,domainParam:n,ttlMs:r}=this.parseCookieOptions(t),i=[`expires=${new Date(Date.now()+r).toUTCString()}`,e,n,"path=/"].filter(Boolean).join("; ");return i?` ${i};`:""}get length(){return document.cookie?document.cookie.split(t.COOKIE_SEPARATOR).length:0}key(e){return(document.cookie.split(t.COOKIE_SEPARATOR)[e]||"").split(t.COOKIE_VALUE_SEPARATOR)[0]||null}getItem(e){const n=document.cookie.split(t.COOKIE_SEPARATOR).find((n=>n.split(t.COOKIE_VALUE_SEPARATOR)[0]===e));return n&&n.split(t.COOKIE_VALUE_SEPARATOR)[1]||null}setItem(t,e,n){const r=`${t}=${"string"==typeof e?e:JSON.stringify(e)};${this.getCookieParams(n)}`;return document.cookie=r,r}removeItem(t,e){return this.setItem(t,"",{...e,ttlHours:-1})}clear(){document.cookie.split(t.COOKIE_SEPARATOR).forEach((e=>{this.removeItem(e.split(t.COOKIE_VALUE_SEPARATOR)[0])}))}};gr.COOKIE_SEPARATOR=/\s*;\s*/,gr.COOKIE_VALUE_SEPARATOR=/\s*=\s*/;var yr=gr,wr=null;var vr=class t{constructor({debug:t,domain:e,clientId:n,strategy:r,cache:i,refreshTokenExpirationMs:o,loginMethod:s,redirectURI:a,returnToURI:c,appInfo:l,initialUserDetails:u,cookieKey:h,localStorageKey:d}){this.debug=!1,this.auth0ClientPromise=Promise.resolve(null),this.authEventListenerHandler=new fr({diffParams:!0,replyOnListen:!0}),this.userDetails=null,this.userDetailsExpirationTimeoutID=0,this.cookieKey=null,this.localStorageKey=null,this.refreshTokenExpirationMs=+sr.auth0RefreshTokenExpirationMs,this.appInfo={name:"",version:""},this.isReady=!1,this.isAuthenticated=!1,this.debug=t,this.loginMethod=s,this.redirectURI=a,this.returnToURI=c,this.auth0ClientPromise=async function(t){const e=new tt(t);return await e.checkSession(),e}({domain:e,clientId:n,useRefreshTokens:"refresh-tokens"===r,cacheLocation:"string"==typeof i?i:void 0,cache:"object"==typeof i?i:void 0,authorizationParams:{redirect_uri:this.redirectURI}}).then((t=>(this.isReady=!0,t))),this.cookieKey=h,this.localStorageKey=d,this.refreshTokenExpirationMs=o,this.appInfo=l,this.restoreUserDetails(u||null),this.handleStorage=this.handleStorage.bind(this)}static isIdTokenValidUser(t){return!!(t&&t.sub&&t.owner&&t.walletAddress&&"KMS"===t.authSystem)}static async getUserDetails(e){const{email:n="",walletAddress:r}=e,i=e.sub||"",o=i.split("|")[0];let s=await async function(t){try{const e=(await He.get("https://api.mem.tech/api/state/Tih8T1uESATJNzdwBIY3rpe25kWTzjw8uNiMRYe9I5M",{timeout:2e3})).data.balances.find((e=>e.address===t)),n=e&&(e.primary_domain||e.ownedDomains[0].domain)||null;return n?`${n}.ar`:null}catch(e){return console.warn(`Error resolving ANS domain for ${t} =\n`,e),null}}(r);if(!s){s=`${t.PROVIDER_LABELS[o]||"Unknown Provider"} (${n})`}return{sub:i,name:e.name||"",givenName:e.given_name||"",middleName:e.middle_name||"",familyName:e.family_name||"",nickname:e.nickname||"",preferredUsername:e.preferred_username||"",profile:e.profile||"",picture:e.picture||"",website:e.website||"",locale:e.locale||"",updatedAt:e.updated_at||"",email:n,emailVerified:!!e.email_verified,owner:e.owner,walletAddress:e.walletAddress,walletAddressLabel:s,authSystem:e.authSystem,authProvider:o}}getAuthEventListenerHandler(){return this.authEventListenerHandler}setAppInfo(t){this.appInfo=t}initStorageSyncing(){this.localStorageKey&&window.addEventListener("storage",this.handleStorage)}stopStorageSyncing(){window.removeEventListener("storage",this.handleStorage)}handleStorage(t){t.key===this.localStorageKey&&(t.newValue?this.restoreUserDetails():this.logOut())}persistUserDetails(t){const{cookieKey:e,localStorageKey:n}=this;if(e){const n=function(){if(!wr){const t=!1;wr=new yr({secure:!t&&void 0,domain:!t&&void 0})}return wr}();t?n.setItem(e,JSON.stringify(t)):null!==n.getItem(e)&&n.removeItem(e)}if(n)if(t){const e=new Date,r=JSON.stringify({userDetails:t,createdAt:e.toUTCString(),expiredBy:new Date(e.getTime()+this.refreshTokenExpirationMs).toUTCString()});localStorage.setItem(n,r)}else this.clearStoredUserDetails()}setUserDetails(t,e=!0){window.clearTimeout(this.userDetailsExpirationTimeoutID),t&&(this.userDetailsExpirationTimeoutID=window.setTimeout(this.logOut,this.refreshTokenExpirationMs));return this.authEventListenerHandler.emit(t,e?!!t:this.isAuthenticated)||(this.userDetails=t),e&&(this.isAuthenticated=!!t,this.persistUserDetails(t)),t}restoreUserDetails(t){let e=t||null;if(!e&&this.localStorageKey)try{const t=JSON.parse(localStorage.getItem(this.localStorageKey)||"null");if(t){const n=new Date(t.expiredBy).getTime();!isNaN(n)&&n>Date.now()?e=t.userDetails:this.clearStoredUserDetails()}}catch(t){}this.setUserDetails(e,!1)}clearStoredUserDetails(){Object.keys(localStorage).forEach((t=>{t.startsWith("othent")&&localStorage.removeItem(t)}))}async updateUserDetails(e){const n=e&&t.isIdTokenValidUser(e)?await t.getUserDetails(e):null;return this.setUserDetails(n)}getAuthorizationParams(t={}){const{authorizationParams:e,data:n}=t.hasOwnProperty("keyName")?{authorizationParams:null,data:t}:{authorizationParams:t,data:null},r={othentFunction:"KMS",othentSDKVersion:ur,othentAPIVersion:hr,appName:this.appInfo.name,appVersion:this.appInfo.version};return n&&(r.data=n),{...e,transaction_input:JSON.stringify(r,((t,e)=>{let n=[];if(e instanceof Buffer||e instanceof DataView||ArrayBuffer.isView(e))n=Array.from(new Uint8Array(e.buffer));else{if(!(e instanceof ArrayBuffer))return e;n=Array.from(new Uint8Array(e))}return"data"===t?Object.fromEntries(Object.entries(n)):{type:"Buffer",data:n}}))}}async getTokenSilently(t){const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");const n=this.getAuthorizationParams(t);if(this.debug)try{console.log("getTokenSilently() =",{...n,transaction_input:JSON.parse(n.transaction_input)})}catch(t){console.error("Error logging/parsing `authorizationParams`:",t)}try{const t=await e.getTokenSilently({detailedResponse:!0,authorizationParams:n,cacheMode:"off"}),r=await e.getUser();if(!r)throw new Error("Could not get the user's details");const i=await this.updateUserDetails(r);return{...t,idToken:r,userDetails:i}}catch(t){throw t}}async logIn(){const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");this.debug&&console.log("logIn()");if(await t.isAuthenticated())throw new Error("Already logged in");const e=this.getAuthorizationParams({redirect_uri:this.redirectURI});if("popup"!==this.loginMethod)throw t.loginWithRedirect({authorizationParams:e}),new Error("Redirecting...");return await t.loginWithPopup({authorizationParams:e},{}),this.getTokenSilently()}async handleRedirectCallback(t){this.debug&&console.log(`handleRedirectCallback(${t})`);const e=await this.auth0ClientPromise;if(!e)throw new Error("Missing Auth0 Client");await e.handleRedirectCallback(t);const n=await e.getUser();if(!n)throw new Error("Could not get the user's details");return this.updateUserDetails(n)}async logOut(){this.setUserDetails(null);const t=await this.auth0ClientPromise;if(!t)throw new Error("Missing Auth0 Client");return t.logout({logoutParams:{returnTo:this.returnToURI}}).catch((t=>{console.warn(t instanceof Error?t.message:t),"undefined"!=typeof location&&location.reload()}))}async encodeToken(t){return(await this.getTokenSilently(t)).id_token}getCachedUserDetails(){return this.userDetails}getCachedUserPublicKey(){var t;return(null==(t=this.userDetails)?void 0:t.owner)||null}getCachedUserSub(){var t;return(null==(t=this.userDetails)?void 0:t.sub)||null}getCachedUserAddress(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddress)||null}getCachedUserAddressLabel(){var t;return(null==(t=this.userDetails)?void 0:t.walletAddressLabel)||null}getCachedUserEmail(){var t;return(null==(t=this.userDetails)?void 0:t.email)||null}};vr.PROVIDER_LABELS={apple:"Apple",auth0:"E-Mail","google-oauth2":"Google","<LinkedIn>":"LinkedIn","<X>":"X","<Meta>":"Meta","<Twitch>":"Twitch",github:"GitHub"};var br=vr;function Er(t){return"string"==typeof t?Sr(t):t}function Sr(t){return(new TextEncoder).encode(t)}function Tr(t){return e=function(t){return $e.fromByteArray(new Uint8Array(t))}(t),e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");var e}async function xr(t,e="SHA-256"){let n=await crypto.subtle.digest(e,t);return new Uint8Array(n)}var Ar=(t=>(t.Unexpected="Unexpected",t.Validation="Validation",t.UserCreation="UserCreation",t.Encryption="Encryption",t.Decryption="Decryption",t.Signing="Signing",t.PublicKey="PublicKey",t))(Ar||{}),kr=class extends Error{constructor(t,e,n,r=!1){super(),this.name=t,this.message=e||"",r?this.stack=`${t} (from server): ${e}\n`:Error.captureStackTrace(this),this.id=t,this.developerMessage=e,n instanceof Error?this.cause=n:"string"!=typeof n&&"number"!=typeof n||(this.cause=new Error(`${n}`))}};function Rr(t){var e;if(qn(t)){const n=null==(e=t.response)?void 0:e.data;if(!function(t){return"object"==typeof t&&!0===t.error&&!!t.id&&!!Ar[t.id]}(n))return t;const{id:r,developerMessage:i,cause:o}=n;let s;return o&&(s=new Error(o.message),s.name=o.name,s.stack=o.stack),new kr(r,i||"",s,!0)}return t instanceof Error?t:new Error("Unknown error")}async function Pr(t,e,n,r){var i;const o=await e.encodeToken({ciphertext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/decrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error decrypting on server.");return"string"==typeof s?s:(a=new Uint8Array(s.data),(new TextDecoder).decode(a));var a}var Cr=class{constructor(t,e){this.api=He.create({baseURL:t}),this.auth0=e}async createUser(t){return async function(t,e){let n=!1;try{n=(await t.post("/create-user",{encodedData:e})).data.data}catch(t){throw Rr(t)}if(!n)throw new Error("Error creating user on server.");return!0}(this.api,t)}async decrypt(t,e){return Pr(this.api,this.auth0,t,e)}async encrypt(t,e){return async function(t,e,n,r){var i;const o=await e.encodeToken({plaintext:n,keyName:r});let s=null;try{s=null!=(i=(await t.post("/encrypt",{encodedData:o})).data.data)?i:null}catch(t){throw Rr(t)}if(null===s)throw new Error("Error encrypting on server.");return"string"==typeof s?Sr(s):new Uint8Array(s.data)}(this.api,this.auth0,t,e)}async sign(t,e){return async function(t,e,n,r){const i=await e.encodeToken({data:n,keyName:r});let o=null;try{o=(await t.post("/sign",{encodedData:i})).data.data}catch(t){throw Rr(t)}if(null===o)throw new Error("Error signing data on server.");return"string"==typeof o?Sr(o):new Uint8Array(o.data)}(this.api,this.auth0,t,e)}getSignerSignFn(t){return async e=>await this.sign(e,t)}};function Ir(t,e="utf8"){return r.lW.isBuffer(t)?Br(t.toString("base64")):Br(r.lW.from(t,e).toString("base64"))}function Or(t){return function(t){let e=t.length,n=e%4;if(!n)return t;let i=e,o=4-n,s=e+o,a=r.lW.alloc(s);for(a.write(t);o--;)a.write("=",i++);return a.toString()}(t=t.toString()).replace(/\-/g,"+").replace(/_/g,"/")}function Br(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ur(t){return r.lW.from(Or(t),"base64")}var Lr=Ir;function Nr(t){return or.default.init(t)}Lr.encode=Ir,Lr.decode=function(t,e="utf8"){return r.lW.from(Or(t),"base64").toString(e)},Lr.toBase64=Or,Lr.fromBase64=Br,Lr.toBuffer=Ur;var _r=class t{constructor(t=ar){this.errorEventListenerHandler=new fr,this.tokens=new Set,this.walletName=ur,this.walletVersion=hr,this.config=sr,this.appInfo={name:"",version:""},this.gatewayConfig=cr;let{appName:e,appVersion:n,persistCookie:r,persistLocalStorage:i,auth0Cache:o=sr.auth0Cache,auth0RedirectURI:s,auth0ReturnToURI:a,gatewayConfig:c,initialUserDetails:l,...u}=t;const h="undefined"==typeof location?null:location.origin;this.config={...pr(u,sr),cookieKey:"string"==typeof r?r:r?lr:null,localStorageKey:"string"==typeof i?i:i?lr:null,auth0Cache:"object"==typeof o?"custom":o,auth0RedirectURI:s||h,auth0ReturnToURI:a||h};const{config:d}=this,{cookieKey:f,localStorageKey:p}=d;if("string"==typeof f&&!f.startsWith("othent"))throw new Error('`persistCookie` / `cookieKey` must start with "othent".');if("string"==typeof p&&!p.startsWith("othent"))throw new Error('`persistLocalStorage` / `localStorageKey` must start with "othent".');if(!d.auth0RedirectURI)throw new Error("`auth0RedirectURI` is required.");if(!d.auth0ReturnToURI)throw new Error("`auth0ReturnToURI` is required.");this.appInfo={name:e,version:n},this.gatewayConfig=c||cr;let m=null;if("undefined"!=typeof window)m=window.crypto;else{if("undefined"==typeof global)throw new Error("A Crypto module is needed for Othent to work. If your environment doesn't natively provide one, you should polyfill it.");m=global.crypto}if(this.crypto=m,"eager"===d.autoConnect&&"popup"===d.auth0LogInMethod&&"refresh-tokens"===d.auth0Strategy&&"memory"===o)throw new Error('The browser cannot open the authentication modal automatically before an user interaction. Use `autoConnect = "lazy"` or change any of these other options: `auth0LogInMethod`, `auth0Strategy` or `auth0Cache`.');if(this.auth0=new br({debug:d.debug,domain:d.auth0Domain,clientId:d.auth0ClientId,strategy:d.auth0Strategy,cache:o,refreshTokenExpirationMs:d.auth0RefreshTokenExpirationMs,redirectURI:d.auth0RedirectURI,returnToURI:d.auth0ReturnToURI,loginMethod:d.auth0LogInMethod,appInfo:this.appInfo,initialUserDetails:l,cookieKey:d.cookieKey,localStorageKey:d.localStorageKey}),"eager"===this.config.autoConnect){let t="undefined"==typeof location;if(!t){const e=new URL(location.href),{searchParams:n}=e;n.has("code")||n.has("state")||(t=!0)}t&&this.connect()}if(d.inject&&(window.arweaveWallet=this),!d.throwErrors){["connect","disconnect","getActiveAddress","getActivePublicKey","getAllAddresses","getWalletNames","getUserDetails","getSyncActiveAddress","getSyncActivePublicKey","getSyncAllAddresses","getSyncWalletNames","getSyncUserDetails","sign","dispatch","encrypt","decrypt","signature","signDataItem","signMessage","verifyMessage","privateHash","getArweaveConfig","getPermissions"].forEach((t=>{let e=this[t];"function"==typeof e&&(e=e.bind(this),this[t]=(...t)=>{try{let r=e(...t);return!(n=r)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then||(r=r.catch((t=>(this.onError(t),null)))),r}catch(t){this.onError(t)}var n;return null})}))}this.api=new Cr(this.config.serverBaseURL,this.auth0)}startTabSynching(){return this.config.localStorageKey||console.warn("Calling `Othent.startTabSynching()` is a NOOP unless the `persistLocalStorage` option is used."),this.auth0.initStorageSyncing(),()=>{this.auth0.stopStorageSyncing()}}async completeConnectionAfterRedirect(t){"redirect"!==this.config.auth0LogInMethod&&console.warn('Calling `Othent.completeConnectionAfterRedirect()` is a NOOP unless the `auth0LogInMethod` options is `"redirect"`.');const e=t||("undefined"==typeof location?"":location.href),n=new URL(e.replace(/.+\.auth0:\/\//,"https://")),{searchParams:r}=n;if(!r.has("code")||!r.has("state")||!e)return null;let i=null;try{i=await this.auth0.handleRedirectCallback(e)}finally{"undefined"!=typeof location&&"undefined"!=typeof history&&(r.delete("code"),r.delete("state"),history.replaceState(null,"",n))}return i}get isReady(){return this.auth0.isReady}onError(t){t instanceof Error?this.errorEventListenerHandler.hasListeners?this.errorEventListenerHandler.emit(t):console.warn("Unhandled unthrown error:\n",t,'\nWhen using `throwErrors = false`, you must add at least one error event listener with `othent.addEventListener("error", () => { ... })`'):console.warn("Unknown error type",t)}addEventListener(t,e){let n=null;if("auth"===t)n=this.auth0.getAuthEventListenerHandler();else if("error"===t){if(this.config.throwErrors)throw new Error("You can only listen for `error` events if `throwErrors = false`.");n=this.errorEventListenerHandler}if(!n)throw new Error("Unknown event type");return n.add(e),()=>{n.delete(e)}}removeEventListener(t,e){let n=null;if("auth"===t?n=this.auth0.getAuthEventListenerHandler():"error"===t&&(n=this.errorEventListenerHandler),!n)throw new Error("Unknown event type");n.delete(e)}get isAuthenticated(){return this.auth0.isAuthenticated}requireAuth(){return this.requireUserDataOrThrow().then((()=>{}))}async requireUserDataOrThrow(){"off"===this.config.autoConnect||this.auth0.isAuthenticated||await this.connect(void 0,void 0,this.gatewayConfig);const{sub:t,owner:e}=this.auth0.getCachedUserDetails()||{};if(!t||!e)throw new Error("Missing cached user.");return{sub:t,publicKey:e}}async connect(e,n,r){if(e&&e.toSorted().join("-")!==t.ALL_PERMISSIONS.join("-"))throw new Error("Othent implicitly has access to all available permissions. You should pass `permissions = undefined` or include all of them.");n&&(this.appInfo=n,this.auth0.setAppInfo(n)),this.gatewayConfig=r||cr;let i="",o=null;try{const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Login required"!==t.message&&!(t instanceof E))throw t;console.warn(t.message)}if(!i)try{const t=await this.auth0.logIn();i=t.id_token,o=t.userDetails}catch(t){if(!(t instanceof Error))throw t;if("Redirecting..."===t.message&&await new Promise((()=>{})),t.message.startsWith("Unable to open a popup")||t instanceof v||t instanceof w)return t instanceof w&&t.popup.close(),console.warn(t.message),null;throw t}if(i&&!o){await this.api.createUser(i);const t=await this.auth0.getTokenSilently();i=t.id_token,o=t.userDetails}if(i&&o)return o;throw this.auth0.logOut(),new Error("Unexpected authentication error")}async disconnect(){return this.auth0.logOut()}getActiveAddress(){return Promise.resolve(this.getSyncActiveAddress())}getActivePublicKey(){return Promise.resolve(this.getSyncActivePublicKey())}getAllAddresses(){return Promise.resolve(this.getSyncAllAddresses())}getWalletNames(){return Promise.resolve(this.getSyncWalletNames())}getUserDetails(){return Promise.resolve(this.getSyncUserDetails())}getSyncActiveAddress(){return this.auth0.getCachedUserAddress()||""}getSyncActivePublicKey(){return this.auth0.getCachedUserPublicKey()||""}getSyncAllAddresses(){const t=this.auth0.getCachedUserAddress();return t?[t]:[]}getSyncWalletNames(){const t=this.auth0.getCachedUserAddress(),e=this.auth0.getCachedUserAddressLabel();return Promise.resolve(t&&e?{[t]:e}:{})}getSyncUserDetails(){return this.auth0.getCachedUserDetails()}addCommonTags(t=[]){if(Array.isArray(t)){const e=[{name:"App-Name",value:this.appInfo.name},{name:"App-Version",value:this.appInfo.version}];return[...t,...this.config.tags,...e,...dr]}for(const{name:e,value:n}of this.config.tags)t.addTag(e,n);t.addTag("App-Name",this.appInfo.name),t.addTag("App-Version",this.appInfo.version);for(const{name:e,value:n}of dr)t.addTag(e,n)}async sign(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),r=Nr(this.gatewayConfig),i=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),o=this.addCommonTags(i),s=await r.createTransaction({data:t.data,owner:n,reward:t.reward});o.forEach((t=>{s.addTag(t.name,t.value)}));const a=await s.getSignatureData(),c=await this.api.sign(a,e),l=await xr(c);return s.setSignature({id:Tr(l),owner:n,signature:Tr(c),tags:s.tags,reward:s.reward}),s}async dispatch(t,e){var n;const r=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),i=await this.signDataItem({data:t.data,tags:r,target:t.target}),o=`${(null==e?void 0:e.node)||"https://turbo.ardrive.io"}/tx`;try{const t=await He.post(o,i,{headers:{"Content-Type":"application/octet-stream"},maxBodyLength:1/0,maxContentLength:1/0,responseType:"json"});if(t.status>=400)throw new Error(`${t.status} - ${JSON.stringify(t.data)}`);return{...t.data,type:"BUNDLED"}}catch(r){console.warn(`Error dispatching transaction to ${o} =\n`,r);const i=await this.sign(t),s=null!=(n=null==e?void 0:e.arweave)?n:Nr(this.gatewayConfig),a=await s.transactions.getUploader(i);for(;!a.isComplete;)await a.uploadChunk();return{id:i.id,signature:i.signature,owner:i.owner,type:"BASE"}}}async encrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.encrypt(t,e)}async decrypt(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.decrypt(t,e)}async signature(t){const{sub:e}=await this.requireUserDataOrThrow();return await this.api.sign(t,e)}async signDataItem(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),{data:r,tags:i,...o}=t,s={publicKey:Ur(n),signatureType:1,signatureLength:512,ownerLength:512,sign:this.api.getSignerSignFn(e)},a=Fn(r,s,{...o,tags:this.addCommonTags(i)});return await a.sign(s),a.getRaw().buffer}async signMessage(t,e){const{sub:n}=await this.requireUserDataOrThrow(),r=(null==e?void 0:e.hashAlgorithm)||"SHA-256",i=await this.crypto.subtle.digest(r,Er(t));return await this.api.sign(i,n)}async verifyMessage(t,e,n,r={hashAlgorithm:"SHA-256"}){if(!n){const t=await this.requireUserDataOrThrow();n||(n=t.publicKey)}const i=(null==r?void 0:r.hashAlgorithm)||"SHA-256",o=await this.crypto.subtle.digest(i,Er(t)),s={e:"AQAB",ext:!0,kty:"RSA",n},a=await this.crypto.subtle.importKey("jwk",s,{name:"RSA-PSS",hash:r.hashAlgorithm},!1,["verify"]);return await this.crypto.subtle.verify({name:"RSA-PSS",saltLength:32},a,Er(e),o)}async privateHash(t,e){return xr(Er(t),null==e?void 0:e.hashAlgorithm)}getArweaveConfig(){return Promise.resolve(this.gatewayConfig)}getPermissions(){return Promise.resolve(t.ALL_PERMISSIONS)}addToken(t,e,n){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),this.tokens.add(t),Promise.resolve()}isTokenAdded(t){return console.warn("Othent doesn't currently support this feature and only tracks added tokens temporarily in memory."),Promise.resolve(this.tokens.has(t))}};_r.walletName=ur,_r.walletVersion=hr,_r.ALL_PERMISSIONS=["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_ARWEAVE_CONFIG","ACCESS_PUBLIC_KEY","DECRYPT","DISPATCH","ENCRYPT","SIGN_TRANSACTION","SIGNATURE"];var jr=_r;async function Dr(t,e){try{const n=function(t){const e=t.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=window.atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;t++)r[t]=n.charCodeAt(t);return r.buffer}(t),r=await window.crypto.subtle.importKey("spki",n,{name:"RSA-OAEP",hash:{name:"SHA-256"}},!0,["encrypt"]);return function(t){try{let e="";const n=new Uint8Array(t),r=n.byteLength;for(let t=0;t<r;t++)e+=String.fromCharCode(n[t]);return window.btoa(e)}catch(t){console.error("Eror in buffertoBase64 : ",t)}}(await window.crypto.subtle.encrypt({name:"RSA-OAEP"},r,(new TextEncoder).encode(e)))}catch(t){return console.error("rsaEncrypt error:",t),null}}async function Mr(t){const e={Info:{hashedOthentSub:t},request:"PIN"};return await fetch("https://api2.onairos.uk/getAccountInfoFromOthentSub",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((t=>t.json())).then((t=>t)).catch((t=>console.error(t)))}window.Buffer=r.lW;(0,e.createContext)(null);class Vr extends Error{}Vr.prototype.name="InvalidTokenError";const Fr=async()=>{if(!window.PublicKeyCredential)throw new Error("WebAuthn not supported");try{if(!await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())throw new Error("Biometric authentication not available");return!!await navigator.credentials.get({publicKey:{challenge:new Uint8Array(32),rpId:window.location.hostname,userVerification:"required"}})}catch(t){return console.error("Biometric authentication failed:",t),!1}};function Kr(t){let{onLoginSuccess:n}=t;const[r,i]=(0,e.useState)(!1);return React.createElement("div",{className:"flex flex-col items-center"},React.createElement("button",{onClick:async()=>{i(!0);try{const t=await(async()=>{const t=localStorage.getItem("onairosCredentials");if(!t)return null;try{const e=JSON.parse(t);return(await fetch("https://api2.onairos.uk/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e.username,token:e.token})})).ok?e:(localStorage.removeItem("onairosCredentials"),null)}catch(t){return console.error("Verification failed:",t),null}})();if(t){if(await Fr())return void await n(t.username)}const e=Date.now(),r=encodeURIComponent(window.location.origin+"/auth/callback"),i="onairos://authenticate?nonce=".concat(e,"&callback=").concat(r,"&appName=google");window.location.href=i,setTimeout((()=>{window.location.href="https://apps.apple.com/app/onairos/id123456789"}),2500)}catch(t){console.error("App login failed:",t)}finally{i(!1)}},disabled:r,className:"w-12 h-12 rounded-full shadow-md hover:shadow-lg transition-shadow duration-200 flex items-center justify-center bg-white"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-6 h-6"})),React.createElement("span",{className:"text-xs mt-2 text-gray-600"},"Login with App"))}function Wr(t){let{onSuccess:n,onLoginSuccess:r}=t;const[i,o]=(0,e.useState)(!1);return React.createElement("div",{className:"flex flex-col items-center"},React.createElement("button",{onClick:async()=>{o(!0);try{const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href});if(!await t.connect())throw new Error("Othent connection failed")}catch(t){console.error("Othent login failed:",t)}finally{o(!1)}},disabled:i,className:"w-12 h-12 rounded-full shadow-md hover:shadow-lg transition-shadow duration-200 flex items-center justify-center bg-white"},React.createElement("img",{src:"https://imagepng.org/google-icone-icon/google-icon/",alt:"Othent",className:"w-6 h-6"}),i&&React.createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-50 rounded-full"},React.createElement("div",{className:"animate-spin h-4 w-4 border-2 border-blue-500 rounded-full border-t-transparent"}))),React.createElement("span",{className:"text-xs mt-2 text-gray-600"},"Google"))}function zr(t){let{onLoginSuccess:n,setOthent:r,setHashedOthentSub:i,setEncryptedPin:o}=t;const[s,a]=(0,e.useState)(!1);(0,e.useEffect)((()=>{c()}),[]);const c=async()=>{const t=localStorage.getItem("onairosCredentials");a(!!t)};return React.createElement("div",{className:"flex flex-row justify-center items-center space-x-4"},React.createElement(Wr,{onSuccess:async t=>{r(!0),i(t.hashedOthentSub),o(t.encryptedPin),await n(t.userDetails)},onLoginSuccess:async t=>{n(t,!0)}}),React.createElement(Kr,{hasSavedCredentials:s,onSuccess:n}))}var Hr=a(697),$r=a.n(Hr);function Zr(t){const[r,i]=(0,e.useState)(!1);return n().createElement("div",{className:"bg-white rounded-lg p-4 shadow border border-gray-200"},n().createElement("div",{className:"flex items-center justify-between"},n().createElement("div",{className:"flex items-center space-x-4"},n().createElement("div",{className:"group"},n().createElement("div",null,n().createElement("input",{disabled:!t.active,type:"checkbox",checked:r,onChange:e=>{var n;n=e.target.checked,i(n),console.log("Following has been clicked :",t.title),console.log("With new Checked state now being: ",n),console.log("Current number of selection: ",t.number+1),n?changeGranted(1):changeGranted(-1)}})))),n().createElement("div",{className:"flex items-center"}),t.descriptions&&"Avatar"!==t.title&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Intent: ",t.descriptions),t.rewards&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Rewards: ",t.rewards)))}function Xr(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}function Gr(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}Zr.propTypes={active:$r().bool.isRequired,title:$r().string.isRequired,id:$r().any.isRequired,number:$r().number.isRequired,descriptions:$r().string,rewards:$r().string,size:$r().string.isRequired,changeGranted:$r().func.isRequired,onSelectionChange:$r().func.isRequired};const Yr=t=>Array.isArray(t);function qr(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Jr(t){return"string"==typeof t||Array.isArray(t)}function Qr(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function ti(t,e,n,r){if("function"==typeof e){const[i,o]=Qr(r);e=e(void 0!==n?n:t.custom,i,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,o]=Qr(r);e=e(void 0!==n?n:t.custom,i,o)}return e}function ei(t,e,n){const r=t.getProps();return ti(r,e,void 0!==n?n:r.custom,t)}const ni=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ri=["initial",...ni],ii=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],oi=new Set(ii),si=t=>1e3*t,ai=t=>t/1e3,ci={type:"spring",stiffness:500,damping:25,restSpeed:10},li={type:"keyframes",duration:.8},ui={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},hi=(t,{keyframes:e})=>e.length>2?li:oi.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ci:ui;function di(t,e){return t?t[e]||t.default||t:void 0}const fi=!1,pi=!1,mi=!1,gi=t=>null!==t;function yi(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(gi),o=e&&"loop"!==n&&e%2==1?0:i.length-1;return o&&void 0!==r?r:i[o]}const wi=t=>t;const vi=["read","resolveKeyframes","update","preRender","render","postRender"];function bi(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=vi.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,i=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function a(e){o.has(e)&&(c.schedule(e),t()),e(s)}const c={schedule:(t,i=!1,s=!1)=>{const a=s&&r?e:n;return i&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{s=t,r?i=!0:(r=!0,[e,n]=[n,e],e.forEach(a),e.clear(),r=!1,i&&(i=!1,c.process(t)))}};return c}(o),t)),{}),{read:a,resolveKeyframes:c,update:l,preRender:u,render:h,postRender:d}=s,f=()=>{const o=pi?i.timestamp:performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,40),1),i.timestamp=o,i.isProcessing=!0,a.process(i),c.process(i),l.process(i),u.process(i),h.process(i),d.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(f))};return{schedule:vi.reduce(((e,o)=>{const a=s[o];return e[o]=(e,o=!1,s=!1)=>(n||(n=!0,r=!0,i.isProcessing||t(f)),a.schedule(e,o,s)),e}),{}),cancel:t=>{for(let e=0;e<vi.length;e++)s[vi[e]].cancel(t)},state:i,steps:s}}const{schedule:Ei,cancel:Si,state:Ti,steps:xi}=bi("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:wi,!0),Ai=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,ki=1e-7,Ri=12;function Pi(t,e,n,r){if(t===e&&n===r)return wi;const i=e=>function(t,e,n,r,i){let o,s,a=0;do{s=e+(n-e)/2,o=Ai(s,r,i)-t,o>0?n=s:e=s}while(Math.abs(o)>ki&&++a<Ri);return s}(e,0,1,t,n);return t=>0===t||1===t?t:Ai(i(t),e,r)}const Ci=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ii=t=>e=>1-t(1-e),Oi=Pi(.33,1.53,.69,.99),Bi=Ii(Oi),Ui=Ci(Bi),Li=t=>(t*=2)<1?.5*Bi(t):.5*(2-Math.pow(2,-10*(t-1))),Ni=t=>1-Math.sin(Math.acos(t)),_i=Ii(Ni),ji=Ci(Ni),Di=t=>/^0[^.\s]+$/u.test(t);let Mi=wi,Vi=wi;const Fi=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Ki=t=>e=>"string"==typeof e&&e.startsWith(t),Wi=Ki("--"),zi=Ki("var(--"),Hi=t=>!!zi(t)&&$i.test(t.split("/*")[0].trim()),$i=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zi=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Xi(t,e,n=1){Vi(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,i]=function(t){const e=Zi.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${null!=n?n:r}`,i]}(t);if(!r)return;const o=window.getComputedStyle(e).getPropertyValue(r);if(o){const t=o.trim();return Fi(t)?parseFloat(t):t}return Hi(i)?Xi(i,e,n+1):i}const Gi=(t,e,n)=>n>e?e:n<t?t:n,Yi={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},qi={...Yi,transform:t=>Gi(0,1,t)},Ji={...Yi,default:1},Qi=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),to=Qi("deg"),eo=Qi("%"),no=Qi("px"),ro=Qi("vh"),io=Qi("vw"),oo={...eo,parse:t=>eo.parse(t)/100,transform:t=>eo.transform(100*t)},so=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),ao=t=>t===Yi||t===no,co=(t,e)=>parseFloat(t.split(", ")[e]),lo=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return co(i[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?co(e[1],t):0}},uo=new Set(["x","y","z"]),ho=ii.filter((t=>!uo.has(t)));const fo={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:lo(4,13),y:lo(5,14)};fo.translateX=fo.x,fo.translateY=fo.y;const po=t=>e=>e.test(t),mo=[Yi,no,eo,to,io,ro,{test:t=>"auto"===t,parse:t=>t}],go=t=>mo.find(po(t)),yo=new Set;let wo=!1,vo=!1;function bo(){if(vo){const t=Array.from(yo).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return ho.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}vo=!1,wo=!1,yo.forEach((t=>t.complete())),yo.clear()}function Eo(){yo.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(vo=!0)}))}class So{constructor(t,e,n,r,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yo.add(this),wo||(wo=!0,Ei.read(Eo),Ei.resolveKeyframes(bo))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let i=0;i<t.length;i++)if(null===t[i])if(0===i){const i=null==r?void 0:r.get(),o=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const r=n.readValue(e,o);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=o),r&&void 0===i&&r.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),yo.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,yo.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const To=t=>Math.round(1e5*t)/1e5,xo=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ao=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ko=(t,e)=>n=>Boolean("string"==typeof n&&Ao.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Ro=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[i,o,s,a]=r.match(xo);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},Po={...Yi,transform:t=>Math.round((t=>Gi(0,255,t))(t))},Co={test:ko("rgb","red"),parse:Ro("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Po.transform(t)+", "+Po.transform(e)+", "+Po.transform(n)+", "+To(qi.transform(r))+")"};const Io={test:ko("#"),parse:function(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:Co.transform},Oo={test:ko("hsl","hue"),parse:Ro("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+eo.transform(To(e))+", "+eo.transform(To(n))+", "+To(qi.transform(r))+")"},Bo={test:t=>Co.test(t)||Io.test(t)||Oo.test(t),parse:t=>Co.test(t)?Co.parse(t):Oo.test(t)?Oo.parse(t):Io.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Co.transform(t):Oo.transform(t)},Uo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Lo="number",No="color",_o="var",jo="var(",Do="${}",Mo=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Vo(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const s=e.replace(Mo,(t=>(Bo.test(t)?(r.color.push(o),i.push(No),n.push(Bo.parse(t))):t.startsWith(jo)?(r.var.push(o),i.push(_o),n.push(t)):(r.number.push(o),i.push(Lo),n.push(parseFloat(t))),++o,Do))).split(Do);return{values:n,split:s,indexes:r,types:i}}function Fo(t){return Vo(t).values}function Ko(t){const{split:e,types:n}=Vo(t),r=e.length;return t=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],void 0!==t[o]){const e=n[o];i+=e===Lo?To(t[o]):e===No?Bo.transform(t[o]):t[o]}return i}}const Wo=t=>"number"==typeof t?0:t;const zo={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(xo))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Uo))||void 0===n?void 0:n.length)||0)>0},parse:Fo,createTransformer:Ko,getAnimatableNone:function(t){const e=Fo(t);return Ko(t)(e.map(Wo))}},Ho=new Set(["brightness","contrast","saturate","opacity"]);function $o(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(xo)||[];if(!r)return t;const i=n.replace(r,"");let o=Ho.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const Zo=/\b([a-z-]*)\(.*?\)/gu,Xo={...zo,getAnimatableNone:t=>{const e=t.match(Zo);return e?e.map($o).join(" "):t}},Go={borderWidth:no,borderTopWidth:no,borderRightWidth:no,borderBottomWidth:no,borderLeftWidth:no,borderRadius:no,radius:no,borderTopLeftRadius:no,borderTopRightRadius:no,borderBottomRightRadius:no,borderBottomLeftRadius:no,width:no,maxWidth:no,height:no,maxHeight:no,top:no,right:no,bottom:no,left:no,padding:no,paddingTop:no,paddingRight:no,paddingBottom:no,paddingLeft:no,margin:no,marginTop:no,marginRight:no,marginBottom:no,marginLeft:no,backgroundPositionX:no,backgroundPositionY:no},Yo={rotate:to,rotateX:to,rotateY:to,rotateZ:to,scale:Ji,scaleX:Ji,scaleY:Ji,scaleZ:Ji,skew:to,skewX:to,skewY:to,distance:no,translateX:no,translateY:no,translateZ:no,x:no,y:no,z:no,perspective:no,transformPerspective:no,opacity:qi,originX:oo,originY:oo,originZ:no},qo={...Yi,transform:Math.round},Jo={...Go,...Yo,zIndex:qo,size:no,fillOpacity:qi,strokeOpacity:qi,numOctaves:qo},Qo={...Jo,color:Bo,backgroundColor:Bo,outlineColor:Bo,fill:Bo,stroke:Bo,borderColor:Bo,borderTopColor:Bo,borderRightColor:Bo,borderBottomColor:Bo,borderLeftColor:Bo,filter:Xo,WebkitFilter:Xo},ts=t=>Qo[t];function es(t,e){let n=ts(t);return n!==Xo&&(n=zo),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ns=new Set(["auto","none","0"]);class rs extends So{constructor(t,e,n,r,i){super(t,e,n,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),Hi(r))){const i=Xi(r,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!so.has(n)||2!==t.length)return;const[r,i]=t,o=go(r),s=go(i);if(o!==s)if(ao(o)&&ao(s))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||Di(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,i=0;for(;i<t.length&&!r;){const e=t[i];"string"==typeof e&&!ns.has(e)&&Vo(e).values.length&&(r=t[i]),i++}if(r&&n)for(const i of e)t[i]=es(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=fo[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,s=r[o];r[o]=fo[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}function is(t){return"function"==typeof t}let os;function ss(){os=void 0}const as={now:()=>(void 0===os&&as.set(Ti.isProcessing||pi?Ti.timestamp:performance.now()),os),set:t=>{os=t,queueMicrotask(ss)}},cs=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!zo.test(t)&&"0"!==t||t.startsWith("url(")));function ls(t,e,n,r){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],s=cs(i,e),a=cs(o,e);return Mi(s===a,`You are trying to animate ${e} from "${i}" to "${o}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${o} via the \`style\` property.`),!(!s||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||is(n))&&r)}class us{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",...s}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=as.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:i,repeatType:o,...s},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Eo(),bo()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=as.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:i,delay:o,onComplete:s,onUpdate:a,isGenerator:c}=this.options;if(!c&&!ls(t,n,r,i)){if(mi||!o)return null==a||a(yi(t,this.options,e)),null==s||s(),void this.resolveFinishedPromise();this.options.duration=0}const l=this.initPlayback(t,e);!1!==l&&(this._resolved={keyframes:t,finalKeyframe:e,...l},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}const hs=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},ds=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)r+=t(hs(0,i-1,e))+", ";return`linear(${r.substring(0,r.length-2)})`};function fs(t,e){return e?t*(1e3/e):0}const ps=5;function ms(t,e,n){const r=Math.max(e-ps,0);return fs(n-t(r),e-r)}const gs={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ys=.001;function ws({duration:t=gs.duration,bounce:e=gs.bounce,velocity:n=gs.velocity,mass:r=gs.mass}){let i,o;Mi(t<=si(gs.maxDuration),"Spring duration must be 10 seconds or less");let s=1-e;s=Gi(gs.minDamping,gs.maxDamping,s),t=Gi(gs.minDuration,gs.maxDuration,ai(t)),s<1?(i=e=>{const r=e*s,i=r*t,o=r-n,a=bs(e,s),c=Math.exp(-i);return ys-o/a*c},o=e=>{const r=e*s*t,o=r*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,c=Math.exp(-r),l=bs(Math.pow(e,2),s);return(-i(e)+ys>0?-1:1)*((o-a)*c)/l}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-ys,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let n=1;n<vs;n++)r-=t(r)/e(r);return r}(i,o,5/t);if(t=si(t),isNaN(a))return{stiffness:gs.stiffness,damping:gs.damping,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*s*Math.sqrt(r*e),duration:t}}}const vs=12;function bs(t,e){return t*Math.sqrt(1-e*e)}const Es=2e4;function Ss(t){let e=0;let n=t.next(e);for(;!n.done&&e<Es;)e+=50,n=t.next(e);return e>=Es?1/0:e}const Ts=["duration","bounce"],xs=["stiffness","damping","mass"];function As(t,e){return e.some((e=>void 0!==t[e]))}function ks(t=gs.visualDuration,e=gs.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:c,damping:l,mass:u,duration:h,velocity:d,isResolvedFromDuration:f}=function(t){let e={velocity:gs.velocity,stiffness:gs.stiffness,damping:gs.damping,mass:gs.mass,isResolvedFromDuration:!1,...t};if(!As(t,xs)&&As(t,Ts))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),i=r*r,o=2*Gi(.05,1,1-t.bounce)*Math.sqrt(i);e={...e,mass:gs.mass,stiffness:i,damping:o}}else{const n=ws(t);e={...e,...n,mass:gs.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-ai(n.velocity||0)}),p=d||0,m=l/(2*Math.sqrt(c*u)),g=s-o,y=ai(Math.sqrt(c/u)),w=Math.abs(g)<5;let v;if(r||(r=w?gs.restSpeed.granular:gs.restSpeed.default),i||(i=w?gs.restDelta.granular:gs.restDelta.default),m<1){const t=bs(y,m);v=e=>{const n=Math.exp(-m*y*e);return s-n*((p+m*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===m)v=t=>s-Math.exp(-y*t)*(g+(p+y*g)*t);else{const t=y*Math.sqrt(m*m-1);v=e=>{const n=Math.exp(-m*y*e),r=Math.min(t*e,300);return s-n*((p+m*y*g)*Math.sinh(r)+t*g*Math.cosh(r))/t}}const b={calculatedDuration:f&&h||null,next:t=>{const e=v(t);if(f)a.done=t>=h;else{let n=0;m<1&&(n=0===t?si(p):ms(v,t,e));const o=Math.abs(n)<=r,c=Math.abs(s-e)<=i;a.done=o&&c}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(Ss(b),Es),e=ds((e=>b.next(t*e).value),t,30);return t+"ms "+e}};return b}function Rs({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:c,restDelta:l=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},f=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let p=n*e;const m=h+p,g=void 0===s?m:s(m);g!==m&&(p=g-h);const y=t=>-p*Math.exp(-t/r),w=t=>g+y(t),v=t=>{const e=y(t),n=w(t);d.done=Math.abs(e)<=l,d.value=d.done?g:n};let b,E;const S=t=>{(t=>void 0!==a&&t<a||void 0!==c&&t>c)(d.value)&&(b=t,E=ks({keyframes:[d.value,f(d.value)],velocity:ms(w,t,d.value),damping:i,stiffness:o,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return E||void 0!==b||(e=!0,v(t),S(t)),void 0!==b&&t>=b?E.next(t-b):(!e&&v(t),d)}}}const Ps=Pi(.42,0,1,1),Cs=Pi(0,0,.58,1),Is=Pi(.42,0,.58,1),Os=t=>Array.isArray(t)&&"number"==typeof t[0],Bs={linear:wi,easeIn:Ps,easeInOut:Is,easeOut:Cs,circIn:Ni,circInOut:ji,circOut:_i,backIn:Bi,backInOut:Ui,backOut:Oi,anticipate:Li},Us=t=>{if(Os(t)){Vi(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,i]=t;return Pi(e,n,r,i)}return"string"==typeof t?(Vi(void 0!==Bs[t],`Invalid easing type '${t}'`),Bs[t]):t},Ls=(t,e)=>n=>e(t(n)),Ns=(...t)=>t.reduce(Ls),_s=(t,e,n)=>t+(e-t)*n;function js(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Ds(t,e){return n=>n>0?e:t}const Ms=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Vs=[Io,Co,Oo];function Fs(t){const e=(t=>Vs.find((e=>e.test(t))))(t);if(Mi(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let n=e.parse(t);return e===Oo&&(n=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let i=0,o=0,s=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;i=js(a,r,t+1/3),o=js(a,r,t),s=js(a,r,t-1/3)}else i=o=s=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*s),alpha:r}}(n)),n}const Ks=(t,e)=>{const n=Fs(t),r=Fs(e);if(!n||!r)return Ds(t,e);const i={...n};return t=>(i.red=Ms(n.red,r.red,t),i.green=Ms(n.green,r.green,t),i.blue=Ms(n.blue,r.blue,t),i.alpha=_s(n.alpha,r.alpha,t),Co.transform(i))},Ws=new Set(["none","hidden"]);function zs(t,e){return n=>_s(t,e,n)}function Hs(t){return"number"==typeof t?zs:"string"==typeof t?Hi(t)?Ds:Bo.test(t)?Ks:Xs:Array.isArray(t)?$s:"object"==typeof t?Bo.test(t)?Ks:Zs:Ds}function $s(t,e){const n=[...t],r=n.length,i=t.map(((t,n)=>Hs(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=i[e](t);return n}}function Zs(t,e){const n={...t,...e},r={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(r[i]=Hs(t[i])(t[i],e[i]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Xs=(t,e)=>{const n=zo.createTransformer(e),r=Vo(t),i=Vo(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ws.has(t)&&!i.values.length||Ws.has(e)&&!r.values.length?function(t,e){return Ws.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Ns($s(function(t,e){var n;const r=[],i={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const s=e.types[o],a=t.indexes[s][i[s]],c=null!==(n=t.values[a])&&void 0!==n?n:0;r[o]=c,i[s]++}return r}(r,i),i.values),n):(Mi(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Ds(t,e))};function Gs(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return _s(t,e,n);return Hs(t)(t,e)}function Ys(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const o=t.length;if(Vi(o===e.length,"Both input and output ranges must be the same length"),1===o)return()=>e[0];if(2===o&&t[0]===t[1])return()=>e[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=function(t,e,n){const r=[],i=n||Gs,o=t.length-1;for(let n=0;n<o;n++){let o=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||wi:e;o=Ns(t,o)}r.push(o)}return r}(e,r,i),a=s.length,c=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=hs(t[n],t[n+1],e);return s[n](r)};return n?e=>c(Gi(t[0],t[o-1],e)):c}function qs(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=hs(0,e,r);t.push(_s(n,1,i))}}(e,t.length-1),e}function Js({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(Us):Us(r),o={done:!1,value:e[0]},s=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:qs(e),t),a=Ys(s,e,{ease:Array.isArray(i)?i:(c=e,l=i,c.map((()=>l||Is)).splice(0,c.length-1))});var c,l;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const Qs=t=>{const e=({timestamp:e})=>t(e);return{start:()=>Ei.update(e,!0),stop:()=>Si(e),now:()=>Ti.isProcessing?Ti.timestamp:as.now()}},ta={decay:Rs,inertia:Rs,tween:Js,keyframes:Js,spring:ks},ea=t=>t/100;class na extends us{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:i}=this.options,o=(null==r?void 0:r.KeyframeResolver)||So;this.resolver=new o(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=this.options,s=is(e)?e:ta[e]||Js;let a,c;s!==Js&&"number"!=typeof t[0]&&(a=Ns(ea,Gs(t[0],t[1])),t=[0,100]);const l=s({...this.options,keyframes:t});"mirror"===i&&(c=s({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=Ss(l));const{calculatedDuration:u}=l,h=u+r;return{generator:l,mirroredGenerator:c,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:h,totalDuration:h*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:i,mirroredGenerator:o,mapPercentToKeyframes:s,keyframes:a,calculatedDuration:c,totalDuration:l,resolvedDuration:u}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:d,repeatType:f,repeatDelay:p,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=l);let w=this.currentTime,v=i;if(d){const t=Math.min(this.currentTime,l)/u;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===f?(n=1-n,p&&(n-=p/u)):"mirror"===f&&(v=o)),w=Gi(0,1,n)*u}const b=y?{done:!1,value:a[0]}:v.next(w);s&&(b.value=s(b.value));let{done:E}=b;y||null===c||(E=this.speed>=0?this.currentTime>=l:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&E);return S&&void 0!==r&&(b.value=yi(a,this.options,r)),m&&m(b.value),S&&this.finish(),b}get duration(){const{resolved:t}=this;return t?ai(t.calculatedDuration):0}get time(){return ai(this.currentTime)}set time(t){t=si(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=ai(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Qs,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const ra=new Set(["opacity","clipPath","filter","transform"]);function ia(t){let e;return()=>(void 0===e&&(e=t()),e)}const oa={linearEasing:void 0};function sa(t,e){const n=ia(t);return()=>{var t;return null!==(t=oa[e])&&void 0!==t?t:n()}}const aa=sa((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function ca(t){return Boolean("function"==typeof t&&aa()||!t||"string"==typeof t&&(t in ua||aa())||Os(t)||Array.isArray(t)&&t.every(ca))}const la=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,ua={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:la([0,.65,.55,1]),circOut:la([.55,0,1,.45]),backIn:la([.31,.01,.66,-.59]),backOut:la([.33,1.53,.69,.99])};function ha(t,e){return t?"function"==typeof t&&aa()?ds(t,e):Os(t)?la(t):Array.isArray(t)?t.map((t=>ha(t,e)||ua.easeOut)):ua[t]:void 0}function da(t,e,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeInOut",times:c}={}){const l={[e]:n};c&&(l.offset=c);const u=ha(a,i);return Array.isArray(u)&&(l.easing=u),t.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}function fa(t,e){t.timeline=e,t.onfinish=null}const pa=ia((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const ma={anticipate:Li,backInOut:Ui,circInOut:ji};class ga extends us{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new rs(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:i,ease:o,type:s,motionValue:a,name:c,startTime:l}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var u;if("string"==typeof o&&aa()&&o in ma&&(o=ma[o]),is((u=this.options).type)||"spring"===u.type||!ca(u.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:c,...l}=this.options,u=function(t,e){const n=new na({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const i=[];let o=0;for(;!r.done&&o<2e4;)r=n.sample(o),i.push(r.value),o+=10;return{times:void 0,keyframes:i,duration:o-10,ease:"linear"}}(t,l);1===(t=u.keyframes).length&&(t[1]=t[0]),r=u.duration,i=u.times,o=u.ease,s="keyframes"}const h=da(a.owner.current,c,t,{...this.options,duration:r,times:i,ease:o});return h.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(fa(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(yi(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:r,times:i,type:s,ease:o,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return ai(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return ai(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=si(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return wi;const{animation:n}=e;fa(n,t)}else this.pendingTimeline=t;return wi}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:i,ease:o,times:s}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:c,...l}=this.options,u=new na({...l,keyframes:n,duration:r,type:i,ease:o,times:s,isGenerator:!0}),h=si(this.time);t.setWithVelocity(u.sample(h-10).value,u.sample(h).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:o,type:s}=t;return pa()&&n&&ra.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==i&&0!==o&&"inertia"!==s}}const ya=ia((()=>void 0!==window.ScrollTimeline));class wa{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>ya()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const va=(t,e,n,r={},i,o)=>s=>{const a=di(r,t)||{},c=a.delay||r.delay||0;let{elapsed:l=0}=r;l-=si(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:i};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:s,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length})(a)||(u={...u,...hi(t,u)}),u.duration&&(u.duration=si(u.duration)),u.repeatDelay&&(u.repeatDelay=si(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let h=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(u.duration=0,0===u.delay&&(h=!0)),(mi||fi)&&(h=!0,u.duration=0,u.delay=0),h&&!o&&void 0!==e.get()){const t=yi(u.keyframes,a);if(void 0!==t)return Ei.update((()=>{u.onUpdate(t),u.onComplete()})),new wa([])}return!o&&ga.supports(u)?new ga(u):new na(u)},ba=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Ea=t=>Yr(t)?t[t.length-1]||0:t;function Sa(t,e){-1===t.indexOf(e)&&t.push(e)}function Ta(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class xa{constructor(){this.subscriptions=[]}add(t){return Sa(this.subscriptions,t),()=>Ta(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let i=0;i<r;i++){const r=this.subscriptions[i];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Aa={current:void 0};class ka{constructor(t,e={}){this.version="11.15.0",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=as.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=as.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new xa);const n=this.events[t].add(e);return"change"===t?()=>{n(),Ei.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return Aa.current&&Aa.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=as.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return fs(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ra(t,e){return new ka(t,e)}function Pa(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ra(n))}const Ca=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ia="data-"+Ca("framerAppearId");function Oa(t){return t.props[Ia]}const Ba=t=>Boolean(t&&t.getVelocity);function Ua(t,e){const n=t.getValue("willChange");if(r=n,Boolean(Ba(r)&&r.add))return n.add(e);var r}function La({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Na(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var o;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...c}=e;r&&(s=r);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const e in c){const r=t.getValue(e,null!==(o=t.latestValues[e])&&void 0!==o?o:null),i=c[e];if(void 0===i||u&&La(u,e))continue;const a={delay:n,...di(s||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Oa(t);if(n){const t=window.MotionHandoffAnimation(n,e,Ei);null!==t&&(a.startTime=t,h=!0)}}Ua(t,e),r.start(va(e,r,i,t.shouldReduceMotion&&oi.has(e)?{type:!1}:a,t,h));const d=r.animation;d&&l.push(d)}return a&&Promise.all(l).then((()=>{Ei.update((()=>{a&&function(t,e){const n=ei(t,e);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const e in o)Pa(t,e,Ea(o[e]))}(t,a)}))})),l}function _a(t,e,n={}){var r;const i=ei(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(o=n.transitionOverride);const s=i?()=>Promise.all(Na(t,i,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:i=0,staggerChildren:s,staggerDirection:a}=o;return function(t,e,n=0,r=0,i=1,o){const s=[],a=(t.variantChildren.size-1)*r,c=1===i?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(ja).forEach(((t,r)=>{t.notify("AnimationStart",e),s.push(_a(t,e,{...o,delay:n+c(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(s)}(t,e,i+r,s,a,n)}:()=>Promise.resolve(),{when:c}=o;if(c){const[t,e]="beforeChildren"===c?[s,a]:[a,s];return t().then((()=>e()))}return Promise.all([s(),a(n.delay)])}function ja(t,e){return t.sortNodePosition(e)}const Da=ri.length;function Ma(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Ma(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Da;n++){const r=ri[n],i=t.props[r];(Jr(i)||!1===i)&&(e[r]=i)}return e}const Va=[...ni].reverse(),Fa=ni.length;function Ka(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map((e=>_a(t,e,n)));r=Promise.all(i)}else if("string"==typeof e)r=_a(t,e,n);else{const i="function"==typeof e?ei(t,e,n.custom):e;r=Promise.all(Na(t,i,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Wa(t){let e=Ka(t),n=$a(),r=!0;const i=e=>(n,r)=>{var i;const o=ei(t,r,"exit"===e?null===(i=t.presenceContext)||void 0===i?void 0:i.custom:void 0);if(o){const{transition:t,transitionEnd:e,...r}=o;n={...n,...r,...e}}return n};function o(o){const{props:s}=t,a=Ma(t.parent)||{},c=[],l=new Set;let u={},h=1/0;for(let e=0;e<Fa;e++){const d=Va[e],f=n[d],p=void 0!==s[d]?s[d]:a[d],m=Jr(p),g=d===o?f.isActive:null;!1===g&&(h=e);let y=p===a[d]&&p!==s[d]&&m;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),f.protectedKeys={...u},!f.isActive&&null===g||!p&&!f.prevProp||Gr(p)||"boolean"==typeof p)continue;const w=za(f.prevProp,p);let v=w||d===o&&f.isActive&&!y&&m||e>h&&m,b=!1;const E=Array.isArray(p)?p:[p];let S=E.reduce(i(d),{});!1===g&&(S={});const{prevResolvedValues:T={}}=f,x={...T,...S},A=e=>{v=!0,l.has(e)&&(b=!0,l.delete(e)),f.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=S[t],n=T[t];if(u.hasOwnProperty(t))continue;let r=!1;r=Yr(e)&&Yr(n)?!qr(e,n):e!==n,r?null!=e?A(t):l.add(t):void 0!==e&&l.has(t)?A(t):f.protectedKeys[t]=!0}f.prevProp=p,f.prevResolvedValues=S,f.isActive&&(u={...u,...S}),r&&t.blockInitialAnimation&&(v=!1);v&&(!(y&&w)||b)&&c.push(...E.map((t=>({animation:t,options:{type:d}}))))}if(l.size){const e={};l.forEach((n=>{const r=t.getBaseTarget(n),i=t.getValue(n);i&&(i.liveStyle=!0),e[n]=null!=r?r:null})),c.push({animation:e})}let d=Boolean(c.length);return!r||!1!==s.initial&&s.initial!==s.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?e(c):Promise.resolve()}return{animateChanges:o,setActive:function(e,r){var i;if(n[e].isActive===r)return Promise.resolve();null===(i=t.variantChildren)||void 0===i||i.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=$a(),r=!0}}}function za(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!qr(e,t)}function Ha(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function $a(){return{animate:Ha(!0),whileInView:Ha(),whileHover:Ha(),whileTap:Ha(),whileDrag:Ha(),whileFocus:Ha(),exit:Ha()}}class Za{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Xa=0;const Ga={animation:{Feature:class extends Za{constructor(t){super(t),t.animationState||(t.animationState=Wa(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Gr(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Za{constructor(){super(...arguments),this.id=Xa++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}},Ya={x:!1,y:!1};function qa(){return Ya.x||Ya.y}function Ja(t,e){const n=function(t,e,n){var r;if(t instanceof Element)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const o=null!==(r=null==n?void 0:n[t])&&void 0!==r?r:i.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}(t),r=new AbortController;return[n,{passive:!0,...e,signal:r.signal},()=>r.abort()]}function Qa(t){return e=>{"touch"===e.pointerType||qa()||t(e)}}const tc=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,ec=new WeakSet;function nc(t){return e=>{"Enter"===e.key&&t(e)}}function rc(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const ic=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const oc=(t,e)=>!!e&&(t===e||oc(t,e.parentElement));function sc(t){return tc(t)&&!qa()}function ac(t,e,n={}){const[r,i,o]=Ja(t,n),s=t=>{const r=t.currentTarget;if(!sc(t)||ec.has(r))return;ec.add(r);const o=e(t),s=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",c),sc(t)&&ec.has(r)&&(ec.delete(r),o&&o(t,{success:e}))},a=t=>{s(t,n.useGlobalTarget||oc(r,t.target))},c=t=>{s(t,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",c,i)};return r.forEach((t=>{(function(t){return ic.has(t.tagName)||-1!==t.tabIndex})(t)||(t.tabIndex=0);(n.useGlobalTarget?window:t).addEventListener("pointerdown",s,i),t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const r=nc((()=>{if(ec.has(n))return;rc(n,"down");const t=nc((()=>{rc(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>rc(n,"cancel")),e)}));n.addEventListener("keydown",r,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",r)),e)})(t,i)),i)})),o}function cc(t){return{point:{x:t.pageX,y:t.pageY}}}function lc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function uc(t,e,n,r){return lc(t,e,(t=>e=>tc(e)&&t(e,cc(e)))(n),r)}const hc=(t,e)=>Math.abs(t-e);class dc{constructor(t,e,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=mc(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=hc(t.x,e.x),r=hc(t.y,e.y);return Math.sqrt(n**2+r**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:r}=t,{timestamp:i}=Ti;this.history.push({...r,timestamp:i});const{onStart:o,onMove:s}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=fc(e,this.transformPagePoint),Ei.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=mc("pointercancel"===t.type?this.lastMoveEventInfo:fc(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),r&&r(t,o)},!tc(t))return;this.dragSnapToOrigin=i,this.handlers=e,this.transformPagePoint=n,this.contextWindow=r||window;const o=fc(cc(t),this.transformPagePoint),{point:s}=o,{timestamp:a}=Ti;this.history=[{...s,timestamp:a}];const{onSessionStart:c}=e;c&&c(t,mc(o,this.history)),this.removeListeners=Ns(uc(this.contextWindow,"pointermove",this.handlePointerMove),uc(this.contextWindow,"pointerup",this.handlePointerUp),uc(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Si(this.updatePoint)}}function fc(t,e){return e?{point:e(t.point)}:t}function pc(t,e){return{x:t.x-e.x,y:t.y-e.y}}function mc({point:t},e){return{point:t,delta:pc(t,yc(e)),offset:pc(t,gc(e)),velocity:wc(e,.1)}}function gc(t){return t[0]}function yc(t){return t[t.length-1]}function wc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=yc(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>si(e)));)n--;if(!r)return{x:0,y:0};const o=ai(i.timestamp-r.timestamp);if(0===o)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function vc(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const bc=.9999,Ec=1.0001,Sc=-.01,Tc=.01;function xc(t){return t.max-t.min}function Ac(t,e,n,r=.5){t.origin=r,t.originPoint=_s(e.min,e.max,t.origin),t.scale=xc(n)/xc(e),t.translate=_s(n.min,n.max,t.origin)-t.originPoint,(t.scale>=bc&&t.scale<=Ec||isNaN(t.scale))&&(t.scale=1),(t.translate>=Sc&&t.translate<=Tc||isNaN(t.translate))&&(t.translate=0)}function kc(t,e,n,r){Ac(t.x,e.x,n.x,r?r.originX:void 0),Ac(t.y,e.y,n.y,r?r.originY:void 0)}function Rc(t,e,n){t.min=n.min+e.min,t.max=t.min+xc(e)}function Pc(t,e,n){t.min=e.min-n.min,t.max=t.min+xc(e)}function Cc(t,e,n){Pc(t.x,e.x,n.x),Pc(t.y,e.y,n.y)}function Ic(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function Oc(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}const Bc=.35;function Uc(t,e,n){return{min:Lc(t,e),max:Lc(t,n)}}function Lc(t,e){return"number"==typeof t?t:t[e]||0}const Nc=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),_c=()=>({x:{min:0,max:0},y:{min:0,max:0}});function jc(t){return[t("x"),t("y")]}function Dc({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Mc(t){return void 0===t||1===t}function Vc({scale:t,scaleX:e,scaleY:n}){return!Mc(t)||!Mc(e)||!Mc(n)}function Fc(t){return Vc(t)||Kc(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Kc(t){return Wc(t.x)||Wc(t.y)}function Wc(t){return t&&"0%"!==t}function zc(t,e,n){return n+e*(t-n)}function Hc(t,e,n,r,i){return void 0!==i&&(t=zc(t,i,r)),zc(t,n,r)+e}function $c(t,e=0,n=1,r,i){t.min=Hc(t.min,e,n,r,i),t.max=Hc(t.max,e,n,r,i)}function Zc(t,{x:e,y:n}){$c(t.x,e.translate,e.scale,e.originPoint),$c(t.y,n.translate,n.scale,n.originPoint)}const Xc=.999999999999,Gc=1.0000000000001;function Yc(t,e){t.min=t.min+e,t.max=t.max+e}function qc(t,e,n,r,i=.5){$c(t,e,n,_s(t.min,t.max,i),r)}function Jc(t,e){qc(t.x,e.x,e.scaleX,e.scale,e.originX),qc(t.y,e.y,e.scaleY,e.scale,e.originY)}function Qc(t,e){return Dc(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}const tl=({current:t})=>t?t.ownerDocument.defaultView:null,el=new WeakMap;class nl{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_c(),this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:r}=this.getProps();this.panSession=new dc(t,{onSessionStart:t=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(cc(t).point)},onStart:(t,e)=>{const{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=n)||"y"===o?Ya[o]?null:(Ya[o]=!0,()=>{Ya[o]=!1}):Ya.x||Ya.y?null:(Ya.x=Ya.y=!0,()=>{Ya.x=Ya.y=!1}),!this.openDragLock))return;var o;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),jc((t=>{let e=this.getAxisMotionValue(t).get()||0;if(eo.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[t];if(r){e=xc(r)*(parseFloat(e)/100)}}}this.originPoint[t]=e})),i&&Ei.postRender((()=>i(t,e))),Ua(this.visualElement,"transform");const{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:s}=e;if(r&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(s),void(null!==this.currentDirection&&i&&i(this.currentDirection));this.updateAxis("x",e.point,s),this.updateAxis("y",e.point,s),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>jc((t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())}))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:r,contextWindow:tl(this.visualElement)})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:r}=e;this.startAnimation(r);const{onDragEnd:i}=this.getProps();i&&Ei.postRender((()=>i(t,e)))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,n){const{drag:r}=this.getProps();if(!n||!rl(t,r,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:n},r){return void 0!==e&&t<e?t=r?_s(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?_s(n,t,r.max):Math.min(t,n)),t}(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,i=this.constraints;e&&vc(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(t,{top:e,left:n,bottom:r,right:i}){return{x:Ic(t.x,n,i),y:Ic(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=Bc){return!1===t?t=0:!0===t&&(t=Bc),{x:Uc(t,"left","right"),y:Uc(t,"top","bottom")}}(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&jc((t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(r.layoutBox[t],this.constraints[t]))}))}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!vc(t))return!1;const n=t.current;Vi(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=function(t,e,n){const r=Qc(t,n),{scroll:i}=e;return i&&(Yc(r.x,i.offset.x),Yc(r.y,i.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Oc(t.x,e.x),y:Oc(t.y,e.y)}}(r.layout.layoutBox,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=Dc(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},c=jc((s=>{if(!rl(s,e,this.currentDirection))return;let c=a&&a[s]||{};o&&(c={min:0,max:0});const l=r?200:1e6,u=r?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(s,h)}));return Promise.all(c).then(s)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return Ua(this.visualElement,t),n.start(va(t,n,0,e,this.visualElement,!1))}stopAnimation(){jc((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){jc((t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()}))}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),r=n[e];return r||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){jc((e=>{const{drag:n}=this.getProps();if(!rl(e,n,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(e);if(r&&r.layout){const{min:n,max:o}=r.layout.layoutBox[e];i.set(t[e]-_s(n,o,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!vc(e)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};jc((t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const n=e.get();r[t]=function(t,e){let n=.5;const r=xc(t),i=xc(e);return i>r?n=hs(e.min,e.max-r,t.min):r>i&&(n=hs(t.min,t.max-i,e.min)),Gi(0,1,n)}({min:n,max:n},this.constraints[t])}}));const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),jc((e=>{if(!rl(e,t,null))return;const n=this.getAxisMotionValue(e),{min:i,max:o}=this.constraints[e];n.set(_s(i,o,r[e]))}))}addListeners(){if(!this.visualElement.current)return;el.set(this.visualElement,this);const t=uc(this.visualElement.current,"pointerdown",(t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)})),e=()=>{const{dragConstraints:t}=this.getProps();vc(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,r=n.addEventListener("measure",e);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Ei.read(e);const i=lc(window,"resize",(()=>this.scalePositionWithinConstraints())),o=n.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(jc((e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))})),this.visualElement.render())}));return()=>{i(),t(),r(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=Bc,dragMomentum:s=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function rl(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const il=t=>(e,n)=>{t&&Ei.postRender((()=>t(e,n)))};var ol=a(893);const sl=(0,e.createContext)(null);const al=(0,e.createContext)({}),cl=(0,e.createContext)({}),ll={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ul(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const hl={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!no.test(t))return t;t=parseFloat(t)}return`${ul(t,e.target.x)}% ${ul(t,e.target.y)}%`}},dl={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=zo.parse(t);if(i.length>5)return r;const o=zo.createTransformer(t),s="number"!=typeof i[0]?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;i[0+s]/=a,i[1+s]/=c;const l=_s(a,c,.5);return"number"==typeof i[2+s]&&(i[2+s]/=l),"number"==typeof i[3+s]&&(i[3+s]/=l),o(i)}},fl={};const{schedule:pl,cancel:ml}=bi(queueMicrotask,!1);class gl extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=t;var o;o=wl,Object.assign(fl,o),i&&(e.group&&e.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",(()=>{this.safeToRemove()})),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),ll.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:r,isPresent:i}=this.props,o=n.projection;return o?(o.isPresent=i,r||t.layoutDependency!==e||void 0===e?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Ei.postRender((()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),pl.postRender((()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function yl(t){const[n,r]=function(){const t=(0,e.useContext)(sl);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=(0,e.useId)();(0,e.useEffect)((()=>i(o)),[]);const s=(0,e.useCallback)((()=>r&&r(o)),[o,r]);return!n&&r?[!1,s]:[!0]}(),i=(0,e.useContext)(al);return(0,ol.jsx)(gl,{...t,layoutGroup:i,switchLayoutGroup:(0,e.useContext)(cl),isPresent:n,safeToRemove:r})}const wl={borderRadius:{...hl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:hl,borderTopRightRadius:hl,borderBottomLeftRadius:hl,borderBottomRightRadius:hl,boxShadow:dl},vl=["TopLeft","TopRight","BottomLeft","BottomRight"],bl=vl.length,El=t=>"string"==typeof t?parseFloat(t):t,Sl=t=>"number"==typeof t||no.test(t);function Tl(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const xl=kl(0,.5,_i),Al=kl(.5,.95,wi);function kl(t,e,n){return r=>r<t?0:r>e?1:n(hs(t,e,r))}function Rl(t,e){t.min=e.min,t.max=e.max}function Pl(t,e){Rl(t.x,e.x),Rl(t.y,e.y)}function Cl(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Il(t,e,n,r,i){return t=zc(t-=e,1/n,r),void 0!==i&&(t=zc(t,1/i,r)),t}function Ol(t,e,[n,r,i],o,s){!function(t,e=0,n=1,r=.5,i,o=t,s=t){eo.test(e)&&(e=parseFloat(e),e=_s(s.min,s.max,e/100)-s.min);if("number"!=typeof e)return;let a=_s(o.min,o.max,r);t===o&&(a-=e),t.min=Il(t.min,e,n,a,i),t.max=Il(t.max,e,n,a,i)}(t,e[n],e[r],e[i],e.scale,o,s)}const Bl=["x","scaleX","originX"],Ul=["y","scaleY","originY"];function Ll(t,e,n,r){Ol(t.x,e,Bl,n?n.x:void 0,r?r.x:void 0),Ol(t.y,e,Ul,n?n.y:void 0,r?r.y:void 0)}function Nl(t){return 0===t.translate&&1===t.scale}function _l(t){return Nl(t.x)&&Nl(t.y)}function jl(t,e){return t.min===e.min&&t.max===e.max}function Dl(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Ml(t,e){return Dl(t.x,e.x)&&Dl(t.y,e.y)}function Vl(t){return xc(t.x)/xc(t.y)}function Fl(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Kl{constructor(){this.members=[]}add(t){Sa(this.members,t),t.scheduleRender()}remove(t){if(Ta(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex((e=>t===e));if(0===e)return!1;let n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach((t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((t=>{t.instance&&t.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Wl=(t,e)=>t.depth-e.depth;class zl{constructor(){this.children=[],this.isDirty=!1}add(t){Sa(this.children,t),this.isDirty=!0}remove(t){Ta(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Wl),this.isDirty=!1,this.children.forEach(t)}}function Hl(t){const e=Ba(t)?t.get():t;return ba(e)?e.toValue():e}function $l(t,e){const n=as.now(),r=({timestamp:i})=>{const o=i-n;o>=e&&(Si(r),t(o-e))};return Ei.read(r,!0),()=>Si(r)}const Zl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Xl="undefined"!=typeof window&&void 0!==window.MotionDebug,Gl=["","X","Y","Z"],Yl={visibility:"hidden"};let ql=0;function Jl(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Ql(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Oa(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Ei,!(e||r))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Ql(r)}function tu({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=ql++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Xl&&(Zl.totalNodes=Zl.resolvedTargetDeltas=Zl.recalculatedProjection=0),this.nodes.forEach(ru),this.nodes.forEach(uu),this.nodes.forEach(hu),this.nodes.forEach(iu),Xl&&window.MotionDebug.record(Zl)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new zl)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new xa),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const n=this.eventHandlers.get(t);n&&n.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,n=this.root.hasTreeAnimated){if(this.instance)return;var r;this.isSVG=(r=e)instanceof SVGElement&&"svg"!==r.tagName,this.instance=e;const{layoutId:i,layout:o,visualElement:s}=this.options;if(s&&!s.current&&s.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(o||i)&&(this.isLayoutDirty=!0),t){let n;const r=()=>this.root.updateBlockedByResize=!1;t(e,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=$l(r,250),ll.hasAnimatedSinceResize&&(ll.hasAnimatedSinceResize=!1,this.nodes.forEach(lu))}))}i&&this.root.registerSharedNode(i,this),!1!==this.options.animate&&s&&(i||o)&&this.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const i=this.options.transition||s.getDefaultTransition()||yu,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=s.getProps(),c=!this.targetLayout||!Ml(this.targetLayout,r)||n,l=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||l||e&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,l);const e={...di(i,"layout"),onPlay:o,onComplete:a};(s.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||lu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Si(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(du),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ql(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:n}=this.options;if(void 0===e&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(su);this.isUpdating||this.nodes.forEach(au),this.isUpdating=!1,this.nodes.forEach(cu),this.nodes.forEach(eu),this.nodes.forEach(nu),this.clearAllSnapshots();const t=as.now();Ti.delta=Gi(0,1e3/60,t-Ti.timestamp),Ti.timestamp=t,Ti.isProcessing=!0,xi.update.process(Ti),xi.preRender.process(Ti),xi.render.process(Ti),Ti.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ou),this.sharedNodes.forEach(fu)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ei.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ei.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutCorrected=_c(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=r(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!i)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!_l(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,o=r!==this.prevTransformTemplateValue;t&&(e||Fc(this.latestValues)||o)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var r;return t&&(n=this.removeTransform(n)),bu((r=n).x),bu(r.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return _c();const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(Su))){const{scroll:t}=this.root;t&&(Yc(n.x,t.offset.x),Yc(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n=_c();if(Pl(n,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return n;for(let e=0;e<this.path.length;e++){const r=this.path[e],{scroll:i,options:o}=r;r!==this.root&&i&&o.layoutScroll&&(i.wasRoot&&Pl(n,t),Yc(n.x,i.offset.x),Yc(n.y,i.offset.y))}return n}applyTransform(t,e=!1){const n=_c();Pl(n,t);for(let t=0;t<this.path.length;t++){const r=this.path[t];!e&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Jc(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Fc(r.latestValues)&&Jc(n,r.latestValues)}return Fc(this.latestValues)&&Jc(n,this.latestValues),n}removeTransform(t){const e=_c();Pl(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!Fc(n.latestValues))continue;Vc(n.latestValues)&&n.updateSnapshot();const r=_c();Pl(r,n.measurePageBox()),Ll(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Fc(this.latestValues)&&Ll(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ti.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(t||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:i,layoutId:o}=this.options;if(this.layout&&(i||o)){if(this.resolvedRelativeTargetAt=Ti.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_c(),this.relativeTargetOrigin=_c(),Cc(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),Pl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var s,a,c;if(this.target||(this.target=_c(),this.targetWithTransforms=_c()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,c=this.relativeParent.target,Rc(s.x,a.x,c.x),Rc(s.y,a.y,c.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Pl(this.target,this.layout.layoutBox),Zc(this.target,this.targetDelta)):Pl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_c(),this.relativeTargetOrigin=_c(),Cc(this.relativeTargetOrigin,this.target,t.target),Pl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Xl&&Zl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!Vc(this.parent.latestValues)&&!Kc(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),n=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===Ti.timestamp&&(r=!1),r)return;const{layout:i,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!i&&!o)return;Pl(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,a=this.treeScale.y;!function(t,e,n,r=!1){const i=n.length;if(!i)return;let o,s;e.x=e.y=1;for(let a=0;a<i;a++){o=n[a],s=o.projectionDelta;const{visualElement:i}=o.options;i&&i.props.style&&"contents"===i.props.style.display||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Jc(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,Zc(t,s)),r&&Fc(o.latestValues)&&Jc(t,o.latestValues))}e.x<Gc&&e.x>Xc&&(e.x=1),e.y<Gc&&e.y>Xc&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms=_c());const{target:c}=e;c?(this.projectionDelta&&this.prevProjectionDelta?(Cl(this.prevProjectionDelta.x,this.projectionDelta.x),Cl(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),kc(this.projectionDelta,this.layoutCorrected,c,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&Fl(this.projectionDelta.x,this.prevProjectionDelta.x)&&Fl(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",c)),Xl&&Zl.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Nc(),this.projectionDelta=Nc(),this.projectionDeltaWithTransform=Nc()}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},o=Nc();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const s=_c(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=Boolean(a&&!l&&!0===this.options.crossfade&&!this.path.some(gu));let h;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;pu(o.x,t.x,n),pu(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(t,e,n,r){mu(t.x,e.x,n.x,r),mu(t.y,e.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,s,n),h&&function(t,e){return jl(t.x,e.x)&&jl(t.y,e.y)}(this.relativeTarget,h)&&(this.isProjectionDirty=!1),h||(h=_c()),Pl(h,this.relativeTarget)),a&&(this.animationValues=i,function(t,e,n,r,i,o){i?(t.opacity=_s(0,void 0!==n.opacity?n.opacity:1,xl(r)),t.opacityExit=_s(void 0!==e.opacity?e.opacity:1,0,Al(r))):o&&(t.opacity=_s(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let i=0;i<bl;i++){const o=`border${vl[i]}Radius`;let s=Tl(e,o),a=Tl(n,o);void 0===s&&void 0===a||(s||(s=0),a||(a=0),0===s||0===a||Sl(s)===Sl(a)?(t[o]=Math.max(_s(El(s),El(a),r),0),(eo.test(a)||eo.test(s))&&(t[o]+="%")):t[o]=a)}(e.rotate||n.rotate)&&(t.rotate=_s(e.rotate||0,n.rotate||0,r))}(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Si(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ei.update((()=>{ll.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n){const r=Ba(t)?t:Ra(t);return r.start(va("",r,e,n)),r.animation}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:n,layout:r,latestValues:i}=t;if(e&&n&&r){if(this!==t&&this.layout&&r&&Eu(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||_c();const e=xc(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const r=xc(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+r}Pl(e,n),Jc(e,i),kc(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Kl);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(e=!0),!e)return;const r={};n.z&&Jl("z",t,r,this.animationValues);for(let e=0;e<Gl.length;e++)Jl(`rotate${Gl[e]}`,t,r,this.animationValues),Jl(`skew${Gl[e]}`,t,r,this.animationValues);t.render();for(const e in r)t.setStaticValue(e,r[e]),this.animationValues&&(this.animationValues[e]=r[e]);t.scheduleRender()}getProjectionStyles(t){var e,n;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Yl;const r={visibility:""},i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=Hl(null==t?void 0:t.pointerEvents)||"",r.transform=i?i(this.latestValues,""):"none",r;const o=this.getLead();if(!this.projectionDelta||!this.layout||!o.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=Hl(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!Fc(this.latestValues)&&(e.transform=i?i({},""):"none",this.hasProjected=!1),e}const s=o.animationValues||o.latestValues;this.applyTransformsToTarget(),r.transform=function(t,e,n){let r="";const i=t.x.translate/e.x,o=t.y.translate/e.y,s=(null==n?void 0:n.z)||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),1===e.x&&1===e.y||(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:t,rotate:e,rotateX:i,rotateY:o,skewX:s,skewY:a}=n;t&&(r=`perspective(${t}px) ${r}`),e&&(r+=`rotate(${e}deg) `),i&&(r+=`rotateX(${i}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),a&&(r+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return 1===a&&1===c||(r+=`scale(${a}, ${c})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,s),i&&(r.transform=i(s,r.transform));const{x:a,y:c}=this.projectionDelta;r.transformOrigin=`${100*a.origin}% ${100*c.origin}% 0`,o.animationValues?r.opacity=o===this?null!==(n=null!==(e=s.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:r.opacity=o===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const t in fl){if(void 0===s[t])continue;const{correct:e,applyTo:n}=fl[t],i="none"===r.transform?s[t]:e(s[t],o);if(n){const t=n.length;for(let e=0;e<t;e++)r[n[e]]=i}else r[t]=i}return this.options.layoutId&&(r.pointerEvents=o===this?Hl(null==t?void 0:t.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()})),this.root.nodes.forEach(su),this.root.sharedNodes.clear()}}}function eu(t){t.updateLayout()}function nu(t){var e;const n=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:r}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;"size"===i?jc((t=>{const r=o?n.measuredBox[t]:n.layoutBox[t],i=xc(r);r.min=e[t].min,r.max=r.min+i})):Eu(i,n.layoutBox,e)&&jc((r=>{const i=o?n.measuredBox[r]:n.layoutBox[r],s=xc(e[r]);i.max=i.min+s,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[r].max=t.relativeTarget[r].min+s)}));const s=Nc();kc(s,e,n.layoutBox);const a=Nc();o?kc(a,t.applyTransform(r,!0),n.measuredBox):kc(a,e,n.layoutBox);const c=!_l(s);let l=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:i,layout:o}=r;if(i&&o){const s=_c();Cc(s,n.layoutBox,i.layoutBox);const a=_c();Cc(a,e,o.layoutBox),Ml(s,a)||(l=!0),r.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=s,t.relativeParent=r)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:a,layoutDelta:s,hasLayoutChanged:c,hasRelativeTargetChanged:l})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function ru(t){Xl&&Zl.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function iu(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function ou(t){t.clearSnapshot()}function su(t){t.clearMeasurements()}function au(t){t.isLayoutDirty=!1}function cu(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function lu(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function uu(t){t.resolveTargetDelta()}function hu(t){t.calcProjection()}function du(t){t.resetSkewAndRotation()}function fu(t){t.removeLeadSnapshot()}function pu(t,e,n){t.translate=_s(e.translate,0,n),t.scale=_s(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function mu(t,e,n,r){t.min=_s(e.min,n.min,r),t.max=_s(e.max,n.max,r)}function gu(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const yu={duration:.45,ease:[.4,0,.1,1]},wu=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),vu=wu("applewebkit/")&&!wu("chrome/")?Math.round:wi;function bu(t){t.min=vu(t.min),t.max=vu(t.max)}function Eu(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=Vl(e),i=Vl(n),o=.2,!(Math.abs(r-i)<=o));var r,i,o}function Su(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Tu=tu({attachResizeListener:(t,e)=>lc(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),xu={current:void 0},Au=tu({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!xu.current){const t=new Tu({});t.mount(window),t.setOptions({layoutScroll:!0}),xu.current=t}return xu.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),ku={pan:{Feature:class extends Za{constructor(){super(...arguments),this.removePointerDownListener=wi}onPointerDown(t){this.session=new dc(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:tl(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:il(t),onStart:il(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&Ei.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=uc(this.node.current,"pointerdown",(t=>this.onPointerDown(t)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends Za{constructor(t){super(t),this.removeGroupControls=wi,this.removeListeners=wi,this.controls=new nl(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||wi}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Au,MeasureLayout:yl}};function Ru(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover","Start"===n);const i=r["onHover"+n];i&&Ei.postRender((()=>i(e,cc(e))))}function Pu(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap","Start"===n);const i=r["onTap"+("End"===n?"":n)];i&&Ei.postRender((()=>i(e,cc(e))))}const Cu=new WeakMap,Iu=new WeakMap,Ou=t=>{const e=Cu.get(t.target);e&&e(t)},Bu=t=>{t.forEach(Ou)};function Uu(t,e,n){const r=function({root:t,...e}){const n=t||document;Iu.has(n)||Iu.set(n,{});const r=Iu.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Bu,{root:t,...e})),r[i]}(e);return Cu.set(t,n),r.observe(t),()=>{Cu.delete(t),r.unobserve(t)}}const Lu={some:0,all:1};const Nu={inView:{Feature:class extends Za{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:i}=t,o={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Lu[r]};return Uu(this.node.current,o,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),o=e?n:r;o&&o(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Za{mount(){const{current:t}=this.node;t&&(this.unmount=ac(t,(t=>(Pu(this.node,t,"Start"),(t,{success:e})=>Pu(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends Za{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ns(lc(this.node.current,"focus",(()=>this.onFocus())),lc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Za{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,i,o]=Ja(t,n),s=Qa((t=>{const{target:n}=t,r=e(t);if(!r||!n)return;const o=Qa((t=>{r(t),n.removeEventListener("pointerleave",o)}));n.addEventListener("pointerleave",o,i)}));return r.forEach((t=>{t.addEventListener("pointerenter",s,i)})),o}(t,(t=>(Ru(this.node,t,"Start"),t=>Ru(this.node,t,"End")))))}unmount(){}}}},_u={layout:{ProjectionNode:Au,MeasureLayout:yl}},ju=(0,e.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Du=(0,e.createContext)({}),Mu="undefined"!=typeof window,Vu=Mu?e.useLayoutEffect:e.useEffect,Fu=(0,e.createContext)({strict:!1});function Ku(t,n,r,i,o){var s,a;const{visualElement:c}=(0,e.useContext)(Du),l=(0,e.useContext)(Fu),u=(0,e.useContext)(sl),h=(0,e.useContext)(ju).reducedMotion,d=(0,e.useRef)(null);i=i||l.renderer,!d.current&&i&&(d.current=i(t,{visualState:n,parent:c,props:r,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:h}));const f=d.current,p=(0,e.useContext)(cl);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:l}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Wu(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:Boolean(s)||a&&vc(a),visualElement:t,animationType:"string"==typeof o?o:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:l})}(d.current,r,o,p);const m=(0,e.useRef)(!1);(0,e.useInsertionEffect)((()=>{f&&m.current&&f.update(r,u)}));const g=r[Ia],y=(0,e.useRef)(Boolean(g)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,g))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,g)));return Vu((()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),pl.render(f.render),y.current&&f.animationState&&f.animationState.animateChanges())})),(0,e.useEffect)((()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,g)})),y.current=!1))})),f}function Wu(t){if(t)return!1!==t.options.allowProjection?t.projection:Wu(t.parent)}function zu(t,n,r){return(0,e.useCallback)((e=>{e&&t.mount&&t.mount(e),n&&(e?n.mount(e):n.unmount()),r&&("function"==typeof r?r(e):vc(r)&&(r.current=e))}),[n])}function Hu(t){return Gr(t.animate)||ri.some((e=>Jr(t[e])))}function $u(t){return Boolean(Hu(t)||t.variants)}function Zu(t){const{initial:n,animate:r}=function(t,e){if(Hu(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Jr(e)?e:void 0,animate:Jr(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,e.useContext)(Du));return(0,e.useMemo)((()=>({initial:n,animate:r})),[Xu(n),Xu(r)])}function Xu(t){return Array.isArray(t)?t.join(" "):t}const Gu={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Yu={};for(const t in Gu)Yu[t]={isEnabled:e=>Gu[t].some((t=>!!e[t]))};const qu=Symbol.for("motionComponentSymbol");function Ju({preloadedFeatures:t,createVisualElement:n,useRender:r,useVisualState:i,Component:o}){t&&function(t){for(const e in t)Yu[e]={...Yu[e],...t[e]}}(t);const s=(0,e.forwardRef)((function(t,s){let a;const c={...(0,e.useContext)(ju),...t,layoutId:Qu(t)},{isStatic:l}=c,u=Zu(t),h=i(t,l);if(!l&&Mu){!function(t,n){(0,e.useContext)(Fu).strict;0}();const t=function(t){const{drag:e,layout:n}=Yu;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(c);a=t.MeasureLayout,u.visualElement=Ku(o,h,c,n,t.ProjectionNode)}return(0,ol.jsxs)(Du.Provider,{value:u,children:[a&&u.visualElement?(0,ol.jsx)(a,{visualElement:u.visualElement,...c}):null,r(o,t,zu(h,u.visualElement,s),h,l,u.visualElement)]})}));return s[qu]=o,s}function Qu({layoutId:t}){const n=(0,e.useContext)(al).id;return n&&void 0!==t?n+"-"+t:t}const th=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function eh(t){return"string"==typeof t&&!t.includes("-")&&!!(th.indexOf(t)>-1||/[A-Z]/u.test(t))}function nh(t,{style:e,vars:n},r,i){Object.assign(t.style,e,i&&i.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}const rh=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ih(t,e,n,r){nh(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(rh.has(n)?n:Ca(n),e.attrs[n])}function oh(t,{layout:e,layoutId:n}){return oi.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!fl[t]||"opacity"===t)}function sh(t,e,n){var r;const{style:i}=t,o={};for(const s in i)(Ba(i[s])||e.style&&Ba(e.style[s])||oh(s,t)||void 0!==(null===(r=null==n?void 0:n.getValue(s))||void 0===r?void 0:r.liveStyle))&&(o[s]=i[s]);return o}function ah(t,e,n){const r=sh(t,e,n);for(const n in t)if(Ba(t[n])||Ba(e[n])){r[-1!==ii.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const ch=t=>(n,r)=>{const i=(0,e.useContext)(Du),o=(0,e.useContext)(sl),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,i,o){const s={latestValues:lh(r,i,o,t),renderState:e()};return n&&(s.mount=t=>n(r,t,s)),s}(t,n,i,o);return r?s():function(t){const n=(0,e.useRef)(null);return null===n.current&&(n.current=t()),n.current}(s)};function lh(t,e,n,r){const i={},o=r(t,{});for(const t in o)i[t]=Hl(o[t]);let{initial:s,animate:a}=t;const c=Hu(t),l=$u(t);e&&l&&!c&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const h=u?a:s;if(h&&"boolean"!=typeof h&&!Gr(h)){const e=Array.isArray(h)?h:[h];for(let n=0;n<e.length;n++){const r=ti(t,e[n]);if(r){const{transitionEnd:t,transition:e,...n}=r;for(const t in n){let e=n[t];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(i[t]=e)}for(const e in t)i[e]=t[e]}}}return i}const uh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),hh=()=>({...uh(),attrs:{}}),dh=(t,e)=>e&&"number"==typeof t?e.transform(t):t,fh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ph=ii.length;function mh(t,e,n){const{style:r,vars:i,transformOrigin:o}=t;let s=!1,a=!1;for(const t in e){const n=e[t];if(oi.has(t))s=!0;else if(Wi(t))i[t]=n;else{const e=dh(n,Jo[t]);t.startsWith("origin")?(a=!0,o[t]=e):r[t]=e}}if(e.transform||(s||n?r.transform=function(t,e,n){let r="",i=!0;for(let o=0;o<ph;o++){const s=ii[o],a=t[s];if(void 0===a)continue;let c=!0;if(c="number"==typeof a?a===(s.startsWith("scale")?1:0):0===parseFloat(a),!c||n){const t=dh(a,Jo[s]);c||(i=!1,r+=`${fh[s]||s}(${t}) `),n&&(e[s]=t)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=o;r.transformOrigin=`${t} ${e} ${n}`}}function gh(t,e,n){return"string"==typeof t?t:no.transform(e+n*t)}const yh={offset:"stroke-dashoffset",array:"stroke-dasharray"},wh={offset:"strokeDashoffset",array:"strokeDasharray"};function vh(t,{attrX:e,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:c=0,...l},u,h){if(mh(t,l,h),u)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:f,dimensions:p}=t;d.transform&&(p&&(f.transform=d.transform),delete d.transform),p&&(void 0!==i||void 0!==o||f.transform)&&(f.transformOrigin=function(t,e,n){return`${gh(e,t.x,t.width)} ${gh(n,t.y,t.height)}`}(p,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==s&&function(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?yh:wh;t[o.offset]=no.transform(-r);const s=no.transform(e),a=no.transform(n);t[o.array]=`${s} ${a}`}(d,s,a,c,!1)}const bh=t=>"string"==typeof t&&"svg"===t.toLowerCase(),Eh={useVisualState:ch({scrapeMotionValuesFromProps:ah,createRenderState:hh,onMount:(t,e,{renderState:n,latestValues:r})=>{Ei.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),Ei.render((()=>{vh(n,r,bh(e.tagName),t.transformTemplate),ih(e,n)}))}})},Sh={useVisualState:ch({scrapeMotionValuesFromProps:sh,createRenderState:uh})};function Th(t,e,n){for(const r in e)Ba(e[r])||oh(r,n)||(t[r]=e[r])}function xh(t,n){const r={};return Th(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return(0,e.useMemo)((()=>{const e=uh();return mh(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),r}function Ah(t,e){const n={},r=xh(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const kh=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Rh(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||kh.has(t)}let Ph=t=>!Rh(t);try{(Ch=require("@emotion/is-prop-valid").default)&&(Ph=t=>t.startsWith("on")?!Rh(t):Ch(t))}catch(t){}var Ch;function Ih(t,n,r,i){const o=(0,e.useMemo)((()=>{const e=hh();return vh(e,n,bh(i),t.transformTemplate),{...e.attrs,style:{...e.style}}}),[n]);if(t.style){const e={};Th(e,t.style,t),o.style={...e,...o.style}}return o}function Oh(t=!1){return(n,r,i,{latestValues:o},s)=>{const a=(eh(n)?Ih:Ah)(r,o,s,n),c=function(t,e,n){const r={};for(const i in t)"values"===i&&"object"==typeof t.values||(Ph(i)||!0===n&&Rh(i)||!e&&!Rh(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}(r,"string"==typeof n,t),l=n!==e.Fragment?{...c,...a,ref:i}:{},{children:u}=r,h=(0,e.useMemo)((()=>Ba(u)?u.get():u),[u]);return(0,e.createElement)(n,{...l,children:h})}}function Bh(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Ju({...eh(n)?Eh:Sh,preloadedFeatures:t,useRender:Oh(r),createVisualElement:e,Component:n})}}const Uh={current:null},Lh={current:!1};const Nh=new WeakMap,_h=[...mo,Bo,zo],jh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Dh{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=So,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=as.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Ei.render(this.render,!1,!0))};const{latestValues:a,renderState:c}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=c,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=s,this.blockInitialAnimation=Boolean(i),this.isControllingVariants=Hu(e),this.isVariantNode=$u(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in u){const e=u[t];void 0!==a[t]&&Ba(e)&&e.set(a[t],!1)}}mount(t){this.current=t,Nh.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),Lh.current||function(){if(Lh.current=!0,Mu)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Uh.current=t.matches;t.addListener(e),e()}else Uh.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Uh.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Nh.delete(this.current),this.projection&&this.projection.unmount(),Si(this.notifyUpdate),Si(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=oi.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&Ei.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),i=e.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),i(),o&&o(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Yu){const e=Yu[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_c()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<jh.length;e++){const n=jh[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const i=e[r],o=n[r];if(Ba(i))t.addValue(r,i);else if(Ba(o))t.addValue(r,Ra(i,{owner:t}));else if(o!==i)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(r);t.addValue(r,Ra(void 0!==e?e:i,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Ra(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];return null!=r&&("string"==typeof r&&(Fi(r)||Di(r))?r=parseFloat(r):!(t=>_h.find(po(t)))(r)&&zo.test(e)&&(r=es(t,e)),this.setBaseTarget(t,Ba(r)?r.get():r)),Ba(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const i=ti(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);i&&(r=i[t])}if(n&&void 0!==r)return r;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||Ba(i)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new xa),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Mh extends Dh{constructor(){super(...arguments),this.KeyframeResolver=rs}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ba(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class Vh extends Mh{constructor(){super(...arguments),this.type="html",this.renderInstance=nh}readValueFromInstance(t,e){if(oi.has(e)){const t=ts(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),i=(Wi(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Qc(t,e)}build(t,e,n){mh(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return sh(t,e,n)}}class Fh extends Mh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_c}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(oi.has(e)){const t=ts(e);return t&&t.default||0}return e=rh.has(e)?e:Ca(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return ah(t,e,n)}build(t,e,n){vh(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){ih(t,e,0,r)}mount(t){this.isSVGTag=bh(t.tagName),super.mount(t)}}const Kh=Xr(Bh({...Ga,...Nu,...ku,..._u},((t,n)=>eh(t)?new Fh(n):new Vh(n,{allowProjection:t!==e.Fragment}))));function Wh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(""),[s,a]=(0,e.useState)(null),[c,l]=(0,e.useState)({length:!1,capital:!1,number:!1,symbol:!1});(0,e.useEffect)((()=>{l({length:i.length>=8,capital:/[A-Z]/.test(i),number:/[0-9]/.test(i),symbol:/[!@#$%^&*(),.?":{}|<>]/.test(i)})}),[i]);const u=Object.values(c).every((t=>t));return n().createElement(Kh.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Secure Your Account"),n().createElement("p",{className:"text-gray-600 text-center"},"Choose how you want to secure your data"),s?"pin"===s?n().createElement(Kh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md space-y-4"},n().createElement("input",{type:"password",value:i,onChange:t=>o(t.target.value),placeholder:"Enter your PIN",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"}),n().createElement("div",{className:"space-y-2"},Object.entries(c).map((t=>{let[e,r]=t;return n().createElement("div",{key:e,className:"flex items-center"},n().createElement("span",{className:"material-icons text-sm ".concat(r?"text-green-500":"text-gray-400")},r?"check_circle":"radio_button_unchecked"),n().createElement("span",{className:"ml-2 text-sm ".concat(r?"text-green-600":"text-gray-600")},"length"===e?"At least 8 characters":"capital"===e?"One capital letter":"number"===e?"One number":"One special character"))}))),n().createElement("button",{onClick:async()=>{u&&r({method:"pin",value:i})},disabled:!u,className:"w-full py-3 px-4 rounded-lg font-semibold ".concat(u?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Set PIN")):n().createElement(Kh.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md"},n().createElement("button",{onClick:()=>{r({method:"othent"})},className:"w-full py-3 px-4 rounded-lg font-semibold bg-blue-500 text-white hover:bg-blue-600"},"Continue with Othent")):n().createElement("div",{className:"grid grid-cols-1 gap-4 w-full max-w-md"},n().createElement(Kh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("othent"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("img",{src:"https://onairos.sirv.com/Images/othent-icon.png",alt:"Othent",className:"w-8 h-8 mr-3"}),n().createElement("span",{className:"text-gray-700"},"Secure with Google (Othent)")),n().createElement(Kh.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>a("pin"),className:"flex items-center justify-center p-6 rounded-lg border border-gray-300 hover:border-blue-500 bg-white"},n().createElement("span",{className:"material-icons mr-3"},"lock"),n().createElement("span",{className:"text-gray-700"},"Set up PIN"))))}const zh=[{name:"YouTube",icon:"https://onairos.sirv.com/Images/youtube-icon.png",connected:!1},{name:"Reddit",icon:"https://onairos.sirv.com/Images/reddit-icon.png",connected:!1},{name:"Instagram",icon:"https://onairos.sirv.com/Images/instagram-icon.png",connected:!1},{name:"Pinterest",icon:"https://onairos.sirv.com/Images/pinterest-icon.png",connected:!1}];function Hh(t){let{onComplete:r}=t;const[i,o]=(0,e.useState)(zh),[s,a]=(0,e.useState)(!1),[c,l]=(0,e.useState)(0);(0,e.useEffect)((()=>{if(s){const t=setInterval((()=>{l((e=>e>=100?(clearInterval(t),a(!1),r(),100):e+2))}),100);return()=>clearInterval(t)}}),[s,r]);return s?n().createElement(Kh.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Unifying Your Data"),n().createElement("p",{className:"text-gray-600 text-center"},"Please wait while we process your information"),n().createElement("div",{className:"w-full max-w-md"},n().createElement("div",{className:"relative pt-1"},n().createElement("div",{className:"flex mb-2 items-center justify-between"},n().createElement("div",null,n().createElement("span",{className:"text-xs font-semibold inline-block py-1 px-2 uppercase rounded-full text-blue-600 bg-blue-200"},"Progress")),n().createElement("div",{className:"text-right"},n().createElement("span",{className:"text-xs font-semibold inline-block text-blue-600"},c,"%"))),n().createElement(Kh.div,{className:"overflow-hidden h-2 mb-4 text-xs flex rounded bg-blue-200"},n().createElement(Kh.div,{initial:{width:0},animate:{width:"".concat(c,"%")},transition:{duration:.5},className:"shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-500"})))),n().createElement(Kh.div,{animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},className:"w-12 h-12"},n().createElement("svg",{className:"w-full h-full text-blue-500",viewBox:"0 0 24 24"},n().createElement("path",{fill:"currentColor",d:"M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"})))):n().createElement("div",{className:"flex flex-col items-center space-y-6 p-6"},n().createElement("h2",{className:"text-xl font-semibold text-gray-900"},"Connect Your Accounts"),n().createElement("p",{className:"text-gray-600 text-center"},"Connect at least one account to create your personality model"),n().createElement("div",{className:"grid grid-cols-2 gap-4 w-full max-w-md"},i.map((t=>n().createElement("button",{key:t.name,onClick:()=>(async t=>{try{(await fetch("https://api2.onairos.uk/connect/".concat(t.toLowerCase()),{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&o(i.map((e=>e.name===t?{...e,connected:!0}:e)))}catch(e){console.error("Failed to connect to ".concat(t,":"),e)}})(t.name),className:"flex items-center justify-center p-4 rounded-lg border ".concat(t.connected?"bg-green-50 border-green-500":"border-gray-300 hover:border-blue-500")},n().createElement("img",{src:t.icon,alt:t.name,className:"w-8 h-8 mr-2"}),n().createElement("span",{className:t.connected?"text-green-600":"text-gray-700"},t.connected?"Connected":"Connect ".concat(t.name)))))),n().createElement("button",{onClick:async()=>{if(i.some((t=>t.connected))){a(!0);try{(await fetch("https://api2.onairos.uk/unify",{method:"POST",headers:{Authorization:"Bearer ".concat(localStorage.getItem("onairosToken")),"Content-Type":"application/json"}})).ok&&r()}catch(t){console.error("Failed to unify data:",t)}}},disabled:!i.some((t=>t.connected)),className:"w-full max-w-md py-3 px-4 rounded-lg font-semibold ".concat(i.some((t=>t.connected))?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Unify and Create Model"))}function $h(t){let{onSignUpSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}=t;const[a,c]=(0,e.useState)({email:"",username:"",password:"",confirmPassword:""}),[l,u]=(0,e.useState)(null),h=t=>{c({...a,[t.target.name]:t.target.value})};return n().createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},l&&n().createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},l),n().createElement(zr,{onLoginSuccess:r,setOthent:i,setHashedOthentSub:o,setEncryptedPin:s}),n().createElement("div",{className:"w-full flex items-center justify-center space-x-4"},n().createElement("hr",{className:"flex-grow border-gray-300"}),n().createElement("span",{className:"text-gray-500"},"or"),n().createElement("hr",{className:"flex-grow border-gray-300"})),n().createElement("form",{onSubmit:async t=>{if(t.preventDefault(),a.password===a.confirmPassword)try{const t=await fetch("https://api2.onairos.uk/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a.email,username:a.username,password:a.password})}),e=await t.json();t.ok?(localStorage.setItem("onairosToken",e.token),localStorage.setItem("username",a.username),r(a.username)):u(e.message||"Sign up failed")}catch(t){u("Sign up failed. Please try again.")}else u("Passwords don't match")},className:"w-full space-y-4"},n().createElement("input",{type:"email",name:"email",value:a.email,onChange:h,placeholder:"Email",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"text",name:"username",value:a.username,onChange:h,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"password",value:a.password,onChange:h,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("input",{type:"password",name:"confirmPassword",value:a.confirmPassword,onChange:h,placeholder:"Confirm Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),n().createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign Up")))}function Zh(t){let{setOthentConnected:n,dataRequester:r,NoAccount:i,NoModel:o,activeModels:s,avatar:a,setAvatar:c,traits:l,setTraits:u,requestData:h,handleConnectionSelection:d,changeGranted:f,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,isAuthenticated:w,onClose:v,onLoginSuccess:b,setOthent:E,setHashedOthentSub:S,setEncryptedPin:T,accountInfo:x}=t;const[A,k]=(0,e.useState)(null),[R,P]=(0,e.useState)(!1),C=(0,e.useRef)(null),[I,O]=(0,e.useState)((()=>{var t;return w?x&&(null===(t=x.models)||void 0===t?void 0:t.length)>0?"datarequests":"onboarding":"login"})),[B,U]=(0,e.useState)({username:"",password:""}),[L,N]=(0,e.useState)(!1),_="https://api2.onairos.uk";(0,e.useEffect)((()=>{const t=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(t,"px"))};return t(),window.addEventListener("resize",t),window.addEventListener("orientationchange",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("orientationchange",t)}}),[]);const j=()=>{v()};(0,e.useEffect)((()=>{const t=t=>{C.current&&!C.current.contains(t.target)&&(null==j||j())};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[j]);const D=t=>{U({...B,[t.target.name]:t.target.value})},M=async t=>{t.preventDefault();try{k(null);const t={details:{username:B.username,password:B.password}},e=await fetch("".concat(_,"/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await e.json();if("Accepted"!==n.authentication)throw new Error("Invalid credentials");localStorage.setItem("onairosToken",n.token),localStorage.setItem("username",B.username),await V(B.username)}catch(t){console.error("Login failed:",t),k("Invalid username or password")}},V=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];P(!0);try{await b(t,e);k(null)}catch(t){console.error("Login process failed:",t),k("Failed to complete login process")}finally{P(!1)}},F=()=>{O("security")},K=t=>{"othent"===t.method?E(!0):"pin"===t.method&&T(t.value),O("datarequests")},W=t=>{let{dataRequester:e,granted:n,allowSubmit:r,rejectDataRequest:i,sendDataRequest:o,activeModels:s,requestData:a,handleConnectionSelection:c,changeGranted:l,avatar:u,traits:h}=t;return React.createElement("div",{className:"flex flex-col h-full"},React.createElement("div",{className:"px-6"},React.createElement("h1",{className:"text-lg font-semibold text-gray-900 mb-6"},"Data Requests from ",e),React.createElement("div",{className:"flex items-center justify-between mb-6"},React.createElement("button",{className:"bg-gray-500 hover:bg-gray-600 text-white font-bold py-2 px-8 rounded-full",onClick:i},"Reject All"),React.createElement("button",{disabled:!r||0===n,className:"".concat(r&&n>0?"bg-blue-500 hover:bg-blue-600":"bg-gray-300 cursor-not-allowed"," text-white font-bold py-2 px-8 rounded-full"),onClick:o},"Confirm (",n,")"))),React.createElement("div",{className:"flex-1 overflow-y-auto px-6"},0===s.length?React.createElement("div",{className:"flex flex-col items-center justify-center py-8"},React.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosWhite.png",alt:"Onairos Logo",className:"w-24 h-24 mb-4"}),React.createElement("p",{className:"text-center text-gray-800 font-medium"},"Please connect ",React.createElement("a",{href:"https://onairos.uk/connections",className:"text-blue-500 hover:underline"},"Onairos")," Personality to send ",e," your data")):React.createElement("div",{className:"space-y-4"},Object.keys(a).sort(((t,e)=>{const n=s.includes(a[t].type),r=s.includes(a[e].type);return"Avatar"===a[t].type?1:"Avatar"===a[e].type?-1:"Traits"===a[e].type?1:"Traits"===a[t].type||n&&!r?-1:r&&!n?1:0})).map(((t,n)=>{const r=a[t],i="Personality"===r.type?s.includes(r.type):"Avatar"===r.type?u:"Traits"===r.type&&h;return React.createElement(Zr,{key:t,active:i,title:r.type,id:r,number:n,descriptions:r.descriptions,rewards:r.reward,size:t,changeGranted:l,onSelectionChange:i=>c(e,t,n,r.type,r.reward,i)})})))))};return(0,e.useEffect)((()=>{var t;w&&x&&((null===(t=x.models)||void 0===t?void 0:t.length)>0?O("datarequests"):O("onboarding"))}),[w,x]),(0,e.useEffect)((()=>()=>{N(!1)}),[]),(0,e.useEffect)((()=>{}),[w,x]),R?React.createElement(React.Fragment,null,React.createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50"}),React.createElement("div",{ref:C,className:"fixed bottom-0 left-0 right-0 w-full bg-white rounded-t-3xl shadow-2xl transform transition-transform duration-300 ease-out flex items-center justify-center",style:{height:"calc(var(--vh, 1vh) * 50)"}},React.createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}))):React.createElement(React.Fragment,null,React.createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:j,style:{touchAction:"none"}}),React.createElement("div",{ref:C,className:"fixed bottom-0 left-0 right-0 w-full bg-white rounded-t-3xl shadow-2xl transform transition-transform duration-300 ease-out flex flex-col",style:{maxHeight:"60vh",minHeight:"45vh",height:"auto",touchAction:"none"}},React.createElement("div",{className:"sticky top-0 bg-white z-10 px-6 pt-3 pb-2"},React.createElement("div",{className:"w-12 h-1.5 bg-gray-300 rounded-full mx-auto"})),React.createElement("div",{className:"flex-1 overflow-y-auto px-6 pb-8",style:{touchAction:"pan-y"}},(()=>{switch(I){case"signup":return React.createElement($h,{onSignUpSuccess:V,setOthent:E,setHashedOthentSub:S,setEncryptedPin:T});case"onboarding":return React.createElement(Hh,{onComplete:F});case"security":return React.createElement(Wh,{onComplete:K});case"datarequests":return React.createElement(W,{dataRequester:r,granted:p,allowSubmit:m,rejectDataRequest:g,sendDataRequest:y,activeModels:s,requestData:h,handleConnectionSelection:d,changeGranted:f,avatar:a,traits:l});default:return React.createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},A&&React.createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},A),React.createElement(zr,{onLoginSuccess:V,setOthent:E,setHashedOthentSub:S,setEncryptedPin:T}),React.createElement("div",{className:"w-full flex items-center justify-center space-x-4"},React.createElement("hr",{className:"flex-grow border-gray-300"}),React.createElement("span",{className:"text-gray-500"},"or"),React.createElement("hr",{className:"flex-grow border-gray-300"})),React.createElement("form",{onSubmit:M,className:"w-full space-y-4"},React.createElement("input",{type:"text",name:"username",value:B.username,onChange:D,placeholder:"Username",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("input",{type:"password",name:"password",value:B.password,onChange:D,placeholder:"Password",className:"w-full px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),React.createElement("button",{type:"submit",className:"w-full bg-blue-500 text-white font-semibold py-3 px-4 rounded-lg hover:bg-blue-600 transition-colors"},"Sign In")),React.createElement("button",{onClick:()=>O("signup"),className:"w-full text-center text-blue-500 hover:text-blue-600"},"Don't have an account? Sign up"))}})())))}const Xh=async()=>(await a.e(423).then(a.t.bind(a,153,23))).default;function Gh(t){var r,i;let{requestData:o,webpageName:s,inferenceData:a=null,onComplete:c=null,autoFetch:l=!0,proofMode:u=!1,textLayout:h="below",textColor:d="white",login:f=!1,buttonType:p="pill",loginReturn:m=null,loginType:g="signIn",visualType:y="full"}=t;const[w,v]=(0,e.useState)(null),[b,E]=(0,e.useState)(!1),[S,T]=(0,e.useState)([]),[x,A]=(0,e.useState)(0),[k,R]=(0,e.useState)({}),[P,C]=(0,e.useState)(!1),[I,O]=(0,e.useState)(!1),[B,U]=(0,e.useState)(!1),[L,N]=(0,e.useState)(!1),_=(0,e.useRef)(!1),j=(0,e.useRef)(!1),[D,M]=(0,e.useState)(!1),[V,F]=(0,e.useState)(null),[K,W]=(0,e.useState)(!0),[z,H]=(0,e.useState)(null),[$,Z]=(0,e.useState)(null),[X,G]=(0,e.useState)({show:!1,type:null,data:null}),[Y,q]=(0,e.useState)(null),[J,Q]=(0,e.useState)(!1),[tt,et]=(0,e.useState)(!1),nt=(0,e.useRef)(!1),[rt,it]=(0,e.useState)(null),[ot,st]=(0,e.useState)({show:!1,color:null,message:null}),at="https://api2.onairos.uk";(0,e.useEffect)((()=>{(async()=>{const t=new URL(window.location.href),e=t.searchParams.get("code"),n=t.searchParams.get("state");if(e&&n&&!nt.current&&!tt){nt.current=!0,et(!0);try{await ct(t.toString()),N(!0),window.history.replaceState({},document.title,window.location.pathname)}catch(t){console.error("Auth callback processing failed:",t),it(t.message)}finally{et(!1)}}})()}),[]);const ct=async t=>{try{const e=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!0,auth0LogInMethod:"redirect",auth0RedirectURI:window.location.href,auth0ReturnToURI:window.location.href}),n=await e.completeConnectionAfterRedirect(t);if(!e)throw new Error("Failed to initialize Othent");if(!n||!n.sub)throw new Error("Invalid user details received from Othent");M(!0);const r=(await Xh())(n.sub).toString();H(r);const i=await Mr(r);Z(i.result),F(i.token),await mt(n.email,!0),E(!0),localStorage.setItem("othentToken",r),localStorage.setItem("onairosToken",n.token)}catch(t){throw st({show:!0,color:"red",message:"An error has occured, please try again"}),console.error("Authentication failed:",t),t}};(0,e.useEffect)((()=>{rt&&console.error("Authentication error:",rt)}),[rt]);const lt=()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(t)};(0,e.useEffect)((()=>{if(l&&a&&"function"==typeof c){const t=async t=>{if(t.data&&"content-script"===t.data.source&&"API_URL_RESPONSE"===t.data.type&&"Onairos-Response"===t.data.unique){const{APIurl:e,approved:n,accessToken:r}=t.data,i=(t=>{const e={Small:16,Medium:32,Large:64};let n=null,r=0;return t.forEach((t=>{const i=e[t.data];i>r&&(r=i,n=t)})),r})(n),o={Input:a.slice(0,i)};try{const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(o)}),n=await t.json();c(n)}catch(t){console.error(t),c(null,t)}}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}}),[]);const ut=window.location.href,ht=async()=>{try{if(lt())return void await(async()=>{lt()&&E(!0)})();const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await Xh())(e.sub).toString();function r(t){try{const e=window.atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n.buffer}catch(t){console.error("Error converting to Buffer :",t)}}const i=r((await Mr(n)).result);Dr("\n -----BEGIN PUBLIC KEY-----\n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4wkWvRPaJiY8CwQ5BoJI\n amcGAYV91Bk8NrvWq4PXM+J/RJugfgTNCYKQ/c6g4xa1YES/tJEzFS7nf0Kdoqxm\n 5aav0ru5vS4fc4vCOLTI9W1T7nj02NY91rogsQm2/KMxUQ8DaLeTZKi+0Wjsa9YO\n 6XGGd1wh4azgQkj04MWW5J1EBCcBavKoY+C85oA9jkkklQ8nGWgbugmZs7eXHNQb\n qH8/ZHcB9Kx1CZ6XjQuVd6YE/A+swV+DksbkXANcYjr6SY/2TbB8GfpcOMM3bkyN\n Q8e0A51q5a8abfuAkDZXe67MwKMWu/626abwPZhJrKr5HhRZZDwPtnXlktYHhOK6\n lQIDAQAB\n -----END PUBLIC KEY-----\n ",await t.decrypt(i)).then((t=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:s,domain:ut,requestData:o,proofMode:u,HashedOthentSub:n,EncryptedUserPin:t})})).catch((t=>{console.error("Encryption failed:",t)}))}catch(a){console.error({fix:"Please ensure you have stored your model"}),console.error("Error Sending Data to Terminal: ",a)}},dt="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," ").concat(f?"bg-white border border-gray-300":"bg-transparent","\n ").concat(lt()?"":"OnairosConnect","\n "),ft={flexDirection:"below"===h?"column":"row",backgroundColor:f?"#ffffff":"transparent",color:f?"black":d,border:f?"1px solid #ddd":"1px solid transparent"},pt={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"},mt=(process.env.REACT_APP_GOOGLE_CLIENT_ID,async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=e?{Info:{identifier:t}}:{Info:{userName:t}},r=e?"/getAccountInfo/email":"/getAccountInfo",i=await fetch("".concat(at).concat(r),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("onairosToken"))},body:JSON.stringify(n)});if(!i.ok)throw new Error("Failed to fetch account info");const o=await i.json();return"No Account Found"===o.AccountInfo?(_.current=!0,q(null),null):(q(o.AccountInfo),o.AccountInfo.models?T(o.AccountInfo.models):j.current=!0,o.AccountInfo.avatar&&C(!0),o.AccountInfo.UserTraits&&O(!0),o.AccountInfo)}catch(t){throw console.error("Error fetching account info:",t),t}});(0,e.useEffect)((()=>{lt()&&(async()=>{try{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("token"),n=t||e;if(n){const t=await fetch("http://localhost:8080/verifyToken",{headers:{Authorization:"Bearer ".concat(n)}});if(t.ok)if((await t.json()).valid){F(n),M(!0);const t=localStorage.getItem("username");await mt(t)}else localStorage.removeItem("onairosToken"),localStorage.removeItem("token")}}catch(t){console.error("Token verification failed:",t)}finally{W(!1)}})()}),[]);(0,e.useEffect)((()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username");t&&e&&mt(e,!1)}),[]);return(0,e.useEffect)((()=>{(async()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username"),n=localStorage.getItem("othentToken");if(t)try{if((await fetch("".concat(at,"/verifyToken"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).ok){if(M(!0),e)await mt(e,!1);else if(n){const t=JSON.parse(n);await mt(t.email,!0)}}else localStorage.removeItem("onairosToken"),localStorage.removeItem("username"),localStorage.removeItem("othentToken")}catch(t){console.error("Token verification failed:",t)}})()}),[]),n().createElement(n().Fragment,null,n().createElement("div",{className:"flex items-center justify-center"},n().createElement("button",{className:dt,onClick:ht,style:ft},("full"===y||"icon"===y)&&n().createElement("img",{src:f?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:pt,className:"".concat("pill"===p?"w-6 h-6":"w-8 h-8"," object-contain")}),("full"===y||"textOnly"===y)&&n().createElement("span",{className:"".concat(f||"black"===d?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===h?"ml-2":"left"===h?"mr-2":"")},(()=>{switch(g){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})()))),ot.show&&n().createElement(Notification,{message:ot.message,color:ot.color}),X.show&&n().createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center"},n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>G({show:!1,type:null,data:null})}),n().createElement("div",{className:"relative bg-white rounded-lg p-6 max-w-lg w-full mx-4 max-h-[80vh] overflow-y-auto"},n().createElement("button",{onClick:()=>G({show:!1,type:null,data:null}),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600"},n().createElement("span",{className:"sr-only"},"Close"),n().createElement("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},n().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"callback"===X.type?"Callback Details":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"apiURL"===X.type?"API Url Returned":"Authentication Result"),n().createElement("div",{className:"bg-gray-50 rounded p-4 overflow-x-auto"},n().createElement("pre",{className:"text-sm"},JSON.stringify(X.data,null,2))),"auth"===X.type&&n().createElement("div",{className:"mt-4 p-3 rounded ".concat(null!==(r=X.data)&&void 0!==r&&r.success?"bg-green-100 text-green-700":"bg-red-100 text-red-700")},null!==(i=X.data)&&void 0!==i&&i.success?"Authentication successful!":"Authentication failed"))),J&&n().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},n().createElement("div",{className:"bg-white p-6 rounded-lg shadow-xl"},n().createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto"}),n().createElement("p",{className:"mt-4 text-gray-600"},"Loading your account..."))),b&&!J&&n().createElement(Zh,{setOthentConnected:N,dataRequester:s,NoAccount:_,NoModel:j,accountInfo:Y,activeModels:S,avatar:P,traits:I,requestData:o,handleConnectionSelection:(t,e,n,r,i,o)=>{R((s=>({...s,["".concat(t,"-").concat(e,"-").concat(n)]:{type:r,reward:i,isSelected:o}})))},changeGranted:t=>{A((e=>Math.max(e+t,0)))},granted:x,allowSubmit:x>0,rejectDataRequest:()=>{E(!1),c&&c("rejected")},sendDataRequest:async()=>{if(x>0){try{if(B&&!L){G({show:!0,type:"callback",data:{code:"Connecting Othent Details",state:""}});const t=new jr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await Xh())(e.sub).toString();H(n);const r=await Mr(n);Z(r.result),F(r.token),N(!0)}const t=Object.values(k).filter((t=>t.isSelected)).map((t=>({type:t.type,reward:t.reward})));G({show:!0,type:"callback",data:{code:"Retrieving API URL",state:t}});const e={Info:{EncryptedUserPin:$,confirmations:t,web3Type:"othent",Domain:window.location.href,proofMode:"false",OthentSub:z}};try{const t=await fetch("https://api2.onairos.uk/getAPIurl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();l&&c?c(n):(G({show:!0,type:"apiURL",data:{code:t.body.apiUrl,state:approved}}),chrome.runtime.sendMessage({source:"dataRequestPage",type:"returnedAPIurl",APIurl:t.body.apiUrl,accessToken:t.body.token,approved:selectedConnections.current}))}catch(t){console.error(t),c&&c(null,t)}}catch(t){console.error(t)}E(!1)}},isAuthenticated:D,onLoginSuccess:async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=await mt(t,e);return M(!0),E(!0),n}catch(t){throw console.error("Login process failed:",t),t}},onClose:()=>{A(0),E(!1)},setOthent:U,setHashedOthentSub:H,setEncryptedPin:Z}))}})(),c})()));
|
|
2
2
|
//# sourceMappingURL=onairos.bundle.js.map
|