onairos 0.1.340 → 0.1.341
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 +1 -1
- package/dist/onairos.bundle.js.map +1 -1
- package/dist/onairos.js +6 -3
- package/package.json +1 -1
- package/src/onairos.jsx +8 -1
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,o,i={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 o=this.stringToBigNum(t,n).shiftedBy(-12);return e?o.toFormat(n):o.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 o{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(`${o.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(`${o.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=o},879:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),o=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 o.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,o=new Uint8Array(n);let i=0;for(;i<n;){let t;this.api.config.logging&&console.log(`[chunk] ${i}/${n}`);try{t=await this.getChunkData(r+i)}catch(t){console.error(`[chunk] Failed to fetch chunk at offset ${r+i}`),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 ${i}/${n}`);o.set(t,i),i+=t.length}return o}}},536:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(586),o=n(874),i=n(363),s=n(248),a=n(935),c=n(927),u=n(825),l=n(244),h=n(243),f=n(879),d=n(759);class p{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new i.default;static utils=l;constructor(t){this.api=new o.default(t),this.wallets=new c.default(this.api,p.crypto),this.chunks=new f.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 d.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=l.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 u.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 o=await this.silo.parseUri(n);if("string"==typeof t.data){const e=await this.crypto.encrypt(l.stringToBuffer(t.data),o.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=l.bufferTob64Url(e)}if(t.data instanceof Uint8Array){const e=await this.crypto.encrypt(t.data,o.getEncryptionKey());r.reward=await this.transactions.getPrice(e.byteLength),r.data=l.bufferTob64Url(e)}const i=new u.default(r);return i.addTag("Silo-Name",o.getAccessKey()),i.addTag("Silo-Version","0.1.0"),i}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 o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=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 i=n(536),s=n(118);i.default.init=function(t={}){const e={host:"arweave.net",port:443,protocol:"https"};if("object"!=typeof location||!location.protocol||!location.hostname)return new i.default({...t,...e});const n=location.protocol.replace(":",""),r=location.hostname,o=location.port?parseInt(location.port):"https"==n?443:80,a=(0,s.getDefaultConfig)(n,r),c=t.protocol||a.protocol,u=t.host||a.host,l=t.port||a.port||o;return new i.default({...t,host:u,protocol:c,port:l})},"object"==typeof globalThis?globalThis.Arweave=i.default:"object"==typeof self&&(self.Arweave=i.default),o(n(536),e),e.default=i.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||{}),o=`${this.config.protocol}://${this.config.host}:${this.config.port}`,i=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: ${o}/${t}`);let s=await fetch(`${o}/${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],u=s,l=async()=>{if(c)try{u.data=new TextDecoder(c).decode(await s.arrayBuffer())}catch(t){u.data=await s.text()}else u.data=await s.text()};if("arraybuffer"===i)u.data=await s.arrayBuffer();else if("text"===i)await l();else if("webstream"===i)u.data=n(s.body);else try{let t=await s.clone().json();"object"!=typeof t?await l():u.data=await s.json(),t=null}catch{await l()}return u}};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},o=await this.jwkToPublicCryptoKey(r),i=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-i.byteLength-2},o,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 o=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),i=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},o,{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},i,t);return r.concatBuffers([s,a])}async decrypt(t,e,n){const o=await this.driver.importKey("raw","string"==typeof e?r.stringToBuffer(e):e,{name:"PBKDF2",length:32},!1,["deriveKey"]),i=await this.driver.deriveKey({name:"PBKDF2",salt:n?r.stringToBuffer(n):r.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},o,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},i,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 o(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 i(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 i(t,e){if(t.length<1)return e;const n=r.default.utils.concatBuffers([e,await o(t[0])]),s=await r.default.crypto.hash(n,"SHA-384");return await i(t.slice(1),s)}e.default=o},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),o=n(244);e.MAX_CHUNK_SIZE=262144,e.MIN_CHUNK_SIZE=32768;const i=32,s=32;async function a(t){let n=[],o=t,i=0;for(;o.byteLength>=e.MAX_CHUNK_SIZE;){let t=e.MAX_CHUNK_SIZE,s=o.byteLength-e.MAX_CHUNK_SIZE;s>0&&s<e.MIN_CHUNK_SIZE&&(t=Math.ceil(o.byteLength/2));const a=o.slice(0,t),c=await r.default.crypto.hash(a);i+=a.byteLength,n.push({dataHash:c,minByteRange:i-a.byteLength,maxByteRange:i}),o=o.slice(t)}return n.push({dataHash:await r.default.crypto.hash(o),minByteRange:i,maxByteRange:i+o.byteLength}),n}async function c(t){return Promise.all(t.map((async({dataHash:t,minByteRange:e,maxByteRange:n})=>({type:"leaf",id:await g(await Promise.all([g(t),g(m(n))])),dataHash:t,minByteRange:e,maxByteRange:n}))))}async function u(t){return await l(await c(await a(t)))}async function l(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 l(n,e+1)}function h(t){const e=f(t);return Array.isArray(e)?d(e):[e]}function f(t,e=new Uint8Array,n=0){if("leaf"==t.type)return{offset:t.maxByteRange-1,proof:(0,o.concatBuffers)([e,t.dataHash,m(t.maxByteRange)])};if("branch"==t.type){const r=(0,o.concatBuffers)([e,t.leftChild.id,t.rightChild.id,m(t.byteRange)]);return[f(t.leftChild,r,n+1),f(t.rightChild,r,n+1)]}throw new Error("Unexpected node type")}function d(t){const e=[];return t.forEach((t=>{Array.isArray(t)?e.push(...d(t)):e.push(t)})),e}async function p(t,e){if(!e)return t;return{type:"branch",id:await g([await g(t.id),await g(e.id),await g(m(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}}async function g(t){return Array.isArray(t)&&(t=r.default.utils.concatBuffers(t)),new Uint8Array(await r.default.crypto.hash(t))}function m(t){const e=new Uint8Array(i);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 u(t)).id},e.generateTree=u,e.generateTransactionChunks=async function(t){const e=await a(t),n=await c(e),r=await l(n),o=await h(r),i=e.slice(-1)[0];return i.maxByteRange-i.minByteRange==0&&(e.splice(e.length-1,1),o.splice(o.length-1,1)),{data_root:r.id,chunks:e,proofs:o}},e.buildLayers=l,e.generateProofs=h,e.arrayFlatten=d,e.intToBuffer=m,e.bufferToInt=y;e.arrayCompare=(t,e)=>t.every(((t,n)=>e[n]===t)),e.validatePath=async function t(n,r,o,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+i){const t=c.slice(0,s),r=c.slice(t.length,t.length+i),u=await g([await g(t),await g(r)]);return!!(0,e.arrayCompare)(n,u)&&{offset:a-1,leftBound:o,rightBound:a,chunkSize:a-o}}const u=c.slice(0,s),l=c.slice(u.length,u.length+s),h=c.slice(u.length+l.length,u.length+l.length+i),f=y(h),d=c.slice(u.length+l.length+h.length),p=await g([await g(u),await g(l),await g(h)]);return!!(0,e.arrayCompare)(n,p)&&(r<f?await t(u,r,o,Math.min(a,f),d):await t(l,r,Math.max(o,f),a,d))},e.debug=async function t(e,n=""){if(e.byteLength<1)return n;const r=e.slice(0,s),o=e.slice(r.length,r.length+s),a=e.slice(r.length+o.length,r.length+o.length+i),c=y(a),u=e.slice(r.length+o.length+a.length),l=await g([await g(r),await g(o),await g(a)]);return t(u,`${n}\n${JSON.stringify(Buffer.from(r))},${JSON.stringify(Buffer.from(o))},${c} => ${JSON.stringify(l)}`)}},246:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransactionUploader=void 0;const r=n(825),o=n(244),i=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),o.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,i.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 o=new r.default(e.transaction);o.chunks||await o.prepareChunks(n);const i=new c(t,o);if(i.chunkIndex=e.chunkIndex,i.lastRequestTimeEnd=e.lastRequestTimeEnd,i.lastResponseError=e.lastResponseError,i.lastResponseStatus=e.lastResponseStatus,i.txPosted=e.txPosted,i.data=n,i.transaction.data_root!==e.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return i}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,i.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,i.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),o=n(921),i=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:o}){this.id=t,this.owner=e,n&&(this.reward=n),r&&(this.tags=r),this.signature=o}async prepareChunks(t){!this.chunks&&t.byteLength>0&&(this.chunks=await(0,i.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],o=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(o.minByteRange,o.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,o.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 o(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}function i(t){return(new TextEncoder).encode(t)}function s(t){return new Uint8Array(r.toByteArray(l(t)))}function a(t){return r.fromByteArray(new Uint8Array(t))}function c(t){return u(a(t))}function u(t){try{return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(t){throw new Error("Failed to encode string",{cause:t})}}function l(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 o(s(t))},e.bufferToString=o,e.stringToBuffer=i,e.stringToB64Url=function(t){return c(i(t))},e.b64UrlToBuffer=s,e.bufferTob64=a,e.bufferTob64Url=c,e.b64UrlEncode=u,e.b64UrlDecode=l},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("."),o=r[r.length-1],i=["localhost","[::1]"];return i.includes(e)||"file"==t||i.includes(o)||!!e.match(n)||!!o.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 o=r.get("data",{decode:!0,string:!1});return this.crypto.decrypt(o,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],i=Math.pow(2,parseInt(e[2])),s=await this.hash(r.stringToBuffer(n),i),a=r.bufferTob64(s.slice(0,15)),c=await this.hash(s.slice(16,31),1);return new o(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 o{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=o},935:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(498),o=n(825),i=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 o.default({...e.data,data:n})}return new o.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 o.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:o,statusText:i}=await this.api.get(`/${t}`,{responseType:"arraybuffer"});if(!r)throw new Error("Bad http status code",{cause:{status:o,statusText:i}});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?i.bufferToString(n):i.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),o="object"==typeof arweaveWallet;if(!r&&!o)throw new Error("No valid JWK or external wallet found to sign transaction.");if(r){t.setOwner(e.n);let r=await t.getSignatureData(),o=await this.crypto.sign(e,r,n),s=await this.crypto.hash(o);t.setSignature({id:i.bufferTob64Url(s),owner:e.n,signature:i.bufferTob64Url(o)})}else{if(!o)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=i.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 o.default(JSON.parse(t)):"function"==typeof t.readInt32BE?t=new o.default(JSON.parse(t.toString())):"object"!=typeof t||t instanceof o.default||(t=new o.default(t)),!(t instanceof o.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 o.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,i=a(t),s=i[0],c=i[1],u=new o(function(t,e,n){return 3*(e+n)/4-n}(0,s,c)),l=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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[l++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=16383,a=0,u=r-o;a<u;a+=s)i.push(c(t,a,a+s>u?u:a+s));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=i[s],r[i.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 o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},431:function(t,e,n){var r;!function(o){"use strict";var i,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",h=1e14,f=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,m=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,o=t.length,i=t[0]+"";r<o;){for(e=t[r++]+"",n=f-e.length;n--;e="0"+e);i+=e}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function b(t,e){var n,r,o=t.c,i=e.c,s=t.s,a=e.s,c=t.e,u=e.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=c==u,!o||!i)return r?0:!o^n?1:-1;if(!r)return c>u^n?1:-1;for(a=(c=o.length)<(u=i.length)?c:u,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return c==u?0:c>u^n?1:-1}function v(t,e,n,r){if(t<e||t>n||t!==c(t))throw Error(u+(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/f)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function S(t,e,n){var r,o;if(e<0){for(o=n+".";++e;o+=n);t=o+t}else if(++e>(r=t.length)){for(o=n,e-=r;--e;o+=n);t+=o}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}i=function t(e){var n,r,o,i,A,T,x,k,R,C,P=W.prototype={constructor:W,toString:null,valueOf:null},I=new W(1),O=20,B=4,U=-7,L=21,N=-1e7,D=1e7,j=!1,M=1,V=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},$="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function W(t,e){var n,i,a,u,h,p,g,m,y=this;if(!(y instanceof W))return new W(t,e);if(null==e){if(t&&!0===t._isBigNumber)return y.s=t.s,void(!t.c||t.e>D?y.c=y.e=null:t.e<N?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(u=0,h=t;h>=10;h/=10,u++);return void(u>D?y.c=y.e=null:(y.e=u,y.c=[t]))}m=String(t)}else{if(!s.test(m=String(t)))return o(y,m,p);y.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(h=m.search(/e/i))>0?(u<0&&(u=h),u+=+m.slice(h+1),m=m.substring(0,h)):u<0&&(u=m.length)}else{if(v(e,2,$.length,"Base"),10==e&&K)return Z(y=new W(t),O+y.e+1,B);if(m=String(t),p="number"==typeof t){if(0*t!=0)return o(y,m,p,e);if(y.s=1/t<0?(m=m.slice(1),-1):1,W.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+t)}else y.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(n=$.slice(0,e),u=h=0,g=m.length;h<g;h++)if(n.indexOf(i=m.charAt(h))<0){if("."==i){if(h>u){u=g;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,h=-1,u=0;continue}return o(y,String(t),p,e)}p=!1,(u=(m=r(m,e,10,y.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(h=0;48===m.charCodeAt(h);h++);for(g=m.length;48===m.charCodeAt(--g););if(m=m.slice(h,++g)){if(g-=h,p&&W.DEBUG&&g>15&&(t>d||t!==c(t)))throw Error(l+y.s*t);if((u=u-h-1)>D)y.c=y.e=null;else if(u<N)y.c=[y.e=0];else{if(y.e=u,y.c=[],h=(u+1)%f,u<0&&(h+=f),h<g){for(h&&y.c.push(+m.slice(0,h)),g-=f;h<g;)y.c.push(+m.slice(h,h+=f));h=f-(m=m.slice(h)).length}else h-=g;for(;h--;m+="0");y.c.push(+m)}}else y.c=[y.e=0]}function z(t,e,n,r){var o,i,s,a,c;if(null==n?n=B:v(n,0,8),!t.c)return t.toString();if(o=t.c[0],s=t.e,null==e)c=w(t.c),c=1==r||2==r&&(s<=U||s>=L)?_(c,s):S(c,s,"0");else if(i=(t=Z(new W(t),e,n)).e,a=(c=w(t.c)).length,1==r||2==r&&(e<=i||i<=U)){for(;a<e;c+="0",a++);c=_(c,i)}else if(e-=s,c=S(c,i,"0"),i+1>a){if(--e>0)for(c+=".";e--;c+="0");}else if((e+=i-a)>0)for(i+1==a&&(c+=".");e--;c+="0");return t.s<0&&o?"-"+c:c}function H(t,e){for(var n,r,o=1,i=new W(t[0]);o<t.length;o++)(!(r=new W(t[o])).s||(n=b(i,r))===e||0===n&&i.s===e)&&(i=r);return i}function q(t,e,n){for(var r=1,o=e.length;!e[--o];e.pop());for(o=e[0];o>=10;o/=10,r++);return(n=r+n*f-1)>D?t.c=t.e=null:n<N?t.c=[t.e=0]:(t.e=n,t.c=e),t}function Z(t,e,n,r){var o,i,s,u,l,d,g,m=t.c,y=p;if(m){t:{for(o=1,u=m[0];u>=10;u/=10,o++);if((i=e-o)<0)i+=f,s=e,l=m[d=0],g=c(l/y[o-s-1]%10);else if((d=a((i+1)/f))>=m.length){if(!r)break t;for(;m.length<=d;m.push(0));l=g=0,o=1,s=(i%=f)-f+1}else{for(l=u=m[d],o=1;u>=10;u/=10,o++);g=(s=(i%=f)-f+o)<0?0:c(l/y[o-s-1]%10)}if(r=r||e<0||null!=m[d+1]||(s<0?l:l%y[o-s-1]),r=n<4?(g||r)&&(0==n||n==(t.s<0?3:2)):g>5||5==g&&(4==n||r||6==n&&(i>0?s>0?l/y[o-s]:0:m[d-1])%10&1||n==(t.s<0?8:7)),e<1||!m[0])return m.length=0,r?(e-=t.e+1,m[0]=y[(f-e%f)%f],t.e=-e||0):m[0]=t.e=0,t;if(0==i?(m.length=d,u=1,d--):(m.length=d+1,u=y[f-i],m[d]=s>0?c(l/y[o-s]%y[s])*u:0),r)for(;;){if(0==d){for(i=1,s=m[0];s>=10;s/=10,i++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);i!=u&&(t.e++,m[0]==h&&(m[0]=1));break}if(m[d]+=u,m[d]!=h)break;m[d--]=0,u=1}for(i=m.length;0===m[--i];m.pop());}t.e>D?t.c=t.e=null:t.e<N&&(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<=U||n>=L?_(e,n):S(e,n,"0"),t.s<0?"-"+e:e)}return W.clone=t,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(u+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(v(n=t[e],0,m,e),O=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(v(n=t[e],0,8,e),B=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(v(n[0],-m,0,e),v(n[1],0,m,e),U=n[0],L=n[1]):(v(n,-m,m,e),U=-(L=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)v(n[0],-m,-1,e),v(n[1],1,m,e),N=n[0],D=n[1];else{if(v(n,-m,m,e),!n)throw Error(u+e+" cannot be zero: "+n);N=-(D=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(u+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw j=!n,Error(u+"crypto unavailable");j=n}else j=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(v(n=t[e],0,9,e),M=n),t.hasOwnProperty(e="POW_PRECISION")&&(v(n=t[e],0,m,e),V=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(u+e+" not an object: "+n);F=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(u+e+" invalid: "+n);K="0123456789"==n.slice(0,10),$=n}}return{DECIMAL_PLACES:O,ROUNDING_MODE:B,EXPONENTIAL_AT:[U,L],RANGE:[N,D],CRYPTO:j,MODULO_MODE:M,POW_PRECISION:V,FORMAT:F,ALPHABET:$}},W.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!W.DEBUG)return!0;var e,n,r=t.c,o=t.e,i=t.s;t:if("[object Array]"=={}.toString.call(r)){if((1===i||-1===i)&&o>=-m&&o<=m&&o===c(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break t}if((e=(o+1)%f)<1&&(e+=f),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===o&&(null===i||1===i||-1===i))return!0;throw Error(u+"Invalid BigNumber: "+t)},W.maximum=W.max=function(){return H(arguments,-1)},W.minimum=W.min=function(){return H(arguments,1)},W.random=(i=9007199254740992,A=Math.random()*i&2097151?function(){return c(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,o,i,s=0,l=[],h=new W(I);if(null==t?t=O:v(t,0,m),o=a(t/f),j)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(o*=2));s<o;)(i=131072*e[s]+(e[s+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[s]=n[0],e[s+1]=n[1]):(l.push(i%1e14),s+=2);s=o/2}else{if(!crypto.randomBytes)throw j=!1,Error(u+"crypto unavailable");for(e=crypto.randomBytes(o*=7);s<o;)(i=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):(l.push(i%1e14),s+=7);s=o/7}if(!j)for(;s<o;)(i=A())<9e15&&(l[s++]=i%1e14);for(o=l[--s],t%=f,o&&t&&(i=p[f-t],l[s]=c(o/i)*i);0===l[s];l.pop(),s--);if(s<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=f);for(s=1,i=l[0];i>=10;i/=10,s++);s<f&&(r-=f-s)}return h.e=r,h.c=l,h}),W.sum=function(){for(var t=1,e=arguments,n=new W(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 o,i,s=[0],a=0,c=t.length;a<c;){for(i=s.length;i--;s[i]*=e);for(s[0]+=r.indexOf(t.charAt(a++)),o=0;o<s.length;o++)s[o]>n-1&&(null==s[o+1]&&(s[o+1]=0),s[o+1]+=s[o]/n|0,s[o]%=n)}return s.reverse()}return function(r,o,i,s,a){var c,u,l,h,f,d,p,g,m=r.indexOf("."),y=O,b=B;for(m>=0&&(h=V,V=0,r=r.replace(".",""),d=(g=new W(o)).pow(r.length-m),V=h,g.c=e(S(w(d.c),d.e,"0"),10,i,t),g.e=g.c.length),l=h=(p=e(r,o,i,a?(c=$,t):(c=t,$))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(m<0?--l:(d.c=p,d.e=l,d.s=s,p=(d=n(d,g,y,b,i)).c,f=d.r,l=d.e),m=p[u=l+y+1],h=i/2,f=f||u<0||null!=p[u+1],f=b<4?(null!=m||f)&&(0==b||b==(d.s<0?3:2)):m>h||m==h&&(4==b||f||6==b&&1&p[u-1]||b==(d.s<0?8:7)),u<1||!p[0])r=f?S(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(p.length=u,f)for(--i;++p[--u]>i;)p[u]=0,u||(++l,p=[1].concat(p));for(h=p.length;!p[--h];);for(m=0,r="";m<=h;r+=c.charAt(p[m++]));r=S(r,l,c.charAt(0))}return r}}(),n=function(){function t(t,e,n){var r,o,i,s,a=0,c=t.length,u=e%g,l=e/g|0;for(t=t.slice();c--;)a=((o=u*(i=t[c]%g)+(r=l*i+(s=t[c]/g|0)*u)%g*g+a)/n|0)+(r/g|0)+l*s,t[c]=o%n;return a&&(t=[a].concat(t)),t}function e(t,e,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;o<n;o++)if(t[o]!=e[o]){i=t[o]>e[o]?1:-1;break}return i}function n(t,e,n,r){for(var o=0;n--;)t[n]-=o,o=t[n]<e[n]?1:0,t[n]=o*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(r,o,i,s,a){var u,l,d,p,g,m,w,b,v,E,_,S,A,T,x,k,R,C=r.s==o.s?1:-1,P=r.c,I=o.c;if(!(P&&P[0]&&I&&I[0]))return new W(r.s&&o.s&&(P?!I||P[0]!=I[0]:I)?P&&0==P[0]||!I?0*C:C/0:NaN);for(v=(b=new W(C)).c=[],C=i+(l=r.e-o.e)+1,a||(a=h,l=y(r.e/f)-y(o.e/f),C=C/f|0),d=0;I[d]==(P[d]||0);d++);if(I[d]>(P[d]||0)&&l--,C<0)v.push(1),p=!0;else{for(T=P.length,k=I.length,d=0,C+=2,(g=c(a/(I[0]+1)))>1&&(I=t(I,g,a),P=t(P,g,a),k=I.length,T=P.length),A=k,_=(E=P.slice(0,k)).length;_<k;E[_++]=0);R=I.slice(),R=[0].concat(R),x=I[0],I[1]>=a/2&&x++;do{if(g=0,(u=e(I,E,k,_))<0){if(S=E[0],k!=_&&(S=S*a+(E[1]||0)),(g=c(S/x))>1)for(g>=a&&(g=a-1),w=(m=t(I,g,a)).length,_=E.length;1==e(m,E,w,_);)g--,n(m,k<w?R:I,w,a),w=m.length,u=1;else 0==g&&(u=g=1),w=(m=I.slice()).length;if(w<_&&(m=[0].concat(m)),n(E,m,_,a),_=E.length,-1==u)for(;e(I,E,k,_)<1;)g++,n(E,k<_?R:I,_,a),_=E.length}else 0===u&&(g++,E=[0]);v[d++]=g,E[0]?E[_++]=P[A]||0:(E=[P[A]],_=1)}while((A++<T||null!=E[0])&&C--);p=null!=E[0],v[0]||v.splice(0,1)}if(a==h){for(d=1,C=v[0];C>=10;C/=10,d++);Z(b,i+(b.e=d+l*f-1)+1,s,p)}else b.e=l,b.r=+p;return b}}(),T=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,k=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(t,e,n,r){var o,i=n?e:e.replace(C,"");if(R.test(i))t.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(T,(function(t,e,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?t:e})),r&&(o=r,i=i.replace(x,"$1").replace(k,"0.$1")),e!=i))return new W(i,o);if(W.DEBUG)throw Error(u+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},P.absoluteValue=P.abs=function(){var t=new W(this);return t.s<0&&(t.s=1),t},P.comparedTo=function(t,e){return b(this,new W(t,e))},P.decimalPlaces=P.dp=function(t,e){var n,r,o,i=this;if(null!=t)return v(t,0,m),null==e?e=B:v(e,0,8),Z(new W(i),t+i.e+1,e);if(!(n=i.c))return null;if(r=((o=n.length-1)-y(this.e/f))*f,o=n[o])for(;o%10==0;o/=10,r--);return r<0&&(r=0),r},P.dividedBy=P.div=function(t,e){return n(this,new W(t,e),O,B)},P.dividedToIntegerBy=P.idiv=function(t,e){return n(this,new W(t,e),0,1)},P.exponentiatedBy=P.pow=function(t,e){var n,r,o,i,s,l,h,d,p=this;if((t=new W(t)).c&&!t.isInteger())throw Error(u+"Exponent not an integer: "+G(t));if(null!=e&&(e=new W(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 d=new W(Math.pow(+G(p),s?t.s*(2-E(t)):+G(t))),e?d.mod(e):d;if(l=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new W(NaN);(r=!l&&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 i=p.s<0&&E(t)?-0:0,p.e>-1&&(i=1/i),new W(l?1/i:i);V&&(i=a(V/f+2))}for(s?(n=new W(.5),l&&(t.s=1),h=E(t)):h=(o=Math.abs(+G(t)))%2,d=new W(I);;){if(h){if(!(d=d.times(p)).c)break;i?d.c.length>i&&(d.c.length=i):r&&(d=d.mod(e))}if(o){if(0===(o=c(o/2)))break;h=o%2}else if(Z(t=t.times(n),t.e+1,1),t.e>14)h=E(t);else{if(0===(o=+G(t)))break;h=o%2}p=p.times(p),i?p.c&&p.c.length>i&&(p.c.length=i):r&&(p=p.mod(e))}return r?d:(l&&(d=I.div(d)),e?d.mod(e):i?Z(d,V,B,undefined):d)},P.integerValue=function(t){var e=new W(this);return null==t?t=B:v(t,0,8),Z(e,e.e+1,t)},P.isEqualTo=P.eq=function(t,e){return 0===b(this,new W(t,e))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(t,e){return b(this,new W(t,e))>0},P.isGreaterThanOrEqualTo=P.gte=function(t,e){return 1===(e=b(this,new W(t,e)))||0===e},P.isInteger=function(){return!!this.c&&y(this.e/f)>this.c.length-2},P.isLessThan=P.lt=function(t,e){return b(this,new W(t,e))<0},P.isLessThanOrEqualTo=P.lte=function(t,e){return-1===(e=b(this,new W(t,e)))||0===e},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(t,e){var n,r,o,i,s=this,a=s.s;if(e=(t=new W(t,e)).s,!a||!e)return new W(NaN);if(a!=e)return t.s=-e,s.plus(t);var c=s.e/f,u=t.e/f,l=s.c,d=t.c;if(!c||!u){if(!l||!d)return l?(t.s=-e,t):new W(d?s:NaN);if(!l[0]||!d[0])return d[0]?(t.s=-e,t):new W(l[0]?s:3==B?-0:0)}if(c=y(c),u=y(u),l=l.slice(),a=c-u){for((i=a<0)?(a=-a,o=l):(u=c,o=d),o.reverse(),e=a;e--;o.push(0));o.reverse()}else for(r=(i=(a=l.length)<(e=d.length))?a:e,a=e=0;e<r;e++)if(l[e]!=d[e]){i=l[e]<d[e];break}if(i&&(o=l,l=d,d=o,t.s=-t.s),(e=(r=d.length)-(n=l.length))>0)for(;e--;l[n++]=0);for(e=h-1;r>a;){if(l[--r]<d[r]){for(n=r;n&&!l[--n];l[n]=e);--l[n],l[r]+=h}l[r]-=d[r]}for(;0==l[0];l.splice(0,1),--u);return l[0]?q(t,l,u):(t.s=3==B?-1:1,t.c=[t.e=0],t)},P.modulo=P.mod=function(t,e){var r,o,i=this;return t=new W(t,e),!i.c||!t.s||t.c&&!t.c[0]?new W(NaN):!t.c||i.c&&!i.c[0]?new W(i):(9==M?(o=t.s,t.s=1,r=n(i,t,0,3),t.s=o,r.s*=o):r=n(i,t,0,M),(t=i.minus(r.times(t))).c[0]||1!=M||(t.s=i.s),t)},P.multipliedBy=P.times=function(t,e){var n,r,o,i,s,a,c,u,l,d,p,m,w,b,v,E=this,_=E.c,S=(t=new W(t,e)).c;if(!(_&&S&&_[0]&&S[0]))return!E.s||!t.s||_&&!_[0]&&!S||S&&!S[0]&&!_?t.c=t.e=t.s=null:(t.s*=E.s,_&&S?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=y(E.e/f)+y(t.e/f),t.s*=E.s,(c=_.length)<(d=S.length)&&(w=_,_=S,S=w,o=c,c=d,d=o),o=c+d,w=[];o--;w.push(0));for(b=h,v=g,o=d;--o>=0;){for(n=0,p=S[o]%v,m=S[o]/v|0,i=o+(s=c);i>o;)n=((u=p*(u=_[--s]%v)+(a=m*u+(l=_[s]/v|0)*p)%v*v+w[i]+n)/b|0)+(a/v|0)+m*l,w[i--]=u%b;w[i]=n}return n?++r:w.splice(0,1),q(t,w,r)},P.negated=function(){var t=new W(this);return t.s=-t.s||null,t},P.plus=function(t,e){var n,r=this,o=r.s;if(e=(t=new W(t,e)).s,!o||!e)return new W(NaN);if(o!=e)return t.s=-e,r.minus(t);var i=r.e/f,s=t.e/f,a=r.c,c=t.c;if(!i||!s){if(!a||!c)return new W(o/0);if(!a[0]||!c[0])return c[0]?t:new W(a[0]?r:0*o)}if(i=y(i),s=y(s),a=a.slice(),o=i-s){for(o>0?(s=i,n=c):(o=-o,n=a),n.reverse();o--;n.push(0));n.reverse()}for((o=a.length)-(e=c.length)<0&&(n=c,c=a,a=n,e=o),o=0;e;)o=(a[--e]=a[e]+c[e]+o)/h|0,a[e]=h===a[e]?0:a[e]%h;return o&&(a=[o].concat(a),++s),q(t,a,s)},P.precision=P.sd=function(t,e){var n,r,o,i=this;if(null!=t&&t!==!!t)return v(t,1,m),null==e?e=B:v(e,0,8),Z(new W(i),t,e);if(!(n=i.c))return null;if(r=(o=n.length-1)*f+1,o=n[o]){for(;o%10==0;o/=10,r--);for(o=n[0];o>=10;o/=10,r++);}return t&&i.e+1>r&&(r=i.e+1),r},P.shiftedBy=function(t){return v(t,-9007199254740991,d),this.times("1e"+t)},P.squareRoot=P.sqrt=function(){var t,e,r,o,i,s=this,a=s.c,c=s.s,u=s.e,l=O+4,h=new W("0.5");if(1!==c||!a||!a[0])return new W(!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+u)%2==0&&(e+="0"),c=Math.sqrt(+e),u=y((u+1)/2)-(u<0||u%2),r=new W(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new W(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=h.times(i.plus(n(s,i,l,1))),w(i.c).slice(0,c)===(e=w(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(e=e.slice(c-3,c+1))&&(o||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Z(r,r.e+O+2,1),t=!r.times(r).eq(s));break}if(!o&&(Z(i,i.e+O+2,0),i.times(i).eq(s))){r=i;break}l+=4,c+=4,o=1}return Z(r,r.e+O+1,B,t)},P.toExponential=function(t,e){return null!=t&&(v(t,0,m),t++),z(this,t,e,1)},P.toFixed=function(t,e){return null!=t&&(v(t,0,m),t=t+this.e+1),z(this,t,e)},P.toFormat=function(t,e,n){var r,o=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(u+"Argument not an object: "+n);if(r=o.toFixed(t,e),o.c){var i,s=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||"",h=s[0],f=s[1],d=o.s<0,p=d?h.slice(1):h,g=p.length;if(c&&(i=a,a=c,c=i,g-=i),a>0&&g>0){for(i=g%a||a,h=p.substr(0,i);i<g;i+=a)h+=l+p.substr(i,a);c>0&&(h+=l+p.slice(i)),d&&(h="-"+h)}r=f?h+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):h}return(n.prefix||"")+r+(n.suffix||"")},P.toFraction=function(t){var e,r,o,i,s,a,c,l,h,d,g,m,y=this,b=y.c;if(null!=t&&(!(c=new W(t)).isInteger()&&(c.c||1!==c.s)||c.lt(I)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+G(c));if(!b)return new W(y);for(e=new W(I),h=r=new W(I),o=l=new W(I),m=w(b),s=e.e=m.length-y.e-1,e.c[0]=p[(a=s%f)<0?f+a:a],t=!t||c.comparedTo(e)>0?s>0?e:h:c,a=D,D=1/0,c=new W(m),l.c[0]=0;d=n(c,e,0,1),1!=(i=r.plus(d.times(o))).comparedTo(t);)r=o,o=i,h=l.plus(d.times(i=h)),l=i,e=c.minus(d.times(i=e)),c=i;return i=n(t.minus(r),o,0,1),l=l.plus(i.times(h)),r=r.plus(i.times(o)),l.s=h.s=y.s,g=n(h,o,s*=2,B).minus(y).abs().comparedTo(n(l,r,s,B).minus(y).abs())<1?[h,o]:[l,r],D=a,g},P.toNumber=function(){return+G(this)},P.toPrecision=function(t,e){return null!=t&&v(t,1,m),z(this,t,e,2)},P.toString=function(t){var e,n=this,o=n.s,i=n.e;return null===i?o?(e="Infinity",o<0&&(e="-"+e)):e="NaN":(null==t?e=i<=U||i>=L?_(w(n.c),i):S(w(n.c),i,"0"):10===t&&K?e=S(w((n=Z(new W(n),O+i+1,B)).c),n.e,"0"):(v(t,2,$.length,"Base"),e=r(S(w(n.c),i,"0"),10,t,o,!0)),o<0&&n.c[0]&&(e="-"+e)),e},P.valueOf=P.toJSON=function(){return G(this)},P._isBigNumber=!0,null!=e&&W.set(e),W}(),i.default=i.BigNumber=i,void 0===(r=function(){return i}.call(e,n,e,t))||(t.exports=r)}()},764:(t,e,n)=>{"use strict";const r=n(742),o=n(645),i="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 u(t,e,n)}function u(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|g(t,e);let r=a(n);const o=r.write(t,e);o!==n&&(r=r.slice(0,o));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(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 d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return d(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 o=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||X(t.length)?a(0):f(t);if("Buffer"===t.type&&Array.isArray(t.data))return f(t.data)}(t);if(o)return o;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 l(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 l(t),a(t<0?0:0|p(t))}function f(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 d(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 g(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 o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return H(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(o)return r?-1:H(t).length;e=(""+e).toLowerCase(),o=!0}}function m(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 P(this,e,n);case"utf8":case"utf-8":return x(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(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,o){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=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:b(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):b(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,r,o){let i,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 u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let r=-1;for(i=n;i<a;i++)if(u(t,i)===u(e,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*s}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(t,i+r)!==u(e,r)){n=!1;break}if(n)return i}return-1}function v(t,e,n,r){n=Number(n)||0;const o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=e.length;let s;for(r>i/2&&(r=i/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if(X(r))return s;t[n+s]=r}return s}function E(t,e,n,r){return Z(H(e,t.length-n),t,n,r)}function _(t,e,n,r){return Z(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 S(t,e,n,r){return Z(q(e),t,n,r)}function A(t,e,n,r){return Z(function(t,e){let n,r,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function T(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function x(t,e,n){n=Math.min(t.length,n);const r=[];let o=e;for(;o<n;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(i=e);break;case 2:n=t[o+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(i=c));break;case 3:n=t[o+1],r=t[o+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=t[o+1],r=t[o+2],a=t[o+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&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=k));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 u(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 l(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 o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];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 o=0;for(n=0;n<t.length;++n){let e=t[n];if(G(e,Uint8Array))o+e.length>r.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,o)):Uint8Array.prototype.set.call(r,e,o);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,o)}o+=e.length}return r},c.byteLength=g,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?x(this,0,t):m.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+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,o){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===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;let i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(i,s),u=this.slice(r,o),l=t.slice(e,n);for(let t=0;t<a;++t)if(u[t]!==l[t]){i=u[t],s=l[t];break}return i<s?-1:s<i?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 o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return _(this,t,e,n);case"base64":return S(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function R(t,e,n){let r="";n=Math.min(t.length,n);for(let o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function C(t,e,n){let r="";n=Math.min(t.length,n);for(let o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function P(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=e;r<n;++r)o+=Y[t[r]];return o}function I(t,e,n){const r=t.slice(e,n);let o="";for(let t=0;t<r.length-1;t+=2)o+=String.fromCharCode(r[t]+256*r[t+1]);return o}function O(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 B(t,e,n,r,o,i){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function U(t,e,n,r,o){$(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i;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 L(t,e,n,r,o){$(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n+7]=i,i>>=8,t[n+6]=i,i>>=8,t[n+5]=i,i>>=8,t[n+4]=i;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 N(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(t,e,n,r,i){return e=+e,n>>>=0,i||N(t,0,n,4),o.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,i){return e=+e,n>>>=0,i||N(t,0,n,8),o.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||O(t,e,this.length);let r=this[t],o=1,i=0;for(;++i<e&&(o*=256);)r+=this[t+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t+--e],o=1;for(;e>0&&(o*=256);)r+=this[t+--e]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(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||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=J((function(t){K(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(t){K(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=this[t],o=1,i=0;for(;++i<e&&(o*=256);)r+=this[t+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||O(t,e,this.length);let r=e,o=1,i=this[t+--r];for(;r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||O(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||O(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||O(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||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){K(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(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){K(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(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||O(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),o.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){B(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){B(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||B(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||B(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||B(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||B(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||B(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 U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return L(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);B(this,t,e,n,r-1,-r)}let o=0,i=1,s=0;for(this[e]=255&t;++o<n&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>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);B(this,t,e,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||B(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||B(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||B(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||B(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||B(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 U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return j(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 o=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),o},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 o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{const i=c.isBuffer(t)?t:c.from(t,r),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-e;++o)this[o+e]=i[o%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 $(t,e,n,r,o,i){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new M.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,n){K(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,o,i)}function K(t,e){if("number"!=typeof t)throw new M.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw K(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.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${e}. Received ${o}`,r}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function H(t,e){let n;e=e||1/0;const r=t.length;let o=null;const i=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.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;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function q(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Z(t,e,n,r){let o;for(o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function G(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}const Y=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)e[r+o]=t[n]+t[o]}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,o=Object.getOwnPropertyDescriptor,i=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,o=e.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!o&&!i)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(o)return o(t,n).value}return t[n]};t.exports=function t(){var e,n,r,o,u,l,h=arguments[0],f=1,d=arguments.length,p=!1;for("boolean"==typeof h&&(p=h,h=arguments[1]||{},f=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});f<d;++f)if(null!=(e=arguments[f]))for(n in e)r=c(h,n),h!==(o=c(e,n))&&(p&&o&&(s(o)||(u=i(o)))?(u?(u=!1,l=r&&i(r)?r:[]):l=r&&s(r)?r:{},a(h,{name:n,newValue:t(p,l,o)})):void 0!==o&&a(h,{name:n,newValue:o}));return h}},645:(t,e)=>{e.read=function(t,e,n,r,o){var i,s,a=8*o-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?o-1:0,f=n?-1:1,d=t[e+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+t[e+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<<u)-1,h=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,g=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=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*c-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;t[n+d]=255&s,d+=p,s/=256,u-=8);t[n+d-p]|=128*g}},703:(t,e,n)=>{"use strict";var r=n(414);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,n,o,i,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:i,resetWarningCache:o};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),o=Symbol.for("react.element"),i=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 u(t,e,n){var r,i={},u=null,l=null;for(r in void 0!==n&&(u=""+n),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(l=e.ref),e)s.call(e,r)&&!c.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:u,ref:l,props:i,_owner:a.current}}e.jsx=u,e.jsxs=u},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 i[t].call(n.exports,n,n.exports,a),n.exports}a.m=i,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 o=Object.create(null);a.r(o);var i={};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=>i[e]=()=>t[e]));return i.default=()=>t,a.d(o,i),o},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={},o="onairos:",a.l=(t,e,n,i)=>{if(r[t])r[t].push(e);else{var s,c;if(void 0!==n)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==o+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",o+n),s.src=t),r[t]=[e];var f=(e,n)=>{s.onerror=s.onload=null,clearTimeout(d);var o=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((t=>t(n))),e)return e(n)},d=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.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 o=new Promise(((n,o)=>r=t[e]=[n,o]));n.push(r[2]=o);var i=a.p+a.u(e),s=new Error;a.l(i,(n=>{if(a.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+o+": "+i+")",s.name="ChunkLoadError",s.type=o,s.request=i,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,o,i=n[0],s=n[1],c=n[2],u=0;if(i.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);u<i.length;u++)o=i[u],a.o(t,o)&&t[o]&&t[o][0](),t[o]=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:()=>Jx,default:()=>Qx});var t={};a.r(t),a.d(t,{hasBrowserEnv:()=>ee,hasStandardBrowserEnv:()=>ne,hasStandardBrowserWebWorkerEnv:()=>oe});var e=a(639),n=a.n(e),r=a(764);function o(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 o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var i="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 u(t,e){return t(e={exports:{}},e.exports),e.exports}var l=u((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(l);var h=s(u((function(t,e){var n=i&&i.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(s,a)}c((r=r.apply(t,e||[])).next())}))},r=i&&i.__generator||function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},o=i;Object.defineProperty(e,"__esModule",{value:!0});var s="browser-tabs-lock-key",a={key:function(t){return n(o,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},getItem:function(t){return n(o,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},clear:function(){return n(o,void 0,void 0,(function(){return r(this,(function(t){return[2,window.localStorage.clear()]}))}))},removeItem:function(t){return n(o,void 0,void 0,(function(){return r(this,(function(t){throw new Error("Unsupported")}))}))},setItem:function(t,e){return n(o,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 u(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()+u(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,o){return void 0===o&&(o=5e3),n(this,void 0,void 0,(function(){var n,i,l,h,f,d,p;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+u(4),i=Date.now()+o,l=s+"-"+e,h=void 0===this.storageHandler?a:this.storageHandler,r.label=1;case 1:return Date.now()<i?[4,c(30)]:[3,8];case 2:return r.sent(),null!==h.getItemSync(l)?[3,5]:(f=this.id+"-"+e+"-"+n,[4,c(Math.floor(25*Math.random()))]);case 3:return r.sent(),h.setItemSync(l,JSON.stringify({id:this.id,iat:n,timeoutKey:f,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:return r.sent(),null!==(d=h.getItemSync(l))&&(p=JSON.parse(d)).id===this.id&&p.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(l,n),[2,!0]):[3,7];case 5:return t.lockCorrector(void 0===this.storageHandler?a:this.storageHandler),[4,this.waitForSomethingToChange(i)];case 6:r.sent(),r.label=7;case 7:return n=Date.now()+u(4),[3,1];case 8:return[2,!1]}}))}))},t.prototype.refreshLockWhileAcquired=function(t,e){return n(this,void 0,void 0,(function(){var o=this;return r(this,(function(i){return setTimeout((function(){return n(o,void 0,void 0,(function(){var n,o,i;return r(this,(function(r){switch(r.label){case 0:return[4,l.default().lock(e)];case 1:return r.sent(),this.acquiredIatSet.has(e)?(n=void 0===this.storageHandler?a:this.storageHandler,null===(o=n.getItemSync(t))?(l.default().unlock(e),[2]):((i=JSON.parse(o)).timeRefreshed=Date.now(),n.setItemSync(t,JSON.stringify(i)),l.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2])):(l.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,o=Date.now(),i=!1;function s(){if(i||(window.removeEventListener("storage",s),t.removeFromWaiting(s),clearTimeout(a),i=!0),!r){r=!0;var e=50-(Date.now()-o);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,o,i,c;return r(this,(function(r){switch(r.label){case 0:return n=void 0===this.storageHandler?a:this.storageHandler,o=s+"-"+e,null===(i=n.getItemSync(o))?[2]:(c=JSON.parse(i)).id!==this.id?[3,2]:[4,l.default().lock(c.iat)];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(o),l.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,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var c=!1,u=0;u<o.length;u++){var l=o[u];if(l.includes(s)){var h=r.getItemSync(l);if(null!==h){var f=JSON.parse(h);(void 0===f.timeRefreshed&&f.timeAcquired<n||void 0!==f.timeRefreshed&&f.timeRefreshed<n)&&(r.removeItemSync(l),c=!0)}}}c&&t.notifyWaiters()},t.waiters=void 0,t}();e.default=h})));const f={timeoutInSeconds:60},d={name:"auth0-spa-js",version:"2.1.3"},p=()=>Date.now();class g extends Error{constructor(t,e){super(e),this.error=t,this.error_description=e,Object.setPrototypeOf(this,g.prototype)}static fromPayload({error:t,error_description:e}){return new g(t,e)}}class m extends g{constructor(t,e,n,r=null){super(t,e),this.state=n,this.appState=r,Object.setPrototypeOf(this,m.prototype)}}class y extends g{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 b extends g{constructor(t){super("cancelled","Popup closed"),this.popup=t,Object.setPrototypeOf(this,b.prototype)}}class v extends g{constructor(t,e,n){super(t,e),this.mfa_token=n,Object.setPrototypeOf(this,v.prototype)}}class E extends g{constructor(t,e){super("missing_refresh_token",`Missing Refresh Token (audience: '${_(t,["default"])}', scope: '${_(e)}')`),this.audience=t,this.scope=e,Object.setPrototypeOf(this,E.prototype)}}function _(t,e=[]){return t&&!e.includes(t)?t:""}const S=()=>window.crypto,A=()=>{const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let e="";return Array.from(S().getRandomValues(new Uint8Array(43))).forEach((n=>e+=t[n%66])),e},T=t=>btoa(t),x=t=>{var{clientId:e}=t,n=o(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()},k=t=>(t=>decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(t.replace(/_/g,"/").replace(/-/g,"+")),R=async(t,e)=>{const n=await fetch(t,e);return{ok:n.ok,json:await n.json()}},C=async(t,e,n,r,o,i,s=1e4)=>o?(async(t,e,n,r,o,i,s)=>{return a={auth:{audience:e,scope:n},timeout:o,fetchUrl:t,fetchOptions:r,useFormData:s},c=i,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,o,i):(async(t,e,n)=>{const r=new AbortController;let o;return e.signal=r.signal,Promise.race([R(t,e),new Promise(((t,e)=>{o=setTimeout((()=>{r.abort(),e(new Error("Timeout when executing 'fetch'"))}),n)}))]).finally((()=>{clearTimeout(o)}))})(t,r,s);async function P(t,e){var{baseUrl:n,timeout:r,audience:i,scope:s,auth0Client:a,useFormData:c}=t,u=o(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const l=c?x(u):JSON.stringify(u);return await async function(t,e,n,r,i,s,a){let c,u=null;for(let o=0;o<3;o++)try{c=await C(t,n,r,i,s,a,e),u=null;break}catch(t){u=t}if(u)throw u;const l=c.json,{error:h,error_description:f}=l,d=o(l,["error","error_description"]),{ok:p}=c;if(!p){const e=f||`HTTP error. Unable to fetch ${t}`;if("mfa_required"===h)throw new v(h,e,d.mfa_token);if("missing_refresh_token"===h)throw new E(n,r);throw new g(h||"request_error",e)}return d}(`${n}/oauth/token`,r,i||"default",s,{method:"POST",body:l,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(a||d))}},e,c)}const I=(...t)=>{return(e=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e};class O{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,o]=t.split("::");return new O({clientId:n,scope:o,audience:r},e)}static fromCacheEntry(t){const{scope:e,audience:n,client_id:r}=t;return new O({scope:e,audience:n,clientId:r})}}class B{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 U{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 L{constructor(t,e,n){this.cache=t,this.keyManifest=e,this.nowProvider=n||p}async setIdToken(t,e,n){var r;const o=this.getIdTokenCacheKey(t);await this.cache.set(o,{id_token:e,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}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 o=await this.nowProvider(),i=Math.floor(o/1e3);return r.expiresAt-e<i?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 O({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 O({clientId:t},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(t,e){return e.filter((e=>{var n;const r=O.fromKey(e),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=t.scope)||void 0===n?void 0:n.split(" "))||[],s=r.scope&&i.reduce(((t,e)=>t&&o.has(e)),!0);return"@@auth0spajs@@"===r.prefix&&r.clientId===t.clientId&&r.audience===t.audience&&s}))[0]}}class N{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 D=t=>"number"==typeof t,j=["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=u((function(t,e){var n=i&&i.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)};function r(t,e){if(!e)return"";var n="; "+t;return!0===e?n:n+"="+e}function o(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,o=0;o<n.length;o++){var i=n[o].split("="),s=i.slice(1).join("=");'"'===s.charAt(0)&&(s=s.slice(1,-1));try{e[i[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=o(t,e,n({path:"/"},r))}e.__esModule=!0,e.encode=o,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,$=M.remove;const K={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),$(t,n)}},W={get:t=>K.get(t)||K.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),K.save(t,e,n)},remove(t,e){let n={};(null==e?void 0:e.cookieDomain)&&(n.domain=e.cookieDomain),$(t,n),K.remove(t,e),K.remove(`_legacy_${t}`,e)}},z={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 H,q=("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",null,!1,function(t){return H=H||function(t,e,n){var r=void 0===e?null:e,o=function(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),o=0,i=n.length;o<i;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(t,void 0!==n&&n),i=o.indexOf("\n",10)+1,s=o.substring(i)+(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(H,t)});const Z={};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 X={memory:()=>(new U).enclosedCache,localstorage:()=>new B},Y=t=>X[t],J=t=>{const{openUrl:e,onRedirect:n}=t,r=o(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 U).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(!S())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===S().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",!Y(e))throw new Error(`Invalid cache location "${e}"`);n=Y(e)()}this.httpTimeoutMs=t.httpTimeoutInSeconds?1e3*t.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===t.legacySameSiteCookie?K:W,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:z;var o;this.scope=I("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new N(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||p,this.cacheManager=new L(n,n.allKeys?void 0:new G(n,this.options.clientId),this.nowProvider),this.domainUrl=(o=this.options.domain,/^https?:\/\//.test(o)?o:`https://${o}`),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 q)}_url(t){const e=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||d)));return`${this.domainUrl}${t}&auth0Client=${e}`}_authorizeUrl(t){return this._url(`/authorize?${x(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,o]=e;if(3!==e.length||!n||!r||!o)throw new Error("ID token could not be decoded");const i=JSON.parse(k(r)),s={__raw:t},a={};return Object.keys(i).forEach((t=>{s[t]=i[t],j.includes(t)||(a[t]=i[t])})),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(k(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&&!D(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||!D(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!D(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()),o=new Date(0);if(o.setUTCSeconds(e.claims.exp+n),r>o)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${o})`);if(null!=e.claims.nbf&&D(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&&D(e.claims.auth_time)){const o=new Date(0);if(o.setUTCSeconds(parseInt(e.claims.auth_time)+t.max_age+n),r>o)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 ${o}`)}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:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_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=T(A()),o=T(A()),i=A(),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=S().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(t));return await e})(i)),a=((t,e,n,r,o,i,s,a)=>Object.assign(Object.assign(Object.assign({client_id:t.clientId},t.authorizationParams),n),{scope:I(e,n.scope),response_type:"code",response_mode:a||"query",state:r,nonce:o,redirect_uri:s||t.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256"}))(this.options,this.scope,t,r,o,s,t.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==e?void 0:e.response_mode),c=this._authorizeUrl(a);return{nonce:o,code_verifier:i,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 o=await(t=>new Promise(((e,n)=>{let r;const o=setInterval((()=>{t.popup&&t.popup.closed&&(clearInterval(o),clearTimeout(i),window.removeEventListener("message",r,!1),n(new b(t.popup)))}),1e3),i=setTimeout((()=>{clearInterval(o),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(i),clearInterval(o),window.removeEventListener("message",r,!1),t.popup.close(),s.data.response.error)return n(g.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!==o.state)throw new g("state_mismatch","Invalid state");const i=(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:o.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:i})}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:i,appState:s}=n,a=o(n,["openUrl","fragment","appState"]),c=(null===(e=a.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,u=await this._prepareAuthorizeUrl(a.authorizationParams||{}),{url:l}=u,h=o(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},h),{appState:s}),c&&{organization:c}));const f=i?`${l}#${i}`:l;r?await r(f):window.location.assign(f)}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:o,error_description:i}=(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 g("missing_transaction","Invalid state");if(this.transactionManager.remove(),o)throw new m(o,i||o,n,s.appState);if(!s.code_verifier||s.state&&s.state!==n)throw new g("state_mismatch","Invalid state");const a=s.organization,c=s.nonce,u=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},u?{redirect_uri:u}:{}),{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:I(this.scope,null===(e=t.authorizationParams)||void 0===e?void 0:e.scope)})}),r=await((t,e)=>{let n=Z[e];return n||(n=t().finally((()=>{delete Z[e],n=null})),Z[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=o(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:o,oauthTokenScope:i,expires_in:s}=t;return Object.assign(Object.assign({id_token:r,access_token:o},i?{scope:i}: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:I(this.scope,null===(n=t.authorizationParams)||void 0===n?void 0:n.scope)})});return e=Object.assign(Object.assign({},f),e),await this.loginWithPopup(r,e),(await this.cacheManager.get(new O({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=o(e,["federated"]),i=n?"&federated":"";return this._url(`/v2/logout?${x(Object.assign({clientId:t.clientId},r))}`)+i}async logout(t={}){const e=J(t),{openUrl:n}=e,r=o(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 i=this._buildLogoutUrl(r);n?await n(i):!1!==n&&window.location.assign(i)}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:o,nonce:i,code_verifier:s,redirect_uri:a,scope:c,audience:u}=await this._prepareAuthorizeUrl(e,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new g("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,l=await((t,e,n=60)=>new Promise(((r,o)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const s=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",a,!1))};let a;const c=setTimeout((()=>{o(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?o(g.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(i),i.setAttribute("src",t)})))(r,this.domainUrl,n);if(o!==l.state)throw new g("state_mismatch","Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},t.authorizationParams),{code_verifier:s,code:l.code,grant_type:"authorization_code",redirect_uri:a,timeout:t.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:e.organization});return Object.assign(Object.assign({},h),{scope:c,oauthTokenScope:h.scope,audience:u})}catch(t){throw"login_required"===t.error&&this.logout({openUrl:!1}),t}}async _getTokenUsingRefreshToken(t){const e=await this.cacheManager.get(new O({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 o=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({},o),{scope:t.authorizationParams.scope,oauthTokenScope:o.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=o(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 O({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 O({scope:t,audience:e,clientId:n}),60);if(r&&r.access_token){const{access_token:t,oauthTokenScope:e,expires_in:n}=r,o=await this._getIdTokenFromCache();return o&&Object.assign(Object.assign({id_token:o.id_token,access_token:t},e?{scope:e}:null),{expires_in:n})}}async _requestToken(t,e){const{nonceIn:n,organization:r}=e||{},o=await P(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},t),this.worker),i=await this._verifyIdToken(o.id_token,n,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},o),{decodedToken:i,scope:t.scope,audience:t.audience||"default"}),o.scope?{oauthTokenScope:o.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||i.claims.org_id),Object.assign(Object.assign({},o),{decodedToken:i})}}var et=a(470);function nt(t,e){return function(){return t.apply(e,arguments)}}const{toString:rt}=Object.prototype,{getPrototypeOf:ot}=Object,it=(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=>it(e)===t),ct=t=>e=>typeof e===t,{isArray:ut}=Array,lt=ct("undefined");const ht=at("ArrayBuffer");const ft=ct("string"),dt=ct("function"),pt=ct("number"),gt=t=>null!==t&&"object"==typeof t,mt=t=>{if("object"!==it(t))return!1;const e=ot(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"),bt=at("Blob"),vt=at("FileList"),Et=at("URLSearchParams");function _t(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,o;if("object"!=typeof t&&(t=[t]),ut(t))for(r=0,o=t.length;r<o;r++)e.call(null,t[r],r,t);else{const o=n?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let s;for(r=0;r<i;r++)s=o[r],e.call(null,t[s],s,t)}}function St(t,e){e=e.toLowerCase();const n=Object.keys(t);let r,o=n.length;for(;o-- >0;)if(r=n[o],e===r.toLowerCase())return r;return null}const At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Tt=t=>!lt(t)&&t!==At;const xt=(kt="undefined"!=typeof Uint8Array&&ot(Uint8Array),t=>kt&&t instanceof kt);var kt;const Rt=at("HTMLFormElement"),Ct=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Pt=at("RegExp"),It=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};_t(n,((n,o)=>{let i;!1!==(i=e(n,o,t))&&(r[o]=i||n)})),Object.defineProperties(t,r)},Ot="abcdefghijklmnopqrstuvwxyz",Bt="0123456789",Ut={DIGIT:Bt,ALPHA:Ot,ALPHA_DIGIT:Ot+Ot.toUpperCase()+Bt};const Lt=at("AsyncFunction"),Nt={isArray:ut,isArrayBuffer:ht,isBuffer:function(t){return null!==t&&!lt(t)&&null!==t.constructor&&!lt(t.constructor)&&dt(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||dt(t.append)&&("formdata"===(e=it(t))||"object"===e&&dt(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:ft,isNumber:pt,isBoolean:t=>!0===t||!1===t,isObject:gt,isPlainObject:mt,isUndefined:lt,isDate:yt,isFile:wt,isBlob:bt,isRegExp:Pt,isFunction:dt,isStream:t=>gt(t)&&dt(t.pipe),isURLSearchParams:Et,isTypedArray:xt,isFileList:vt,forEach:_t,merge:function t(){const{caseless:e}=Tt(this)&&this||{},n={},r=(r,o)=>{const i=e&&St(n,o)||o;mt(n[i])&&mt(r)?n[i]=t(n[i],r):mt(r)?n[i]=t({},r):ut(r)?n[i]=r.slice():n[i]=r};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&_t(arguments[t],r);return n},extend:(t,e,n,{allOwnKeys:r}={})=>(_t(e,((e,r)=>{n&&dt(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 o,i,s;const a={};if(e=e||{},null==t)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)s=o[i],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&ot(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:it,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(ut(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:Rt,hasOwnProperty:Ct,hasOwnProp:Ct,reduceDescriptors:It,freezeMethods:t=>{It(t,((e,n)=>{if(dt(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];dt(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 ut(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:St,global:At,isContextDefined:Tt,ALPHABET:Ut,generateString:(t=16,e=Ut.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n},isSpecCompliantForm:function(t){return!!(t&&dt(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,r)=>{if(gt(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const o=ut(t)?[]:{};return _t(t,((t,e)=>{const i=n(t,r+1);!lt(i)&&(o[e]=i)})),e[r]=void 0,o}}return t};return n(t,0)},isAsyncFn:Lt,isThenable:t=>t&&(gt(t)||dt(t))&&dt(t.then)&&dt(t.catch)};function Dt(t,e,n,r,o){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),o&&(this.response=o)}Nt.inherits(Dt,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:Nt.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const jt=Dt.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(Dt,Mt),Object.defineProperty(jt,"isAxiosError",{value:!0}),Dt.from=(t,e,n,r,o,i)=>{const s=Object.create(jt);return Nt.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),Dt.call(s,t.message,e,n,r,o),s.cause=t,s.name=t.name,i&&Object.assign(s,i),s};const Vt=Dt;function Ft(t){return Nt.isPlainObject(t)||Nt.isArray(t)}function $t(t){return Nt.endsWith(t,"[]")?t.slice(0,-2):t}function Kt(t,e,n){return t?t.concat(e).map((function(t,e){return t=$t(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const Wt=Nt.toFlatObject(Nt,{},null,(function(t){return/^is[A-Z]/.test(t)}));const zt=function(t,e,n){if(!Nt.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=Nt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!Nt.isUndefined(e[t])}))).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Nt.isSpecCompliantForm(e);if(!Nt.isFunction(o))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(Nt.isDate(t))return t.toISOString();if(!a&&Nt.isBlob(t))throw new Vt("Blob is not supported. Use a Buffer instead.");return Nt.isArrayBuffer(t)||Nt.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,n,o){let a=t;if(t&&!o&&"object"==typeof t)if(Nt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(Nt.isArray(t)&&function(t){return Nt.isArray(t)&&!t.some(Ft)}(t)||(Nt.isFileList(t)||Nt.endsWith(n,"[]"))&&(a=Nt.toArray(t)))return n=$t(n),a.forEach((function(t,r){!Nt.isUndefined(t)&&null!==t&&e.append(!0===s?Kt([n],r,i):null===s?n:n+"[]",c(t))})),!1;return!!Ft(t)||(e.append(Kt(o,n,i),c(t)),!1)}const l=[],h=Object.assign(Wt,{defaultVisitor:u,convertValue:c,isVisitable:Ft});if(!Nt.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!Nt.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Nt.forEach(n,(function(n,i){!0===(!(Nt.isUndefined(n)||null===n)&&o.call(e,n,Nt.isString(i)?i.trim():i,r,h))&&t(n,r?r.concat(i):[i])})),l.pop()}}(t),e};function Ht(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function qt(t,e){this._pairs=[],t&&zt(t,this,e)}const Zt=qt.prototype;Zt.append=function(t,e){this._pairs.push([t,e])},Zt.toString=function(t){const e=t?function(e){return t.call(this,e,Ht)}:Ht;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const Gt=qt;function Xt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Yt(t,e,n){if(!e)return t;const r=n&&n.encode||Xt,o=n&&n.serialize;let i;if(i=o?o(e,n):Nt.isURLSearchParams(e)?e.toString():new Gt(e,n).toString(r),i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}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){Nt.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 oe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ie={...t,...te};const se=function(t){function e(t,n,r,o){let i=t[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=t.length;if(i=!i&&Nt.isArray(r)?r.length:i,a)return Nt.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&Nt.isObject(r[i])||(r[i]=[]);return e(t,n,r[i],o)&&Nt.isArray(r[i])&&(r[i]=function(t){const e={},n=Object.keys(t);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],e[i]=t[i];return e}(r[i])),!s}if(Nt.isFormData(t)&&Nt.isFunction(t.entries)){const n={};return Nt.forEachEntry(t,((t,r)=>{e(function(t){return Nt.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,o=Nt.isObject(t);o&&Nt.isHTMLForm(t)&&(t=new FormData(t));if(Nt.isFormData(t))return r&&r?JSON.stringify(se(t)):t;if(Nt.isArrayBuffer(t)||Nt.isBuffer(t)||Nt.isStream(t)||Nt.isFile(t)||Nt.isBlob(t))return t;if(Nt.isArrayBufferView(t))return t.buffer;if(Nt.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return zt(t,new ie.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return ie.isNode&&Nt.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((i=Nt.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return zt(i?{"files[]":t}:t,e&&new e,this.formSerializer)}}return o||r?(e.setContentType("application/json",!1),function(t,e,n){if(Nt.isString(t))try{return(e||JSON.parse)(t),Nt.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&&Nt.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:ie.classes.FormData,Blob:ie.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Nt.forEach(["delete","get","head","post","put","patch"],(t=>{ae.headers[t]={}}));const ce=ae,ue=Nt.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"]),le=Symbol("internals");function he(t){return t&&String(t).trim().toLowerCase()}function fe(t){return!1===t||null==t?t:Nt.isArray(t)?t.map(fe):String(t)}function de(t,e,n,r,o){return Nt.isFunction(r)?r.call(this,e,n):(o&&(e=n),Nt.isString(e)?Nt.isString(r)?-1!==e.indexOf(r):Nt.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 o(t,e,n){const o=he(e);if(!o)throw new Error("header name must be a non-empty string");const i=Nt.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||e]=fe(t))}const i=(t,e)=>Nt.forEach(t,((t,n)=>o(t,n,e)));return Nt.isPlainObject(t)||t instanceof this.constructor?i(t,e):Nt.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?i((t=>{const e={};let n,r,o;return t&&t.split("\n").forEach((function(t){o=t.indexOf(":"),n=t.substring(0,o).trim().toLowerCase(),r=t.substring(o+1).trim(),!n||e[n]&&ue[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&&o(e,t,n),this}get(t,e){if(t=he(t)){const n=Nt.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(Nt.isFunction(e))return e.call(this,t,n);if(Nt.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=he(t)){const n=Nt.findKey(this,t);return!(!n||void 0===this[n]||e&&!de(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function o(t){if(t=he(t)){const o=Nt.findKey(n,t);!o||e&&!de(0,n[o],o,e)||(delete n[o],r=!0)}}return Nt.isArray(t)?t.forEach(o):o(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const o=e[n];t&&!de(0,this[o],o,t,!0)||(delete this[o],r=!0)}return r}normalize(t){const e=this,n={};return Nt.forEach(this,((r,o)=>{const i=Nt.findKey(n,o);if(i)return e[i]=fe(r),void delete e[o];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete e[o],e[s]=fe(r),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Nt.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&Nt.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[le]=this[le]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=he(t);e[r]||(!function(t,e){const n=Nt.toCamelCase(" "+e);["get","set","has"].forEach((r=>{Object.defineProperty(t,r+n,{value:function(t,n,o){return this[r].call(this,e,t,n,o)},configurable:!0})}))}(n,t),e[r]=!0)}return Nt.isArray(t)?t.forEach(r):r(t),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Nt.reduceDescriptors(pe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),Nt.freezeMethods(pe);const ge=pe;function me(t,e){const n=this||ce,r=e||n,o=ge.from(r.headers);let i=r.data;return Nt.forEach(t,(function(t){i=t.call(n,i,o.normalize(),e?e.status:void 0)})),o.normalize(),i}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"}Nt.inherits(we,Vt,{__CANCEL__:!0});const be=we;const ve=ie.hasStandardBrowserEnv?{write(t,e,n,r,o,i){const s=[t+"="+encodeURIComponent(e)];Nt.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Nt.isString(r)&&s.push("path="+r),Nt.isString(o)&&s.push("domain="+o),!0===i&&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 _e=ie.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=Nt.isString(t)?r(t):t;return e.protocol===n.protocol&&e.host===n.host}}():function(){return!0};const Se=function(t,e){t=t||10;const n=new Array(t),r=new Array(t);let o,i=0,s=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,h=0;for(;l!==i;)h+=n[l++],l%=t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-o<e)return;const f=u&&c-u;return f?Math.round(1e3*h/f):void 0}};function Ae(t,e){let n=0;const r=Se(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,c=r(a);n=i;const u={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:o};u[e?"download":"upload"]=!0,t(u)}}const Te={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){let r=t.data;const o=ge.from(t.headers).normalize();let i,s,{responseType:a,withXSRFToken:c}=t;function u(){t.cancelToken&&t.cancelToken.unsubscribe(i),t.signal&&t.signal.removeEventListener("abort",i)}if(Nt.isFormData(r))if(ie.hasStandardBrowserEnv||ie.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if(!1!==(s=o.getContentType())){const[t,...e]=s?s.split(";").map((t=>t.trim())).filter(Boolean):[];o.setContentType([t||"multipart/form-data",...e].join("; "))}let l=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",n=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.set("Authorization","Basic "+btoa(e+":"+n))}const h=Ee(t.baseURL,t.url);function f(){if(!l)return;const r=ge.from("getAllResponseHeaders"in l&&l.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),u()}),(function(t){n(t),u()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:t,request:l}),l=null}if(l.open(t.method.toUpperCase(),Yt(h,t.params,t.paramsSerializer),!0),l.timeout=t.timeout,"onloadend"in l?l.onloadend=f:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(f)},l.onabort=function(){l&&(n(new Vt("Request aborted",Vt.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new Vt("Network Error",Vt.ERR_NETWORK,t,l)),l=null},l.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,l)),l=null},ie.hasStandardBrowserEnv&&(c&&Nt.isFunction(c)&&(c=c(t)),c||!1!==c&&_e(h))){const e=t.xsrfHeaderName&&t.xsrfCookieName&&ve.read(t.xsrfCookieName);e&&o.set(t.xsrfHeaderName,e)}void 0===r&&o.setContentType(null),"setRequestHeader"in l&&Nt.forEach(o.toJSON(),(function(t,e){l.setRequestHeader(e,t)})),Nt.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&"json"!==a&&(l.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&l.addEventListener("progress",Ae(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Ae(t.onUploadProgress)),(t.cancelToken||t.signal)&&(i=e=>{l&&(n(!e||e.type?new be(null,t,l):e),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(i),t.signal&&(t.signal.aborted?i():t.signal.addEventListener("abort",i)));const d=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(h);d&&-1===ie.protocols.indexOf(d)?n(new Vt("Unsupported protocol "+d+":",Vt.ERR_BAD_REQUEST,t)):l.send(r||null)}))}};Nt.forEach(Te,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const xe=t=>`- ${t}`,ke=t=>Nt.isFunction(t)||null===t||!1===t,Re=t=>{t=Nt.isArray(t)?t:[t];const{length:e}=t;let n,r;const o={};for(let i=0;i<e;i++){let e;if(n=t[i],r=n,!ke(n)&&(r=Te[(e=String(n)).toLowerCase()],void 0===r))throw new Vt(`Unknown adapter '${e}'`);if(r)break;o[e||"#"+i]=r}if(!r){const t=Object.entries(o).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(xe).join("\n"):" "+xe(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 be(null,t)}function Pe(t){Ce(t),t.headers=ge.from(t.headers),t.data=me.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Re(t.adapter||ce.adapter)(t).then((function(e){return Ce(t),e.data=me.call(t,t.transformResponse,e),e.headers=ge.from(e.headers),e}),(function(e){return ye(e)||(Ce(t),e&&e.response&&(e.response.data=me.call(t,t.transformResponse,e.response),e.response.headers=ge.from(e.response.headers))),Promise.reject(e)}))}const Ie=t=>t instanceof ge?t.toJSON():t;function Oe(t,e){e=e||{};const n={};function r(t,e,n){return Nt.isPlainObject(t)&&Nt.isPlainObject(e)?Nt.merge.call({caseless:n},t,e):Nt.isPlainObject(e)?Nt.merge({},e):Nt.isArray(e)?e.slice():e}function o(t,e,n){return Nt.isUndefined(e)?Nt.isUndefined(t)?void 0:r(void 0,t,n):r(t,e,n)}function i(t,e){if(!Nt.isUndefined(e))return r(void 0,e)}function s(t,e){return Nt.isUndefined(e)?Nt.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function a(n,o,i){return i in e?r(n,o):i in t?r(void 0,n):void 0}const c={url:i,method:i,data:i,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)=>o(Ie(t),Ie(e),!0)};return Nt.forEach(Object.keys(Object.assign({},t,e)),(function(r){const i=c[r]||o,s=i(t[r],e[r],r);Nt.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Be="1.6.5",Ue={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ue[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const Le={};Ue.transitional=function(t,e,n){function r(t,e){return"[Axios v1.6.5] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,o,i)=>{if(!1===t)throw new Vt(r(o," has been removed"+(e?" in "+e:"")),Vt.ERR_DEPRECATED);return e&&!Le[o]&&(Le[o]=!0,console.warn(r(o," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,o,i)}};const Ne={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 o=r.length;for(;o-- >0;){const i=r[o],s=e[i];if(s){const e=t[i],n=void 0===e||s(e,i,t);if(!0!==n)throw new Vt("option "+i+" must be "+n,Vt.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Vt("Unknown option "+i,Vt.ERR_BAD_OPTION)}},validators:Ue},De=Ne.validators;class je{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=Oe(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:o}=e;void 0!==n&&Ne.assertOptions(n,{silentJSONParsing:De.transitional(De.boolean),forcedJSONParsing:De.transitional(De.boolean),clarifyTimeoutError:De.transitional(De.boolean)},!1),null!=r&&(Nt.isFunction(r)?e.paramsSerializer={serialize:r}:Ne.assertOptions(r,{encode:De.function,serialize:De.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=o&&Nt.merge(o.common,o[e.method]);o&&Nt.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete o[t]})),e.headers=ge.concat(i,o);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 u;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let l,h=0;if(!a){const t=[Pe.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),l=t.length,u=Promise.resolve(e);h<l;)u=u.then(t[h++],t[h++]);return u}l=s.length;let f=e;for(h=0;h<l;){const t=s[h++],e=s[h++];try{f=t(f)}catch(t){e.call(this,t);break}}try{u=Pe.call(this,f)}catch(t){return Promise.reject(t)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(t){return Yt(Ee((t=Oe(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}Nt.forEach(["delete","get","head","options"],(function(t){je.prototype[t]=function(e,n){return this.request(Oe(n||{},{method:t,url:e,data:(n||{}).data}))}})),Nt.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,o){return this.request(Oe(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}je.prototype[t]=e(),je.prototype[t+"Form"]=e(!0)}));const Me=je;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,o){n.reason||(n.reason=new be(t,r,o),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 $e={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($e).forEach((([t,e])=>{$e[e]=t}));const Ke=$e;const We=function t(e){const n=new Me(e),r=nt(Me.prototype.request,n);return Nt.extend(r,Me.prototype,n,{allOwnKeys:!0}),Nt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(Oe(e,n))},r}(ce);We.Axios=Me,We.CanceledError=be,We.CancelToken=Fe,We.isCancel=ye,We.VERSION=Be,We.toFormData=zt,We.AxiosError=Vt,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=function(t){return function(e){return t.apply(null,e)}},We.isAxiosError=function(t){return Nt.isObject(t)&&!0===t.isAxiosError},We.mergeConfig=Oe,We.AxiosHeaders=ge,We.formToJSON=t=>se(Nt.isHTMLForm(t)?new FormData(t):t),We.getAdapter=Re,We.HttpStatusCode=Ke,We.default=We;const ze=We;var He=a(742),qe=Object.create,Ze=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Xe=Object.getOwnPropertyNames,Ye=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty,Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),tn=(t,e,n)=>(n=null!=t?qe(Ye(t)):{},((t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let o of Xe(e))!Je.call(t,o)&&o!==n&&Ze(t,o,{get:()=>e[o],enumerable:!(r=Ge(e,o))||r.enumerable});return t})(!e&&t&&t.__esModule?n:Ze(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,o=4-n,i=e+o,s=Buffer.alloc(i);for(s.write(t);o--;)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)?o(t.toString("base64")):o(Buffer.from(t,e).toString("base64"))}function r(t){return t=t.toString(),e.default(t).replace(/\-/g,"+").replace(/_/g,"/")}function o(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var i=n;i.encode=n,i.decode=function(t,e){return void 0===e&&(e="utf8"),Buffer.from(r(t),"base64").toString(e)},i.toBase64=r,i.fromBase64=o,i.toBuffer=function(t){return Buffer.from(r(t),"base64")},t.default=i})),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,i=s(t),a=i[0],c=i[1],u=new o(function(t,e,n){return 3*(e+n)/4-n}(0,a,c)),l=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)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[l++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},t.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=16383,a=0,u=r-o;a<u;a+=s)i.push(c(t,a,a+s>u?u:a+s));return 1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),i.join("")};var e,n=[],r=[],o=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(e=0,64;e<64;++e)n[e]=i[e],r[i.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,o=[],i=e;i<n;i+=3)r=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(a(r));return o.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 o(t){return new Uint8Array(e.toByteArray(c(t)))}function i(t){return e.fromByteArray(new Uint8Array(t))}function s(t){return a(i(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(o(t))},t.bufferToString=n,t.stringToBuffer=r,t.stringToB64Url=function(t){return s(r(t))},t.b64UrlToBuffer=o,t.bufferTob64=i,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},o=await this.jwkToPublicCryptoKey(r),i=await this.driver.digest("SHA-256",e),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},o,n,e),a=await this.driver.verify({name:"RSA-PSS",saltLength:32},o,n,e),c=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((o.algorithm.modulusLength-1)/8)-i.byteLength-2},o,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 o=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),i=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},o,{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},i,t);return e.concatBuffers([s,a])}async decrypt(t,n,r){let o=await this.driver.importKey("raw","string"==typeof n?e.stringToBuffer(n):n,{name:"PBKDF2",length:32},!1,["deriveKey"]),i=await this.driver.deriveKey({name:"PBKDF2",salt:r?e.stringToBuffer(r):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},o,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=t.slice(0,16),a=await this.driver.decrypt({name:"AES-CBC",iv:s},i,t.slice(16));return e.concatBuffers([a])}}})),cn=Qe((t=>{t.read=function(t,e,n,r,o){var i,s,a=8*o-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?o-1:0,f=n?-1:1,d=t[e+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+t[e+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)},t.write=function(t,e,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<<u)-1,h=l>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,g=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=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*c-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;t[n+d]=255&s,d+=p,s/=256,u-=8);t[n+d-p]|=128*g}})),un=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 o=2147483647;function i(t){if(t>o)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 u(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|d(t,e),r=i(n),o=r.write(t,e);return o!==n&&(r=r.slice(0,o)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(q(t,Uint8Array)){let e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return l(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(q(t,ArrayBuffer)||t&&q(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(q(t,SharedArrayBuffer)||t&&q(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 o=function(t){if(s.isBuffer(t)){let e=0|f(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||Z(t.length)?i(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(o)return o;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 u(t){return c(t),i(t<0?0:0|f(t))}function l(t){let e=t.length<0?0:0|f(t.length),n=i(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 f(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||q(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 o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(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(o)return r?-1:W(t).length;e=(""+e).toLowerCase(),o=!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 R(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return x(this,e,n);case"latin1":case"binary":return k(this,e,n);case"base64":return S(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 g(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)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,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,o){let i,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 u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let r=-1;for(i=n;i<a;i++)if(u(t,i)===u(e,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*s}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(t,i+r)!==u(e,r)){n=!1;break}if(n)return i}return-1}function w(t,e,n,r){n=Number(n)||0;let o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;let i,s=e.length;for(r>s/2&&(r=s/2),i=0;i<r;++i){let r=parseInt(e.substr(2*i,2),16);if(Z(r))return i;t[n+i]=r}return i}function b(t,e,n,r){return H(W(e,t.length-n),t,n,r)}function v(t,e,n,r){return H(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(z(e),t,n,r)}function _(t,e,n,r){return H(function(t,e){let n,r,o,i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function S(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function A(t,e,n){n=Math.min(t.length,n);let r=[],o=e;for(;o<n;){let e=t[o],i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(i=e);break;case 2:n=t[o+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(i=c));break;case 3:n=t[o+1],r=t[o+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=t[o+1],r=t[o+2],a=t[o+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&&(i=c))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=s}return function(t){let e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=T));return n}(r)}t.kMaxLength=o,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?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}(t,e,n)},s.allocUnsafe=function(t){return u(t)},s.allocUnsafeSlow=function(t){return u(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),q(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 o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];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),o=0;for(n=0;n<t.length;++n){let e=t[n];if(q(e,Uint8Array))o+e.length>r.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(r,o)):Uint8Array.prototype.set.call(r,e,o);else{if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,o)}o+=e.length}return r},s.byteLength=d,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)g(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)g(this,e,e+3),g(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)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},s.prototype.toString=function(){let t=this.length;return 0===t?"":0===arguments.length?A(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,o){if(q(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===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(i,a),u=this.slice(r,o),l=t.slice(e,n);for(let t=0;t<c;++t)if(u[t]!==l[t]){i=u[t],a=l[t];break}return i<a?-1:a<i?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return m(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 o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return b(this,t,e,n);case"ascii":case"latin1":case"binary":return v(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function x(t,e,n){let r="";n=Math.min(t.length,n);for(let o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function k(t,e,n){let r="";n=Math.min(t.length,n);for(let o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function R(t,e,n){let r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=e;r<n;++r)o+=G[t[r]];return o}function C(t,e,n){let r=t.slice(e,n),o="";for(let t=0;t<r.length-1;t+=2)o+=String.fromCharCode(r[t]+256*r[t+1]);return o}function P(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 I(t,e,n,r,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function O(t,e,n,r,o){V(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i;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 B(t,e,n,r,o){V(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n+7]=i,i>>=8,t[n+6]=i,i>>=8,t[n+5]=i,i>>=8,t[n+4]=i;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 U(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,r,o,i){return e=+e,r>>>=0,i||U(t,0,r,4),n.write(t,e,r,o,23,4),r+4}function N(t,e,r,o,i){return e=+e,r>>>=0,i||U(t,0,r,8),n.write(t,e,r,o,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||P(t,e,this.length);let r=this[t],o=1,i=0;for(;++i<e&&(o*=256);)r+=this[t+i]*o;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t+--e],o=1;for(;e>0&&(o*=256);)r+=this[t+--e]*o;return r},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(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||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=X((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&$(t,this.length-8);let r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))})),s.prototype.readBigUInt64BE=X((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&$(t,this.length-8);let r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),s.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t],o=1,i=0;for(;++i<e&&(o*=256);)r+=this[t+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=e,o=1,i=this[t+--r];for(;r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||P(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||P(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||P(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||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=X((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&$(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=X((function(t){F(t>>>=0,"offset");let e=this[t],n=this[t+7];(void 0===e||void 0===n)&&$(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||P(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(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){I(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){I(this,t,e,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||I(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||I(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||I(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||I(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||I(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=X((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=X((function(t,e=0){return B(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);I(this,t,e,n,r-1,-r)}let o=0,i=1,s=0;for(this[e]=255&t;++o<n&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>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);I(this,t,e,n,r-1,-r)}let o=n-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||I(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||I(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||I(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||I(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||I(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=X((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=X((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return N(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 o=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),o},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 o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{let i=s.isBuffer(t)?t:s.from(t,r),a=i.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-e;++o)this[o+e]=i[o%a]}return this};var D={};function j(t,e,n){D[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,o,i){if(t>n||t<e){let r,o="bigint"==typeof e?"n":"";throw r=i>3?0===e||e===BigInt(0)?`>= 0${o} and < 2${o} ** ${8*(i+1)}${o}`:`>= -(2${o} ** ${8*(i+1)-1}${o}) and < 2 ** ${8*(i+1)-1}${o}`:`>= ${e}${o} and <= ${n}${o}`,new D.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){F(e,"offset"),(void 0===t[e]||void 0===t[e+n])&&$(e,t.length-(n+1))}(r,o,i)}function F(t,e){if("number"!=typeof t)throw new D.ERR_INVALID_ARG_TYPE(e,"number",t)}function $(t,e,n){throw Math.floor(t)!==t?(F(t,n),new D.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=M(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=M(o)),o+="n"),r+=` It must be ${e}. Received ${o}`,r}),RangeError);var K=/[^+/0-9A-Za-z-_]/g;function W(t,e){e=e||1/0;let n,r=t.length,o=null,i=[];for(let s=0;s<r;++s){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.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;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function z(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let o;for(o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(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 o=0;o<16;++o)e[r+o]=t[n]+t[o]}return e}();function X(t){return typeof BigInt>"u"?Y:t}function Y(){throw new Error("BigInt not supported")}})),ln=Qe(((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:un().Buffer,Crypto:window.crypto}):e.exports={Buffer:un().Buffer,Crypto:crypto}})),hn={};((t,e)=>{for(var n in e)Ze(t,n,{get:e[n],enumerable:!0})})(hn,{AVSCTap:()=>Cn,ArweaveSigner:()=>An,DataItem:()=>Mn,MAX_TAG_BYTES:()=>Dn,MIN_BINARY_SIZE:()=>jn,SIG_CONFIG:()=>Sn,SignatureConfig:()=>wn,Signer:()=>fn,createData:()=>Fn,deserializeTags:()=>On,indexToType:()=>Tn,serializeTags:()=>Pn,tagsExceedLimit:()=>In});var fn=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,n,r){throw new Error("You must implement verify method on child")}},dn=tn(rn(),1),pn=tn(sn(),1);async function gn(t){if(Array.isArray(t)){let e=(0,pn.concatBuffers)([(0,pn.stringToBuffer)("list"),(0,pn.stringToBuffer)(t.length.toString())]);return await mn(t,await _n().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 _n().hash(n,"SHA-384"),await _n().hash(e,"SHA-384")]);return await _n().hash(r,"SHA-384")}async function mn(t,e){if(t.length<1)return e;let n=(0,pn.concatBuffers)([e,await gn(t[0])]),r=await _n().hash(n,"SHA-384");return await mn(t.slice(1),r)}var yn,wn,bn=tn(an(),1),vn=bn.default.default?bn.default.default:bn.default,En=class extends vn{getPublicKey(t){throw new Error("Unimplemented")}};function _n(){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 Sn={[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"}},An=class{signatureType=1;ownerLength=Sn[1].pubLength;signatureLength=Sn[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return dn.default.toBuffer(this.pk)}sign(t){return _n().sign(this.jwk,t)}static async verify(t,e,n){return await _n().verify(t,e,n)}},Tn={1:An},xn=tn(rn(),1);async function kn(t){return gn([(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 Rn(t,e){let{signature:n,id:r}=await async function(t,e){let n=await kn(t),r=await e.sign(n),o=await _n().hash(r);return{signature:Buffer.from(r),id:Buffer.from(o)}}(t,e);return t.getRaw().set(n,2),r}var Cn=class{buf;pos;constructor(t=Buffer.alloc(Dn),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 o,i,s,a;for(o=0,i=e;o<i;o++)s=t.charCodeAt(o),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(o+1)))?(s=65536+((1023&s)<<10)+(1023&a),o++,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,o=0,i=0,s=this.buf;do{t=s[this.pos++],e=128&t,o|=(127&t)<<i,i+=7}while(e&&i<28);if(e){n=o,r=268435456;do{t=s[this.pos++],n+=(127&t)*r,r*=128}while(128&t);return(n%2?-(n+1):n)/2}return o>>1^-(1&o)}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 Pn(t){let e=new Cn;return e.writeTags(t),e.toBuffer()}function In(t){let e=new Cn;return e.writeTags(t),e.tagsExceedLimit()}function On(t){return new Cn(t).readTags()}function Bn(t){let e=0;for(let n=t.length-1;n>=0;n--)e=256*e+t[n];return e}function Un(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 Ln=tn(ln(),1),Nn=tn(un(),1),Dn=4096,jn=80,Mn=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return void 0!==t.binary}get signatureType(){let t=Bn(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()=>xn.default.encode(await this.rawId))()}set id(t){this._id=xn.default.toBuffer(t)}get rawId(){return(async()=>Nn.Buffer.from(await Ln.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 xn.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 Sn[this.signatureType].sigLength}get owner(){return xn.default.encode(this.rawOwner)}get ownerLength(){return Sn[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):Nn.Buffer.alloc(0)}get target(){return xn.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return 1==this.binary[t]?this.binary.subarray(t+1,t+33):Nn.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Bn(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(0==Bn(this.binary.subarray(t,t+8)))return[];let e=Bn(this.binary.subarray(t+8,t+16));return On(Nn.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map((t=>({name:xn.default.encode(t.name),value:xn.default.encode(t.value)})))}getStartOfData(){let t=this.getTagsStart();return t+16+Bn(this.binary.subarray(t+8,t+16))}get rawData(){let t=this.getTagsStart(),e=t+16+Bn(this.binary.subarray(t+8,t+16));return this.binary.subarray(e,this.binary.length)}get data(){return xn.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await Rn(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=Nn.Buffer.from(await _n().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:xn.default.encode(t.name),value:xn.default.encode(t.value)}))),data:this.data}}static async verify(t){if(t.byteLength<jn)return!1;let e=new Mn(t),n=e.signatureType,r=e.getTagsStart(),o=Bn(t.subarray(r,r+8)),i=Bn(t.subarray(r+8,r+16));if(i>Dn)return!1;if(o>0)try{if(On(Nn.Buffer.from(t.subarray(r+16,r+16+i))).length!==o)return!1}catch{return!1}let s=Tn[n],a=await kn(e);return await s.verify(e.rawOwner,a,e.rawSignature)}async getSignatureData(){return kn(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,o=n?.target?Vn.default.toBuffer(n.target):null,i=1+(o?.byteLength??0),s=n?.anchor?Buffer.from(n.anchor):null,a=1+(s?.byteLength??0),c=(n?.tags?.length??0)>0?Pn(n.tags):null,u=16+(c?c.byteLength:0),l=Buffer.from(t),h=l.byteLength,f=2+e.signatureLength+e.ownerLength+i+a+u+h,d=Buffer.alloc(f);if(d.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),d.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}`);d.set(r,2+e.signatureLength);let p=2+e.signatureLength+e.ownerLength;if(d[p]=o?1:0,o){if(32!==o.byteLength)throw new Error(`Target must be 32 bytes but was incorrectly ${o.byteLength}`);d.set(o,p+1)}let g=p+i,m=g+1;if(d[g]=s?1:0,s){if(m+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");d.set(s,g+1)}d.set(Un(n?.tags?.length??0),m);let y=Un(c?.byteLength??0);d.set(y,m+8),c&&d.set(c,m+16);let w=m+u;return d.set(l,w),new Mn(d)}var $n={...hn};globalThis.arbundles??=$n;const{Axios:Kn,AxiosError:Wn,CanceledError:zn,isCancel:Hn,CancelToken:qn,VERSION:Zn,all:Gn,Cancel:Xn,isAxiosError:Yn,spread:Jn,toFormData:Qn,AxiosHeaders:tr,HttpStatusCode:er,formToJSON:nr,getAdapter:rr,mergeConfig:or}=ze;var ir=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},ur="othentUserDetails",lr="Othent KMS",hr="2.0.0-beta.10",fr=[{name:"Client",value:lr},{name:"Client-Version",value:hr}],dr=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),o=n===r;return this.lastEmittedUpdateId=r,this.lastEmittedParams=t,this.listeners.forEach((n=>{if(!o||!e.has(n)){e.add(n);try{n(...t)}catch(t){}}})),o}};function pr(t,e){return et(!0,{},e,t)}var gr={secure:!0,domain:!0,ttlHours:360},mr=class t{constructor(e=gr){this.secureParam=null,this.domainParam=null,this.ttlMs=1296e6;const{secureParam:n,domainParam:r,ttlMs:o}=this.parseCookieOptions(pr(e,gr));return this.secureParam=n,this.domainParam=r,this.ttlMs=o,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),o=[`expires=${new Date(Date.now()+r).toUTCString()}`,e,n,"path=/"].filter(Boolean).join("; ");return o?` ${o};`:""}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])}))}};mr.COOKIE_SEPARATOR=/\s*;\s*/,mr.COOKIE_VALUE_SEPARATOR=/\s*=\s*/;var yr=mr,wr=null;var br=class t{constructor({debug:t,domain:e,clientId:n,strategy:r,cache:o,refreshTokenExpirationMs:i,loginMethod:s,redirectURI:a,returnToURI:c,appInfo:u,initialUserDetails:l,cookieKey:h,localStorageKey:f}){this.debug=!1,this.auth0ClientPromise=Promise.resolve(null),this.authEventListenerHandler=new dr({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 o?o:void 0,cache:"object"==typeof o?o:void 0,authorizationParams:{redirect_uri:this.redirectURI}}).then((t=>(this.isReady=!0,t))),this.cookieKey=h,this.localStorageKey=f,this.refreshTokenExpirationMs=i,this.appInfo=u,this.restoreUserDetails(l||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,o=e.sub||"",i=o.split("|")[0];let s=await async function(t){try{const e=(await ze.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[i]||"Unknown Provider"} (${n})`}return{sub:o,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:i}}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:lr,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 o=await this.updateUserDetails(r);return{...t,idToken:r,userDetails:o}}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}};br.PROVIDER_LABELS={apple:"Apple",auth0:"E-Mail","google-oauth2":"Google","<LinkedIn>":"LinkedIn","<X>":"X","<Meta>":"Meta","<Twitch>":"Twitch",github:"GitHub"};var vr=br;function Er(t){return"string"==typeof t?_r(t):t}function _r(t){return(new TextEncoder).encode(t)}function Sr(t){return e=function(t){return He.fromByteArray(new Uint8Array(t))}(t),e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"");var e}async function Ar(t,e="SHA-256"){let n=await crypto.subtle.digest(e,t);return new Uint8Array(n)}var Tr=(t=>(t.Unexpected="Unexpected",t.Validation="Validation",t.UserCreation="UserCreation",t.Encryption="Encryption",t.Decryption="Decryption",t.Signing="Signing",t.PublicKey="PublicKey",t))(Tr||{}),xr=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 kr(t){var e;if(Yn(t)){const n=null==(e=t.response)?void 0:e.data;if(!function(t){return"object"==typeof t&&!0===t.error&&!!t.id&&!!Tr[t.id]}(n))return t;const{id:r,developerMessage:o,cause:i}=n;let s;return i&&(s=new Error(i.message),s.name=i.name,s.stack=i.stack),new xr(r,o||"",s,!0)}return t instanceof Error?t:new Error("Unknown error")}async function Rr(t,e,n,r){var o;const i=await e.encodeToken({ciphertext:n,keyName:r});let s=null;try{s=null!=(o=(await t.post("/decrypt",{encodedData:i})).data.data)?o:null}catch(t){throw kr(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=ze.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 kr(t)}if(!n)throw new Error("Error creating user on server.");return!0}(this.api,t)}async decrypt(t,e){return Rr(this.api,this.auth0,t,e)}async encrypt(t,e){return async function(t,e,n,r){var o;const i=await e.encodeToken({plaintext:n,keyName:r});let s=null;try{s=null!=(o=(await t.post("/encrypt",{encodedData:i})).data.data)?o:null}catch(t){throw kr(t)}if(null===s)throw new Error("Error encrypting on server.");return"string"==typeof s?_r(s):new Uint8Array(s.data)}(this.api,this.auth0,t,e)}async sign(t,e){return async function(t,e,n,r){const o=await e.encodeToken({data:n,keyName:r});let i=null;try{i=(await t.post("/sign",{encodedData:o})).data.data}catch(t){throw kr(t)}if(null===i)throw new Error("Error signing data on server.");return"string"==typeof i?_r(i):new Uint8Array(i.data)}(this.api,this.auth0,t,e)}getSignerSignFn(t){return async e=>await this.sign(e,t)}};function Pr(t,e="utf8"){return r.lW.isBuffer(t)?Or(t.toString("base64")):Or(r.lW.from(t,e).toString("base64"))}function Ir(t){return function(t){let e=t.length,n=e%4;if(!n)return t;let o=e,i=4-n,s=e+i,a=r.lW.alloc(s);for(a.write(t);i--;)a.write("=",o++);return a.toString()}(t=t.toString()).replace(/\-/g,"+").replace(/_/g,"/")}function Or(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Br(t){return r.lW.from(Ir(t),"base64")}var Ur=Pr;function Lr(t){return ir.default.init(t)}Ur.encode=Pr,Ur.decode=function(t,e="utf8"){return r.lW.from(Ir(t),"base64").toString(e)},Ur.toBase64=Ir,Ur.fromBase64=Or,Ur.toBuffer=Br;var Nr=class t{constructor(t=ar){this.errorEventListenerHandler=new dr,this.tokens=new Set,this.walletName=lr,this.walletVersion=hr,this.config=sr,this.appInfo={name:"",version:""},this.gatewayConfig=cr;let{appName:e,appVersion:n,persistCookie:r,persistLocalStorage:o,auth0Cache:i=sr.auth0Cache,auth0RedirectURI:s,auth0ReturnToURI:a,gatewayConfig:c,initialUserDetails:u,...l}=t;const h="undefined"==typeof location?null:location.origin;this.config={...pr(l,sr),cookieKey:"string"==typeof r?r:r?ur:null,localStorageKey:"string"==typeof o?o:o?ur:null,auth0Cache:"object"==typeof i?"custom":i,auth0RedirectURI:s||h,auth0ReturnToURI:a||h};const{config:f}=this,{cookieKey:d,localStorageKey:p}=f;if("string"==typeof d&&!d.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(!f.auth0RedirectURI)throw new Error("`auth0RedirectURI` is required.");if(!f.auth0ReturnToURI)throw new Error("`auth0ReturnToURI` is required.");this.appInfo={name:e,version:n},this.gatewayConfig=c||cr;let g=null;if("undefined"!=typeof window)g=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.");g=global.crypto}if(this.crypto=g,"eager"===f.autoConnect&&"popup"===f.auth0LogInMethod&&"refresh-tokens"===f.auth0Strategy&&"memory"===i)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 vr({debug:f.debug,domain:f.auth0Domain,clientId:f.auth0ClientId,strategy:f.auth0Strategy,cache:i,refreshTokenExpirationMs:f.auth0RefreshTokenExpirationMs,redirectURI:f.auth0RedirectURI,returnToURI:f.auth0ReturnToURI,loginMethod:f.auth0LogInMethod,appInfo:this.appInfo,initialUserDetails:u,cookieKey:f.cookieKey,localStorageKey:f.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(f.inject&&(window.arweaveWallet=this),!f.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 o=null;try{o=await this.auth0.handleRedirectCallback(e)}finally{"undefined"!=typeof location&&"undefined"!=typeof history&&(r.delete("code"),r.delete("state"),history.replaceState(null,"",n))}return o}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 o="",i=null;try{const t=await this.auth0.getTokenSilently();o=t.id_token,i=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(!o)try{const t=await this.auth0.logIn();o=t.id_token,i=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 b||t instanceof w)return t instanceof w&&t.popup.close(),console.warn(t.message),null;throw t}if(o&&!i){await this.api.createUser(o);const t=await this.auth0.getTokenSilently();o=t.id_token,i=t.userDetails}if(o&&i)return i;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,...fr]}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 fr)t.addTag(e,n)}async sign(t){const{sub:e,publicKey:n}=await this.requireUserDataOrThrow(),r=Lr(this.gatewayConfig),o=t.get("tags").map((t=>({name:t.get("name",{decode:!0,string:!0}),value:t.get("value",{decode:!0,string:!0})}))),i=this.addCommonTags(o),s=await r.createTransaction({data:t.data,owner:n,reward:t.reward});i.forEach((t=>{s.addTag(t.name,t.value)}));const a=await s.getSignatureData(),c=await this.api.sign(a,e),u=await Ar(c);return s.setSignature({id:Sr(u),owner:n,signature:Sr(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})}))),o=await this.signDataItem({data:t.data,tags:r,target:t.target}),i=`${(null==e?void 0:e.node)||"https://turbo.ardrive.io"}/tx`;try{const t=await ze.post(i,o,{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 ${i} =\n`,r);const o=await this.sign(t),s=null!=(n=null==e?void 0:e.arweave)?n:Lr(this.gatewayConfig),a=await s.transactions.getUploader(o);for(;!a.isComplete;)await a.uploadChunk();return{id:o.id,signature:o.signature,owner:o.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:o,...i}=t,s={publicKey:Br(n),signatureType:1,signatureLength:512,ownerLength:512,sign:this.api.getSignerSignFn(e)},a=Fn(r,s,{...i,tags:this.addCommonTags(o)});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",o=await this.crypto.subtle.digest(r,Er(t));return await this.api.sign(o,n)}async verifyMessage(t,e,n,r={hashAlgorithm:"SHA-256"}){if(!n){const t=await this.requireUserDataOrThrow();n||(n=t.publicKey)}const o=(null==r?void 0:r.hashAlgorithm)||"SHA-256",i=await this.crypto.subtle.digest(o,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),i)}async privateHash(t,e){return Ar(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))}};Nr.walletName=lr,Nr.walletVersion=hr,Nr.ALL_PERMISSIONS=["ACCESS_ADDRESS","ACCESS_ALL_ADDRESSES","ACCESS_ARWEAVE_CONFIG","ACCESS_PUBLIC_KEY","DECRYPT","DISPATCH","ENCRYPT","SIGN_TRANSACTION","SIGNATURE"];var Dr=Nr;async function jr(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;const Vr=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 Fr(t){let{onLoginSuccess:n}=t;const[r,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=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 Vr())return void await n(t.username)}const e=Date.now(),r=encodeURIComponent(window.location.origin+"/auth/callback"),o="onairos://authenticate?nonce=".concat(e,"&callback=").concat(r,"&appName=google");window.location.href=o,setTimeout((()=>{window.location.href="https://apps.apple.com/app/onairos/id123456789"}),2500)}catch(t){console.error("App login failed:",t)}finally{o(!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"))}class $r extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,$r.prototype)}}const Kr="ERR_INVALID_VALUE",Wr="ERR_UNEXPECTED_VALUE",zr="ERR_UNEXPECTED_TYPE",Hr="ERR_PARSE";function qr(t,e){const n={};for(const r in t){const o=t[r];if(!o)continue;let i,s;"function"==typeof o?(i=r,s=o):[i,s]=o;try{const t=s(e(i));void 0!==t&&(n[r]=t)}catch(t){throw new $r(Hr,`Parser for "${r}" property failed${i===r?"":`. Source field: "${i}"`}`,t)}}return n}function Zr(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new $r(Kr,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new $r(Wr);return e}function Gr(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new $r(Hr,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function Xr(t,e){return Gr(e||"object",(e=>{const n=Zr(e);return qr(t,(t=>n[t]))}))}function Yr(t){throw new $r(zr,`Unexpected value received: ${JSON.stringify(t)}`)}Gr("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void Yr(t)}));const Jr=Gr("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();Yr(t)})),Qr=Gr("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}Yr(t)}));Gr("date",(t=>t instanceof Date?t:new Date(1e3*Qr()(t))));function to(t){return/^#[\da-f]{6}$/i.test(t)}function eo(t){const e=t.replace(/\s/g,"").toLowerCase();if(to(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}const no=Gr("rgb",(t=>eo(Jr()(t)))),ro=Gr("themeParams",(t=>{const e=no(!0);return Object.entries(Zr(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));class oo extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,oo.prototype)}}function io(t){return t.replace(/[A-Z]/g,(t=>`_${t.toLowerCase()}`))}const so="ERR_INVALID_VALUE",ao="ERR_UNEXPECTED_VALUE",co="ERR_UNEXPECTED_TYPE",uo="ERR_PARSE";function lo(t,e){const n={};for(const r in t){const o=t[r];if(!o)continue;let i,s;"function"==typeof o?(i=r,s=o):[i,s]=o;try{const t=s(e(i));void 0!==t&&(n[r]=t)}catch(t){throw new oo(uo,`Parser for "${r}" property failed${i===r?"":`. Source field: "${i}"`}`,t)}}return n}function ho(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new oo(so,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new oo(ao);return e}function fo(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new oo(uo,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function po(t,e){return fo(e||"object",(e=>{const n=ho(e);return lo(t,(t=>n[t]))}))}function go(t){throw new oo(co,`Unexpected value received: ${JSON.stringify(t)}`)}const mo=fo("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void go(t)})),yo=fo("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();go(t)})),wo=fo("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}go(t)})),bo=fo("date",(t=>t instanceof Date?t:new Date(1e3*wo()(t))));function vo(t,e){return fo(e||"searchParams",(e=>{"string"!=typeof e&&!(e instanceof URLSearchParams)&&go(e);const n="string"==typeof e?new URLSearchParams(e):e;return lo(t,(t=>{const e=n.get(t);return null===e?void 0:e}))}))}function Eo(t){for(const e in t)t[e]=[io(e),t[e]];return t}const _o=t=>{const e=wo(),n=wo(!0),r=yo(),o=yo(!0),i=mo(!0),s=po(Eo({addedToAttachmentMenu:i,allowsWriteToPm:i,firstName:r,id:e,isBot:i,isPremium:i,languageCode:o,lastName:o,photoUrl:o,username:o}),"User")(!0);return vo(Eo({authDate:bo(),canSendAfter:n,chat:po(Eo({id:e,type:r,title:r,photoUrl:o,username:o}),"Chat")(!0),chatInstance:o,chatType:o,hash:r,queryId:o,receiver:s,startParam:o,signature:r,user:s}),"initData")(t)};const So=fo("rgb",(t=>function(t){const e=t.replace(/\s/g,"").toLowerCase();if(function(t){return/^#[\da-f]{6}$/i.test(t)}(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}(yo()(t)))),Ao=fo("themeParams",(t=>{const e=So(!0);return Object.entries(ho(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));function To(t){return JSON.stringify(Object.fromEntries(Object.entries(t).map((([t,e])=>[io(t),e]))))}const xo=t=>{const e=yo(),n=yo(!0),r=mo(!0);return vo({botInline:["tgWebAppBotInline",r],defaultColors:["tgWebAppDefaultColors",Ao(!0)],fullscreen:["tgWebAppFullscreen",r],initData:["tgWebAppData",_o(!0)],initDataRaw:["tgWebAppData",n],platform:["tgWebAppPlatform",e],showSettings:["tgWebAppShowSettings",r],startParam:["tgWebAppStartParam",n],themeParams:["tgWebAppThemeParams",Ao()],version:["tgWebAppVersion",e]},"launchParams")(t)};function ko(t){const{initDataRaw:e,startParam:n,showSettings:r,botInline:o,fullscreen:i,defaultColors:s}=t,a=new URLSearchParams;return a.set("tgWebAppPlatform",t.platform),a.set("tgWebAppThemeParams",To(t.themeParams)),a.set("tgWebAppVersion",t.version),e&&a.set("tgWebAppData",e),n&&a.set("tgWebAppStartParam",n),"boolean"==typeof r&&a.set("tgWebAppShowSettings",r?"1":"0"),"boolean"==typeof o&&a.set("tgWebAppBotInline",o?"1":"0"),"boolean"==typeof i&&a.set("tgWebAppFullscreen",i?"1":"0"),s&&a.set("tgWebAppDefaultColors",To(s)),a.toString()}const Ro=po({eventType:yo(),eventData:t=>t},"miniAppsMessage"),Co=fo("fn",(t=>{if("function"==typeof t)return t;go(t)}));const Po=po({TelegramWebviewProxy:po({postEvent:Co()})()});function Io(t){return Po().isValid(t)}var Oo=Object.defineProperty,Bo=(t,e,n)=>((t,e,n)=>e in t?Oo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);let Uo=class t extends Error{constructor(e,n,r){super("object"==typeof n?n.message:n||e,{cause:"object"==typeof n?n.cause:r}),this.type=e,this.name="TypedError",Object.setPrototypeOf(this,t.prototype)}};function Lo(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function No(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach((t=>{t()}))}]}function Do(t){return e=>function(t,e){return t instanceof Uo&&t.type===e}(e,t)}const jo="ERR_ABORTED",Mo="ERR_CANCELED",Vo="ERR_TIMED_OUT";function Fo(t){return new Uo(jo,{cause:t})}Do(Vo),Do(jo),Do(Mo);function $o(t,e){return t.reject=e.reject,t}class Ko extends Promise{constructor(t,e){let n,r,o,i;"function"==typeof t?(n=t,r=e):r=t,super(((t,e)=>{r||(r={});const{abortSignal:s}=r;if(s&&s.aborted)return e(Fo(s.reason));const[a,c]=No(),u=t=>(...e)=>(c(),t(...e)),l=new AbortController,{signal:h}=l;i=u((t=>{l.abort(t),e(t)})),o=u(t),s&&a(Lo(s,"abort",(()=>{i(Fo(s.reason))})));const{timeout:f}=r;if(f){const t=setTimeout((()=>{i(new Uo(Vo,`Timeout reached: ${f}ms`))}),f);a((()=>{clearTimeout(t)}))}n&&n(o,i,h)})),Bo(this,"reject"),this.reject=i}static withFn(t,e){return new Ko(((e,n,r)=>{try{const o=t(r);return o instanceof Promise?o.then(e,n):e(o)}catch(t){n(t)}}),e)}static resolve(t){return new Ko((e=>{e(t)}))}static reject(t){return new Ko(((e,n)=>{n(t)}))}cancel(){this.reject(new Uo(Mo))}catch(t){return this.then(void 0,t)}finally(t){return $o(super.finally(t),this)}then(t,e){return $o(super.then(t,e),this)}}function Wo(t,e){return t.resolve=e.resolve,t}let zo=class t extends Ko{constructor(t,e){let n,r,o;"function"==typeof t?(n=t,r=e):r=t,super(((t,e,r)=>{o=t,n&&n(t,e,r)}),r),Bo(this,"resolve"),this.resolve=o}static withFn(e,n){return new t(((t,n,r)=>Ko.withFn(e,{abortSignal:r}).then(t,n)),n)}static resolve(e){return new t((t=>{t(e)}))}static reject(e){return new t(((t,n)=>{n(e)}))}catch(t){return this.then(void 0,t)}finally(t){return Wo(super.finally(t),this)}then(t,e){return Wo(super.then(t,e),this)}};function Ho(t){return`tapps/${t}`}function qo(t,e){sessionStorage.setItem(Ho(t),JSON.stringify(e))}function Zo(t){const e=sessionStorage.getItem(Ho(t));try{return e?JSON.parse(e):void 0}catch{}}function Go(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}function Xo(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:o=!0}=e;function i(e,...i){if(!o||"function"==typeof o&&!o())return;const s="font-weight:bold;padding:0 5px;border-radius:5px";console[e](`%c${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c / %c${t}`,`${s};background-color: lightblue;color:black`,"",`${s};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...i)}return[function(...t){i("log",...t)},function(...t){i("error",...t)}]}function Yo(t,e){document.documentElement.style.setProperty(t,e)}function Jo(t){document.documentElement.style.removeProperty(t)}function Qo(t,e){e||(e={});const n=e.equals||Object.is;let r=[],o=t;const i=t=>{if(!n(o,t)){const e=o;o=t,function(t,e){e()}(0,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),o=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));o>=0&&r.splice(o,1)},c=Object.assign((function(){return function(t){ti.length&&ti[ti.length-1].add(t)}(c),o}),{destroy(){r=[]},set:i,reset(){i(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const ti=[];const ei=Qo(!1),[ni,ri]=Xo("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:ei}),oi={clipboard_text_received:po({req_id:yo(),data:t=>null===t?t:yo(!0)(t)},"clipboard_text_received"),custom_method_invoked:po({req_id:yo(),result:t=>t,error:yo(!0)},"custom_method_invoked"),popup_closed:fo("popup_closed",(t=>t?po({button_id:t=>null==t?void 0:yo()(t)})()(t):{})),viewport_changed:po({height:wo(),width:t=>null==t?window.innerWidth:wo()(t),is_state_stable:mo(),is_expanded:mo()},"viewport_changed")};const ii=Qo(),si=Qo();function ai(){return si()||si.set(function(t){const e=window,[,n]=No(Lo(e,"message",(n=>{if(n.source!==e.parent)return;let r;try{r=Ro()(n.data)}catch{return}const{eventType:o,eventData:i}=r,s=oi[o];try{const e=s?s()(i):i;ni("Event received:",e?{eventType:o,eventData:e}:{eventType:o}),t([o,e])}catch(t){ri([`An error occurred processing the "${o}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/telegram-apps/issues/new/choose"].join("\n"),r,t)}})));return n}(ii.set)),ii}const ci=Qo({});function ui(t){let e=ci()[t];return e||(e=Qo(void 0,{equals:()=>!1}),ai().sub((n=>{n&&n[0]===t&&e.set(n[1])})),ci.set({...ci(),[t]:e})),e}function li(t,e,n){return ui(t).sub(e,n)}const hi="ERR_RETRIEVE_LP_FAILED",fi="ERR_UNKNOWN_ENV",di="ERR_INVOKE_CUSTOM_METHOD_RESPONSE",pi=Qo("https://web.telegram.org");function gi(t,e){ni("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window;if(Io(n))return void n.TelegramWebviewProxy.postEvent(t,JSON.stringify(e));const r=JSON.stringify({eventType:t,eventData:e});if(function(){try{return window.self!==window.top}catch{return!0}}())return n.parent.postMessage(r,pi());const{external:o}=n;if(!po({notify:Co()})().isValid(o))throw new Uo(fi);o.notify(r)}function mi(t,e,n){n||(n={});const{capture:r}=n,[o,i]=No();return new Ko((i=>{(Array.isArray(e)?e:[e]).forEach((t=>{o(li(t,(n=>{(!r||(Array.isArray(e)?r({event:t,payload:n}):r(n)))&&i(n)})))})),(n.postEvent||gi)(t,n.params)}),n).finally(i)}function yi(t){return xo()(t)}function wi(t){return yi(t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&"))}function bi(){return wi(window.location.href)}function vi(){const t=performance.getEntriesByType("navigation")[0];if(!t)throw new Error("Unable to get first navigation entry.");return wi(t.name)}const Ei="launchParams";function _i(){return yi(Zo(Ei)||"")}function Si(t){qo("launchParams",ko(t))}function Ai(t){return t instanceof Error?t.message+(t.cause?`\n ${Ai(t.cause)}`:""):JSON.stringify(t)}function Ti(){const t=[];for(const e of[bi,vi,_i])try{const t=e();return Si(t),t}catch(e){t.push(e)}throw new Uo(hi,["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/telegram-apps-bridge/environment","Collected errors:",...t.map((t=>`— ${Ai(t)}`))].join("\n"))}function xi(t){if("simple"===t)try{return Ti(),!0}catch{return!1}return Ko.withFn((async()=>{if(Io(window))return!0;try{return await mi("web_app_request_theme","theme_changed",{timeout:100}),!0}catch{return!1}}),t)}function ki(t,e,n){ui(t).unsub(e,n)}function Ri(t){return({req_id:e})=>e===t}function Ci(t){return t.split(".").map(Number)}function Pi(t,e){return function(t,e){const n=Ci(t),r=Ci(e),o=Math.max(n.length,r.length);for(let t=0;t<o;t+=1){const e=n[t]||0,o=r[t]||0;if(e!==o)return e>o?1:-1}return 0}(t,e)<=0}function Ii(t,e,n){if("string"==typeof n){if("web_app_open_link"===t){if("try_instant_view"===e)return Pi("6.4",n);if("try_browser"===e)return Pi("7.6",n)}if("web_app_set_header_color"===t&&"color"===e)return Pi("6.9",n);if("web_app_close"===t&&"return_back"===e)return Pi("7.6",n);if("web_app_setup_main_button"===t&&"has_shine_effect"===e)return Pi("7.10",n)}switch(t){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return Pi("6.1",e);case"web_app_open_popup":return Pi("6.2",e);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return Pi("6.4",e);case"web_app_switch_inline_query":return Pi("6.7",e);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return Pi("6.9",e);case"web_app_setup_settings_button":return Pi("6.10",e);case"web_app_biometry_get_info":case"web_app_biometry_open_settings":case"web_app_biometry_request_access":case"web_app_biometry_request_auth":case"web_app_biometry_update_token":return Pi("7.2",e);case"web_app_setup_swipe_behavior":return Pi("7.7",e);case"web_app_share_to_story":return Pi("7.8",e);case"web_app_setup_secondary_button":case"web_app_set_bottom_bar_color":return Pi("7.10",e);case"web_app_request_safe_area":case"web_app_request_content_safe_area":case"web_app_request_fullscreen":case"web_app_exit_fullscreen":case"web_app_set_emoji_status":case"web_app_add_to_home_screen":case"web_app_check_home_screen":case"web_app_request_emoji_status_access":return Pi("8.0",e);default:return["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"].includes(t)}}function Oi(){const t=performance.getEntriesByType("navigation")[0];return!!t&&"reload"===t.type}let Bi;function Ui(t){if(Bi)return t();Bi=new Map;try{t()}finally{Bi.forEach((t=>t())),Bi=void 0}}function Li(t,e){e||(e={});const n=e.equals||Object.is;let r=[],o=t;const i=t=>{if(!n(o,t)){const e=o;o=t,function(t,e){Bi&&Bi.set(t,e)||e()}(c,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),o=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));o>=0&&r.splice(o,1)},c=Object.assign((function(){return function(t){Ni.length&&Ni[Ni.length-1].add(t)}(c),o}),{destroy(){r=[]},set:i,reset(){i(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const Ni=[];function Di(t,e){let n,r=new Set;function o(){return n||(n=Li(s(),e))}function i(){o().set(s())}function s(){r.forEach((t=>{t.unsub(i,{signal:!0})}));const e=new Set;let n;Ni.push(e);try{n=t()}finally{Ni.pop()}return e.forEach((t=>{t.sub(i,{signal:!0})})),r=e,n}return Object.assign((function(){return o()()}),{destroy(){o().destroy()},sub:(...t)=>o().sub(...t),unsub(...t){o().unsub(...t)},unsubAll(...t){o().unsubAll(...t)}})}const ji=Li((()=>{let t=0;return()=>(t+=1).toString()})()),Mi=Li(gi),Vi=Li("0.0");function Fi(){return ji()()}function $i(t,e,n){return function(t,e,n,r){return mi("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:Ri(n)}).then((({result:t,error:e})=>{if(e)throw new Uo(di,e);return t}))}(t,e,Fi(),{...n||{},postEvent:Wi})}const Ki=(t,e,n)=>(n||(n={}),n.postEvent||(n.postEvent=Wi),mi(t,e,n)),Wi=(t,e)=>Mi()(t,e);function zi(t){return Di((()=>Ii(t,Vi())))}const Hi="ERR_POPUP_INVALID_PARAMS",qi="ERR_INVALID_URL",Zi="ERR_ALREADY_REQUESTING",Gi="ERR_ALREADY_OPENED",Xi="ERR_NOT_INITIALIZED",Yi="ERR_NOT_SUPPORTED",Ji="ERR_NOT_MOUNTED";function Qi(){return typeof window>"u"}function ts(t,e,{isSupported:n,isMounted:r,component:o,supports:i}={}){const s=`${o?`${o}.`:""}${t}()`;function a(t){if(i){const e=i[t];return Ii(e[0],e[1],Vi())}return!0}n=n?Array.isArray(n)||"object"==typeof n&&"any"in n?n:[n]:void 0;const c=()=>{if(!n)return;const t=`it is unsupported in Mini Apps version ${Vi()}`;function e(e){return"string"==typeof e?Ii(e,Vi())?void 0:t:e.fn()?void 0:e.error}if(Array.isArray(n)){for(const t of n){const n=e(t);if(n)return n}return}let r;for(const t of n.any)if(r=e(t),!r)return;return t},u=Di((()=>!c())),l=Di((()=>"0.0"!==Vi())),h=Di((()=>!r||r())),f=Di((()=>xi("simple")&&!Qi()&&l()&&u()&&h()));let d;if(i){d={};for(const t in i)d[t]=Di((()=>a(t)))}return Object.assign(((...t)=>{const n=`Unable to call the ${s} ${o?"method":"function"}:`;if(Qi()||!xi("simple"))throw new Uo(fi,`${n} it can't be called outside Mini Apps`);if(!l())throw new Uo(Xi,`${n} the SDK was not initialized. Use the SDK init() function`);const r=c();if(r)throw new Uo(Yi,`${n} ${r}`);const u=((...t)=>{if(i)for(const e in i)if(i[e][2](...t)&&!a(e))return`option ${e} is not supported in Mini Apps version ${Vi()}`})(...t);if(u)throw new Uo(Yi,`${n} ${u}`);if(!h())throw new Uo(Ji,`${n} the component is not mounted. Use the ${o}.mount() method`);return e(...t)}),e,{isAvailable:f,ifAvailable:(...t)=>f()?e(...t):void 0},n?{isSupported:u}:{},d?{supports:d}:{})}function es(t,e){return e||(e={}),(n,r,o,i)=>ts(n,r,{...e,isSupported:o||e.isSupported,supports:i,component:t})}function ns(t,e,n){return es(t,{isSupported:n,isMounted:e})}function rs(t,e){return es(t,{isSupported:e})}const os="web_app_setup_back_button",is="back_button_pressed",ss="backButton",as=Li(!1),cs=Li(!1),us=zi(os),ls=ns(ss,cs,os),hs=rs(ss,os),fs=ls("hide",(()=>{ps(!1)})),ds=hs("mount",(()=>{cs()||(ps(Oi()&&Zo(ss)||!1),cs.set(!0))}));function ps(t){t!==as()&&(Wi(os,{is_visible:t}),qo(ss,t),as.set(t))}const gs=hs("onClick",(t=>li(is,t))),ms=hs("offClick",(t=>{ki(is,t)})),ys=ls("show",(()=>{ps(!0)}));Symbol.toStringTag;function ws(t,e,n,r,o){const i=void 0===o||o?Ko:Promise;return Object.assign(((...o)=>i.resolve().then((async()=>{if(n()){const t=e();throw r.set(t),t}let s;Ui((()=>{n.set(i.resolve(t(...o))),r.set(void 0)}));try{s=[!0,await n()]}catch(t){s=[!1,t]}if(Ui((()=>{n.set(void 0),r.set(s[0]?void 0:s[1])})),!s[0])throw s[1];return s[1]}))),t)}function bs(t,e,n,r,o,i){const s=ws(e,(()=>new Uo("ERR_ALREADY_MOUNTING",`The ${t} component is already mounting`)),o,i);return t=>Ko.resolve().then((async()=>{if(!r()){const e=await s(t);Ui((()=>{r.set(!0),n(e)}))}}))}const vs=es,Es=Li({available:!1}),_s=Li(!1),Ss=Li(!1),As=Li(!1),Ts=Di((()=>!!ks())),xs=Li(),ks=Li(),Rs=Di((()=>{const t=Es();return t&&t.available}));function Cs(t){return t.available?{available:!0,tokenSaved:t.token_saved,deviceId:t.device_id,accessRequested:t.access_requested,type:t.type,accessGranted:t.access_granted}:{available:!1}}const Ps="web_app_biometry_get_info",Is=ts("requestBiometry",(t=>Ki(Ps,"biometry_info_received",t).then(Cs)),{isSupported:Ps}),Os="web_app_biometry_request_auth",Bs="biometry_info_received",Us="biometry",Ls=zi(Os),Ns=vs(Us),Ds=rs(Us,Os),js=ns(Us,As,Os);function Ms(){throw new Uo("ERR_NOT_AVAILABLE","Biometry is not available")}const Vs=js("authenticate",(t=>Ko.withFn((async e=>{if(_s())throw new Uo(Zi,"Authentication is already in progress");const n=Es();(!n||!n.available)&&Ms(),_s.set(!0);try{const r=await Ki(Os,"biometry_auth_requested",{abortSignal:e,params:{reason:((t||{}).reason||"").trim()}}),{token:o}=r;return"string"==typeof o&&zs({...n,token:o}),r}finally{_s.set(!1)}}),t))),Fs=Ds("openSettings",(()=>{Wi("web_app_biometry_open_settings")})),$s=js("requestAccess",(t=>Ko.withFn((async e=>{if(Ss())throw new Uo(Zi,"Access request is already in progress");Ss.set(!0);try{const n=await Ki("web_app_biometry_request_access",Bs,{abortSignal:e,params:{reason:(t||{}).reason||""}}).then(Cs);return n.available||Ms(),zs(n),n.accessGranted}finally{Ss.set(!1)}}),t))),Ks=Ns("mount",bs(Us,(t=>Oi()&&Zo(Us)||Is(t)),(t=>{li(Bs,Ws),zs(t)}),As,ks,xs)),Ws=t=>{zs(Cs(t))};function zs(t){Es.set(t),qo(Us,t)}const Hs=js("updateToken",(t=>(t||(t={}),Ki("web_app_biometry_update_token","biometry_token_updated",{...t,params:{token:t.token||"",reason:t.reason}}).then((t=>t.status)))));Symbol.toStringTag;function qs(t,e){return es(t,{isMounted:e})}const Zs="closingBehavior",Gs=Li(!1),Xs=Li(!1),Ys=qs(Zs,Xs),Js=vs(Zs),Qs=Ys("disableConfirmation",(()=>{na(!1)})),ta=Ys("enableConfirmation",(()=>{na(!0)})),ea=Js("mount",(()=>{Xs()||(na(Oi()&&Zo(Zs)||!1),Xs.set(!0))}));function na(t){t!==Gs()&&(Wi("web_app_setup_closing_behavior",{need_confirmation:t}),qo(Zs,t),Gs.set(t))}Symbol.toStringTag;const ra="web_app_invoke_custom_method",oa=rs("cloudStorage",ra),ia=zi(ra),sa=oa("deleteItem",((t,e)=>{const n=Array.isArray(t)?t:[t];return n.length?$i("deleteStorageValues",{keys:n},e).then():Ko.resolve()}));const aa=oa("getItem",(function(t,e){const n=Array.isArray(t)?t:[t];return n.length?$i("getStorageValues",{keys:n},e).then((e=>{const r=Xr(Object.fromEntries(n.map((t=>[t,Jr()]))))()(e);return Array.isArray(t)?r:r[t]})):Ko.resolve("string"==typeof t?"":{})})),ca=oa("getKeys",(t=>$i("getStorageKeys",{},t).then(function(t,e){return Gr("array",(e=>{let n;if(Array.isArray(e))n=e;else if("string"==typeof e)try{const t=JSON.parse(e);Array.isArray(t)&&(n=t)}catch{}return n||Yr(e),n.map(t)}))}(Jr())()))),ua=oa("setItem",((t,e,n)=>$i("saveStorageValue",{key:t,value:e},n).then())),la=(Symbol.toStringTag,"web_app_trigger_haptic_feedback"),ha=rs("hapticFeedback",la),fa=zi(la),da=ha("impactOccurred",(t=>{Wi(la,{type:"impact",impact_style:t})})),pa=ha("notificationOccurred",(t=>{Wi(la,{type:"notification",notification_type:t})})),ga=ha("selectionChanged",(()=>{Wi(la,{type:"selection_change"})})),ma=(Symbol.toStringTag,Li(void 0));function ya(t){return Di((()=>{const e=ma();return e?e[t]:void 0}))}const wa=ya("authDate"),ba=ya("canSendAfter"),va=Di((()=>{const t=wa(),e=ba();return e&&t?new Date(t.getTime()+1e3*e):void 0})),Ea=ya("chat"),_a=ya("chatType"),Sa=ya("chatInstance"),Aa=ya("hash"),Ta=ya("queryId"),xa=Li(),ka=ya("receiver");const Ra=ya("startParam"),Ca=ya("user");Symbol.toStringTag;const Pa="web_app_open_invoice",Ia=rs("invoice",Pa),Oa=Li(!1),Ba=zi(Pa);async function Ua(t,e,n){if(Oa())throw new Uo(Gi,"An invoice is already opened");let r;if("url"===e){const{hostname:e,pathname:n}=new URL(t,window.location.href);if("t.me"!==e)throw new Uo(qi,`Link has unexpected hostname: ${e}`);const o=n.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);if(!o)throw new Uo("ERR_INVALID_SLUG",'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"');[,,r]=o}else r=t,n=e;return Oa.set(!0),Ki(Pa,"invoice_closed",{...n,params:{slug:r},capture:t=>r===t.slug}).then((t=>t.status)).finally((()=>{Oa.set(!1)}))}const La=Ia("open",Ua);Symbol.toStringTag;function Na(t){return Object.fromEntries(Object.entries(t).filter((t=>void 0!==t[1])))}function Da(t){const e=eo(t);return Math.sqrt([.299,.587,.114].reduce(((t,n,r)=>{const o=parseInt(e.slice(1+2*r,1+2*(r+1)),16);return t+o*o*n}),0))<120}const ja=Li(!1),Ma=Li(!1),Va=Li({});function Fa(t){return Di((()=>Va()[t]))}const $a=Fa("accentTextColor"),Ka=Fa("bgColor"),Wa=Fa("buttonColor"),za=Fa("buttonTextColor"),Ha=Fa("bottomBarBgColor"),qa=Fa("destructiveTextColor"),Za=Fa("headerBgColor"),Ga=Fa("hintColor"),Xa=Di((()=>{const{bgColor:t}=Va();return!t||Da(t)})),Ya=Fa("linkColor"),Ja=Fa("secondaryBgColor"),Qa=Fa("sectionBgColor"),tc=Fa("sectionHeaderTextColor"),ec=Fa("sectionSeparatorColor"),nc=Fa("subtitleTextColor"),rc=Fa("textColor");function oc(t){return Di((()=>sc()[t]))}const ic=Li({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"}),sc=Di((()=>{const t=ic();return{...t,backgroundColor:t.backgroundColor||Wa()||"#2481cc",textColor:t.textColor||za()||"#ffffff"}})),ac=Li(!1),cc=oc("backgroundColor"),uc=oc("hasShineEffect"),lc=oc("isEnabled"),hc=oc("isLoaderVisible"),fc=oc("isVisible"),dc=oc("text"),pc=oc("textColor"),gc="main_button_pressed",mc="mainButton",yc=vs(mc),wc=qs(mc,ac),bc=yc("mount",(()=>{if(!ac()){const t=Oi()&&Zo(mc);t&&ic.set(t),ac.set(!0)}})),vc=yc("onClick",(t=>li(gc,t))),Ec=yc("offClick",(t=>{ki(gc,t)})),_c=wc("setParams",(t=>{ic.set({...ic(),...Na(t)}),qo(mc,ic());const e=sc();e.text&&Wi("web_app_setup_main_button",{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;function Sc(){throw new Uo("ERR_VARS_ALREADY_BOUND","CSS variables are already bound")}const Ac="themeParams",Tc="theme_changed",xc=vs(Ac),kc=qs(Ac,ja)("bindCssVars",(t=>{function e(t){Object.entries(Va()).forEach((([e,n])=>{n&&t(e,n)}))}function n(){e(((e,n)=>{Yo(t(e),n)}))}return Ma()&&Sc(),t||(t=t=>`--tg-theme-${Go(t)}`),n(),Va.sub(n),Ma.set(!0),()=>{e(Jo),Va.unsub(n),Ma.set(!1)}})),Rc=xc("mount",(()=>{ja()||(li(Tc,Cc),Va.set(Oi()&&Zo(Ac)||Ti().themeParams),ja.set(!0))})),Cc=t=>{const e=function(t){return ro()(t)}(t.theme_params);Va.set(e),qo(Ac,e)};function Pc(t){return Di((()=>{const e=t();return to(e)?e:"bg_color"===e?Ka():Ja()}))}const Ic=Li("bg_color"),Oc=Pc(Ic),Bc=Li("bottom_bar_bg_color"),Uc=Di((()=>{const t=Bc();return to(t)?t:"bottom_bar_bg_color"===t?Ha()||Ja():"secondary_bg_color"===t?Ja():Ka()})),Lc=Li("bg_color"),Nc=Pc(Lc),Dc=Li(!1),jc=Li(!1),Mc=Di((()=>{const t=Oc();return!!t&&Da(t)})),Vc=Li(!0),Fc=Di((()=>({backgroundColor:Ic(),bottomBarColor:Bc(),headerColor:Lc(),isActive:Vc()}))),$c="web_app_set_background_color",Kc="web_app_set_bottom_bar_color",Wc="web_app_set_header_color",zc="visibility_changed",Hc="miniApp",qc={any:[$c,Kc,Wc]},Zc=Di((()=>qc.any.some((t=>Ii(t,Vi()))))),Gc=vs(Hc),Xc=rs(Hc,qc),Yc=ns(Hc,Dc,qc),Jc=Yc("bindCssVars",(t=>{jc()&&Sc();const[e,n]=No();function r(t,n){function r(){Yo(t,n()||null)}r(),e(n.sub(r),Jo.bind(null,t))}return t||(t=t=>`--tg-${Go(t)}`),r(t("bgColor"),Oc),r(t("bottomBarColor"),Uc),r(t("headerColor"),Nc),e((()=>{jc.set(!1)})),jc.set(!0),n})),Qc=Gc("close",(t=>{Wi("web_app_close",{return_back:t})})),tu=t=>{Vc.set(t.is_visible),ru()},eu=Xc("mount",(()=>{if(!Dc()){const t=Oi()&&Zo(Hc);Rc(),ou.ifAvailable(t?t.backgroundColor:"bg_color"),iu.ifAvailable(t?t.bottomBarColor:"bottom_bar_bg_color"),su.ifAvailable(t?t.headerColor:"bg_color"),Vc.set(!t||t.isActive),li(zc,tu),Dc.set(!0)}})),nu=Gc("ready",(()=>{Wi("web_app_ready")}));function ru(){qo(Hc,Fc())}const ou=Yc("setBackgroundColor",(t=>{t!==Ic()&&(Wi($c,{color:t}),Ic.set(t),ru())}),$c),iu=Yc("setBottomBarColor",(t=>{t!==Bc()&&(Wi(Kc,{color:t}),Bc.set(t),ru())}),Kc),su=Yc("setHeaderColor",(t=>{t!==Lc()&&(Wi(Wc,to(t)?{color:t}:{color_key:t}),Lc.set(t),ru())}),Wc,{rgb:[Wc,"color",to]});const au=Object.freeze(Object.defineProperty({__proto__:null,backgroundColor:Ic,backgroundColorRGB:Oc,bindCssVars:Jc,bottomBarColor:Bc,bottomBarColorRGB:Uc,close:Qc,headerColor:Lc,headerColorRGB:Nc,isActive:Vc,isCssVarsBound:jc,isDark:Mc,isMounted:Dc,isSupported:Zc,mount:eu,ready:nu,setBackgroundColor:ou,setBottomBarColor:iu,setHeaderColor:su,state:Fc,unmount:function(){ki(zc,tu),Dc.set(!1)}},Symbol.toStringTag,{value:"Module"}));function cu(t){const e=t.message.trim(),n=(t.title||"").trim(),r=t.buttons||[];if(n.length>64)throw new Uo(Hi,`Invalid title: ${n}`);if(!e||e.length>256)throw new Uo(Hi,`Invalid message: ${e}`);if(r.length>3)throw new Uo(Hi,`Invalid buttons count: ${r.length}`);return{title:n,message:e,buttons:r.length?r.map(((t,e)=>{const n=t.id||"";if(n.length>64)throw new Uo(Hi,`Button with index ${e} has invalid id: ${n}`);if(!t.type||"default"===t.type||"destructive"===t.type){const r=t.text.trim();if(!r||r.length>64)throw new Uo(Hi,`Button with index ${e} has invalid text: ${r}`);return{type:t.type,text:r,id:n}}return{type:t.type,id:n}})):[{type:"close",id:""}]}}const uu="web_app_open_popup",lu=rs("popup",uu),hu=Li(!1),fu=zi(uu),du=lu("open",(async t=>{if(hu())throw new Uo(Gi,"A popup is already opened");hu.set(!0);try{const{button_id:e=null}=await Ki(uu,"popup_closed",{...t,params:cu(t)});return e}finally{hu.set(!1)}})),pu=(Symbol.toStringTag,"web_app_open_scan_qr_popup"),gu=rs("qrScanner",pu),mu=gu("close",(()=>{yu.set(!1),Wi("web_app_close_scan_qr_popup")})),yu=Li(!1),wu=zi(pu);const bu=gu("open",(function(t){return Ko.withFn((e=>{if(yu())throw new Uo(Gi,"The QR Scanner is already opened");yu.set(!0),t||(t={});const{onCaptured:n,text:r,capture:o}=t,[,i]=No(yu.sub((()=>{s.resolve()})),li("scan_qr_popup_closed",(()=>{yu.set(!1)})),li("qr_text_received",(t=>{n?n(t.data):(!o||o(t.data))&&(s.resolve(t.data),mu())}))),s=new zo({abortSignal:e}).catch(mu).finally(i);return(t.postEvent||Wi)(pu,{text:r}),s}),t)}));Symbol.toStringTag;function vu(t){return Di((()=>_u()[t]))}const Eu=Li({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,position:"left",text:"Cancel"}),_u=Di((()=>{const t=Eu();return{...t,backgroundColor:t.backgroundColor||Uc()||"#000000",textColor:t.textColor||Wa()||"#2481cc"}})),Su=Li(!1),Au=vu("backgroundColor"),Tu=vu("hasShineEffect"),xu=vu("isEnabled"),ku=vu("isLoaderVisible"),Ru=vu("isVisible"),Cu=vu("position"),Pu=vu("text"),Iu=vu("textColor"),Ou="web_app_setup_secondary_button",Bu="secondary_button_pressed",Uu="secondaryButton",Lu=rs(Uu,Ou),Nu=ns(Uu,Su,Ou),Du=zi(Ou),ju=Lu("mount",(()=>{if(!Su()){const t=Oi()&&Zo(Uu);t&&Eu.set(t),Su.set(!0)}})),Mu=Lu("onClick",(t=>li(Bu,t))),Vu=Lu("offClick",(t=>{ki(Bu,t)})),Fu=Nu("setParams",(t=>{Eu.set({...Eu(),...Object.fromEntries(Object.entries(t).filter((([,t])=>void 0!==t)))}),qo(Uu,Eu());const e=_u();e.text&&Wi(Ou,{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,position:e.position,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;const $u="web_app_setup_settings_button",Ku="settings_button_pressed",Wu="settingsButton",zu=Li(!1),Hu=Li(!1),qu=zi($u),Zu=rs(Wu,$u),Gu=ns(Wu,Hu,$u),Xu=Gu("hide",(()=>{Ju(!1)})),Yu=Zu("mount",(()=>{Hu()||(Ju(Oi()&&Zo(Wu)||!1),Hu.set(!0))}));function Ju(t){t!==zu()&&(Wi($u,{is_visible:t}),qo(Wu,t),zu.set(t))}const Qu=Zu("onClick",(t=>li(Ku,t))),tl=Zu("offClick",(t=>{ki(Ku,t)})),el=Gu("show",(()=>{Ju(!0)}));Symbol.toStringTag;const nl="web_app_setup_swipe_behavior",rl="swipeBehavior",ol=Li(!1),il=zi(nl),sl=Li(!0),al=rs(rl,nl),cl=ns(rl,ol,nl),ul=cl("disableVertical",(()=>{fl(!1)})),ll=cl("enableVertical",(()=>{fl(!0)})),hl=al("mount",(()=>{ol()||(fl(Oi()&&Zo(rl)||!1,!0),ol.set(!0))}));function fl(t,e){(t!==sl()||e)&&(Wi(nl,{allow_vertical_swipe:t}),qo(rl,t),sl.set(t))}Symbol.toStringTag,Symbol.toStringTag;const dl="viewport",pl="web_app_request_fullscreen",gl="fullscreen_changed",ml="safe_area_changed",yl="content_safe_area_changed",wl="viewport_changed",bl="web_app_request_safe_area",vl="web_app_request_content_safe_area",El={left:0,top:0,bottom:0,right:0};function _l(t){return Math.max(t,0)}const Sl=Li({contentSafeAreaInsets:El,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:El,stableHeight:0,width:0});function Al(t){return Di((()=>Sl()[t]))}function Tl(t){const{height:e,stableHeight:n,width:r}=t;Sl.set({...Sl(),...Na({...t,height:e?_l(e):void 0,width:r?_l(r):void 0,stableHeight:n?_l(n):void 0})}),qo(dl,Sl())}const xl=Al("isFullscreen"),kl=Li(),Rl=Di((()=>!!kl())),Cl=Li(),Pl=Li(!1),Il=Di((()=>!!Bl())),Ol=Li(void 0),Bl=Li(),Ul=ns(dl,Pl,pl);function Ll(t,e){return Ul(t,ws((t=>Ki(e,[gl,"fullscreen_failed"],t).then((t=>{if("error"in t){if("ALREADY_FULLSCREEN"===t.error)return!0;throw new Uo("ERR_FULLSCREEN_FAILED","Fullscreen request failed",t.error)}return t.is_fullscreen})).then((t=>{t!==xl()&&Tl({isFullscreen:t})}))),(()=>new Uo(Zi,"Fullscreen mode change is already being requested")),kl,Cl))}const Nl=Ll("requestFullscreen",pl),Dl=Ll("exitFullscreen","web_app_exit_fullscreen"),jl=vs(dl),Ml=qs(dl,Pl);function Vl(t){return Di((()=>Fl()[t]))}const Fl=Al("safeAreaInsets"),$l=Vl("bottom"),Kl=Vl("left"),Wl=Vl("right"),zl=Vl("top");function Hl(t){return Di((()=>ql()[t]))}const ql=Al("contentSafeAreaInsets"),Zl=Hl("bottom"),Gl=Hl("left"),Xl=Hl("right"),Yl=Hl("top"),Jl=ts("requestContentSafeAreaInsets",(t=>Ki(vl,"content_safe_area_changed",t)),{isSupported:vl}),Ql=ts("requestSafeAreaInsets",(t=>Ki(bl,"safe_area_changed",t)),{isSupported:bl});const th=t=>{const{height:e}=t;Tl({isExpanded:t.is_expanded,height:e,width:t.width,stableHeight:t.is_state_stable?e:void 0})},eh=t=>{Tl({isFullscreen:t.is_fullscreen})},nh=t=>{Tl({safeAreaInsets:t})},rh=t=>{Tl({contentSafeAreaInsets:t})},oh=jl("mount",bs(dl,(t=>Ko.resolve().then((async()=>{const e=Oi()&&Zo(dl);if(e)return e;const[n,r]=await Ko.all([Ql.ifAvailable(t)||Fl(),Jl.ifAvailable(t)||ql()]),o=Ti(),i={contentSafeAreaInsets:r,isFullscreen:!!o.fullscreen,safeAreaInsets:n};if(["macos","tdesktop","unigram","webk","weba","web"].includes(o.platform)){const t=window;return{...i,height:t.innerHeight,isExpanded:!0,stableHeight:t.innerHeight,width:t.innerWidth}}return function(t){return Ki("web_app_request_viewport","viewport_changed",t).then((t=>({height:t.height,width:t.width,isExpanded:t.is_expanded,isStable:t.is_state_stable})))}(t).then((t=>({...i,height:t.height,isExpanded:t.isExpanded,stableHeight:t.isStable?t.height:0,width:t.width})))}))),(t=>{li(wl,th),li(gl,eh),li(ml,nh),li(yl,rh),Tl(t)}),Pl,Bl,Ol));const ih=Li(!1),sh=Al("height"),ah=Al("stableHeight"),ch=Al("width"),uh=Ml("bindCssVars",(t=>{ih()&&Sc(),t||(t=t=>`--tg-viewport-${Go(t)}`);const e=[["height",sh],["stableHeight",ah],["width",ch],["safeAreaInsetTop",zl],["safeAreaInsetBottom",$l],["safeAreaInsetLeft",Kl],["safeAreaInsetRight",Wl],["contentSafeAreaInsetTop",Yl],["contentSafeAreaInsetBottom",Zl],["contentSafeAreaInsetLeft",Gl],["contentSafeAreaInsetRight",Xl]].reduce(((e,[n,r])=>{const o=t(n);if(o){const t=()=>{Yo(o,`${r()}px`)};e.push([t,r.sub(t),o])}return e}),[]);return e.forEach((t=>{t[0]()})),ih.set(!0),()=>{e.forEach((t=>{t[1](),Jo(t[2])})),ih.set(!1)}})),lh=jl("expand",(()=>{Wi("web_app_expand")})),hh=Al("isExpanded"),fh=Di((()=>sh()===ah())),dh=(Symbol.toStringTag,vs()("openLink",((t,e)=>{if("string"==typeof t)try{t=new URL(t)}catch(e){throw new Uo(qi,`"${t.toString()}" is invalid URL`,e)}e||(e={}),Wi("web_app_open_link",{url:t.toString(),try_browser:e.tryBrowser,try_instant_view:e.tryInstantView})})),"web_app_open_tg_link"),ph=vs()("openTelegramLink",(t=>{const e=t.toString();if(!e.match(/^https:\/\/t.me\/.+/))throw new Uo(qi,`"${e}" is invalid URL`);Ii(dh,Vi())?(t=new URL(t),Wi(dh,{path_full:t.pathname+t.search})):window.location.href=e}));vs()("shareURL",((t,e)=>{ph("https://t.me/share/url?"+new URLSearchParams({url:t,text:e||""}).toString().replace(/\+/g,"%20"))}));function gh(t){let{onLoginSuccess:e}=t;return React.createElement("div",{className:"flex flex-col items-center"},React.createElement("button",{onClick:async()=>{if(au.mount.isAvailable())try{au.mount();const t=au.initData,e="OnairosMiniApp",n=new URL("https://onairos.uk/othent-connect");n.searchParams.append("tgAppUrl",encodeURIComponent(JSON.stringify(t))),n.searchParams.append("botUsername",e),au.openLink(n.toString())}catch(t){console.error("Telegram auth flow failed:",t)}else console.error("Telegram Mini App not available")},className:"flex items-center justify-center px-4 py-2 border border-gray-300 rounded-full shadow-sm bg-white hover:bg-gray-50"},React.createElement("img",{src:"https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",alt:"Google",className:"w-5 h-5 mr-2"}),React.createElement("span",null,"Continue with Google")))}function mh(t){let{onLoginSuccess:n,setOthent:r,setHashedOthentSub:o,setEncryptedPin:i}=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(gh,{onLoginSuccess:async t=>{n(t,!0)}}),React.createElement(Fr,{hasSavedCredentials:s,onSuccess:n}))}var yh=a(697),wh=a.n(yh);function bh(t){let{active:e,title:r,id:o,number:i,descriptions:s,rewards:a,size:c,isChecked:u,onCheckboxChange:l}=t;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:!e,type:"checkbox",checked:u,onChange:t=>l(t.target.checked)})))),n().createElement("div",{className:"flex items-center"}),s&&"Avatar"!==r&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Intent: ",s),a&&n().createElement("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-300"},"Rewards: ",a)))}function vh(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 Eh(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}bh.propTypes={active:wh().bool.isRequired,title:wh().string.isRequired,id:wh().any.isRequired,number:wh().number.isRequired,descriptions:wh().string,rewards:wh().string,size:wh().string.isRequired,isChecked:wh().bool.isRequired,onCheckboxChange:wh().func.isRequired};const _h=t=>Array.isArray(t);function Sh(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 Ah(t){return"string"==typeof t||Array.isArray(t)}function Th(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function xh(t,e,n,r){if("function"==typeof e){const[o,i]=Th(r);e=e(void 0!==n?n:t.custom,o,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[o,i]=Th(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function kh(t,e,n){const r=t.getProps();return xh(r,e,void 0!==n?n:r.custom,t)}const Rh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ch=["initial",...Rh],Ph=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ih=new Set(Ph),Oh=t=>1e3*t,Bh=t=>t/1e3,Uh={type:"spring",stiffness:500,damping:25,restSpeed:10},Lh={type:"keyframes",duration:.8},Nh={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Dh=(t,{keyframes:e})=>e.length>2?Lh:Ih.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Uh:Nh;function jh(t,e){return t?t[e]||t.default||t:void 0}const Mh=!1,Vh=!1,Fh=!1,$h=t=>null!==t;function Kh(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter($h),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const Wh=t=>t;const zh=["read","resolveKeyframes","update","preRender","render","postRender"];function Hh(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,s=zh.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function a(e){i.has(e)&&(c.schedule(e),t()),e(s)}const c={schedule:(t,o=!1,s=!1)=>{const a=s&&r?e:n;return o&&i.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{s=t,r?o=!0:(r=!0,[e,n]=[n,e],e.forEach(a),e.clear(),r=!1,o&&(o=!1,c.process(t)))}};return c}(i),t)),{}),{read:a,resolveKeyframes:c,update:u,preRender:l,render:h,postRender:f}=s,d=()=>{const i=Vh?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,a.process(o),c.process(o),u.process(o),l.process(o),h.process(o),f.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(d))};return{schedule:zh.reduce(((e,i)=>{const a=s[i];return e[i]=(e,i=!1,s=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(d)),a.schedule(e,i,s)),e}),{}),cancel:t=>{for(let e=0;e<zh.length;e++)s[zh[e]].cancel(t)},state:o,steps:s}}const{schedule:qh,cancel:Zh,state:Gh,steps:Xh}=Hh("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Wh,!0),Yh=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Jh=1e-7,Qh=12;function tf(t,e,n,r){if(t===e&&n===r)return Wh;const o=e=>function(t,e,n,r,o){let i,s,a=0;do{s=e+(n-e)/2,i=Yh(s,r,o)-t,i>0?n=s:e=s}while(Math.abs(i)>Jh&&++a<Qh);return s}(e,0,1,t,n);return t=>0===t||1===t?t:Yh(o(t),e,r)}const ef=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,nf=t=>e=>1-t(1-e),rf=tf(.33,1.53,.69,.99),of=nf(rf),sf=ef(of),af=t=>(t*=2)<1?.5*of(t):.5*(2-Math.pow(2,-10*(t-1))),cf=t=>1-Math.sin(Math.acos(t)),uf=nf(cf),lf=ef(cf),hf=t=>/^0[^.\s]+$/u.test(t);let ff=Wh,df=Wh;const pf=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),gf=t=>e=>"string"==typeof e&&e.startsWith(t),mf=gf("--"),yf=gf("var(--"),wf=t=>!!yf(t)&&bf.test(t.split("/*")[0].trim()),bf=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vf=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ef(t,e,n=1){df(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=vf.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return pf(t)?parseFloat(t):t}return wf(o)?Ef(o,e,n+1):o}const _f=(t,e,n)=>n>e?e:n<t?t:n,Sf={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Af={...Sf,transform:t=>_f(0,1,t)},Tf={...Sf,default:1},xf=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),kf=xf("deg"),Rf=xf("%"),Cf=xf("px"),Pf=xf("vh"),If=xf("vw"),Of={...Rf,parse:t=>Rf.parse(t)/100,transform:t=>Rf.transform(100*t)},Bf=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Uf=t=>t===Sf||t===Cf,Lf=(t,e)=>parseFloat(t.split(", ")[e]),Nf=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Lf(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Lf(e[1],t):0}},Df=new Set(["x","y","z"]),jf=Ph.filter((t=>!Df.has(t)));const Mf={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:Nf(4,13),y:Nf(5,14)};Mf.translateX=Mf.x,Mf.translateY=Mf.y;const Vf=t=>e=>e.test(t),Ff=[Sf,Cf,Rf,kf,If,Pf,{test:t=>"auto"===t,parse:t=>t}],$f=t=>Ff.find(Vf(t)),Kf=new Set;let Wf=!1,zf=!1;function Hf(){if(zf){const t=Array.from(Kf).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 jf.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)}))}zf=!1,Wf=!1,Kf.forEach((t=>t.complete())),Kf.clear()}function qf(){Kf.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(zf=!0)}))}class Zf{constructor(t,e,n,r,o,i=!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=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Kf.add(this),Wf||(Wf=!0,qh.read(qf),qh.resolveKeyframes(Hf))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Kf.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Kf.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Gf=t=>Math.round(1e5*t)/1e5,Xf=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Yf=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Jf=(t,e)=>n=>Boolean("string"==typeof n&&Yf.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Qf=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,s,a]=r.match(Xf);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},td={...Sf,transform:t=>Math.round((t=>_f(0,255,t))(t))},ed={test:Jf("rgb","red"),parse:Qf("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+td.transform(t)+", "+td.transform(e)+", "+td.transform(n)+", "+Gf(Af.transform(r))+")"};const nd={test:Jf("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:ed.transform},rd={test:Jf("hsl","hue"),parse:Qf("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Rf.transform(Gf(e))+", "+Rf.transform(Gf(n))+", "+Gf(Af.transform(r))+")"},od={test:t=>ed.test(t)||nd.test(t)||rd.test(t),parse:t=>ed.test(t)?ed.parse(t):rd.test(t)?rd.parse(t):nd.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ed.transform(t):rd.transform(t)},id=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const sd="number",ad="color",cd="var",ud="var(",ld="${}",hd=/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 fd(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const s=e.replace(hd,(t=>(od.test(t)?(r.color.push(i),o.push(ad),n.push(od.parse(t))):t.startsWith(ud)?(r.var.push(i),o.push(cd),n.push(t)):(r.number.push(i),o.push(sd),n.push(parseFloat(t))),++i,ld))).split(ld);return{values:n,split:s,indexes:r,types:o}}function dd(t){return fd(t).values}function pd(t){const{split:e,types:n}=fd(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===sd?Gf(t[i]):e===ad?od.transform(t[i]):t[i]}return o}}const gd=t=>"number"==typeof t?0:t;const md={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Xf))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(id))||void 0===n?void 0:n.length)||0)>0},parse:dd,createTransformer:pd,getAnimatableNone:function(t){const e=dd(t);return pd(t)(e.map(gd))}},yd=new Set(["brightness","contrast","saturate","opacity"]);function wd(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(Xf)||[];if(!r)return t;const o=n.replace(r,"");let i=yd.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const bd=/\b([a-z-]*)\(.*?\)/gu,vd={...md,getAnimatableNone:t=>{const e=t.match(bd);return e?e.map(wd).join(" "):t}},Ed={borderWidth:Cf,borderTopWidth:Cf,borderRightWidth:Cf,borderBottomWidth:Cf,borderLeftWidth:Cf,borderRadius:Cf,radius:Cf,borderTopLeftRadius:Cf,borderTopRightRadius:Cf,borderBottomRightRadius:Cf,borderBottomLeftRadius:Cf,width:Cf,maxWidth:Cf,height:Cf,maxHeight:Cf,top:Cf,right:Cf,bottom:Cf,left:Cf,padding:Cf,paddingTop:Cf,paddingRight:Cf,paddingBottom:Cf,paddingLeft:Cf,margin:Cf,marginTop:Cf,marginRight:Cf,marginBottom:Cf,marginLeft:Cf,backgroundPositionX:Cf,backgroundPositionY:Cf},_d={rotate:kf,rotateX:kf,rotateY:kf,rotateZ:kf,scale:Tf,scaleX:Tf,scaleY:Tf,scaleZ:Tf,skew:kf,skewX:kf,skewY:kf,distance:Cf,translateX:Cf,translateY:Cf,translateZ:Cf,x:Cf,y:Cf,z:Cf,perspective:Cf,transformPerspective:Cf,opacity:Af,originX:Of,originY:Of,originZ:Cf},Sd={...Sf,transform:Math.round},Ad={...Ed,..._d,zIndex:Sd,size:Cf,fillOpacity:Af,strokeOpacity:Af,numOctaves:Sd},Td={...Ad,color:od,backgroundColor:od,outlineColor:od,fill:od,stroke:od,borderColor:od,borderTopColor:od,borderRightColor:od,borderBottomColor:od,borderLeftColor:od,filter:vd,WebkitFilter:vd},xd=t=>Td[t];function kd(t,e){let n=xd(t);return n!==vd&&(n=md),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Rd=new Set(["auto","none","0"]);class Cd extends Zf{constructor(t,e,n,r,o){super(t,e,n,r,o,!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(),wf(r))){const o=Ef(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Bf.has(n)||2!==t.length)return;const[r,o]=t,i=$f(r),s=$f(o);if(i!==s)if(Uf(i)&&Uf(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||hf(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!Rd.has(e)&&fd(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=kd(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=Mf[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 o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,s=r[i];r[i]=Mf[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 Pd(t){return"function"==typeof t}let Id;function Od(){Id=void 0}const Bd={now:()=>(void 0===Id&&Bd.set(Gh.isProcessing||Vh?Gh.timestamp:performance.now()),Id),set:t=>{Id=t,queueMicrotask(Od)}},Ud=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!md.test(t)&&"0"!==t||t.startsWith("url(")));function Ld(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],s=Ud(o,e),a=Ud(i,e);return ff(s===a,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} 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||Pd(n))&&r)}class Nd{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...s}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Bd.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...s},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(qf(),Hf()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Bd.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:s,onUpdate:a,isGenerator:c}=this.options;if(!c&&!Ld(t,n,r,o)){if(Fh||!i)return null==a||a(Kh(t,this.options,e)),null==s||s(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(t,e);!1!==u&&(this._resolved={keyframes:t,finalKeyframe:e,...u},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 Dd=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},jd=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let e=0;e<o;e++)r+=t(Dd(0,o-1,e))+", ";return`linear(${r.substring(0,r.length-2)})`};function Md(t,e){return e?t*(1e3/e):0}const Vd=5;function Fd(t,e,n){const r=Math.max(e-Vd,0);return Md(n-t(r),e-r)}const $d={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},Kd=.001;function Wd({duration:t=$d.duration,bounce:e=$d.bounce,velocity:n=$d.velocity,mass:r=$d.mass}){let o,i;ff(t<=Oh($d.maxDuration),"Spring duration must be 10 seconds or less");let s=1-e;s=_f($d.minDamping,$d.maxDamping,s),t=_f($d.minDuration,$d.maxDuration,Bh(t)),s<1?(o=e=>{const r=e*s,o=r*t,i=r-n,a=Hd(e,s),c=Math.exp(-o);return Kd-i/a*c},i=e=>{const r=e*s*t,i=r*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,c=Math.exp(-r),u=Hd(Math.pow(e,2),s);return(-o(e)+Kd>0?-1:1)*((i-a)*c)/u}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-Kd,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let n=1;n<zd;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Oh(t),isNaN(a))return{stiffness:$d.stiffness,damping:$d.damping,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*s*Math.sqrt(r*e),duration:t}}}const zd=12;function Hd(t,e){return t*Math.sqrt(1-e*e)}const qd=2e4;function Zd(t){let e=0;let n=t.next(e);for(;!n.done&&e<qd;)e+=50,n=t.next(e);return e>=qd?1/0:e}const Gd=["duration","bounce"],Xd=["stiffness","damping","mass"];function Yd(t,e){return e.some((e=>void 0!==t[e]))}function Jd(t=$d.visualDuration,e=$d.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const i=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:c,damping:u,mass:l,duration:h,velocity:f,isResolvedFromDuration:d}=function(t){let e={velocity:$d.velocity,stiffness:$d.stiffness,damping:$d.damping,mass:$d.mass,isResolvedFromDuration:!1,...t};if(!Yd(t,Xd)&&Yd(t,Gd))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),o=r*r,i=2*_f(.05,1,1-t.bounce)*Math.sqrt(o);e={...e,mass:$d.mass,stiffness:o,damping:i}}else{const n=Wd(t);e={...e,...n,mass:$d.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Bh(n.velocity||0)}),p=f||0,g=u/(2*Math.sqrt(c*l)),m=s-i,y=Bh(Math.sqrt(c/l)),w=Math.abs(m)<5;let b;if(r||(r=w?$d.restSpeed.granular:$d.restSpeed.default),o||(o=w?$d.restDelta.granular:$d.restDelta.default),g<1){const t=Hd(y,g);b=e=>{const n=Math.exp(-g*y*e);return s-n*((p+g*y*m)/t*Math.sin(t*e)+m*Math.cos(t*e))}}else if(1===g)b=t=>s-Math.exp(-y*t)*(m+(p+y*m)*t);else{const t=y*Math.sqrt(g*g-1);b=e=>{const n=Math.exp(-g*y*e),r=Math.min(t*e,300);return s-n*((p+g*y*m)*Math.sinh(r)+t*m*Math.cosh(r))/t}}const v={calculatedDuration:d&&h||null,next:t=>{const e=b(t);if(d)a.done=t>=h;else{let n=0;g<1&&(n=0===t?Oh(p):Fd(b,t,e));const i=Math.abs(n)<=r,c=Math.abs(s-e)<=o;a.done=i&&c}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(Zd(v),qd),e=jd((e=>v.next(t*e).value),t,30);return t+"ms "+e}};return v}function Qd({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:s,min:a,max:c,restDelta:u=.5,restSpeed:l}){const h=t[0],f={done:!1,value:h},d=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let p=n*e;const g=h+p,m=void 0===s?g:s(g);m!==g&&(p=m-h);const y=t=>-p*Math.exp(-t/r),w=t=>m+y(t),b=t=>{const e=y(t),n=w(t);f.done=Math.abs(e)<=u,f.value=f.done?m:n};let v,E;const _=t=>{(t=>void 0!==a&&t<a||void 0!==c&&t>c)(f.value)&&(v=t,E=Jd({keyframes:[f.value,d(f.value)],velocity:Fd(w,t,f.value),damping:o,stiffness:i,restDelta:u,restSpeed:l}))};return _(0),{calculatedDuration:null,next:t=>{let e=!1;return E||void 0!==v||(e=!0,b(t),_(t)),void 0!==v&&t>=v?E.next(t-v):(!e&&b(t),f)}}}const tp=tf(.42,0,1,1),ep=tf(0,0,.58,1),np=tf(.42,0,.58,1),rp=t=>Array.isArray(t)&&"number"==typeof t[0],op={linear:Wh,easeIn:tp,easeInOut:np,easeOut:ep,circIn:cf,circInOut:lf,circOut:uf,backIn:of,backInOut:sf,backOut:rf,anticipate:af},ip=t=>{if(rp(t)){df(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return tf(e,n,r,o)}return"string"==typeof t?(df(void 0!==op[t],`Invalid easing type '${t}'`),op[t]):t},sp=(t,e)=>n=>e(t(n)),ap=(...t)=>t.reduce(sp),cp=(t,e,n)=>t+(e-t)*n;function up(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 lp(t,e){return n=>n>0?e:t}const hp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},fp=[nd,ed,rd];function dp(t){const e=(t=>fp.find((e=>e.test(t))))(t);if(ff(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===rd&&(n=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,s=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;o=up(a,r,t+1/3),i=up(a,r,t),s=up(a,r,t-1/3)}else o=i=s=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*s),alpha:r}}(n)),n}const pp=(t,e)=>{const n=dp(t),r=dp(e);if(!n||!r)return lp(t,e);const o={...n};return t=>(o.red=hp(n.red,r.red,t),o.green=hp(n.green,r.green,t),o.blue=hp(n.blue,r.blue,t),o.alpha=cp(n.alpha,r.alpha,t),ed.transform(o))},gp=new Set(["none","hidden"]);function mp(t,e){return n=>cp(t,e,n)}function yp(t){return"number"==typeof t?mp:"string"==typeof t?wf(t)?lp:od.test(t)?pp:vp:Array.isArray(t)?wp:"object"==typeof t?od.test(t)?pp:bp:lp}function wp(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>yp(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function bp(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=yp(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const vp=(t,e)=>{const n=md.createTransformer(e),r=fd(t),o=fd(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?gp.has(t)&&!o.values.length||gp.has(e)&&!r.values.length?function(t,e){return gp.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):ap(wp(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const s=e.types[i],a=t.indexes[s][o[s]],c=null!==(n=t.values[a])&&void 0!==n?n:0;r[i]=c,o[s]++}return r}(r,o),o.values),n):(ff(!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.`),lp(t,e))};function Ep(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return cp(t,e,n);return yp(t)(t,e)}function _p(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(df(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=function(t,e,n){const r=[],o=n||Ep,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||Wh:e;i=ap(t,i)}r.push(i)}return r}(e,r,o),a=s.length,c=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=Dd(t[n],t[n+1],e);return s[n](r)};return n?e=>c(_f(t[0],t[i-1],e)):c}function Sp(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=Dd(0,e,r);t.push(cp(n,1,o))}}(e,t.length-1),e}function Ap({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=(t=>Array.isArray(t)&&"number"!=typeof t[0])(r)?r.map(ip):ip(r),i={done:!1,value:e[0]},s=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Sp(e),t),a=_p(s,e,{ease:Array.isArray(o)?o:(c=e,u=o,c.map((()=>u||np)).splice(0,c.length-1))});var c,u;return{calculatedDuration:t,next:e=>(i.value=a(e),i.done=e>=t,i)}}const Tp=t=>{const e=({timestamp:e})=>t(e);return{start:()=>qh.update(e,!0),stop:()=>Zh(e),now:()=>Gh.isProcessing?Gh.timestamp:Bd.now()}},xp={decay:Qd,inertia:Qd,tween:Ap,keyframes:Ap,spring:Jd},kp=t=>t/100;class Rp extends Nd{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:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||Zf;this.resolver=new i(o,((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:o,velocity:i=0}=this.options,s=Pd(e)?e:xp[e]||Ap;let a,c;s!==Ap&&"number"!=typeof t[0]&&(a=ap(kp,Ep(t[0],t[1])),t=[0,100]);const u=s({...this.options,keyframes:t});"mirror"===o&&(c=s({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===u.calculatedDuration&&(u.calculatedDuration=Zd(u));const{calculatedDuration:l}=u,h=l+r;return{generator:u,mirroredGenerator:c,mapPercentToKeyframes:a,calculatedDuration:l,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:o,mirroredGenerator:i,mapPercentToKeyframes:s,keyframes:a,calculatedDuration:c,totalDuration:u,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:h,repeat:f,repeatType:d,repeatDelay:p,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/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 m=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?m<0:m>u;this.currentTime=Math.max(m,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let w=this.currentTime,b=o;if(f){const t=Math.min(this.currentTime,u)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,f+1);Boolean(e%2)&&("reverse"===d?(n=1-n,p&&(n-=p/l)):"mirror"===d&&(b=i)),w=_f(0,1,n)*l}const v=y?{done:!1,value:a[0]}:b.next(w);s&&(v.value=s(v.value));let{done:E}=v;y||null===c||(E=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const _=null===this.holdTime&&("finished"===this.state||"running"===this.state&&E);return _&&void 0!==r&&(v.value=Kh(a,this.options,r)),g&&g(v.value),_&&this.finish(),v}get duration(){const{resolved:t}=this;return t?Bh(t.calculatedDuration):0}get time(){return Bh(this.currentTime)}set time(t){t=Oh(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=Bh(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Tp,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 Cp=new Set(["opacity","clipPath","filter","transform"]);function Pp(t){let e;return()=>(void 0===e&&(e=t()),e)}const Ip={linearEasing:void 0};function Op(t,e){const n=Pp(t);return()=>{var t;return null!==(t=Ip[e])&&void 0!==t?t:n()}}const Bp=Op((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function Up(t){return Boolean("function"==typeof t&&Bp()||!t||"string"==typeof t&&(t in Np||Bp())||rp(t)||Array.isArray(t)&&t.every(Up))}const Lp=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Np={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Lp([0,.65,.55,1]),circOut:Lp([.55,0,1,.45]),backIn:Lp([.31,.01,.66,-.59]),backOut:Lp([.33,1.53,.69,.99])};function Dp(t,e){return t?"function"==typeof t&&Bp()?jd(t,e):rp(t)?Lp(t):Array.isArray(t)?t.map((t=>Dp(t,e)||Np.easeOut)):Np[t]:void 0}function jp(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:s="loop",ease:a="easeInOut",times:c}={}){const u={[e]:n};c&&(u.offset=c);const l=Dp(a,o);return Array.isArray(l)&&(u.easing=l),t.animate(u,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===s?"alternate":"normal"})}function Mp(t,e){t.timeline=e,t.onfinish=null}const Vp=Pp((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const Fp={anticipate:af,backInOut:sf,circInOut:lf};class $p extends Nd{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Cd(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:s,motionValue:a,name:c,startTime:u}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var l;if("string"==typeof i&&Bp()&&i in Fp&&(i=Fp[i]),Pd((l=this.options).type)||"spring"===l.type||!Up(l.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:c,...u}=this.options,l=function(t,e){const n=new Rp({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,u);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,s="keyframes"}const h=jp(a.owner.current,c,t,{...this.options,duration:r,times:o,ease:i});return h.startTime=null!=u?u:this.calcStartTime(),this.pendingTimeline?(Mp(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(Kh(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:r,times:o,type:s,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return Bh(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Bh(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Oh(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 Wh;const{animation:n}=e;Mp(n,t)}else this.pendingTimeline=t;return Wh}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:o,ease:i,times:s}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:c,...u}=this.options,l=new Rp({...u,keyframes:n,duration:r,type:o,ease:i,times:s,isGenerator:!0}),h=Oh(this.time);t.setWithVelocity(l.sample(h-10).value,l.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:o,damping:i,type:s}=t;return Vp()&&n&&Cp.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==s}}const Kp=Pp((()=>void 0!==window.ScrollTimeline));class Wp{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=>Kp()&&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 zp=(t,e,n,r={},o,i)=>s=>{const a=jh(r,t)||{},c=a.delay||r.delay||0;let{elapsed:u=0}=r;u-=Oh(c);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:s,repeatDelay:a,from:c,elapsed:u,...l}){return!!Object.keys(l).length})(a)||(l={...l,...Dh(t,l)}),l.duration&&(l.duration=Oh(l.duration)),l.repeatDelay&&(l.repeatDelay=Oh(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let h=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(h=!0)),(Fh||Mh)&&(h=!0,l.duration=0,l.delay=0),h&&!i&&void 0!==e.get()){const t=Kh(l.keyframes,a);if(void 0!==t)return qh.update((()=>{l.onUpdate(t),l.onComplete()})),new Wp([])}return!i&&$p.supports(l)?new $p(l):new Rp(l)},Hp=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),qp=t=>_h(t)?t[t.length-1]||0:t;function Zp(t,e){-1===t.indexOf(e)&&t.push(e)}function Gp(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Xp{constructor(){this.subscriptions=[]}add(t){return Zp(this.subscriptions,t),()=>Gp(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 o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Yp={current:void 0};class Jp{constructor(t,e={}){this.version="11.15.0",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Bd.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=Bd.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 Xp);const n=this.events[t].add(e);return"change"===t?()=>{n(),qh.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 Yp.current&&Yp.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Bd.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Md(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 Qp(t,e){return new Jp(t,e)}function tg(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Qp(n))}const eg=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ng="data-"+eg("framerAppearId");function rg(t){return t.props[ng]}const og=t=>Boolean(t&&t.getVelocity);function ig(t,e){const n=t.getValue("willChange");if(r=n,Boolean(og(r)&&r.add))return n.add(e);var r}function sg({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function ag(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...c}=e;r&&(s=r);const u=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in c){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=c[e];if(void 0===o||l&&sg(l,e))continue;const a={delay:n,...jh(s||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=rg(t);if(n){const t=window.MotionHandoffAnimation(n,e,qh);null!==t&&(a.startTime=t,h=!0)}}ig(t,e),r.start(zp(e,r,o,t.shouldReduceMotion&&Ih.has(e)?{type:!1}:a,t,h));const f=r.animation;f&&u.push(f)}return a&&Promise.all(u).then((()=>{qh.update((()=>{a&&function(t,e){const n=kh(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)tg(t,e,qp(i[e]))}(t,a)}))})),u}function cg(t,e,n={}){var r;const o=kh(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const s=o?()=>Promise.all(ag(t,o,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:s,staggerDirection:a}=i;return function(t,e,n=0,r=0,o=1,i){const s=[],a=(t.variantChildren.size-1)*r,c=1===o?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(ug).forEach(((t,r)=>{t.notify("AnimationStart",e),s.push(cg(t,e,{...i,delay:n+c(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(s)}(t,e,o+r,s,a,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[t,e]="beforeChildren"===c?[s,a]:[a,s];return t().then((()=>e()))}return Promise.all([s(),a(n.delay)])}function ug(t,e){return t.sortNodePosition(e)}const lg=Ch.length;function hg(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&hg(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<lg;n++){const r=Ch[n],o=t.props[r];(Ah(o)||!1===o)&&(e[r]=o)}return e}const fg=[...Rh].reverse(),dg=Rh.length;function pg(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 o=e.map((e=>cg(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=cg(t,e,n);else{const o="function"==typeof e?kh(t,e,n.custom):e;r=Promise.all(ag(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function gg(t){let e=pg(t),n=wg(),r=!0;const o=e=>(n,r)=>{var o;const i=kh(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const{props:s}=t,a=hg(t.parent)||{},c=[],u=new Set;let l={},h=1/0;for(let e=0;e<dg;e++){const f=fg[e],d=n[f],p=void 0!==s[f]?s[f]:a[f],g=Ah(p),m=f===i?d.isActive:null;!1===m&&(h=e);let y=p===a[f]&&p!==s[f]&&g;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),d.protectedKeys={...l},!d.isActive&&null===m||!p&&!d.prevProp||Eh(p)||"boolean"==typeof p)continue;const w=mg(d.prevProp,p);let b=w||f===i&&d.isActive&&!y&&g||e>h&&g,v=!1;const E=Array.isArray(p)?p:[p];let _=E.reduce(o(f),{});!1===m&&(_={});const{prevResolvedValues:S={}}=d,A={...S,..._},T=e=>{b=!0,u.has(e)&&(v=!0,u.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in A){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=_h(e)&&_h(n)?!Sh(e,n):e!==n,r?null!=e?T(t):u.add(t):void 0!==e&&u.has(t)?T(t):d.protectedKeys[t]=!0}d.prevProp=p,d.prevResolvedValues=_,d.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(y&&w)||v)&&c.push(...E.map((t=>({animation:t,options:{type:f}}))))}if(u.size){const e={};u.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),c.push({animation:e})}let f=Boolean(c.length);return!r||!1!==s.initial&&s.initial!==s.animate||t.manuallyAnimateOnMount||(f=!1),r=!1,f?e(c):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const s=i(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=wg(),r=!0}}}function mg(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Sh(e,t)}function yg(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wg(){return{animate:yg(!0),whileInView:yg(),whileHover:yg(),whileTap:yg(),whileDrag:yg(),whileFocus:yg(),exit:yg()}}class bg{constructor(t){this.isMounted=!1,this.node=t}update(){}}let vg=0;const Eg={animation:{Feature:class extends bg{constructor(t){super(t),t.animationState||(t.animationState=gg(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Eh(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 bg{constructor(){super(...arguments),this.id=vg++}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(){}}}},_g={x:!1,y:!1};function Sg(){return _g.x||_g.y}function Ag(t,e){const n=function(t,e,n){var r;if(t instanceof Element)return[t];if("string"==typeof t){let o=document;e&&(o=e.current);const i=null!==(r=null==n?void 0:n[t])&&void 0!==r?r:o.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}(t),r=new AbortController;return[n,{passive:!0,...e,signal:r.signal},()=>r.abort()]}function Tg(t){return e=>{"touch"===e.pointerType||Sg()||t(e)}}const xg=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,kg=new WeakSet;function Rg(t){return e=>{"Enter"===e.key&&t(e)}}function Cg(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Pg=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Ig=(t,e)=>!!e&&(t===e||Ig(t,e.parentElement));function Og(t){return xg(t)&&!Sg()}function Bg(t,e,n={}){const[r,o,i]=Ag(t,n),s=t=>{const r=t.currentTarget;if(!Og(t)||kg.has(r))return;kg.add(r);const i=e(t),s=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",c),Og(t)&&kg.has(r)&&(kg.delete(r),i&&i(t,{success:e}))},a=t=>{s(t,n.useGlobalTarget||Ig(r,t.target))},c=t=>{s(t,!1)};window.addEventListener("pointerup",a,o),window.addEventListener("pointercancel",c,o)};return r.forEach((t=>{(function(t){return Pg.has(t.tagName)||-1!==t.tabIndex})(t)||(t.tabIndex=0);(n.useGlobalTarget?window:t).addEventListener("pointerdown",s,o),t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const r=Rg((()=>{if(kg.has(n))return;Cg(n,"down");const t=Rg((()=>{Cg(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>Cg(n,"cancel")),e)}));n.addEventListener("keydown",r,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",r)),e)})(t,o)),o)})),i}function Ug(t){return{point:{x:t.pageX,y:t.pageY}}}function Lg(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Ng(t,e,n,r){return Lg(t,e,(t=>e=>xg(e)&&t(e,Ug(e)))(n),r)}const Dg=(t,e)=>Math.abs(t-e);class jg{constructor(t,e,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:o=!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=Fg(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=Dg(t.x,e.x),r=Dg(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:o}=Gh;this.history.push({...r,timestamp:o});const{onStart:i,onMove:s}=this.handlers;e||(i&&i(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=Mg(e,this.transformPagePoint),qh.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:o}=this.handlers;if(this.dragSnapToOrigin&&o&&o(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const i=Fg("pointercancel"===t.type?this.lastMoveEventInfo:Mg(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,i),r&&r(t,i)},!xg(t))return;this.dragSnapToOrigin=o,this.handlers=e,this.transformPagePoint=n,this.contextWindow=r||window;const i=Mg(Ug(t),this.transformPagePoint),{point:s}=i,{timestamp:a}=Gh;this.history=[{...s,timestamp:a}];const{onSessionStart:c}=e;c&&c(t,Fg(i,this.history)),this.removeListeners=ap(Ng(this.contextWindow,"pointermove",this.handlePointerMove),Ng(this.contextWindow,"pointerup",this.handlePointerUp),Ng(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Zh(this.updatePoint)}}function Mg(t,e){return e?{point:e(t.point)}:t}function Vg(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Fg({point:t},e){return{point:t,delta:Vg(t,Kg(e)),offset:Vg(t,$g(e)),velocity:Wg(e,.1)}}function $g(t){return t[0]}function Kg(t){return t[t.length-1]}function Wg(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=Kg(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>Oh(e)));)n--;if(!r)return{x:0,y:0};const i=Bh(o.timestamp-r.timestamp);if(0===i)return{x:0,y:0};const s={x:(o.x-r.x)/i,y:(o.y-r.y)/i};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function zg(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Hg=.9999,qg=1.0001,Zg=-.01,Gg=.01;function Xg(t){return t.max-t.min}function Yg(t,e,n,r=.5){t.origin=r,t.originPoint=cp(e.min,e.max,t.origin),t.scale=Xg(n)/Xg(e),t.translate=cp(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Hg&&t.scale<=qg||isNaN(t.scale))&&(t.scale=1),(t.translate>=Zg&&t.translate<=Gg||isNaN(t.translate))&&(t.translate=0)}function Jg(t,e,n,r){Yg(t.x,e.x,n.x,r?r.originX:void 0),Yg(t.y,e.y,n.y,r?r.originY:void 0)}function Qg(t,e,n){t.min=n.min+e.min,t.max=t.min+Xg(e)}function tm(t,e,n){t.min=e.min-n.min,t.max=t.min+Xg(e)}function em(t,e,n){tm(t.x,e.x,n.x),tm(t.y,e.y,n.y)}function nm(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 rm(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 om=.35;function im(t,e,n){return{min:sm(t,e),max:sm(t,n)}}function sm(t,e){return"number"==typeof t?t:t[e]||0}const am=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),cm=()=>({x:{min:0,max:0},y:{min:0,max:0}});function um(t){return[t("x"),t("y")]}function lm({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function hm(t){return void 0===t||1===t}function fm({scale:t,scaleX:e,scaleY:n}){return!hm(t)||!hm(e)||!hm(n)}function dm(t){return fm(t)||pm(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function pm(t){return gm(t.x)||gm(t.y)}function gm(t){return t&&"0%"!==t}function mm(t,e,n){return n+e*(t-n)}function ym(t,e,n,r,o){return void 0!==o&&(t=mm(t,o,r)),mm(t,n,r)+e}function wm(t,e=0,n=1,r,o){t.min=ym(t.min,e,n,r,o),t.max=ym(t.max,e,n,r,o)}function bm(t,{x:e,y:n}){wm(t.x,e.translate,e.scale,e.originPoint),wm(t.y,n.translate,n.scale,n.originPoint)}const vm=.999999999999,Em=1.0000000000001;function _m(t,e){t.min=t.min+e,t.max=t.max+e}function Sm(t,e,n,r,o=.5){wm(t,e,n,cp(t.min,t.max,o),r)}function Am(t,e){Sm(t.x,e.x,e.scaleX,e.scale,e.originX),Sm(t.y,e.y,e.scaleY,e.scale,e.originY)}function Tm(t,e){return lm(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 xm=({current:t})=>t?t.ownerDocument.defaultView:null,km=new WeakMap;class Rm{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=cm(),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 jg(t,{onSessionStart:t=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(Ug(t).point)},onStart:(t,e)=>{const{drag:n,dragPropagation:r,onDragStart:o}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(i=n)||"y"===i?_g[i]?null:(_g[i]=!0,()=>{_g[i]=!1}):_g.x||_g.y?null:(_g.x=_g.y=!0,()=>{_g.x=_g.y=!1}),!this.openDragLock))return;var i;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),um((t=>{let e=this.getAxisMotionValue(t).get()||0;if(Rf.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[t];if(r){e=Xg(r)*(parseFloat(e)/100)}}}this.originPoint[t]=e})),o&&qh.postRender((()=>o(t,e))),ig(this.visualElement,"transform");const{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:o,onDrag:i}=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&&o&&o(this.currentDirection));this.updateAxis("x",e.point,s),this.updateAxis("y",e.point,s),this.visualElement.render(),i&&i(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>um((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:xm(this.visualElement)})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:r}=e;this.startAnimation(r);const{onDragEnd:o}=this.getProps();o&&qh.postRender((()=>o(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||!Cm(t,r,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(i=function(t,{min:e,max:n},r){return void 0!==e&&t<e?t=r?cp(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?cp(n,t,r.max):Math.min(t,n)),t}(i,this.constraints[t],this.elastic[t])),o.set(i)}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,o=this.constraints;e&&zg(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(t,{top:e,left:n,bottom:r,right:o}){return{x:nm(t.x,n,o),y:nm(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=om){return!1===t?t=0:!0===t&&(t=om),{x:im(t,"left","right"),y:im(t,"top","bottom")}}(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&um((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||!zg(t))return!1;const n=t.current;df(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 o=function(t,e,n){const r=Tm(t,n),{scroll:o}=e;return o&&(_m(r.x,o.offset.x),_m(r.y,o.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let i=function(t,e){return{x:rm(t.x,e.x),y:rm(t.y,e.y)}}(r.layout.layoutBox,o);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(i));this.hasMutatedConstraints=!!t,t&&(i=lm(t))}return i}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},c=um((s=>{if(!Cm(s,e,this.currentDirection))return;let c=a&&a[s]||{};i&&(c={min:0,max:0});const u=r?200:1e6,l=r?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:u,bounceDamping:l,timeConstant:750,restDelta:1,restSpeed:10,...o,...c};return this.startAxisValueAnimation(s,h)}));return Promise.all(c).then(s)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return ig(this.visualElement,t),n.start(zp(t,n,0,e,this.visualElement,!1))}stopAnimation(){um((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){um((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){um((e=>{const{drag:n}=this.getProps();if(!Cm(e,n,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(e);if(r&&r.layout){const{min:n,max:i}=r.layout.layoutBox[e];o.set(t[e]-cp(n,i,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!zg(e)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};um((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=Xg(t),o=Xg(e);return o>r?n=Dd(e.min,e.max-r,t.min):r>o&&(n=Dd(t.min,t.max-o,e.min)),_f(0,1,n)}({min:n,max:n},this.constraints[t])}}));const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),um((e=>{if(!Cm(e,t,null))return;const n=this.getAxisMotionValue(e),{min:o,max:i}=this.constraints[e];n.set(cp(o,i,r[e]))}))}addListeners(){if(!this.visualElement.current)return;km.set(this.visualElement,this);const t=Ng(this.visualElement.current,"pointerdown",(t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)})),e=()=>{const{dragConstraints:t}=this.getProps();zg(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()),qh.read(e);const o=Lg(window,"resize",(()=>this.scalePositionWithinConstraints())),i=n.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(um((e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))})),this.visualElement.render())}));return()=>{o(),t(),r(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:i=om,dragMomentum:s=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:r,dragConstraints:o,dragElastic:i,dragMomentum:s}}}function Cm(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const Pm=t=>(e,n)=>{t&&qh.postRender((()=>t(e,n)))};var Im=a(893);const Om=(0,e.createContext)(null);const Bm=(0,e.createContext)({}),Um=(0,e.createContext)({}),Lm={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Nm(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Dm={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!Cf.test(t))return t;t=parseFloat(t)}return`${Nm(t,e.target.x)}% ${Nm(t,e.target.y)}%`}},jm={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=md.parse(t);if(o.length>5)return r;const i=md.createTransformer(t),s="number"!=typeof o[0]?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;o[0+s]/=a,o[1+s]/=c;const u=cp(a,c,.5);return"number"==typeof o[2+s]&&(o[2+s]/=u),"number"==typeof o[3+s]&&(o[3+s]/=u),i(o)}},Mm={};const{schedule:Vm,cancel:Fm}=Hh(queueMicrotask,!1);class $m extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:o}=t;var i;i=Wm,Object.assign(Mm,i),o&&(e.group&&e.group.add(o),n&&n.register&&r&&n.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",(()=>{this.safeToRemove()})),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Lm.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:r,isPresent:o}=this.props,i=n.projection;return i?(i.isPresent=o,r||t.layoutDependency!==e||void 0===e?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||qh.postRender((()=>{const t=i.getStack();t&&t.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Vm.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 Km(t){const[n,r]=function(){const t=(0,e.useContext)(Om);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,i=(0,e.useId)();(0,e.useEffect)((()=>o(i)),[]);const s=(0,e.useCallback)((()=>r&&r(i)),[i,r]);return!n&&r?[!1,s]:[!0]}(),o=(0,e.useContext)(Bm);return(0,Im.jsx)($m,{...t,layoutGroup:o,switchLayoutGroup:(0,e.useContext)(Um),isPresent:n,safeToRemove:r})}const Wm={borderRadius:{...Dm,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Dm,borderTopRightRadius:Dm,borderBottomLeftRadius:Dm,borderBottomRightRadius:Dm,boxShadow:jm},zm=["TopLeft","TopRight","BottomLeft","BottomRight"],Hm=zm.length,qm=t=>"string"==typeof t?parseFloat(t):t,Zm=t=>"number"==typeof t||Cf.test(t);function Gm(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Xm=Jm(0,.5,uf),Ym=Jm(.5,.95,Wh);function Jm(t,e,n){return r=>r<t?0:r>e?1:n(Dd(t,e,r))}function Qm(t,e){t.min=e.min,t.max=e.max}function ty(t,e){Qm(t.x,e.x),Qm(t.y,e.y)}function ey(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function ny(t,e,n,r,o){return t=mm(t-=e,1/n,r),void 0!==o&&(t=mm(t,1/o,r)),t}function ry(t,e,[n,r,o],i,s){!function(t,e=0,n=1,r=.5,o,i=t,s=t){Rf.test(e)&&(e=parseFloat(e),e=cp(s.min,s.max,e/100)-s.min);if("number"!=typeof e)return;let a=cp(i.min,i.max,r);t===i&&(a-=e),t.min=ny(t.min,e,n,a,o),t.max=ny(t.max,e,n,a,o)}(t,e[n],e[r],e[o],e.scale,i,s)}const oy=["x","scaleX","originX"],iy=["y","scaleY","originY"];function sy(t,e,n,r){ry(t.x,e,oy,n?n.x:void 0,r?r.x:void 0),ry(t.y,e,iy,n?n.y:void 0,r?r.y:void 0)}function ay(t){return 0===t.translate&&1===t.scale}function cy(t){return ay(t.x)&&ay(t.y)}function uy(t,e){return t.min===e.min&&t.max===e.max}function ly(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function hy(t,e){return ly(t.x,e.x)&&ly(t.y,e.y)}function fy(t){return Xg(t.x)/Xg(t.y)}function dy(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class py{constructor(){this.members=[]}add(t){Zp(this.members,t),t.scheduleRender()}remove(t){if(Gp(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 gy=(t,e)=>t.depth-e.depth;class my{constructor(){this.children=[],this.isDirty=!1}add(t){Zp(this.children,t),this.isDirty=!0}remove(t){Gp(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(gy),this.isDirty=!1,this.children.forEach(t)}}function yy(t){const e=og(t)?t.get():t;return Hp(e)?e.toValue():e}function wy(t,e){const n=Bd.now(),r=({timestamp:o})=>{const i=o-n;i>=e&&(Zh(r),t(i-e))};return qh.read(r,!0),()=>Zh(r)}const by={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},vy="undefined"!=typeof window&&void 0!==window.MotionDebug,Ey=["","X","Y","Z"],_y={visibility:"hidden"};let Sy=0;function Ay(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Ty(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=rg(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",qh,!(e||r))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Ty(r)}function xy({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=Sy++,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,vy&&(by.totalNodes=by.resolvedTargetDeltas=by.recalculatedProjection=0),this.nodes.forEach(Cy),this.nodes.forEach(Ny),this.nodes.forEach(Dy),this.nodes.forEach(Py),vy&&window.MotionDebug.record(by)},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 my)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Xp),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:o,layout:i,visualElement:s}=this.options;if(s&&!s.current&&s.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(i||o)&&(this.isLayoutDirty=!0),t){let n;const r=()=>this.root.updateBlockedByResize=!1;t(e,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=wy(r,250),Lm.hasAnimatedSinceResize&&(Lm.hasAnimatedSinceResize=!1,this.nodes.forEach(Ly))}))}o&&this.root.registerSharedNode(o,this),!1!==this.options.animate&&s&&(o||i)&&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 o=this.options.transition||s.getDefaultTransition()||Ky,{onLayoutAnimationStart:i,onLayoutAnimationComplete:a}=s.getProps(),c=!this.targetLayout||!hy(this.targetLayout,r)||n,u=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||u||e&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,u);const e={...jh(o,"layout"),onPlay:i,onComplete:a};(s.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||Ly(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,Zh(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(jy),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&&Ty(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(Oy);this.isUpdating||this.nodes.forEach(By),this.isUpdating=!1,this.nodes.forEach(Uy),this.nodes.forEach(ky),this.nodes.forEach(Ry),this.clearAllSnapshots();const t=Bd.now();Gh.delta=_f(0,1e3/60,t-Gh.timestamp),Gh.timestamp=t,Gh.isProcessing=!0,Xh.update.process(Gh),Xh.preRender.process(Gh),Xh.render.process(Gh),Gh.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Vm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Iy),this.sharedNodes.forEach(My)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,qh.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){qh.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=cm(),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(!o)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!cy(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,i=r!==this.prevTransformTemplateValue;t&&(e||dm(this.latestValues)||i)&&(o(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)),Hy((r=n).x),Hy(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 cm();const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(Zy))){const{scroll:t}=this.root;t&&(_m(n.x,t.offset.x),_m(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n=cm();if(ty(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:o,options:i}=r;r!==this.root&&o&&i.layoutScroll&&(o.wasRoot&&ty(n,t),_m(n.x,o.offset.x),_m(n.y,o.offset.y))}return n}applyTransform(t,e=!1){const n=cm();ty(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&&Am(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),dm(r.latestValues)&&Am(n,r.latestValues)}return dm(this.latestValues)&&Am(n,this.latestValues),n}removeTransform(t){const e=cm();ty(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!dm(n.latestValues))continue;fm(n.latestValues)&&n.updateSnapshot();const r=cm();ty(r,n.measurePageBox()),sy(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return dm(this.latestValues)&&sy(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!==Gh.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:o,layoutId:i}=this.options;if(this.layout&&(o||i)){if(this.resolvedRelativeTargetAt=Gh.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget=cm(),this.relativeTargetOrigin=cm(),em(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),ty(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var s,a,c;if(this.target||(this.target=cm(),this.targetWithTransforms=cm()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,c=this.relativeParent.target,Qg(s.x,a.x,c.x),Qg(s.y,a.y,c.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):ty(this.target,this.layout.layoutBox),bm(this.target,this.targetDelta)):ty(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=cm(),this.relativeTargetOrigin=cm(),em(this.relativeTargetOrigin,this.target,t.target),ty(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}vy&&by.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!fm(this.parent.latestValues)&&!pm(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===Gh.timestamp&&(r=!1),r)return;const{layout:o,layoutId:i}=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||!o&&!i)return;ty(this.layoutCorrected,this.layout.layoutBox);const s=this.treeScale.x,a=this.treeScale.y;!function(t,e,n,r=!1){const o=n.length;if(!o)return;let i,s;e.x=e.y=1;for(let a=0;a<o;a++){i=n[a],s=i.projectionDelta;const{visualElement:o}=i.options;o&&o.props.style&&"contents"===o.props.style.display||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Am(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),s&&(e.x*=s.x.scale,e.y*=s.y.scale,bm(t,s)),r&&dm(i.latestValues)&&Am(t,i.latestValues))}e.x<Em&&e.x>vm&&(e.x=1),e.y<Em&&e.y>vm&&(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=cm());const{target:c}=e;c?(this.projectionDelta&&this.prevProjectionDelta?(ey(this.prevProjectionDelta.x,this.projectionDelta.x),ey(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Jg(this.projectionDelta,this.layoutCorrected,c,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&dy(this.projectionDelta.x,this.prevProjectionDelta.x)&&dy(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",c)),vy&&by.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=am(),this.projectionDelta=am(),this.projectionDeltaWithTransform=am()}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},o={...this.latestValues},i=am();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const s=cm(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,l=Boolean(a&&!u&&!0===this.options.crossfade&&!this.path.some($y));let h;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;Vy(i.x,t.x,n),Vy(i.y,t.y,n),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(em(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(t,e,n,r){Fy(t.x,e.x,n.x,r),Fy(t.y,e.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,s,n),h&&function(t,e){return uy(t.x,e.x)&&uy(t.y,e.y)}(this.relativeTarget,h)&&(this.isProjectionDirty=!1),h||(h=cm()),ty(h,this.relativeTarget)),a&&(this.animationValues=o,function(t,e,n,r,o,i){o?(t.opacity=cp(0,void 0!==n.opacity?n.opacity:1,Xm(r)),t.opacityExit=cp(void 0!==e.opacity?e.opacity:1,0,Ym(r))):i&&(t.opacity=cp(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let o=0;o<Hm;o++){const i=`border${zm[o]}Radius`;let s=Gm(e,i),a=Gm(n,i);void 0===s&&void 0===a||(s||(s=0),a||(a=0),0===s||0===a||Zm(s)===Zm(a)?(t[i]=Math.max(cp(qm(s),qm(a),r),0),(Rf.test(a)||Rf.test(s))&&(t[i]+="%")):t[i]=a)}(e.rotate||n.rotate)&&(t.rotate=cp(e.rotate||0,n.rotate||0,r))}(o,r,this.latestValues,n,l,u)),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&&(Zh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=qh.update((()=>{Lm.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n){const r=og(t)?t:Qp(t);return r.start(zp("",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:o}=t;if(e&&n&&r){if(this!==t&&this.layout&&r&&qy(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||cm();const e=Xg(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const r=Xg(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+r}ty(e,n),Am(e,o),Jg(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new py);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&&Ay("z",t,r,this.animationValues);for(let e=0;e<Ey.length;e++)Ay(`rotate${Ey[e]}`,t,r,this.animationValues),Ay(`skew${Ey[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 _y;const r={visibility:""},o=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=yy(null==t?void 0:t.pointerEvents)||"",r.transform=o?o(this.latestValues,""):"none",r;const i=this.getLead();if(!this.projectionDelta||!this.layout||!i.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=yy(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!dm(this.latestValues)&&(e.transform=o?o({},""):"none",this.hasProjected=!1),e}const s=i.animationValues||i.latestValues;this.applyTransformsToTarget(),r.transform=function(t,e,n){let r="";const o=t.x.translate/e.x,i=t.y.translate/e.y,s=(null==n?void 0:n.z)||0;if((o||i||s)&&(r=`translate3d(${o}px, ${i}px, ${s}px) `),1===e.x&&1===e.y||(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:t,rotate:e,rotateX:o,rotateY:i,skewX:s,skewY:a}=n;t&&(r=`perspective(${t}px) ${r}`),e&&(r+=`rotate(${e}deg) `),o&&(r+=`rotateX(${o}deg) `),i&&(r+=`rotateY(${i}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),o&&(r.transform=o(s,r.transform));const{x:a,y:c}=this.projectionDelta;r.transformOrigin=`${100*a.origin}% ${100*c.origin}% 0`,i.animationValues?r.opacity=i===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=i===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const t in Mm){if(void 0===s[t])continue;const{correct:e,applyTo:n}=Mm[t],o="none"===r.transform?s[t]:e(s[t],i);if(n){const t=n.length;for(let e=0;e<t;e++)r[n[e]]=o}else r[t]=o}return this.options.layoutId&&(r.pointerEvents=i===this?yy(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(Oy),this.root.sharedNodes.clear()}}}function ky(t){t.updateLayout()}function Ry(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:o}=t.options,i=n.source!==t.layout.source;"size"===o?um((t=>{const r=i?n.measuredBox[t]:n.layoutBox[t],o=Xg(r);r.min=e[t].min,r.max=r.min+o})):qy(o,n.layoutBox,e)&&um((r=>{const o=i?n.measuredBox[r]:n.layoutBox[r],s=Xg(e[r]);o.max=o.min+s,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[r].max=t.relativeTarget[r].min+s)}));const s=am();Jg(s,e,n.layoutBox);const a=am();i?Jg(a,t.applyTransform(r,!0),n.measuredBox):Jg(a,e,n.layoutBox);const c=!cy(s);let u=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:o,layout:i}=r;if(o&&i){const s=cm();em(s,n.layoutBox,o.layoutBox);const a=cm();em(a,e,i.layoutBox),hy(s,a)||(u=!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:u})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Cy(t){vy&&by.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 Py(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Iy(t){t.clearSnapshot()}function Oy(t){t.clearMeasurements()}function By(t){t.isLayoutDirty=!1}function Uy(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Ly(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Ny(t){t.resolveTargetDelta()}function Dy(t){t.calcProjection()}function jy(t){t.resetSkewAndRotation()}function My(t){t.removeLeadSnapshot()}function Vy(t,e,n){t.translate=cp(e.translate,0,n),t.scale=cp(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Fy(t,e,n,r){t.min=cp(e.min,n.min,r),t.max=cp(e.max,n.max,r)}function $y(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const Ky={duration:.45,ease:[.4,0,.1,1]},Wy=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),zy=Wy("applewebkit/")&&!Wy("chrome/")?Math.round:Wh;function Hy(t){t.min=zy(t.min),t.max=zy(t.max)}function qy(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=fy(e),o=fy(n),i=.2,!(Math.abs(r-o)<=i));var r,o,i}function Zy(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Gy=xy({attachResizeListener:(t,e)=>Lg(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Xy={current:void 0},Yy=xy({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Xy.current){const t=new Gy({});t.mount(window),t.setOptions({layoutScroll:!0}),Xy.current=t}return Xy.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),Jy={pan:{Feature:class extends bg{constructor(){super(...arguments),this.removePointerDownListener=Wh}onPointerDown(t){this.session=new jg(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xm(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Pm(t),onStart:Pm(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&qh.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=Ng(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 bg{constructor(t){super(t),this.removeGroupControls=Wh,this.removeListeners=Wh,this.controls=new Rm(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wh}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Yy,MeasureLayout:Km}};function Qy(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover","Start"===n);const o=r["onHover"+n];o&&qh.postRender((()=>o(e,Ug(e))))}function tw(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap","Start"===n);const o=r["onTap"+("End"===n?"":n)];o&&qh.postRender((()=>o(e,Ug(e))))}const ew=new WeakMap,nw=new WeakMap,rw=t=>{const e=ew.get(t.target);e&&e(t)},ow=t=>{t.forEach(rw)};function iw(t,e,n){const r=function({root:t,...e}){const n=t||document;nw.has(n)||nw.set(n,{});const r=nw.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(ow,{root:t,...e})),r[o]}(e);return ew.set(t,n),r.observe(t),()=>{ew.delete(t),r.unobserve(t)}}const sw={some:0,all:1};const aw={inView:{Feature:class extends bg{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:o}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:sw[r]};return iw(this.node.current,i,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,o&&!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(),i=e?n:r;i&&i(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 bg{mount(){const{current:t}=this.node;t&&(this.unmount=Bg(t,(t=>(tw(this.node,t,"Start"),(t,{success:e})=>tw(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends bg{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=ap(Lg(this.node.current,"focus",(()=>this.onFocus())),Lg(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends bg{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,o,i]=Ag(t,n),s=Tg((t=>{const{target:n}=t,r=e(t);if(!r||!n)return;const i=Tg((t=>{r(t),n.removeEventListener("pointerleave",i)}));n.addEventListener("pointerleave",i,o)}));return r.forEach((t=>{t.addEventListener("pointerenter",s,o)})),i}(t,(t=>(Qy(this.node,t,"Start"),t=>Qy(this.node,t,"End")))))}unmount(){}}}},cw={layout:{ProjectionNode:Yy,MeasureLayout:Km}},uw=(0,e.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),lw=(0,e.createContext)({}),hw="undefined"!=typeof window,fw=hw?e.useLayoutEffect:e.useEffect,dw=(0,e.createContext)({strict:!1});function pw(t,n,r,o,i){var s,a;const{visualElement:c}=(0,e.useContext)(lw),u=(0,e.useContext)(dw),l=(0,e.useContext)(Om),h=(0,e.useContext)(uw).reducedMotion,f=(0,e.useRef)(null);o=o||u.renderer,!f.current&&o&&(f.current=o(t,{visualState:n,parent:c,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:h}));const d=f.current,p=(0,e.useContext)(Um);!d||d.projection||!i||"html"!==d.type&&"svg"!==d.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:s,dragConstraints:a,layoutScroll:c,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:gw(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(s)||a&&zg(a),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}(f.current,r,i,p);const g=(0,e.useRef)(!1);(0,e.useInsertionEffect)((()=>{d&&g.current&&d.update(r,l)}));const m=r[ng],y=(0,e.useRef)(Boolean(m)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,m))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,m)));return fw((()=>{d&&(g.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),Vm.render(d.render),y.current&&d.animationState&&d.animationState.animateChanges())})),(0,e.useEffect)((()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,m)})),y.current=!1))})),d}function gw(t){if(t)return!1!==t.options.allowProjection?t.projection:gw(t.parent)}function mw(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):zg(r)&&(r.current=e))}),[n])}function yw(t){return Eh(t.animate)||Ch.some((e=>Ah(t[e])))}function ww(t){return Boolean(yw(t)||t.variants)}function bw(t){const{initial:n,animate:r}=function(t,e){if(yw(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Ah(e)?e:void 0,animate:Ah(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,e.useContext)(lw));return(0,e.useMemo)((()=>({initial:n,animate:r})),[vw(n),vw(r)])}function vw(t){return Array.isArray(t)?t.join(" "):t}const Ew={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"]},_w={};for(const t in Ew)_w[t]={isEnabled:e=>Ew[t].some((t=>!!e[t]))};const Sw=Symbol.for("motionComponentSymbol");function Aw({preloadedFeatures:t,createVisualElement:n,useRender:r,useVisualState:o,Component:i}){t&&function(t){for(const e in t)_w[e]={..._w[e],...t[e]}}(t);const s=(0,e.forwardRef)((function(t,s){let a;const c={...(0,e.useContext)(uw),...t,layoutId:Tw(t)},{isStatic:u}=c,l=bw(t),h=o(t,u);if(!u&&hw){!function(t,n){(0,e.useContext)(dw).strict;0}();const t=function(t){const{drag:e,layout:n}=_w;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,l.visualElement=pw(i,h,c,n,t.ProjectionNode)}return(0,Im.jsxs)(lw.Provider,{value:l,children:[a&&l.visualElement?(0,Im.jsx)(a,{visualElement:l.visualElement,...c}):null,r(i,t,mw(h,l.visualElement,s),h,u,l.visualElement)]})}));return s[Sw]=i,s}function Tw({layoutId:t}){const n=(0,e.useContext)(Bm).id;return n&&void 0!==t?n+"-"+t:t}const xw=["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 kw(t){return"string"==typeof t&&!t.includes("-")&&!!(xw.indexOf(t)>-1||/[A-Z]/u.test(t))}function Rw(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}const Cw=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 Pw(t,e,n,r){Rw(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Cw.has(n)?n:eg(n),e.attrs[n])}function Iw(t,{layout:e,layoutId:n}){return Ih.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Mm[t]||"opacity"===t)}function Ow(t,e,n){var r;const{style:o}=t,i={};for(const s in o)(og(o[s])||e.style&&og(e.style[s])||Iw(s,t)||void 0!==(null===(r=null==n?void 0:n.getValue(s))||void 0===r?void 0:r.liveStyle))&&(i[s]=o[s]);return i}function Bw(t,e,n){const r=Ow(t,e,n);for(const n in t)if(og(t[n])||og(e[n])){r[-1!==Ph.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const Uw=t=>(n,r)=>{const o=(0,e.useContext)(lw),i=(0,e.useContext)(Om),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,o,i){const s={latestValues:Lw(r,o,i,t),renderState:e()};return n&&(s.mount=t=>n(r,t,s)),s}(t,n,o,i);return r?s():function(t){const n=(0,e.useRef)(null);return null===n.current&&(n.current=t()),n.current}(s)};function Lw(t,e,n,r){const o={},i=r(t,{});for(const t in i)o[t]=yy(i[t]);let{initial:s,animate:a}=t;const c=yw(t),u=ww(t);e&&u&&!c&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let l=!!n&&!1===n.initial;l=l||!1===s;const h=l?a:s;if(h&&"boolean"!=typeof h&&!Eh(h)){const e=Array.isArray(h)?h:[h];for(let n=0;n<e.length;n++){const r=xh(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[l?e.length-1:0]}null!==e&&(o[t]=e)}for(const e in t)o[e]=t[e]}}}return o}const Nw=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Dw=()=>({...Nw(),attrs:{}}),jw=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Mw={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Vw=Ph.length;function Fw(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let s=!1,a=!1;for(const t in e){const n=e[t];if(Ih.has(t))s=!0;else if(mf(t))o[t]=n;else{const e=jw(n,Ad[t]);t.startsWith("origin")?(a=!0,i[t]=e):r[t]=e}}if(e.transform||(s||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<Vw;i++){const s=Ph[i],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=jw(a,Ad[s]);c||(o=!1,r+=`${Mw[s]||s}(${t}) `),n&&(e[s]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function $w(t,e,n){return"string"==typeof t?t:Cf.transform(e+n*t)}const Kw={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ww={offset:"strokeDashoffset",array:"strokeDasharray"};function zw(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:s,pathSpacing:a=1,pathOffset:c=0,...u},l,h){if(Fw(t,u,h),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:f,style:d,dimensions:p}=t;f.transform&&(p&&(d.transform=f.transform),delete f.transform),p&&(void 0!==o||void 0!==i||d.transform)&&(d.transformOrigin=function(t,e,n){return`${$w(e,t.x,t.width)} ${$w(n,t.y,t.height)}`}(p,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(f.x=e),void 0!==n&&(f.y=n),void 0!==r&&(f.scale=r),void 0!==s&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Kw:Ww;t[i.offset]=Cf.transform(-r);const s=Cf.transform(e),a=Cf.transform(n);t[i.array]=`${s} ${a}`}(f,s,a,c,!1)}const Hw=t=>"string"==typeof t&&"svg"===t.toLowerCase(),qw={useVisualState:Uw({scrapeMotionValuesFromProps:Bw,createRenderState:Dw,onMount:(t,e,{renderState:n,latestValues:r})=>{qh.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),qh.render((()=>{zw(n,r,Hw(e.tagName),t.transformTemplate),Pw(e,n)}))}})},Zw={useVisualState:Uw({scrapeMotionValuesFromProps:Ow,createRenderState:Nw})};function Gw(t,e,n){for(const r in e)og(e[r])||Iw(r,n)||(t[r]=e[r])}function Xw(t,n){const r={};return Gw(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return(0,e.useMemo)((()=>{const e=Nw();return Fw(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),r}function Yw(t,e){const n={},r=Xw(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 Jw=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 Qw(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Jw.has(t)}let tb=t=>!Qw(t);try{(eb=require("@emotion/is-prop-valid").default)&&(tb=t=>t.startsWith("on")?!Qw(t):eb(t))}catch(Js){}var eb;function nb(t,n,r,o){const i=(0,e.useMemo)((()=>{const e=Dw();return zw(e,n,Hw(o),t.transformTemplate),{...e.attrs,style:{...e.style}}}),[n]);if(t.style){const e={};Gw(e,t.style,t),i.style={...e,...i.style}}return i}function rb(t=!1){return(n,r,o,{latestValues:i},s)=>{const a=(kw(n)?nb:Yw)(r,i,s,n),c=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(tb(o)||!0===n&&Qw(o)||!e&&!Qw(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(r,"string"==typeof n,t),u=n!==e.Fragment?{...c,...a,ref:o}:{},{children:l}=r,h=(0,e.useMemo)((()=>og(l)?l.get():l),[l]);return(0,e.createElement)(n,{...u,children:h})}}function ob(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Aw({...kw(n)?qw:Zw,preloadedFeatures:t,useRender:rb(r),createVisualElement:e,Component:n})}}const ib={current:null},sb={current:!1};const ab=new WeakMap,cb=[...Ff,od,md],ub=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class lb{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Zf,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=Bd.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,qh.render(this.render,!1,!0))};const{latestValues:a,renderState:c}=i;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(o),this.isControllingVariants=yw(e),this.isVariantNode=ww(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==a[t]&&og(e)&&e.set(a[t],!1)}}mount(t){this.current=t,ab.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))),sb.current||function(){if(sb.current=!0,hw)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ib.current=t.matches;t.addListener(e),e()}else ib.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||ib.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){ab.delete(this.current),this.projection&&this.projection.unmount(),Zh(this.notifyUpdate),Zh(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=Ih.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&qh.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),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 _w){const e=_w[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):cm()}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<ub.length;e++){const n=ub[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 o=e[r],i=n[r];if(og(o))t.addValue(r,o);else if(og(i))t.addValue(r,Qp(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,Qp(void 0!==e?e:o,{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=Qp(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&&(pf(r)||hf(r))?r=parseFloat(r):!(t=>cb.find(Vf(t)))(r)&&md.test(e)&&(r=kd(t,e)),this.setBaseTarget(t,og(r)?r.get():r)),og(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 o=xh(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||og(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new Xp),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class hb extends lb{constructor(){super(...arguments),this.KeyframeResolver=Cd}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;og(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class fb extends hb{constructor(){super(...arguments),this.type="html",this.renderInstance=Rw}readValueFromInstance(t,e){if(Ih.has(e)){const t=xd(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(mf(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Tm(t,e)}build(t,e,n){Fw(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Ow(t,e,n)}}class db extends hb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=cm}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Ih.has(e)){const t=xd(e);return t&&t.default||0}return e=Cw.has(e)?e:eg(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return Bw(t,e,n)}build(t,e,n){zw(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Pw(t,e,0,r)}mount(t){this.isSVGTag=Hw(t.tagName),super.mount(t)}}const pb=vh(ob({...Eg,...aw,...Jy,...cw},((t,n)=>kw(t)?new db(n):new fb(n,{allowProjection:t!==e.Fragment}))));function gb(t){let{onComplete:r}=t;const[o,i]=(0,e.useState)(""),[s,a]=(0,e.useState)(null),[c,u]=(0,e.useState)({length:!1,capital:!1,number:!1,symbol:!1});(0,e.useEffect)((()=>{u({length:o.length>=8,capital:/[A-Z]/.test(o),number:/[0-9]/.test(o),symbol:/[!@#$%^&*(),.?":{}|<>]/.test(o)})}),[o]);const l=Object.values(c).every((t=>t));return n().createElement(pb.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(pb.div,{initial:{opacity:0},animate:{opacity:1},className:"w-full max-w-md space-y-4"},n().createElement("input",{type:"password",value:o,onChange:t=>i(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()=>{l&&r({method:"pin",value:o})},disabled:!l,className:"w-full py-3 px-4 rounded-lg font-semibold ".concat(l?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Set PIN")):n().createElement(pb.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(pb.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(pb.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 mb=[{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 yb(t){let{onComplete:r}=t;const[o,i]=(0,e.useState)(mb),[s,a]=(0,e.useState)(!1),[c,u]=(0,e.useState)(0);(0,e.useEffect)((()=>{if(s){const t=setInterval((()=>{u((e=>e>=100?(clearInterval(t),a(!1),r(),100):e+2))}),100);return()=>clearInterval(t)}}),[s,r]);return s?n().createElement(pb.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(pb.div,{className:"overflow-hidden h-2 mb-4 text-xs flex rounded bg-blue-200"},n().createElement(pb.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(pb.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"},o.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&&i(o.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(o.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:!o.some((t=>t.connected)),className:"w-full max-w-md py-3 px-4 rounded-lg font-semibold ".concat(o.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"))}(0,e.createContext)(null);function wb(t){let{onSignUpSuccess:r,setOthent:o,setHashedOthentSub:i,setEncryptedPin:s}=t;const[a,c]=(0,e.useState)({email:"",username:"",password:"",confirmPassword:""}),[u,l]=(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"},u&&n().createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},u),n().createElement(mh,{onLoginSuccess:r,setOthent:o,setHashedOthentSub:i,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)):l(e.message||"Sign up failed")}catch(t){l("Sign up failed. Please try again.")}else l("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 bb(t){let{setOthentConnected:n,dataRequester:r,NoAccount:o,NoModel:i,activeModels:s,avatar:a,setAvatar:c,traits:u,setTraits:l,requestData:h,handleConnectionSelection:f,changeGranted:d,granted:p,allowSubmit:g,rejectDataRequest:m,sendDataRequest:y,isAuthenticated:w,onClose:b,onLoginSuccess:v,setOthentUser:E,setHashedOthentSub:_,setEncryptedPin:S,accountInfo:A}=t;const[T,x]=(0,e.useState)(null),[k,R]=(0,e.useState)(!1),C=(0,e.useRef)(null),[P,I]=(0,e.useState)({}),O=(t,e)=>{console.log(t," is being changed check to:",e),I((n=>({...n,[t]:e}))),d(e?1:-1);const n=h[t];f(r,t,n.index,n.type,n.reward,e),console.log(n," Selection registered"),f(r,t,n.index,n.type,n.reward,!0)},[B,U]=(0,e.useState)((()=>{var t;return w?A&&(null===(t=A.models)||void 0===t?void 0:t.length)>0?"datarequests":"onboarding":"login"})),[L,N]=(0,e.useState)({username:"",password:""}),[D,j]=(0,e.useState)(!1);(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 M=()=>{b()};(0,e.useEffect)((()=>{const t=t=>{C.current&&!C.current.contains(t.target)&&(null==M||M())};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[M]);const V=t=>{N({...L,[t.target.name]:t.target.value})},F=async t=>{t.preventDefault();try{x(null);const t={details:{username:L.username,password:L.password}},e=await fetch("".concat("https://api2.onairos.uk","/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",L.username),await $(L.username)}catch(t){console.error("Login failed:",t),x("Invalid username or password")}},$=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];R(!0);try{await v(t,e);x(null)}catch(t){console.error("Login process failed:",t),x("Failed to complete login process")}finally{R(!1)}},K=()=>{U("security")},W=t=>{"othent"===t.method?E(!0):"pin"===t.method&&S(t.value),U("datarequests")},z=t=>{let{dataRequester:e,granted:n,allowSubmit:r,rejectDataRequest:o,sendDataRequest:i,activeModels:s,requestData:a,handleConnectionSelection:c,changeGranted:u,avatar:l,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:o},"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:i},"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,e)=>{const n=a[t],r="Personality"===n.type?s.includes(n.type):"Avatar"===n.type?l:"Traits"===n.type&&h;return React.createElement(bh,{key:t,active:r,title:n.type,id:n,number:e,descriptions:n.descriptions,rewards:n.reward,size:t,isChecked:!!P[t],onCheckboxChange:e=>O(t,e)})})))))};return(0,e.useEffect)((()=>{var t;w&&A&&((null===(t=A.models)||void 0===t?void 0:t.length)>0?U("datarequests"):U("onboarding"))}),[w,A]),(0,e.useEffect)((()=>()=>{j(!1)}),[]),(0,e.useEffect)((()=>{}),[w,A]),React.createElement(React.Fragment,null,React.createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:M,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(B){case"signup":return React.createElement(wb,{onSignUpSuccess:$,setOthentUser:E,setHashedOthentSub:_,setEncryptedPin:S});case"onboarding":return React.createElement(yb,{onComplete:K});case"security":return React.createElement(gb,{onComplete:W});case"datarequests":return React.createElement(z,{dataRequester:r,granted:p,allowSubmit:g,rejectDataRequest:m,sendDataRequest:y,activeModels:s,requestData:h,handleConnectionSelection:f,changeGranted:d,avatar:a,traits:u});default:return React.createElement("div",{className:"flex flex-col items-center justify-start max-w-sm mx-auto space-y-6 pt-4"},T&&React.createElement("div",{className:"w-full bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg"},T),React.createElement(mh,{onLoginSuccess:$,setOthentUser:E,setHashedOthentSub:_,setEncryptedPin:S}),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:F,className:"w-full space-y-4"},React.createElement("input",{type:"text",name:"username",value:L.username,onChange:V,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:L.password,onChange:V,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:()=>U("signup"),className:"w-full text-center text-blue-500 hover:text-blue-600"},"Don't have an account? Sign up"))}})())))}const vb=async()=>(await a.e(423).then(a.t.bind(a,153,23))).default;function Eb(t){var r,o;let{requestData:i,webpageName:s,inferenceData:a=null,onComplete:c=null,autoFetch:u=!0,proofMode:l=!1,textLayout:h="below",textColor:f="white",login:d=!1,buttonType:p="pill",loginReturn:g=null,loginType:m="signIn",visualType:y="full"}=t;const[w,b]=(0,e.useState)(null),[v,E]=(0,e.useState)(!1),[_,S]=(0,e.useState)([]),[A,T]=(0,e.useState)(0),[x,k]=(0,e.useState)({}),[R,C]=(0,e.useState)(!1),[P,I]=(0,e.useState)(!1),[O,B]=(0,e.useState)(!1),[U,L]=(0,e.useState)(!1),N=(0,e.useRef)(!1),D=(0,e.useRef)(!1),[j,M]=(0,e.useState)(!1),[V,F]=(0,e.useState)(null),[$,K]=(0,e.useState)(!0),[W,z]=(0,e.useState)(null),[H,q]=(0,e.useState)(null),[Z,G]=(0,e.useState)({show:!1,type:null,data:null}),[X,Y]=(0,e.useState)(null),[J,Q]=(0,e.useState)(!1),[tt,et]=(0,e.useState)(!1),nt=(0,e.useRef)(!1),[rt,ot]=(0,e.useState)(null),[it,st]=(0,e.useState)({show:!1,color:null,message:null}),at=useTelegram(),{webApp:ct}=at,ut="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 lt(t.toString()),L(!0),window.history.replaceState({},document.title,window.location.pathname)}catch(t){console.error("Auth callback processing failed:",t),ot(t.message)}finally{et(!1)}}})(),(async()=>{au.mount.isAvailable()&&au.onEvent("viewportChanged",(()=>{var t;const e=null===(t=au.initDataUnsafe)||void 0===t?void 0:t.start_param;if(e)try{const t=JSON.parse(decodeURIComponent(e));t&&G({show:!0,type:"callback",data:{code:t,state:"Completing Redirect back"}})}catch(t){console.error("Error processing auth data:",t)}}))})()}),[]);const lt=async t=>{try{const e=new Dr({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 vb())(n.sub).toString();z(r);const o=await Mr(r);q(o.result),F(o.token),await wt(n.email,!0),E(!0),localStorage.setItem("othentToken",JSON.stringify(n)),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 ht=()=>{const t=navigator.userAgent||navigator.vendor||window.opera;return/android|iphone|ipad|ipod|windows phone/i.test(t)};(0,e.useEffect)((()=>{if(u&&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,o=(t=>{const e={Small:16,Medium:32,Large:64};let n=null,r=0;return t.forEach((t=>{const o=e[t.data];o>r&&(r=o,n=t)})),r})(n),i={Input:a.slice(0,o)};try{const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(i)}),n=await t.json();c(n)}catch(t){console.error(t),c(null,t)}}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}}),[]);const ft=async(t,e,n)=>{const r={Info:{EncryptedUserPin:e,confirmations:t,web3Type:"othent",Domain:window.location.href,proofMode:!1,OthentSub:n}};try{const t=await fetch("https://api2.onairos.uk/getAPIurl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await t.json();u&&c?c(n):G({show:!0,type:"apiURL",data:{code:n,state:e}})}catch(t){console.error(t),c&&c(null,t)}},dt=window.location.href,pt=async()=>{try{if(ht())return void await(async()=>{ht()&&E(!0)})();const t=new Dr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),e=await t.connect(),n=(await vb())(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 o=r((await Mr(n)).result);jr("\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(o)).then((t=>{window.postMessage({source:"webpage",type:"GET_API_URL",webpageName:s,domain:dt,requestData:i,proofMode:l,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)}},gt="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," ").concat(d?"bg-white border border-gray-300":"bg-transparent","\n ").concat(ht()?"":"OnairosConnect","\n "),mt={flexDirection:"below"===h?"column":"row",backgroundColor:d?"#ffffff":"transparent",color:d?"black":f,border:d?"1px solid #ddd":"1px solid transparent"},yt={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"},wt=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",o=await fetch("".concat(ut).concat(r),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("onairosToken"))},body:JSON.stringify(n)});if(!o.ok)throw new Error("Failed to fetch account info");const i=await o.json();return"No Account Found"===i.AccountInfo?(N.current=!0,Y(null),null):(Y(i.AccountInfo),i.AccountInfo.models?S(i.AccountInfo.models):D.current=!0,i.AccountInfo.avatar&&C(!0),i.AccountInfo.UserTraits&&I(!0),i.AccountInfo.othent&&B(!0),i.AccountInfo)}catch(t){throw console.error("Error fetching account info:",t),t}};(0,e.useEffect)((()=>{ht()&&(async()=>{try{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("token"),n=t||e;if(n){const t=await fetch("https://api2.onairos.uk/verifyToken",{headers:{Authorization:"Bearer ".concat(n)}});if(t.ok)if((await t.json()).valid){F(n),M(!0);const t=localStorage.getItem("username");await wt(t)}else localStorage.removeItem("onairosToken"),localStorage.removeItem("token")}}catch(t){console.error("Token verification failed:",t)}finally{K(!1)}})()}),[]);(0,e.useEffect)((()=>{const t=localStorage.getItem("onairosToken"),e=localStorage.getItem("username");t&&e&&wt(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(ut,"/verifyToken"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})).ok){if(M(!0),e)await wt(e,!1);else if(n){const t=JSON.parse(n);await wt(t.email,!0)}}else localStorage.removeItem("onairosToken"),localStorage.removeItem("username"),localStorage.removeItem("othentToken")}catch(t){console.error("Token verification failed:",t)}})()}),[]),(0,e.useEffect)((()=>{au.mount.isAvailable()&&au.mount()}),[]),n().createElement(n().Fragment,null,n().createElement("div",{className:"flex items-center justify-center"},n().createElement("button",{className:gt,onClick:pt,style:mt},("full"===y||"icon"===y)&&n().createElement("img",{src:d?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:yt,className:"".concat("pill"===p?"w-6 h-6":"w-8 h-8"," object-contain")}),("full"===y||"textOnly"===y)&&n().createElement("span",{className:"".concat(d||"black"===f?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===h?"ml-2":"left"===h?"mr-2":"")},(()=>{switch(m){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})()))),it.show&&n().createElement(Notification,{message:it.message,color:it.color}),Z.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"===Z.type?"Callback Details":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"debug"===Z.type?"Debug Results":"Authentication Result"),n().createElement("h3",{className:"text-lg font-semibold mb-4"},"apiURL"===Z.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(Z.data,null,2))),"auth"===Z.type&&n().createElement("div",{className:"mt-4 p-3 rounded ".concat(null!==(r=Z.data)&&void 0!==r&&r.success?"bg-green-100 text-green-700":"bg-red-100 text-red-700")},null!==(o=Z.data)&&void 0!==o&&o.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..."))),v&&!J&&n().createElement(bb,{setOthentConnected:L,dataRequester:s,NoAccount:N,NoModel:D,accountInfo:X,activeModels:_,avatar:R,traits:P,requestData:i,handleConnectionSelection:(t,e,n,r,o,i)=>{k((s=>({...s,["".concat(t,"-").concat(e,"-").concat(n)]:{type:r,reward:o,isSelected:i}})))},changeGranted:t=>{T((e=>Math.max(e+t,0)))},granted:A,allowSubmit:A>0,rejectDataRequest:()=>{E(!1),c&&c("rejected")},sendDataRequest:async()=>{if(!(A<=0))try{const t=Object.values(x).filter((t=>t.isSelected)).map((t=>({type:t.type,reward:t.reward})));if(null==H&&O&&!U){G({show:!0,type:"debug",data:{code:"Connecting Othent Details",state1:H,state2:U,state3:O}});const e=new Dr({appInfo:{name:"Onairos",version:"1.0.0",env:"production"},throwErrors:!1}),n=await e.connect(),r=(await vb())(n.sub).toString();z(r);const o=await Mr(r),i=o.result;q(i),L(!0),G({show:!0,type:"callback",data:{code:"Just Before API",state:o.token}}),await ft(t,i,r)}else H&&W?await ft(t,H,W):console.error("Missing required authentication data")}catch(t){console.error("Error in sendDataRequest:",t)}finally{E(!1)}},isAuthenticated:j,onLoginSuccess:async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const n=await wt(t,e);return M(!0),E(!0),n}catch(t){throw console.error("Login process failed:",t),t}},onClose:()=>{T(0),E(!1)},setOthentUser:B,setHashedOthentSub:z,setEncryptedPin:q}))}class _b extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,_b.prototype)}}const Sb="ERR_INVALID_VALUE",Ab="ERR_UNEXPECTED_VALUE",Tb="ERR_UNEXPECTED_TYPE",xb="ERR_PARSE";function kb(t,e){const n={};for(const r in t){const o=t[r];if(!o)continue;let i,s;"function"==typeof o?(i=r,s=o):[i,s]=o;try{const t=s(e(i));void 0!==t&&(n[r]=t)}catch(t){throw new _b(xb,`Parser for "${r}" property failed${i===r?"":`. Source field: "${i}"`}`,t)}}return n}function Rb(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new _b(Sb,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new _b(Ab);return e}function Cb(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new _b(xb,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function Pb(t,e){return Cb(e||"object",(e=>{const n=Rb(e);return kb(t,(t=>n[t]))}))}function Ib(t){throw new _b(Tb,`Unexpected value received: ${JSON.stringify(t)}`)}Cb("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void Ib(t)}));const Ob=Cb("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();Ib(t)})),Bb=Cb("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}Ib(t)}));Cb("date",(t=>t instanceof Date?t:new Date(1e3*Bb()(t))));function Ub(t){return/^#[\da-f]{6}$/i.test(t)}function Lb(t){const e=t.replace(/\s/g,"").toLowerCase();if(Ub(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}const Nb=Cb("rgb",(t=>Lb(Ob()(t)))),Db=Cb("themeParams",(t=>{const e=Nb(!0);return Object.entries(Rb(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));class jb extends Error{constructor(t,e,n){super("object"==typeof e?e.message:e||t,{cause:"object"==typeof e?e.cause:n}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,jb.prototype)}}function Mb(t){return t.replace(/[A-Z]/g,(t=>`_${t.toLowerCase()}`))}const Vb="ERR_INVALID_VALUE",Fb="ERR_UNEXPECTED_VALUE",$b="ERR_UNEXPECTED_TYPE",Kb="ERR_PARSE";function Wb(t,e){const n={};for(const r in t){const o=t[r];if(!o)continue;let i,s;"function"==typeof o?(i=r,s=o):[i,s]=o;try{const t=s(e(i));void 0!==t&&(n[r]=t)}catch(t){throw new jb(Kb,`Parser for "${r}" property failed${i===r?"":`. Source field: "${i}"`}`,t)}}return n}function zb(t){let e=t;if("string"==typeof e)try{e=JSON.parse(e)}catch(t){throw new jb(Vb,{cause:t})}if("object"!=typeof e||!e||Array.isArray(e))throw new jb(Fb);return e}function Hb(t,e){return n=>{const r=r=>{if(!n||void 0!==r)try{return e(r)}catch(e){throw new jb(Kb,{message:`"${t}" transformer failed to parse the value`,cause:e})}};return Object.assign(r,{isValid(t){try{return r(t),!0}catch{return!1}}})}}function qb(t,e){return Hb(e||"object",(e=>{const n=zb(e);return Wb(t,(t=>n[t]))}))}function Zb(t){throw new jb($b,`Unexpected value received: ${JSON.stringify(t)}`)}const Gb=Hb("boolean",(t=>{if("boolean"==typeof t)return t;const e=String(t);return"1"===e||"true"===e||"0"!==e&&"false"!==e&&void Zb(t)})),Xb=Hb("string",(t=>{if("string"==typeof t||"number"==typeof t)return t.toString();Zb(t)})),Yb=Hb("number",(t=>{if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);if(!Number.isNaN(e))return e}Zb(t)})),Jb=Hb("date",(t=>t instanceof Date?t:new Date(1e3*Yb()(t))));function Qb(t,e){return Hb(e||"searchParams",(e=>{"string"!=typeof e&&!(e instanceof URLSearchParams)&&Zb(e);const n="string"==typeof e?new URLSearchParams(e):e;return Wb(t,(t=>{const e=n.get(t);return null===e?void 0:e}))}))}function tv(t){for(const e in t)t[e]=[Mb(e),t[e]];return t}const ev=t=>{const e=Yb(),n=Yb(!0),r=Xb(),o=Xb(!0),i=Gb(!0),s=qb(tv({addedToAttachmentMenu:i,allowsWriteToPm:i,firstName:r,id:e,isBot:i,isPremium:i,languageCode:o,lastName:o,photoUrl:o,username:o}),"User")(!0);return Qb(tv({authDate:Jb(),canSendAfter:n,chat:qb(tv({id:e,type:r,title:r,photoUrl:o,username:o}),"Chat")(!0),chatInstance:o,chatType:o,hash:r,queryId:o,receiver:s,startParam:o,signature:r,user:s}),"initData")(t)};const nv=Hb("rgb",(t=>function(t){const e=t.replace(/\s/g,"").toLowerCase();if(function(t){return/^#[\da-f]{6}$/i.test(t)}(e))return e;if(function(t){return/^#[\da-f]{3}$/i.test(t)}(e)){let t="#";for(let n=0;n<3;n+=1)t+=e[1+n].repeat(2);return t}const n=e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${t}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((t,e)=>{const n=parseInt(e,10).toString(16);return t+(1===n.length?"0":"")+n}),"#")}(Xb()(t)))),rv=Hb("themeParams",(t=>{const e=nv(!0);return Object.entries(zb(t)).reduce(((t,[n,r])=>(t[function(t){return t.replace(/_[a-z]/g,(t=>t[1].toUpperCase()))}(n)]=e(r),t)),{})}));function ov(t){return JSON.stringify(Object.fromEntries(Object.entries(t).map((([t,e])=>[Mb(t),e]))))}const iv=t=>{const e=Xb(),n=Xb(!0),r=Gb(!0);return Qb({botInline:["tgWebAppBotInline",r],defaultColors:["tgWebAppDefaultColors",rv(!0)],fullscreen:["tgWebAppFullscreen",r],initData:["tgWebAppData",ev(!0)],initDataRaw:["tgWebAppData",n],platform:["tgWebAppPlatform",e],showSettings:["tgWebAppShowSettings",r],startParam:["tgWebAppStartParam",n],themeParams:["tgWebAppThemeParams",rv()],version:["tgWebAppVersion",e]},"launchParams")(t)};function sv(t){const{initDataRaw:e,startParam:n,showSettings:r,botInline:o,fullscreen:i,defaultColors:s}=t,a=new URLSearchParams;return a.set("tgWebAppPlatform",t.platform),a.set("tgWebAppThemeParams",ov(t.themeParams)),a.set("tgWebAppVersion",t.version),e&&a.set("tgWebAppData",e),n&&a.set("tgWebAppStartParam",n),"boolean"==typeof r&&a.set("tgWebAppShowSettings",r?"1":"0"),"boolean"==typeof o&&a.set("tgWebAppBotInline",o?"1":"0"),"boolean"==typeof i&&a.set("tgWebAppFullscreen",i?"1":"0"),s&&a.set("tgWebAppDefaultColors",ov(s)),a.toString()}const av=qb({eventType:Xb(),eventData:t=>t},"miniAppsMessage"),cv=Hb("fn",(t=>{if("function"==typeof t)return t;Zb(t)}));const uv=qb({TelegramWebviewProxy:qb({postEvent:cv()})()});function lv(t){return uv().isValid(t)}var hv=Object.defineProperty,fv=(t,e,n)=>((t,e,n)=>e in t?hv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);let dv=class t extends Error{constructor(e,n,r){super("object"==typeof n?n.message:n||e,{cause:"object"==typeof n?n.cause:r}),this.type=e,this.name="TypedError",Object.setPrototypeOf(this,t.prototype)}};function pv(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function gv(...t){const e=t.flat(1);return[e.push.bind(e),()=>{e.forEach((t=>{t()}))}]}function mv(t){return e=>function(t,e){return t instanceof dv&&t.type===e}(e,t)}const yv="ERR_ABORTED",wv="ERR_CANCELED",bv="ERR_TIMED_OUT";function vv(t){return new dv(yv,{cause:t})}mv(bv),mv(yv),mv(wv);function Ev(t,e){return t.reject=e.reject,t}class _v extends Promise{constructor(t,e){let n,r,o,i;"function"==typeof t?(n=t,r=e):r=t,super(((t,e)=>{r||(r={});const{abortSignal:s}=r;if(s&&s.aborted)return e(vv(s.reason));const[a,c]=gv(),u=t=>(...e)=>(c(),t(...e)),l=new AbortController,{signal:h}=l;i=u((t=>{l.abort(t),e(t)})),o=u(t),s&&a(pv(s,"abort",(()=>{i(vv(s.reason))})));const{timeout:f}=r;if(f){const t=setTimeout((()=>{i(new dv(bv,`Timeout reached: ${f}ms`))}),f);a((()=>{clearTimeout(t)}))}n&&n(o,i,h)})),fv(this,"reject"),this.reject=i}static withFn(t,e){return new _v(((e,n,r)=>{try{const o=t(r);return o instanceof Promise?o.then(e,n):e(o)}catch(t){n(t)}}),e)}static resolve(t){return new _v((e=>{e(t)}))}static reject(t){return new _v(((e,n)=>{n(t)}))}cancel(){this.reject(new dv(wv))}catch(t){return this.then(void 0,t)}finally(t){return Ev(super.finally(t),this)}then(t,e){return Ev(super.then(t,e),this)}}function Sv(t,e){return t.resolve=e.resolve,t}let Av=class t extends _v{constructor(t,e){let n,r,o;"function"==typeof t?(n=t,r=e):r=t,super(((t,e,r)=>{o=t,n&&n(t,e,r)}),r),fv(this,"resolve"),this.resolve=o}static withFn(e,n){return new t(((t,n,r)=>_v.withFn(e,{abortSignal:r}).then(t,n)),n)}static resolve(e){return new t((t=>{t(e)}))}static reject(e){return new t(((t,n)=>{n(e)}))}catch(t){return this.then(void 0,t)}finally(t){return Sv(super.finally(t),this)}then(t,e){return Sv(super.then(t,e),this)}};function Tv(t){return`tapps/${t}`}function xv(t,e){sessionStorage.setItem(Tv(t),JSON.stringify(e))}function kv(t){const e=sessionStorage.getItem(Tv(t));try{return e?JSON.parse(e):void 0}catch{}}function Rv(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}function Cv(t,e){e||(e={});const{textColor:n,bgColor:r,shouldLog:o=!0}=e;function i(e,...i){if(!o||"function"==typeof o&&!o())return;const s="font-weight:bold;padding:0 5px;border-radius:5px";console[e](`%c${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c / %c${t}`,`${s};background-color: lightblue;color:black`,"",`${s};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...i)}return[function(...t){i("log",...t)},function(...t){i("error",...t)}]}function Pv(t,e){document.documentElement.style.setProperty(t,e)}function Iv(t){document.documentElement.style.removeProperty(t)}function Ov(t,e){e||(e={});const n=e.equals||Object.is;let r=[],o=t;const i=t=>{if(!n(o,t)){const e=o;o=t,function(t,e){e()}(0,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),o=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));o>=0&&r.splice(o,1)},c=Object.assign((function(){return function(t){Bv.length&&Bv[Bv.length-1].add(t)}(c),o}),{destroy(){r=[]},set:i,reset(){i(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const Bv=[];const Uv=Ov(!1),[Lv,Nv]=Cv("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:Uv}),Dv={clipboard_text_received:qb({req_id:Xb(),data:t=>null===t?t:Xb(!0)(t)},"clipboard_text_received"),custom_method_invoked:qb({req_id:Xb(),result:t=>t,error:Xb(!0)},"custom_method_invoked"),popup_closed:Hb("popup_closed",(t=>t?qb({button_id:t=>null==t?void 0:Xb()(t)})()(t):{})),viewport_changed:qb({height:Yb(),width:t=>null==t?window.innerWidth:Yb()(t),is_state_stable:Gb(),is_expanded:Gb()},"viewport_changed")};const jv=Ov(),Mv=Ov();function Vv(){return Mv()||Mv.set(function(t){const e=window,[,n]=gv(pv(e,"message",(n=>{if(n.source!==e.parent)return;let r;try{r=av()(n.data)}catch{return}const{eventType:o,eventData:i}=r,s=Dv[o];try{const e=s?s()(i):i;Lv("Event received:",e?{eventType:o,eventData:e}:{eventType:o}),t([o,e])}catch(t){Nv([`An error occurred processing the "${o}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/telegram-apps/issues/new/choose"].join("\n"),r,t)}})));return n}(jv.set)),jv}const Fv=Ov({});function $v(t){let e=Fv()[t];return e||(e=Ov(void 0,{equals:()=>!1}),Vv().sub((n=>{n&&n[0]===t&&e.set(n[1])})),Fv.set({...Fv(),[t]:e})),e}function Kv(t,e,n){return $v(t).sub(e,n)}const Wv="ERR_METHOD_UNSUPPORTED",zv="ERR_RETRIEVE_LP_FAILED",Hv="ERR_METHOD_PARAMETER_UNSUPPORTED",qv="ERR_UNKNOWN_ENV",Zv="ERR_INVOKE_CUSTOM_METHOD_RESPONSE",Gv=Ov("https://web.telegram.org");function Xv(t,e){Lv("Posting event:",e?{eventType:t,eventData:e}:{eventType:t});const n=window;if(lv(n))return void n.TelegramWebviewProxy.postEvent(t,JSON.stringify(e));const r=JSON.stringify({eventType:t,eventData:e});if(function(){try{return window.self!==window.top}catch{return!0}}())return n.parent.postMessage(r,Gv());const{external:o}=n;if(!qb({notify:cv()})().isValid(o))throw new dv(qv);o.notify(r)}function Yv(t,e,n){n||(n={});const{capture:r}=n,[o,i]=gv();return new _v((i=>{(Array.isArray(e)?e:[e]).forEach((t=>{o(Kv(t,(n=>{(!r||(Array.isArray(e)?r({event:t,payload:n}):r(n)))&&i(n)})))})),(n.postEvent||Xv)(t,n.params)}),n).finally(i)}function Jv(t){return iv()(t)}function Qv(t){return Jv(t.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&"))}function tE(){return Qv(window.location.href)}function eE(){const t=performance.getEntriesByType("navigation")[0];if(!t)throw new Error("Unable to get first navigation entry.");return Qv(t.name)}const nE="launchParams";function rE(){return Jv(kv(nE)||"")}function oE(t){xv("launchParams",sv(t))}function iE(t){return t instanceof Error?t.message+(t.cause?`\n ${iE(t.cause)}`:""):JSON.stringify(t)}function sE(){const t=[];for(const e of[tE,eE,rE])try{const t=e();return oE(t),t}catch(e){t.push(e)}throw new dv(zv,["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/telegram-apps-bridge/environment","Collected errors:",...t.map((t=>`— ${iE(t)}`))].join("\n"))}function aE(t){if("simple"===t)try{return sE(),!0}catch{return!1}return _v.withFn((async()=>{if(lv(window))return!0;try{return await Yv("web_app_request_theme","theme_changed",{timeout:100}),!0}catch{return!1}}),t)}function cE(t,e){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:t,eventData:e}),source:window.parent}))}function uE(){["TelegramGameProxy_receiveEvent","TelegramGameProxy","Telegram"].forEach((t=>{delete window[t]}))}function lE(t,e,n){$v(t).unsub(e,n)}function hE(t){return({req_id:e})=>e===t}function fE(t){return t.split(".").map(Number)}function dE(t,e){return function(t,e){const n=fE(t),r=fE(e),o=Math.max(n.length,r.length);for(let t=0;t<o;t+=1){const e=n[t]||0,o=r[t]||0;if(e!==o)return e>o?1:-1}return 0}(t,e)<=0}function pE(t,e,n){if("string"==typeof n){if("web_app_open_link"===t){if("try_instant_view"===e)return dE("6.4",n);if("try_browser"===e)return dE("7.6",n)}if("web_app_set_header_color"===t&&"color"===e)return dE("6.9",n);if("web_app_close"===t&&"return_back"===e)return dE("7.6",n);if("web_app_setup_main_button"===t&&"has_shine_effect"===e)return dE("7.10",n)}switch(t){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return dE("6.1",e);case"web_app_open_popup":return dE("6.2",e);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return dE("6.4",e);case"web_app_switch_inline_query":return dE("6.7",e);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return dE("6.9",e);case"web_app_setup_settings_button":return dE("6.10",e);case"web_app_biometry_get_info":case"web_app_biometry_open_settings":case"web_app_biometry_request_access":case"web_app_biometry_request_auth":case"web_app_biometry_update_token":return dE("7.2",e);case"web_app_setup_swipe_behavior":return dE("7.7",e);case"web_app_share_to_story":return dE("7.8",e);case"web_app_setup_secondary_button":case"web_app_set_bottom_bar_color":return dE("7.10",e);case"web_app_request_safe_area":case"web_app_request_content_safe_area":case"web_app_request_fullscreen":case"web_app_exit_fullscreen":case"web_app_set_emoji_status":case"web_app_add_to_home_screen":case"web_app_check_home_screen":case"web_app_request_emoji_status_access":return dE("8.0",e);default:return["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"].includes(t)}}function gE(t,e){e||(e="strict");const n="function"==typeof e?e:t=>{const{method:n,version:r}=t;let o,i;if("param"in t?(o=`Parameter "${t.param}" of "${n}" method is unsupported in Mini Apps version ${r}`,i=Hv):(o=`Method "${n}" is unsupported in Mini Apps version ${r}`,i=Wv),"strict"===e)throw new dv(i,o);return console.warn(o)};return(e,r)=>pE(e,t)?function(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}(r)&&"web_app_set_header_color"===e&&"color"in r&&!pE(e,"color",t)?n({version:t,method:e,param:"color"}):Xv(e,r):n({version:t,method:e})}function mE(){const t=performance.getEntriesByType("navigation")[0];return!!t&&"reload"===t.type}let yE;function wE(t){if(yE)return t();yE=new Map;try{t()}finally{yE.forEach((t=>t())),yE=void 0}}function bE(t,e){e||(e={});const n=e.equals||Object.is;let r=[],o=t;const i=t=>{if(!n(o,t)){const e=o;o=t,function(t,e){yE&&yE.set(t,e)||e()}(c,(()=>{[...r].forEach((([n,r])=>{n(t,e),r&&a(n,!0)}))}))}};function s(t){const e="object"!=typeof t?{once:t}:t;return{once:e.once||!1,signal:e.signal||!1}}const a=(t,e)=>{const n=s(e),o=r.findIndex((([e,r])=>e===t&&r.once===n.once&&r.signal===n.signal));o>=0&&r.splice(o,1)},c=Object.assign((function(){return function(t){vE.length&&vE[vE.length-1].add(t)}(c),o}),{destroy(){r=[]},set:i,reset(){i(t)},sub:(t,e)=>(r.push([t,s(e)]),()=>a(t,e)),unsub:a,unsubAll(){r=r.filter((t=>t[1].signal))}});return c}const vE=[];function EE(t,e){let n,r=new Set;function o(){return n||(n=bE(s(),e))}function i(){o().set(s())}function s(){r.forEach((t=>{t.unsub(i,{signal:!0})}));const e=new Set;let n;vE.push(e);try{n=t()}finally{vE.pop()}return e.forEach((t=>{t.sub(i,{signal:!0})})),r=e,n}return Object.assign((function(){return o()()}),{destroy(){o().destroy()},sub:(...t)=>o().sub(...t),unsub(...t){o().unsub(...t)},unsubAll(...t){o().unsubAll(...t)}})}const _E=bE((()=>{let t=0;return()=>(t+=1).toString()})()),SE=bE(Xv),AE=bE("0.0");function TE(){return _E()()}function xE(t,e,n){return function(t,e,n,r){return Yv("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:t,params:e,req_id:n},capture:hE(n)}).then((({result:t,error:e})=>{if(e)throw new dv(Zv,e);return t}))}(t,e,TE(),{...n||{},postEvent:RE})}const kE=(t,e,n)=>(n||(n={}),n.postEvent||(n.postEvent=RE),Yv(t,e,n)),RE=(t,e)=>SE()(t,e);function CE(t){return EE((()=>pE(t,AE())))}const PE="ERR_POPUP_INVALID_PARAMS",IE="ERR_INVALID_URL",OE="ERR_ALREADY_REQUESTING",BE="ERR_ALREADY_OPENED",UE="ERR_NOT_INITIALIZED",LE="ERR_NOT_SUPPORTED",NE="ERR_NOT_MOUNTED";function DE(){return typeof window>"u"}function jE(t,e,{isSupported:n,isMounted:r,component:o,supports:i}={}){const s=`${o?`${o}.`:""}${t}()`;function a(t){if(i){const e=i[t];return pE(e[0],e[1],AE())}return!0}n=n?Array.isArray(n)||"object"==typeof n&&"any"in n?n:[n]:void 0;const c=()=>{if(!n)return;const t=`it is unsupported in Mini Apps version ${AE()}`;function e(e){return"string"==typeof e?pE(e,AE())?void 0:t:e.fn()?void 0:e.error}if(Array.isArray(n)){for(const t of n){const n=e(t);if(n)return n}return}let r;for(const t of n.any)if(r=e(t),!r)return;return t},u=EE((()=>!c())),l=EE((()=>"0.0"!==AE())),h=EE((()=>!r||r())),f=EE((()=>aE("simple")&&!DE()&&l()&&u()&&h()));let d;if(i){d={};for(const t in i)d[t]=EE((()=>a(t)))}return Object.assign(((...t)=>{const n=`Unable to call the ${s} ${o?"method":"function"}:`;if(DE()||!aE("simple"))throw new dv(qv,`${n} it can't be called outside Mini Apps`);if(!l())throw new dv(UE,`${n} the SDK was not initialized. Use the SDK init() function`);const r=c();if(r)throw new dv(LE,`${n} ${r}`);const u=((...t)=>{if(i)for(const e in i)if(i[e][2](...t)&&!a(e))return`option ${e} is not supported in Mini Apps version ${AE()}`})(...t);if(u)throw new dv(LE,`${n} ${u}`);if(!h())throw new dv(NE,`${n} the component is not mounted. Use the ${o}.mount() method`);return e(...t)}),e,{isAvailable:f,ifAvailable:(...t)=>f()?e(...t):void 0},n?{isSupported:u}:{},d?{supports:d}:{})}function ME(t,e){return e||(e={}),(n,r,o,i)=>jE(n,r,{...e,isSupported:o||e.isSupported,supports:i,component:t})}function VE(t,e,n){return ME(t,{isSupported:n,isMounted:e})}function FE(t,e){return ME(t,{isSupported:e})}const $E="web_app_setup_back_button",KE="back_button_pressed",WE="backButton",zE=bE(!1),HE=bE(!1),qE=CE($E),ZE=VE(WE,HE,$E),GE=FE(WE,$E),XE=ZE("hide",(()=>{JE(!1)})),YE=GE("mount",(()=>{HE()||(JE(mE()&&kv(WE)||!1),HE.set(!0))}));function JE(t){t!==zE()&&(RE($E,{is_visible:t}),xv(WE,t),zE.set(t))}const QE=GE("onClick",(t=>Kv(KE,t))),t_=GE("offClick",(t=>{lE(KE,t)})),e_=ZE("show",(()=>{JE(!0)}));Symbol.toStringTag;function n_(t,e,n,r,o){const i=void 0===o||o?_v:Promise;return Object.assign(((...o)=>i.resolve().then((async()=>{if(n()){const t=e();throw r.set(t),t}let s;wE((()=>{n.set(i.resolve(t(...o))),r.set(void 0)}));try{s=[!0,await n()]}catch(t){s=[!1,t]}if(wE((()=>{n.set(void 0),r.set(s[0]?void 0:s[1])})),!s[0])throw s[1];return s[1]}))),t)}function r_(t,e,n,r,o,i){const s=n_(e,(()=>new dv("ERR_ALREADY_MOUNTING",`The ${t} component is already mounting`)),o,i);return t=>_v.resolve().then((async()=>{if(!r()){const e=await s(t);wE((()=>{r.set(!0),n(e)}))}}))}const o_=ME,i_=bE({available:!1}),s_=bE(!1),a_=bE(!1),c_=bE(!1),u_=EE((()=>!!h_())),l_=bE(),h_=bE(),f_=EE((()=>{const t=i_();return t&&t.available}));function d_(t){return t.available?{available:!0,tokenSaved:t.token_saved,deviceId:t.device_id,accessRequested:t.access_requested,type:t.type,accessGranted:t.access_granted}:{available:!1}}const p_="web_app_biometry_get_info",g_=jE("requestBiometry",(t=>kE(p_,"biometry_info_received",t).then(d_)),{isSupported:p_}),m_="web_app_biometry_request_auth",y_="biometry_info_received",w_="biometry",b_=CE(m_),v_=o_(w_),E_=FE(w_,m_),__=VE(w_,c_,m_);function S_(){throw new dv("ERR_NOT_AVAILABLE","Biometry is not available")}const A_=__("authenticate",(t=>_v.withFn((async e=>{if(s_())throw new dv(OE,"Authentication is already in progress");const n=i_();(!n||!n.available)&&S_(),s_.set(!0);try{const r=await kE(m_,"biometry_auth_requested",{abortSignal:e,params:{reason:((t||{}).reason||"").trim()}}),{token:o}=r;return"string"==typeof o&&C_({...n,token:o}),r}finally{s_.set(!1)}}),t))),T_=E_("openSettings",(()=>{RE("web_app_biometry_open_settings")})),x_=__("requestAccess",(t=>_v.withFn((async e=>{if(a_())throw new dv(OE,"Access request is already in progress");a_.set(!0);try{const n=await kE("web_app_biometry_request_access",y_,{abortSignal:e,params:{reason:(t||{}).reason||""}}).then(d_);return n.available||S_(),C_(n),n.accessGranted}finally{a_.set(!1)}}),t))),k_=v_("mount",r_(w_,(t=>mE()&&kv(w_)||g_(t)),(t=>{Kv(y_,R_),C_(t)}),c_,h_,l_)),R_=t=>{C_(d_(t))};function C_(t){i_.set(t),xv(w_,t)}const P_=__("updateToken",(t=>(t||(t={}),kE("web_app_biometry_update_token","biometry_token_updated",{...t,params:{token:t.token||"",reason:t.reason}}).then((t=>t.status)))));Symbol.toStringTag;function I_(t,e){return ME(t,{isMounted:e})}const O_="closingBehavior",B_=bE(!1),U_=bE(!1),L_=I_(O_,U_),N_=o_(O_),D_=L_("disableConfirmation",(()=>{V_(!1)})),j_=L_("enableConfirmation",(()=>{V_(!0)})),M_=N_("mount",(()=>{U_()||(V_(mE()&&kv(O_)||!1),U_.set(!0))}));function V_(t){t!==B_()&&(RE("web_app_setup_closing_behavior",{need_confirmation:t}),xv(O_,t),B_.set(t))}Symbol.toStringTag;const F_="web_app_invoke_custom_method",$_=FE("cloudStorage",F_),K_=CE(F_),W_=$_("deleteItem",((t,e)=>{const n=Array.isArray(t)?t:[t];return n.length?xE("deleteStorageValues",{keys:n},e).then():_v.resolve()}));const z_=$_("getItem",(function(t,e){const n=Array.isArray(t)?t:[t];return n.length?xE("getStorageValues",{keys:n},e).then((e=>{const r=Pb(Object.fromEntries(n.map((t=>[t,Ob()]))))()(e);return Array.isArray(t)?r:r[t]})):_v.resolve("string"==typeof t?"":{})})),H_=$_("getKeys",(t=>xE("getStorageKeys",{},t).then(function(t,e){return Cb("array",(e=>{let n;if(Array.isArray(e))n=e;else if("string"==typeof e)try{const t=JSON.parse(e);Array.isArray(t)&&(n=t)}catch{}return n||Ib(e),n.map(t)}))}(Ob())()))),q_=$_("setItem",((t,e,n)=>xE("saveStorageValue",{key:t,value:e},n).then())),Z_=(Symbol.toStringTag,"web_app_trigger_haptic_feedback"),G_=FE("hapticFeedback",Z_),X_=CE(Z_),Y_=G_("impactOccurred",(t=>{RE(Z_,{type:"impact",impact_style:t})})),J_=G_("notificationOccurred",(t=>{RE(Z_,{type:"notification",notification_type:t})})),Q_=G_("selectionChanged",(()=>{RE(Z_,{type:"selection_change"})})),tS=(Symbol.toStringTag,bE(void 0));function eS(t){return EE((()=>{const e=tS();return e?e[t]:void 0}))}const nS=eS("authDate"),rS=eS("canSendAfter"),oS=EE((()=>{const t=nS(),e=rS();return e&&t?new Date(t.getTime()+1e3*e):void 0})),iS=eS("chat"),sS=eS("chatType"),aS=eS("chatInstance"),cS=eS("hash"),uS=eS("queryId"),lS=bE(),hS=eS("receiver");const fS=eS("startParam"),dS=eS("user");Symbol.toStringTag;const pS="web_app_open_invoice",gS=FE("invoice",pS),mS=bE(!1),yS=CE(pS);async function wS(t,e,n){if(mS())throw new dv(BE,"An invoice is already opened");let r;if("url"===e){const{hostname:e,pathname:n}=new URL(t,window.location.href);if("t.me"!==e)throw new dv(IE,`Link has unexpected hostname: ${e}`);const o=n.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);if(!o)throw new dv("ERR_INVALID_SLUG",'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"');[,,r]=o}else r=t,n=e;return mS.set(!0),kE(pS,"invoice_closed",{...n,params:{slug:r},capture:t=>r===t.slug}).then((t=>t.status)).finally((()=>{mS.set(!1)}))}const bS=gS("open",wS);Symbol.toStringTag;function vS(t){return Object.fromEntries(Object.entries(t).filter((t=>void 0!==t[1])))}function ES(t){const e=Lb(t);return Math.sqrt([.299,.587,.114].reduce(((t,n,r)=>{const o=parseInt(e.slice(1+2*r,1+2*(r+1)),16);return t+o*o*n}),0))<120}const _S=bE(!1),SS=bE(!1),AS=bE({});function TS(t){return EE((()=>AS()[t]))}const xS=TS("accentTextColor"),kS=TS("bgColor"),RS=TS("buttonColor"),CS=TS("buttonTextColor"),PS=TS("bottomBarBgColor"),IS=TS("destructiveTextColor"),OS=TS("headerBgColor"),BS=TS("hintColor"),US=EE((()=>{const{bgColor:t}=AS();return!t||ES(t)})),LS=TS("linkColor"),NS=TS("secondaryBgColor"),DS=TS("sectionBgColor"),jS=TS("sectionHeaderTextColor"),MS=TS("sectionSeparatorColor"),VS=TS("subtitleTextColor"),FS=TS("textColor");function $S(t){return EE((()=>WS()[t]))}const KS=bE({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"}),WS=EE((()=>{const t=KS();return{...t,backgroundColor:t.backgroundColor||RS()||"#2481cc",textColor:t.textColor||CS()||"#ffffff"}})),zS=bE(!1),HS=$S("backgroundColor"),qS=$S("hasShineEffect"),ZS=$S("isEnabled"),GS=$S("isLoaderVisible"),XS=$S("isVisible"),YS=$S("text"),JS=$S("textColor"),QS="main_button_pressed",tA="mainButton",eA=o_(tA),nA=I_(tA,zS),rA=eA("mount",(()=>{if(!zS()){const t=mE()&&kv(tA);t&&KS.set(t),zS.set(!0)}})),oA=eA("onClick",(t=>Kv(QS,t))),iA=eA("offClick",(t=>{lE(QS,t)})),sA=nA("setParams",(t=>{KS.set({...KS(),...vS(t)}),xv(tA,KS());const e=WS();e.text&&RE("web_app_setup_main_button",{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;function aA(){throw new dv("ERR_VARS_ALREADY_BOUND","CSS variables are already bound")}const cA="themeParams",uA="theme_changed",lA=o_(cA),hA=I_(cA,_S)("bindCssVars",(t=>{function e(t){Object.entries(AS()).forEach((([e,n])=>{n&&t(e,n)}))}function n(){e(((e,n)=>{Pv(t(e),n)}))}return SS()&&aA(),t||(t=t=>`--tg-theme-${Rv(t)}`),n(),AS.sub(n),SS.set(!0),()=>{e(Iv),AS.unsub(n),SS.set(!1)}})),fA=lA("mount",(()=>{_S()||(Kv(uA,dA),AS.set(mE()&&kv(cA)||sE().themeParams),_S.set(!0))})),dA=t=>{const e=function(t){return Db()(t)}(t.theme_params);AS.set(e),xv(cA,e)};function pA(t){return EE((()=>{const e=t();return Ub(e)?e:"bg_color"===e?kS():NS()}))}const gA=bE("bg_color"),mA=pA(gA),yA=bE("bottom_bar_bg_color"),wA=EE((()=>{const t=yA();return Ub(t)?t:"bottom_bar_bg_color"===t?PS()||NS():"secondary_bg_color"===t?NS():kS()})),bA=bE("bg_color"),vA=pA(bA),EA=bE(!1),_A=bE(!1),SA=EE((()=>{const t=mA();return!!t&&ES(t)})),AA=bE(!0),TA=EE((()=>({backgroundColor:gA(),bottomBarColor:yA(),headerColor:bA(),isActive:AA()}))),xA="web_app_set_background_color",kA="web_app_set_bottom_bar_color",RA="web_app_set_header_color",CA="visibility_changed",PA="miniApp",IA={any:[xA,kA,RA]},OA=EE((()=>IA.any.some((t=>pE(t,AE()))))),BA=o_(PA),UA=FE(PA,IA),LA=VE(PA,EA,IA),NA=LA("bindCssVars",(t=>{_A()&&aA();const[e,n]=gv();function r(t,n){function r(){Pv(t,n()||null)}r(),e(n.sub(r),Iv.bind(null,t))}return t||(t=t=>`--tg-${Rv(t)}`),r(t("bgColor"),mA),r(t("bottomBarColor"),wA),r(t("headerColor"),vA),e((()=>{_A.set(!1)})),_A.set(!0),n})),DA=BA("close",(t=>{RE("web_app_close",{return_back:t})})),jA=t=>{AA.set(t.is_visible),FA()},MA=UA("mount",(()=>{if(!EA()){const t=mE()&&kv(PA);fA(),$A.ifAvailable(t?t.backgroundColor:"bg_color"),KA.ifAvailable(t?t.bottomBarColor:"bottom_bar_bg_color"),WA.ifAvailable(t?t.headerColor:"bg_color"),AA.set(!t||t.isActive),Kv(CA,jA),EA.set(!0)}})),VA=BA("ready",(()=>{RE("web_app_ready")}));function FA(){xv(PA,TA())}const $A=LA("setBackgroundColor",(t=>{t!==gA()&&(RE(xA,{color:t}),gA.set(t),FA())}),xA),KA=LA("setBottomBarColor",(t=>{t!==yA()&&(RE(kA,{color:t}),yA.set(t),FA())}),kA),WA=LA("setHeaderColor",(t=>{t!==bA()&&(RE(RA,Ub(t)?{color:t}:{color_key:t}),bA.set(t),FA())}),RA,{rgb:[RA,"color",Ub]});Symbol.toStringTag;function zA(t){const e=t.message.trim(),n=(t.title||"").trim(),r=t.buttons||[];if(n.length>64)throw new dv(PE,`Invalid title: ${n}`);if(!e||e.length>256)throw new dv(PE,`Invalid message: ${e}`);if(r.length>3)throw new dv(PE,`Invalid buttons count: ${r.length}`);return{title:n,message:e,buttons:r.length?r.map(((t,e)=>{const n=t.id||"";if(n.length>64)throw new dv(PE,`Button with index ${e} has invalid id: ${n}`);if(!t.type||"default"===t.type||"destructive"===t.type){const r=t.text.trim();if(!r||r.length>64)throw new dv(PE,`Button with index ${e} has invalid text: ${r}`);return{type:t.type,text:r,id:n}}return{type:t.type,id:n}})):[{type:"close",id:""}]}}const HA="web_app_open_popup",qA=FE("popup",HA),ZA=bE(!1),GA=CE(HA),XA=qA("open",(async t=>{if(ZA())throw new dv(BE,"A popup is already opened");ZA.set(!0);try{const{button_id:e=null}=await kE(HA,"popup_closed",{...t,params:zA(t)});return e}finally{ZA.set(!1)}})),YA=(Symbol.toStringTag,"web_app_open_scan_qr_popup"),JA=FE("qrScanner",YA),QA=JA("close",(()=>{tT.set(!1),RE("web_app_close_scan_qr_popup")})),tT=bE(!1),eT=CE(YA);const nT=JA("open",(function(t){return _v.withFn((e=>{if(tT())throw new dv(BE,"The QR Scanner is already opened");tT.set(!0),t||(t={});const{onCaptured:n,text:r,capture:o}=t,[,i]=gv(tT.sub((()=>{s.resolve()})),Kv("scan_qr_popup_closed",(()=>{tT.set(!1)})),Kv("qr_text_received",(t=>{n?n(t.data):(!o||o(t.data))&&(s.resolve(t.data),QA())}))),s=new Av({abortSignal:e}).catch(QA).finally(i);return(t.postEvent||RE)(YA,{text:r}),s}),t)}));Symbol.toStringTag;function rT(t){return EE((()=>iT()[t]))}const oT=bE({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,position:"left",text:"Cancel"}),iT=EE((()=>{const t=oT();return{...t,backgroundColor:t.backgroundColor||wA()||"#000000",textColor:t.textColor||RS()||"#2481cc"}})),sT=bE(!1),aT=rT("backgroundColor"),cT=rT("hasShineEffect"),uT=rT("isEnabled"),lT=rT("isLoaderVisible"),hT=rT("isVisible"),fT=rT("position"),dT=rT("text"),pT=rT("textColor"),gT="web_app_setup_secondary_button",mT="secondary_button_pressed",yT="secondaryButton",wT=FE(yT,gT),bT=VE(yT,sT,gT),vT=CE(gT),ET=wT("mount",(()=>{if(!sT()){const t=mE()&&kv(yT);t&&oT.set(t),sT.set(!0)}})),_T=wT("onClick",(t=>Kv(mT,t))),ST=wT("offClick",(t=>{lE(mT,t)})),AT=bT("setParams",(t=>{oT.set({...oT(),...Object.fromEntries(Object.entries(t).filter((([,t])=>void 0!==t)))}),xv(yT,oT());const e=iT();e.text&&RE(gT,{color:e.backgroundColor,has_shine_effect:e.hasShineEffect,is_active:e.isEnabled,is_progress_visible:e.isLoaderVisible,is_visible:e.isVisible,position:e.position,text:e.text,text_color:e.textColor})}));Symbol.toStringTag;const TT="web_app_setup_settings_button",xT="settings_button_pressed",kT="settingsButton",RT=bE(!1),CT=bE(!1),PT=CE(TT),IT=FE(kT,TT),OT=VE(kT,CT,TT),BT=OT("hide",(()=>{LT(!1)})),UT=IT("mount",(()=>{CT()||(LT(mE()&&kv(kT)||!1),CT.set(!0))}));function LT(t){t!==RT()&&(RE(TT,{is_visible:t}),xv(kT,t),RT.set(t))}const NT=IT("onClick",(t=>Kv(xT,t))),DT=IT("offClick",(t=>{lE(xT,t)})),jT=OT("show",(()=>{LT(!0)}));Symbol.toStringTag;const MT="web_app_setup_swipe_behavior",VT="swipeBehavior",FT=bE(!1),$T=CE(MT),KT=bE(!0),WT=FE(VT,MT),zT=VE(VT,FT,MT),HT=zT("disableVertical",(()=>{GT(!1)})),qT=zT("enableVertical",(()=>{GT(!0)})),ZT=WT("mount",(()=>{FT()||(GT(mE()&&kv(VT)||!1,!0),FT.set(!0))}));function GT(t,e){(t!==KT()||e)&&(RE(MT,{allow_vertical_swipe:t}),xv(VT,t),KT.set(t))}Symbol.toStringTag,Symbol.toStringTag;const XT="viewport",YT="web_app_request_fullscreen",JT="fullscreen_changed",QT="safe_area_changed",tx="content_safe_area_changed",ex="viewport_changed",nx="web_app_request_safe_area",rx="web_app_request_content_safe_area",ox={left:0,top:0,bottom:0,right:0};function ix(t){return Math.max(t,0)}const sx=bE({contentSafeAreaInsets:ox,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:ox,stableHeight:0,width:0});function ax(t){return EE((()=>sx()[t]))}function cx(t){const{height:e,stableHeight:n,width:r}=t;sx.set({...sx(),...vS({...t,height:e?ix(e):void 0,width:r?ix(r):void 0,stableHeight:n?ix(n):void 0})}),xv(XT,sx())}const ux=ax("isFullscreen"),lx=bE(),hx=EE((()=>!!lx())),fx=bE(),dx=bE(!1),px=EE((()=>!!mx())),gx=bE(void 0),mx=bE(),yx=VE(XT,dx,YT);function wx(t,e){return yx(t,n_((t=>kE(e,[JT,"fullscreen_failed"],t).then((t=>{if("error"in t){if("ALREADY_FULLSCREEN"===t.error)return!0;throw new dv("ERR_FULLSCREEN_FAILED","Fullscreen request failed",t.error)}return t.is_fullscreen})).then((t=>{t!==ux()&&cx({isFullscreen:t})}))),(()=>new dv(OE,"Fullscreen mode change is already being requested")),lx,fx))}const bx=wx("requestFullscreen",YT),vx=wx("exitFullscreen","web_app_exit_fullscreen"),Ex=o_(XT),_x=I_(XT,dx);function Sx(t){return EE((()=>Ax()[t]))}const Ax=ax("safeAreaInsets"),Tx=Sx("bottom"),xx=Sx("left"),kx=Sx("right"),Rx=Sx("top");function Cx(t){return EE((()=>Px()[t]))}const Px=ax("contentSafeAreaInsets"),Ix=Cx("bottom"),Ox=Cx("left"),Bx=Cx("right"),Ux=Cx("top"),Lx=jE("requestContentSafeAreaInsets",(t=>kE(rx,"content_safe_area_changed",t)),{isSupported:rx}),Nx=jE("requestSafeAreaInsets",(t=>kE(nx,"safe_area_changed",t)),{isSupported:nx});const Dx=t=>{const{height:e}=t;cx({isExpanded:t.is_expanded,height:e,width:t.width,stableHeight:t.is_state_stable?e:void 0})},jx=t=>{cx({isFullscreen:t.is_fullscreen})},Mx=t=>{cx({safeAreaInsets:t})},Vx=t=>{cx({contentSafeAreaInsets:t})},Fx=Ex("mount",r_(XT,(t=>_v.resolve().then((async()=>{const e=mE()&&kv(XT);if(e)return e;const[n,r]=await _v.all([Nx.ifAvailable(t)||Ax(),Lx.ifAvailable(t)||Px()]),o=sE(),i={contentSafeAreaInsets:r,isFullscreen:!!o.fullscreen,safeAreaInsets:n};if(["macos","tdesktop","unigram","webk","weba","web"].includes(o.platform)){const t=window;return{...i,height:t.innerHeight,isExpanded:!0,stableHeight:t.innerHeight,width:t.innerWidth}}return function(t){return kE("web_app_request_viewport","viewport_changed",t).then((t=>({height:t.height,width:t.width,isExpanded:t.is_expanded,isStable:t.is_state_stable})))}(t).then((t=>({...i,height:t.height,isExpanded:t.isExpanded,stableHeight:t.isStable?t.height:0,width:t.width})))}))),(t=>{Kv(ex,Dx),Kv(JT,jx),Kv(QT,Mx),Kv(tx,Vx),cx(t)}),dx,mx,gx));const $x=bE(!1),Kx=ax("height"),Wx=ax("stableHeight"),zx=ax("width"),Hx=_x("bindCssVars",(t=>{$x()&&aA(),t||(t=t=>`--tg-viewport-${Rv(t)}`);const e=[["height",Kx],["stableHeight",Wx],["width",zx],["safeAreaInsetTop",Rx],["safeAreaInsetBottom",Tx],["safeAreaInsetLeft",xx],["safeAreaInsetRight",kx],["contentSafeAreaInsetTop",Ux],["contentSafeAreaInsetBottom",Ix],["contentSafeAreaInsetLeft",Ox],["contentSafeAreaInsetRight",Bx]].reduce(((e,[n,r])=>{const o=t(n);if(o){const t=()=>{Pv(o,`${r()}px`)};e.push([t,r.sub(t),o])}return e}),[]);return e.forEach((t=>{t[0]()})),$x.set(!0),()=>{e.forEach((t=>{t[1](),Iv(t[2])})),$x.set(!1)}})),qx=Ex("expand",(()=>{RE("web_app_expand")})),Zx=ax("isExpanded"),Gx=EE((()=>Kx()===Wx())),Xx=(Symbol.toStringTag,o_()("openLink",((t,e)=>{if("string"==typeof t)try{t=new URL(t)}catch(e){throw new dv(IE,`"${t.toString()}" is invalid URL`,e)}e||(e={}),RE("web_app_open_link",{url:t.toString(),try_browser:e.tryBrowser,try_instant_view:e.tryInstantView})})),"web_app_open_tg_link"),Yx=o_()("openTelegramLink",(t=>{const e=t.toString();if(!e.match(/^https:\/\/t.me\/.+/))throw new dv(IE,`"${e}" is invalid URL`);pE(Xx,AE())?(t=new URL(t),RE(Xx,{path_full:t.pathname+t.search})):window.location.href=e}));o_()("shareURL",((t,e)=>{Yx("https://t.me/share/url?"+new URLSearchParams({url:t,text:e||""}).toString().replace(/\+/g,"%20"))}));function Jx(t){return n().createElement(Eb,t)}!function(t){(function(t){t||(t={});const{postEvent:e}=t,n=t.version||sE().version;AE.set(n),SE.set("function"==typeof e?e:gE(n))})(t),[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach((t=>{let e=window;t.forEach(((t,n,r)=>{n!==r.length-1?(t in e||(e[t]={}),e=e[t]):e[t]=cE}))}));const[e,n]=gv(Kv("reload_iframe",(()=>{RE("iframe_will_reload"),window.location.reload()})),uE),{acceptCustomStyles:r=!0}=t||{};if(r){const t=document.createElement("style");t.id="telegram-custom-styles",document.head.appendChild(t),e(Kv("set_custom_style",(e=>{t.innerHTML=e})),(()=>{document.head.removeChild(t)}))}RE("iframe_ready",{reload_supported:!0})}();const Qx=Jx})(),c})()));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["React"],t);else{var n="object"==typeof exports?t(require("react")):t(e.React);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(this,(e=>(()=>{"use strict";var t={639:t=>{t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var s=n[e]={exports:{}};return t[e](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{Onairos:()=>Di,default:()=>Ni});var e=r(639),t=r.n(e);class n extends Error{constructor(e,t,r){super("object"==typeof t?t.message:t||e,{cause:"object"==typeof t?t.cause:r}),this.type=e,this.name="TypedError",Object.setPrototypeOf(this,n.prototype)}}const s="ERR_INVALID_VALUE",i="ERR_UNEXPECTED_VALUE",a="ERR_UNEXPECTED_TYPE",c="ERR_PARSE";function u(e,t){const r={};for(const o in e){const s=e[o];if(!s)continue;let i,a;"function"==typeof s?(i=o,a=s):[i,a]=s;try{const e=a(t(i));void 0!==e&&(r[o]=e)}catch(e){throw new n(c,`Parser for "${o}" property failed${i===o?"":`. Source field: "${i}"`}`,e)}}return r}function p(e){let t=e;if("string"==typeof t)try{t=JSON.parse(t)}catch(e){throw new n(s,{cause:e})}if("object"!=typeof t||!t||Array.isArray(t))throw new n(i);return t}function l(e,t){return r=>{const o=o=>{if(!r||void 0!==o)try{return t(o)}catch(t){throw new n(c,{message:`"${e}" transformer failed to parse the value`,cause:t})}};return Object.assign(o,{isValid(e){try{return o(e),!0}catch{return!1}}})}}function f(e,t){return l(t||"object",(t=>{const n=p(t);return u(e,(e=>n[e]))}))}function _(e){throw new n(a,`Unexpected value received: ${JSON.stringify(e)}`)}l("boolean",(e=>{if("boolean"==typeof e)return e;const t=String(e);return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void _(e)}));const d=l("string",(e=>{if("string"==typeof e||"number"==typeof e)return e.toString();_(e)})),b=l("number",(e=>{if("number"==typeof e)return e;if("string"==typeof e){const t=Number(e);if(!Number.isNaN(t))return t}_(e)}));l("date",(e=>e instanceof Date?e:new Date(1e3*b()(e))));function h(e){return/^#[\da-f]{6}$/i.test(e)}function g(e){const t=e.replace(/\s/g,"").toLowerCase();if(h(t))return t;if(function(e){return/^#[\da-f]{3}$/i.test(e)}(t)){let e="#";for(let n=0;n<3;n+=1)e+=t[1+n].repeat(2);return e}const n=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((e,t)=>{const n=parseInt(t,10).toString(16);return e+(1===n.length?"0":"")+n}),"#")}const m=l("rgb",(e=>g(d()(e)))),w=l("themeParams",(e=>{const t=m(!0);return Object.entries(p(e)).reduce(((e,[n,r])=>(e[function(e){return e.replace(/_[a-z]/g,(e=>e[1].toUpperCase()))}(n)]=t(r),e)),{})}));class y extends Error{constructor(e,t,n){super("object"==typeof t?t.message:t||e,{cause:"object"==typeof t?t.cause:n}),this.type=e,this.name="TypedError",Object.setPrototypeOf(this,y.prototype)}}function v(e){return e.replace(/[A-Z]/g,(e=>`_${e.toLowerCase()}`))}const E="ERR_INVALID_VALUE",S="ERR_UNEXPECTED_VALUE",A="ERR_UNEXPECTED_TYPE",R="ERR_PARSE";function C(e,t){const n={};for(const r in e){const o=e[r];if(!o)continue;let s,i;"function"==typeof o?(s=r,i=o):[s,i]=o;try{const e=i(t(s));void 0!==e&&(n[r]=e)}catch(e){throw new y(R,`Parser for "${r}" property failed${s===r?"":`. Source field: "${s}"`}`,e)}}return n}function T(e){let t=e;if("string"==typeof t)try{t=JSON.parse(t)}catch(e){throw new y(E,{cause:e})}if("object"!=typeof t||!t||Array.isArray(t))throw new y(S);return t}function x(e,t){return n=>{const r=r=>{if(!n||void 0!==r)try{return t(r)}catch(t){throw new y(R,{message:`"${e}" transformer failed to parse the value`,cause:t})}};return Object.assign(r,{isValid(e){try{return r(e),!0}catch{return!1}}})}}function P(e,t){return x(t||"object",(t=>{const n=T(t);return C(e,(e=>n[e]))}))}function $(e){throw new y(A,`Unexpected value received: ${JSON.stringify(e)}`)}const k=x("boolean",(e=>{if("boolean"==typeof e)return e;const t=String(e);return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void $(e)})),O=x("string",(e=>{if("string"==typeof e||"number"==typeof e)return e.toString();$(e)})),I=x("number",(e=>{if("number"==typeof e)return e;if("string"==typeof e){const t=Number(e);if(!Number.isNaN(t))return t}$(e)})),L=x("date",(e=>e instanceof Date?e:new Date(1e3*I()(e))));function j(e,t){return x(t||"searchParams",(t=>{"string"!=typeof t&&!(t instanceof URLSearchParams)&&$(t);const n="string"==typeof t?new URLSearchParams(t):t;return C(e,(e=>{const t=n.get(e);return null===t?void 0:t}))}))}function D(e){for(const t in e)e[t]=[v(t),e[t]];return e}const N=e=>{const t=I(),n=I(!0),r=O(),o=O(!0),s=k(!0),i=P(D({addedToAttachmentMenu:s,allowsWriteToPm:s,firstName:r,id:t,isBot:s,isPremium:s,languageCode:o,lastName:o,photoUrl:o,username:o}),"User")(!0);return j(D({authDate:L(),canSendAfter:n,chat:P(D({id:t,type:r,title:r,photoUrl:o,username:o}),"Chat")(!0),chatInstance:o,chatType:o,hash:r,queryId:o,receiver:i,startParam:o,signature:r,user:i}),"initData")(e)};const q=x("rgb",(e=>function(e){const t=e.replace(/\s/g,"").toLowerCase();if(function(e){return/^#[\da-f]{6}$/i.test(e)}(t))return t;if(function(e){return/^#[\da-f]{3}$/i.test(e)}(t)){let e="#";for(let n=0;n<3;n+=1)e+=t[1+n].repeat(2);return e}const n=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce(((e,t)=>{const n=parseInt(t,10).toString(16);return e+(1===n.length?"0":"")+n}),"#")}(O()(e)))),U=x("themeParams",(e=>{const t=q(!0);return Object.entries(T(e)).reduce(((e,[n,r])=>(e[function(e){return e.replace(/_[a-z]/g,(e=>e[1].toUpperCase()))}(n)]=t(r),e)),{})}));function V(e){return JSON.stringify(Object.fromEntries(Object.entries(e).map((([e,t])=>[v(e),t]))))}const B=e=>{const t=O(),n=O(!0),r=k(!0);return j({botInline:["tgWebAppBotInline",r],defaultColors:["tgWebAppDefaultColors",U(!0)],fullscreen:["tgWebAppFullscreen",r],initData:["tgWebAppData",N(!0)],initDataRaw:["tgWebAppData",n],platform:["tgWebAppPlatform",t],showSettings:["tgWebAppShowSettings",r],startParam:["tgWebAppStartParam",n],themeParams:["tgWebAppThemeParams",U()],version:["tgWebAppVersion",t]},"launchParams")(e)};function M(e){const{initDataRaw:t,startParam:n,showSettings:r,botInline:o,fullscreen:s,defaultColors:i}=e,a=new URLSearchParams;return a.set("tgWebAppPlatform",e.platform),a.set("tgWebAppThemeParams",V(e.themeParams)),a.set("tgWebAppVersion",e.version),t&&a.set("tgWebAppData",t),n&&a.set("tgWebAppStartParam",n),"boolean"==typeof r&&a.set("tgWebAppShowSettings",r?"1":"0"),"boolean"==typeof o&&a.set("tgWebAppBotInline",o?"1":"0"),"boolean"==typeof s&&a.set("tgWebAppFullscreen",s?"1":"0"),i&&a.set("tgWebAppDefaultColors",V(i)),a.toString()}const W=P({eventType:O(),eventData:e=>e},"miniAppsMessage"),F=x("fn",(e=>{if("function"==typeof e)return e;$(e)}));const H=P({TelegramWebviewProxy:P({postEvent:F()})()});function G(e){return H().isValid(e)}var J=Object.defineProperty,Y=(e,t,n)=>((e,t,n)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);let K=class e extends Error{constructor(t,n,r){super("object"==typeof n?n.message:n||t,{cause:"object"==typeof n?n.cause:r}),this.type=t,this.name="TypedError",Object.setPrototypeOf(this,e.prototype)}};function Z(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function z(...e){const t=e.flat(1);return[t.push.bind(t),()=>{t.forEach((e=>{e()}))}]}function X(e){return t=>function(e,t){return e instanceof K&&e.type===t}(t,e)}const Q="ERR_ABORTED",ee="ERR_CANCELED",te="ERR_TIMED_OUT";function ne(e){return new K(Q,{cause:e})}X(te),X(Q),X(ee);function re(e,t){return e.reject=t.reject,e}class oe extends Promise{constructor(e,t){let n,r,o,s;"function"==typeof e?(n=e,r=t):r=e,super(((e,t)=>{r||(r={});const{abortSignal:i}=r;if(i&&i.aborted)return t(ne(i.reason));const[a,c]=z(),u=e=>(...t)=>(c(),e(...t)),p=new AbortController,{signal:l}=p;s=u((e=>{p.abort(e),t(e)})),o=u(e),i&&a(Z(i,"abort",(()=>{s(ne(i.reason))})));const{timeout:f}=r;if(f){const e=setTimeout((()=>{s(new K(te,`Timeout reached: ${f}ms`))}),f);a((()=>{clearTimeout(e)}))}n&&n(o,s,l)})),Y(this,"reject"),this.reject=s}static withFn(e,t){return new oe(((t,n,r)=>{try{const o=e(r);return o instanceof Promise?o.then(t,n):t(o)}catch(e){n(e)}}),t)}static resolve(e){return new oe((t=>{t(e)}))}static reject(e){return new oe(((t,n)=>{n(e)}))}cancel(){this.reject(new K(ee))}catch(e){return this.then(void 0,e)}finally(e){return re(super.finally(e),this)}then(e,t){return re(super.then(e,t),this)}}function se(e,t){return e.resolve=t.resolve,e}let ie=class e extends oe{constructor(e,t){let n,r,o;"function"==typeof e?(n=e,r=t):r=e,super(((e,t,r)=>{o=e,n&&n(e,t,r)}),r),Y(this,"resolve"),this.resolve=o}static withFn(t,n){return new e(((e,n,r)=>oe.withFn(t,{abortSignal:r}).then(e,n)),n)}static resolve(t){return new e((e=>{e(t)}))}static reject(t){return new e(((e,n)=>{n(t)}))}catch(e){return this.then(void 0,e)}finally(e){return se(super.finally(e),this)}then(e,t){return se(super.then(e,t),this)}};function ae(e){return`tapps/${e}`}function ce(e,t){sessionStorage.setItem(ae(e),JSON.stringify(t))}function ue(e){const t=sessionStorage.getItem(ae(e));try{return t?JSON.parse(t):void 0}catch{}}function pe(e){return e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}function le(e,t){t||(t={});const{textColor:n,bgColor:r,shouldLog:o=!0}=t;function s(t,...s){if(!o||"function"==typeof o&&!o())return;const i="font-weight:bold;padding:0 5px;border-radius:5px";console[t](`%c${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c / %c${e}`,`${i};background-color: lightblue;color:black`,"",`${i};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...s)}return[function(...e){s("log",...e)},function(...e){s("error",...e)}]}function fe(e,t){document.documentElement.style.setProperty(e,t)}function _e(e){document.documentElement.style.removeProperty(e)}function de(e,t){t||(t={});const n=t.equals||Object.is;let r=[],o=e;const s=e=>{if(!n(o,e)){const t=o;o=e,function(e,t){t()}(0,(()=>{[...r].forEach((([n,r])=>{n(e,t),r&&a(n,!0)}))}))}};function i(e){const t="object"!=typeof e?{once:e}:e;return{once:t.once||!1,signal:t.signal||!1}}const a=(e,t)=>{const n=i(t),o=r.findIndex((([t,r])=>t===e&&r.once===n.once&&r.signal===n.signal));o>=0&&r.splice(o,1)},c=Object.assign((function(){return function(e){be.length&&be[be.length-1].add(e)}(c),o}),{destroy(){r=[]},set:s,reset(){s(e)},sub:(e,t)=>(r.push([e,i(t)]),()=>a(e,t)),unsub:a,unsubAll(){r=r.filter((e=>e[1].signal))}});return c}const be=[];const he=de(!1),[ge,me]=le("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:he}),we={clipboard_text_received:P({req_id:O(),data:e=>null===e?e:O(!0)(e)},"clipboard_text_received"),custom_method_invoked:P({req_id:O(),result:e=>e,error:O(!0)},"custom_method_invoked"),popup_closed:x("popup_closed",(e=>e?P({button_id:e=>null==e?void 0:O()(e)})()(e):{})),viewport_changed:P({height:I(),width:e=>null==e?window.innerWidth:I()(e),is_state_stable:k(),is_expanded:k()},"viewport_changed")};const ye=de(),ve=de();function Ee(){return ve()||ve.set(function(e){const t=window,[,n]=z(Z(t,"message",(n=>{if(n.source!==t.parent)return;let r;try{r=W()(n.data)}catch{return}const{eventType:o,eventData:s}=r,i=we[o];try{const t=i?i()(s):s;ge("Event received:",t?{eventType:o,eventData:t}:{eventType:o}),e([o,t])}catch(e){me([`An error occurred processing the "${o}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/telegram-apps/issues/new/choose"].join("\n"),r,e)}})));return n}(ye.set)),ye}const Se=de({});function Ae(e){let t=Se()[e];return t||(t=de(void 0,{equals:()=>!1}),Ee().sub((n=>{n&&n[0]===e&&t.set(n[1])})),Se.set({...Se(),[e]:t})),t}function Re(e,t,n){return Ae(e).sub(t,n)}const Ce="ERR_METHOD_UNSUPPORTED",Te="ERR_RETRIEVE_LP_FAILED",xe="ERR_METHOD_PARAMETER_UNSUPPORTED",Pe="ERR_UNKNOWN_ENV",$e="ERR_INVOKE_CUSTOM_METHOD_RESPONSE",ke=de("https://web.telegram.org");function Oe(e,t){ge("Posting event:",t?{eventType:e,eventData:t}:{eventType:e});const n=window;if(G(n))return void n.TelegramWebviewProxy.postEvent(e,JSON.stringify(t));const r=JSON.stringify({eventType:e,eventData:t});if(function(){try{return window.self!==window.top}catch{return!0}}())return n.parent.postMessage(r,ke());const{external:o}=n;if(!P({notify:F()})().isValid(o))throw new K(Pe);o.notify(r)}function Ie(e,t,n){n||(n={});const{capture:r}=n,[o,s]=z();return new oe((s=>{(Array.isArray(t)?t:[t]).forEach((e=>{o(Re(e,(n=>{(!r||(Array.isArray(t)?r({event:e,payload:n}):r(n)))&&s(n)})))})),(n.postEvent||Oe)(e,n.params)}),n).finally(s)}function Le(e){return B()(e)}function je(e){return Le(e.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&"))}function De(){return je(window.location.href)}function Ne(){const e=performance.getEntriesByType("navigation")[0];if(!e)throw new Error("Unable to get first navigation entry.");return je(e.name)}const qe="launchParams";function Ue(){return Le(ue(qe)||"")}function Ve(e){ce("launchParams",M(e))}function Be(e){return e instanceof Error?e.message+(e.cause?`\n ${Be(e.cause)}`:""):JSON.stringify(e)}function Me(){const e=[];for(const t of[De,Ne,Ue])try{const e=t();return Ve(e),e}catch(t){e.push(t)}throw new K(Te,["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/telegram-apps-bridge/environment","Collected errors:",...e.map((e=>`— ${Be(e)}`))].join("\n"))}function We(e){if("simple"===e)try{return Me(),!0}catch{return!1}return oe.withFn((async()=>{if(G(window))return!0;try{return await Ie("web_app_request_theme","theme_changed",{timeout:100}),!0}catch{return!1}}),e)}function Fe(e,t){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:e,eventData:t}),source:window.parent}))}function He(){["TelegramGameProxy_receiveEvent","TelegramGameProxy","Telegram"].forEach((e=>{delete window[e]}))}function Ge(e,t,n){Ae(e).unsub(t,n)}function Je(e){return({req_id:t})=>t===e}function Ye(e){return e.split(".").map(Number)}function Ke(e,t){return function(e,t){const n=Ye(e),r=Ye(t),o=Math.max(n.length,r.length);for(let e=0;e<o;e+=1){const t=n[e]||0,o=r[e]||0;if(t!==o)return t>o?1:-1}return 0}(e,t)<=0}function Ze(e,t,n){if("string"==typeof n){if("web_app_open_link"===e){if("try_instant_view"===t)return Ke("6.4",n);if("try_browser"===t)return Ke("7.6",n)}if("web_app_set_header_color"===e&&"color"===t)return Ke("6.9",n);if("web_app_close"===e&&"return_back"===t)return Ke("7.6",n);if("web_app_setup_main_button"===e&&"has_shine_effect"===t)return Ke("7.10",n)}switch(e){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return Ke("6.1",t);case"web_app_open_popup":return Ke("6.2",t);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return Ke("6.4",t);case"web_app_switch_inline_query":return Ke("6.7",t);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return Ke("6.9",t);case"web_app_setup_settings_button":return Ke("6.10",t);case"web_app_biometry_get_info":case"web_app_biometry_open_settings":case"web_app_biometry_request_access":case"web_app_biometry_request_auth":case"web_app_biometry_update_token":return Ke("7.2",t);case"web_app_setup_swipe_behavior":return Ke("7.7",t);case"web_app_share_to_story":return Ke("7.8",t);case"web_app_setup_secondary_button":case"web_app_set_bottom_bar_color":return Ke("7.10",t);case"web_app_request_safe_area":case"web_app_request_content_safe_area":case"web_app_request_fullscreen":case"web_app_exit_fullscreen":case"web_app_set_emoji_status":case"web_app_add_to_home_screen":case"web_app_check_home_screen":case"web_app_request_emoji_status_access":return Ke("8.0",t);default:return["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"].includes(e)}}function ze(e,t){t||(t="strict");const n="function"==typeof t?t:e=>{const{method:n,version:r}=e;let o,s;if("param"in e?(o=`Parameter "${e.param}" of "${n}" method is unsupported in Mini Apps version ${r}`,s=xe):(o=`Method "${n}" is unsupported in Mini Apps version ${r}`,s=Ce),"strict"===t)throw new K(s,o);return console.warn(o)};return(t,r)=>Ze(t,e)?function(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}(r)&&"web_app_set_header_color"===t&&"color"in r&&!Ze(t,"color",e)?n({version:e,method:t,param:"color"}):Oe(t,r):n({version:e,method:t})}function Xe(){const e=performance.getEntriesByType("navigation")[0];return!!e&&"reload"===e.type}let Qe;function et(e){if(Qe)return e();Qe=new Map;try{e()}finally{Qe.forEach((e=>e())),Qe=void 0}}function tt(e,t){t||(t={});const n=t.equals||Object.is;let r=[],o=e;const s=e=>{if(!n(o,e)){const t=o;o=e,function(e,t){Qe&&Qe.set(e,t)||t()}(c,(()=>{[...r].forEach((([n,r])=>{n(e,t),r&&a(n,!0)}))}))}};function i(e){const t="object"!=typeof e?{once:e}:e;return{once:t.once||!1,signal:t.signal||!1}}const a=(e,t)=>{const n=i(t),o=r.findIndex((([t,r])=>t===e&&r.once===n.once&&r.signal===n.signal));o>=0&&r.splice(o,1)},c=Object.assign((function(){return function(e){nt.length&&nt[nt.length-1].add(e)}(c),o}),{destroy(){r=[]},set:s,reset(){s(e)},sub:(e,t)=>(r.push([e,i(t)]),()=>a(e,t)),unsub:a,unsubAll(){r=r.filter((e=>e[1].signal))}});return c}const nt=[];function rt(e,t){let n,r=new Set;function o(){return n||(n=tt(i(),t))}function s(){o().set(i())}function i(){r.forEach((e=>{e.unsub(s,{signal:!0})}));const t=new Set;let n;nt.push(t);try{n=e()}finally{nt.pop()}return t.forEach((e=>{e.sub(s,{signal:!0})})),r=t,n}return Object.assign((function(){return o()()}),{destroy(){o().destroy()},sub:(...e)=>o().sub(...e),unsub(...e){o().unsub(...e)},unsubAll(...e){o().unsubAll(...e)}})}const ot=tt((()=>{let e=0;return()=>(e+=1).toString()})()),st=tt(Oe),it=tt("0.0");function at(){return ot()()}function ct(e,t,n){return function(e,t,n,r){return Ie("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:e,params:t,req_id:n},capture:Je(n)}).then((({result:e,error:t})=>{if(t)throw new K($e,t);return e}))}(e,t,at(),{...n||{},postEvent:pt})}const ut=(e,t,n)=>(n||(n={}),n.postEvent||(n.postEvent=pt),Ie(e,t,n)),pt=(e,t)=>st()(e,t);function lt(e){return rt((()=>Ze(e,it())))}const ft="ERR_POPUP_INVALID_PARAMS",_t="ERR_INVALID_URL",dt="ERR_ALREADY_REQUESTING",bt="ERR_ALREADY_OPENED",ht="ERR_NOT_INITIALIZED",gt="ERR_NOT_SUPPORTED",mt="ERR_NOT_MOUNTED";function wt(){return typeof window>"u"}function yt(e,t,{isSupported:n,isMounted:r,component:o,supports:s}={}){const i=`${o?`${o}.`:""}${e}()`;function a(e){if(s){const t=s[e];return Ze(t[0],t[1],it())}return!0}n=n?Array.isArray(n)||"object"==typeof n&&"any"in n?n:[n]:void 0;const c=()=>{if(!n)return;const e=`it is unsupported in Mini Apps version ${it()}`;function t(t){return"string"==typeof t?Ze(t,it())?void 0:e:t.fn()?void 0:t.error}if(Array.isArray(n)){for(const e of n){const n=t(e);if(n)return n}return}let r;for(const e of n.any)if(r=t(e),!r)return;return e},u=rt((()=>!c())),p=rt((()=>"0.0"!==it())),l=rt((()=>!r||r())),f=rt((()=>We("simple")&&!wt()&&p()&&u()&&l()));let _;if(s){_={};for(const e in s)_[e]=rt((()=>a(e)))}return Object.assign(((...e)=>{const n=`Unable to call the ${i} ${o?"method":"function"}:`;if(wt()||!We("simple"))throw new K(Pe,`${n} it can't be called outside Mini Apps`);if(!p())throw new K(ht,`${n} the SDK was not initialized. Use the SDK init() function`);const r=c();if(r)throw new K(gt,`${n} ${r}`);const u=((...e)=>{if(s)for(const t in s)if(s[t][2](...e)&&!a(t))return`option ${t} is not supported in Mini Apps version ${it()}`})(...e);if(u)throw new K(gt,`${n} ${u}`);if(!l())throw new K(mt,`${n} the component is not mounted. Use the ${o}.mount() method`);return t(...e)}),t,{isAvailable:f,ifAvailable:(...e)=>f()?t(...e):void 0},n?{isSupported:u}:{},_?{supports:_}:{})}function vt(e,t){return t||(t={}),(n,r,o,s)=>yt(n,r,{...t,isSupported:o||t.isSupported,supports:s,component:e})}function Et(e,t,n){return vt(e,{isSupported:n,isMounted:t})}function St(e,t){return vt(e,{isSupported:t})}const At="web_app_setup_back_button",Rt="back_button_pressed",Ct="backButton",Tt=tt(!1),xt=tt(!1),Pt=lt(At),$t=Et(Ct,xt,At),kt=St(Ct,At),Ot=$t("hide",(()=>{Lt(!1)})),It=kt("mount",(()=>{xt()||(Lt(Xe()&&ue(Ct)||!1),xt.set(!0))}));function Lt(e){e!==Tt()&&(pt(At,{is_visible:e}),ce(Ct,e),Tt.set(e))}const jt=kt("onClick",(e=>Re(Rt,e))),Dt=kt("offClick",(e=>{Ge(Rt,e)})),Nt=$t("show",(()=>{Lt(!0)}));Symbol.toStringTag;function qt(e,t,n,r,o){const s=void 0===o||o?oe:Promise;return Object.assign(((...o)=>s.resolve().then((async()=>{if(n()){const e=t();throw r.set(e),e}let i;et((()=>{n.set(s.resolve(e(...o))),r.set(void 0)}));try{i=[!0,await n()]}catch(e){i=[!1,e]}if(et((()=>{n.set(void 0),r.set(i[0]?void 0:i[1])})),!i[0])throw i[1];return i[1]}))),e)}function Ut(e,t,n,r,o,s){const i=qt(t,(()=>new K("ERR_ALREADY_MOUNTING",`The ${e} component is already mounting`)),o,s);return e=>oe.resolve().then((async()=>{if(!r()){const t=await i(e);et((()=>{r.set(!0),n(t)}))}}))}const Vt=vt,Bt=tt({available:!1}),Mt=tt(!1),Wt=tt(!1),Ft=tt(!1),Ht=rt((()=>!!Jt())),Gt=tt(),Jt=tt(),Yt=rt((()=>{const e=Bt();return e&&e.available}));function Kt(e){return e.available?{available:!0,tokenSaved:e.token_saved,deviceId:e.device_id,accessRequested:e.access_requested,type:e.type,accessGranted:e.access_granted}:{available:!1}}const Zt="web_app_biometry_get_info",zt=yt("requestBiometry",(e=>ut(Zt,"biometry_info_received",e).then(Kt)),{isSupported:Zt}),Xt="web_app_biometry_request_auth",Qt="biometry_info_received",en="biometry",tn=lt(Xt),nn=Vt(en),rn=St(en,Xt),on=Et(en,Ft,Xt);function sn(){throw new K("ERR_NOT_AVAILABLE","Biometry is not available")}const an=on("authenticate",(e=>oe.withFn((async t=>{if(Mt())throw new K(dt,"Authentication is already in progress");const n=Bt();(!n||!n.available)&&sn(),Mt.set(!0);try{const r=await ut(Xt,"biometry_auth_requested",{abortSignal:t,params:{reason:((e||{}).reason||"").trim()}}),{token:o}=r;return"string"==typeof o&&fn({...n,token:o}),r}finally{Mt.set(!1)}}),e))),cn=rn("openSettings",(()=>{pt("web_app_biometry_open_settings")})),un=on("requestAccess",(e=>oe.withFn((async t=>{if(Wt())throw new K(dt,"Access request is already in progress");Wt.set(!0);try{const n=await ut("web_app_biometry_request_access",Qt,{abortSignal:t,params:{reason:(e||{}).reason||""}}).then(Kt);return n.available||sn(),fn(n),n.accessGranted}finally{Wt.set(!1)}}),e))),pn=nn("mount",Ut(en,(e=>Xe()&&ue(en)||zt(e)),(e=>{Re(Qt,ln),fn(e)}),Ft,Jt,Gt)),ln=e=>{fn(Kt(e))};function fn(e){Bt.set(e),ce(en,e)}const _n=on("updateToken",(e=>(e||(e={}),ut("web_app_biometry_update_token","biometry_token_updated",{...e,params:{token:e.token||"",reason:e.reason}}).then((e=>e.status)))));Symbol.toStringTag;function dn(e,t){return vt(e,{isMounted:t})}const bn="closingBehavior",hn=tt(!1),gn=tt(!1),mn=dn(bn,gn),wn=Vt(bn),yn=mn("disableConfirmation",(()=>{Sn(!1)})),vn=mn("enableConfirmation",(()=>{Sn(!0)})),En=wn("mount",(()=>{gn()||(Sn(Xe()&&ue(bn)||!1),gn.set(!0))}));function Sn(e){e!==hn()&&(pt("web_app_setup_closing_behavior",{need_confirmation:e}),ce(bn,e),hn.set(e))}Symbol.toStringTag;const An="web_app_invoke_custom_method",Rn=St("cloudStorage",An),Cn=lt(An),Tn=Rn("deleteItem",((e,t)=>{const n=Array.isArray(e)?e:[e];return n.length?ct("deleteStorageValues",{keys:n},t).then():oe.resolve()}));const xn=Rn("getItem",(function(e,t){const n=Array.isArray(e)?e:[e];return n.length?ct("getStorageValues",{keys:n},t).then((t=>{const r=f(Object.fromEntries(n.map((e=>[e,d()]))))()(t);return Array.isArray(e)?r:r[e]})):oe.resolve("string"==typeof e?"":{})})),Pn=Rn("getKeys",(e=>ct("getStorageKeys",{},e).then(function(e,t){return l("array",(t=>{let n;if(Array.isArray(t))n=t;else if("string"==typeof t)try{const e=JSON.parse(t);Array.isArray(e)&&(n=e)}catch{}return n||_(t),n.map(e)}))}(d())()))),$n=Rn("setItem",((e,t,n)=>ct("saveStorageValue",{key:e,value:t},n).then())),kn=(Symbol.toStringTag,"web_app_trigger_haptic_feedback"),On=St("hapticFeedback",kn),In=lt(kn),Ln=On("impactOccurred",(e=>{pt(kn,{type:"impact",impact_style:e})})),jn=On("notificationOccurred",(e=>{pt(kn,{type:"notification",notification_type:e})})),Dn=On("selectionChanged",(()=>{pt(kn,{type:"selection_change"})})),Nn=(Symbol.toStringTag,tt(void 0));function qn(e){return rt((()=>{const t=Nn();return t?t[e]:void 0}))}const Un=qn("authDate"),Vn=qn("canSendAfter"),Bn=rt((()=>{const e=Un(),t=Vn();return t&&e?new Date(e.getTime()+1e3*t):void 0})),Mn=qn("chat"),Wn=qn("chatType"),Fn=qn("chatInstance"),Hn=qn("hash"),Gn=qn("queryId"),Jn=tt(),Yn=qn("receiver");const Kn=qn("startParam"),Zn=qn("user");Symbol.toStringTag;const zn="web_app_open_invoice",Xn=St("invoice",zn),Qn=tt(!1),er=lt(zn);async function tr(e,t,n){if(Qn())throw new K(bt,"An invoice is already opened");let r;if("url"===t){const{hostname:t,pathname:n}=new URL(e,window.location.href);if("t.me"!==t)throw new K(_t,`Link has unexpected hostname: ${t}`);const o=n.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);if(!o)throw new K("ERR_INVALID_SLUG",'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"');[,,r]=o}else r=e,n=t;return Qn.set(!0),ut(zn,"invoice_closed",{...n,params:{slug:r},capture:e=>r===e.slug}).then((e=>e.status)).finally((()=>{Qn.set(!1)}))}const nr=Xn("open",tr);Symbol.toStringTag;function rr(e){return Object.fromEntries(Object.entries(e).filter((e=>void 0!==e[1])))}function or(e){const t=g(e);return Math.sqrt([.299,.587,.114].reduce(((e,n,r)=>{const o=parseInt(t.slice(1+2*r,1+2*(r+1)),16);return e+o*o*n}),0))<120}const sr=tt(!1),ir=tt(!1),ar=tt({});function cr(e){return rt((()=>ar()[e]))}const ur=cr("accentTextColor"),pr=cr("bgColor"),lr=cr("buttonColor"),fr=cr("buttonTextColor"),_r=cr("bottomBarBgColor"),dr=cr("destructiveTextColor"),br=cr("headerBgColor"),hr=cr("hintColor"),gr=rt((()=>{const{bgColor:e}=ar();return!e||or(e)})),mr=cr("linkColor"),wr=cr("secondaryBgColor"),yr=cr("sectionBgColor"),vr=cr("sectionHeaderTextColor"),Er=cr("sectionSeparatorColor"),Sr=cr("subtitleTextColor"),Ar=cr("textColor");function Rr(e){return rt((()=>Tr()[e]))}const Cr=tt({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,text:"Continue"}),Tr=rt((()=>{const e=Cr();return{...e,backgroundColor:e.backgroundColor||lr()||"#2481cc",textColor:e.textColor||fr()||"#ffffff"}})),xr=tt(!1),Pr=Rr("backgroundColor"),$r=Rr("hasShineEffect"),kr=Rr("isEnabled"),Or=Rr("isLoaderVisible"),Ir=Rr("isVisible"),Lr=Rr("text"),jr=Rr("textColor"),Dr="main_button_pressed",Nr="mainButton",qr=Vt(Nr),Ur=dn(Nr,xr),Vr=qr("mount",(()=>{if(!xr()){const e=Xe()&&ue(Nr);e&&Cr.set(e),xr.set(!0)}})),Br=qr("onClick",(e=>Re(Dr,e))),Mr=qr("offClick",(e=>{Ge(Dr,e)})),Wr=Ur("setParams",(e=>{Cr.set({...Cr(),...rr(e)}),ce(Nr,Cr());const t=Tr();t.text&&pt("web_app_setup_main_button",{color:t.backgroundColor,has_shine_effect:t.hasShineEffect,is_active:t.isEnabled,is_progress_visible:t.isLoaderVisible,is_visible:t.isVisible,text:t.text,text_color:t.textColor})}));Symbol.toStringTag;function Fr(){throw new K("ERR_VARS_ALREADY_BOUND","CSS variables are already bound")}const Hr="themeParams",Gr="theme_changed",Jr=Vt(Hr),Yr=dn(Hr,sr)("bindCssVars",(e=>{function t(e){Object.entries(ar()).forEach((([t,n])=>{n&&e(t,n)}))}function n(){t(((t,n)=>{fe(e(t),n)}))}return ir()&&Fr(),e||(e=e=>`--tg-theme-${pe(e)}`),n(),ar.sub(n),ir.set(!0),()=>{t(_e),ar.unsub(n),ir.set(!1)}})),Kr=Jr("mount",(()=>{sr()||(Re(Gr,Zr),ar.set(Xe()&&ue(Hr)||Me().themeParams),sr.set(!0))})),Zr=e=>{const t=function(e){return w()(e)}(e.theme_params);ar.set(t),ce(Hr,t)};function zr(e){return rt((()=>{const t=e();return h(t)?t:"bg_color"===t?pr():wr()}))}const Xr=tt("bg_color"),Qr=zr(Xr),eo=tt("bottom_bar_bg_color"),to=rt((()=>{const e=eo();return h(e)?e:"bottom_bar_bg_color"===e?_r()||wr():"secondary_bg_color"===e?wr():pr()})),no=tt("bg_color"),ro=zr(no),oo=tt(!1),so=tt(!1),io=rt((()=>{const e=Qr();return!!e&&or(e)})),ao=tt(!0),co=rt((()=>({backgroundColor:Xr(),bottomBarColor:eo(),headerColor:no(),isActive:ao()}))),uo="web_app_set_background_color",po="web_app_set_bottom_bar_color",lo="web_app_set_header_color",fo="visibility_changed",_o="miniApp",bo={any:[uo,po,lo]},ho=rt((()=>bo.any.some((e=>Ze(e,it()))))),go=Vt(_o),mo=St(_o,bo),wo=Et(_o,oo,bo),yo=wo("bindCssVars",(e=>{so()&&Fr();const[t,n]=z();function r(e,n){function r(){fe(e,n()||null)}r(),t(n.sub(r),_e.bind(null,e))}return e||(e=e=>`--tg-${pe(e)}`),r(e("bgColor"),Qr),r(e("bottomBarColor"),to),r(e("headerColor"),ro),t((()=>{so.set(!1)})),so.set(!0),n})),vo=go("close",(e=>{pt("web_app_close",{return_back:e})})),Eo=e=>{ao.set(e.is_visible),Ro()},So=mo("mount",(()=>{if(!oo()){const e=Xe()&&ue(_o);Kr(),Co.ifAvailable(e?e.backgroundColor:"bg_color"),To.ifAvailable(e?e.bottomBarColor:"bottom_bar_bg_color"),xo.ifAvailable(e?e.headerColor:"bg_color"),ao.set(!e||e.isActive),Re(fo,Eo),oo.set(!0)}})),Ao=go("ready",(()=>{pt("web_app_ready")}));function Ro(){ce(_o,co())}const Co=wo("setBackgroundColor",(e=>{e!==Xr()&&(pt(uo,{color:e}),Xr.set(e),Ro())}),uo),To=wo("setBottomBarColor",(e=>{e!==eo()&&(pt(po,{color:e}),eo.set(e),Ro())}),po),xo=wo("setHeaderColor",(e=>{e!==no()&&(pt(lo,h(e)?{color:e}:{color_key:e}),no.set(e),Ro())}),lo,{rgb:[lo,"color",h]});Symbol.toStringTag;function Po(e){const t=e.message.trim(),n=(e.title||"").trim(),r=e.buttons||[];if(n.length>64)throw new K(ft,`Invalid title: ${n}`);if(!t||t.length>256)throw new K(ft,`Invalid message: ${t}`);if(r.length>3)throw new K(ft,`Invalid buttons count: ${r.length}`);return{title:n,message:t,buttons:r.length?r.map(((e,t)=>{const n=e.id||"";if(n.length>64)throw new K(ft,`Button with index ${t} has invalid id: ${n}`);if(!e.type||"default"===e.type||"destructive"===e.type){const r=e.text.trim();if(!r||r.length>64)throw new K(ft,`Button with index ${t} has invalid text: ${r}`);return{type:e.type,text:r,id:n}}return{type:e.type,id:n}})):[{type:"close",id:""}]}}const $o="web_app_open_popup",ko=St("popup",$o),Oo=tt(!1),Io=lt($o),Lo=ko("open",(async e=>{if(Oo())throw new K(bt,"A popup is already opened");Oo.set(!0);try{const{button_id:t=null}=await ut($o,"popup_closed",{...e,params:Po(e)});return t}finally{Oo.set(!1)}})),jo=(Symbol.toStringTag,"web_app_open_scan_qr_popup"),Do=St("qrScanner",jo),No=Do("close",(()=>{qo.set(!1),pt("web_app_close_scan_qr_popup")})),qo=tt(!1),Uo=lt(jo);const Vo=Do("open",(function(e){return oe.withFn((t=>{if(qo())throw new K(bt,"The QR Scanner is already opened");qo.set(!0),e||(e={});const{onCaptured:n,text:r,capture:o}=e,[,s]=z(qo.sub((()=>{i.resolve()})),Re("scan_qr_popup_closed",(()=>{qo.set(!1)})),Re("qr_text_received",(e=>{n?n(e.data):(!o||o(e.data))&&(i.resolve(e.data),No())}))),i=new ie({abortSignal:t}).catch(No).finally(s);return(e.postEvent||pt)(jo,{text:r}),i}),e)}));Symbol.toStringTag;function Bo(e){return rt((()=>Wo()[e]))}const Mo=tt({hasShineEffect:!1,isEnabled:!0,isLoaderVisible:!1,isVisible:!1,position:"left",text:"Cancel"}),Wo=rt((()=>{const e=Mo();return{...e,backgroundColor:e.backgroundColor||to()||"#000000",textColor:e.textColor||lr()||"#2481cc"}})),Fo=tt(!1),Ho=Bo("backgroundColor"),Go=Bo("hasShineEffect"),Jo=Bo("isEnabled"),Yo=Bo("isLoaderVisible"),Ko=Bo("isVisible"),Zo=Bo("position"),zo=Bo("text"),Xo=Bo("textColor"),Qo="web_app_setup_secondary_button",es="secondary_button_pressed",ts="secondaryButton",ns=St(ts,Qo),rs=Et(ts,Fo,Qo),os=lt(Qo),ss=ns("mount",(()=>{if(!Fo()){const e=Xe()&&ue(ts);e&&Mo.set(e),Fo.set(!0)}})),is=ns("onClick",(e=>Re(es,e))),as=ns("offClick",(e=>{Ge(es,e)})),cs=rs("setParams",(e=>{Mo.set({...Mo(),...Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}),ce(ts,Mo());const t=Wo();t.text&&pt(Qo,{color:t.backgroundColor,has_shine_effect:t.hasShineEffect,is_active:t.isEnabled,is_progress_visible:t.isLoaderVisible,is_visible:t.isVisible,position:t.position,text:t.text,text_color:t.textColor})}));Symbol.toStringTag;const us="web_app_setup_settings_button",ps="settings_button_pressed",ls="settingsButton",fs=tt(!1),_s=tt(!1),ds=lt(us),bs=St(ls,us),hs=Et(ls,_s,us),gs=hs("hide",(()=>{ws(!1)})),ms=bs("mount",(()=>{_s()||(ws(Xe()&&ue(ls)||!1),_s.set(!0))}));function ws(e){e!==fs()&&(pt(us,{is_visible:e}),ce(ls,e),fs.set(e))}const ys=bs("onClick",(e=>Re(ps,e))),vs=bs("offClick",(e=>{Ge(ps,e)})),Es=hs("show",(()=>{ws(!0)}));Symbol.toStringTag;const Ss="web_app_setup_swipe_behavior",As="swipeBehavior",Rs=tt(!1),Cs=lt(Ss),Ts=tt(!0),xs=St(As,Ss),Ps=Et(As,Rs,Ss),$s=Ps("disableVertical",(()=>{Is(!1)})),ks=Ps("enableVertical",(()=>{Is(!0)})),Os=xs("mount",(()=>{Rs()||(Is(Xe()&&ue(As)||!1,!0),Rs.set(!0))}));function Is(e,t){(e!==Ts()||t)&&(pt(Ss,{allow_vertical_swipe:e}),ce(As,e),Ts.set(e))}Symbol.toStringTag,Symbol.toStringTag;const Ls="viewport",js="web_app_request_fullscreen",Ds="fullscreen_changed",Ns="safe_area_changed",qs="content_safe_area_changed",Us="viewport_changed",Vs="web_app_request_safe_area",Bs="web_app_request_content_safe_area",Ms={left:0,top:0,bottom:0,right:0};function Ws(e){return Math.max(e,0)}const Fs=tt({contentSafeAreaInsets:Ms,height:0,isExpanded:!1,isFullscreen:!1,safeAreaInsets:Ms,stableHeight:0,width:0});function Hs(e){return rt((()=>Fs()[e]))}function Gs(e){const{height:t,stableHeight:n,width:r}=e;Fs.set({...Fs(),...rr({...e,height:t?Ws(t):void 0,width:r?Ws(r):void 0,stableHeight:n?Ws(n):void 0})}),ce(Ls,Fs())}const Js=Hs("isFullscreen"),Ys=tt(),Ks=rt((()=>!!Ys())),Zs=tt(),zs=tt(!1),Xs=rt((()=>!!ei())),Qs=tt(void 0),ei=tt(),ti=Et(Ls,zs,js);function ni(e,t){return ti(e,qt((e=>ut(t,[Ds,"fullscreen_failed"],e).then((e=>{if("error"in e){if("ALREADY_FULLSCREEN"===e.error)return!0;throw new K("ERR_FULLSCREEN_FAILED","Fullscreen request failed",e.error)}return e.is_fullscreen})).then((e=>{e!==Js()&&Gs({isFullscreen:e})}))),(()=>new K(dt,"Fullscreen mode change is already being requested")),Ys,Zs))}const ri=ni("requestFullscreen",js),oi=ni("exitFullscreen","web_app_exit_fullscreen"),si=Vt(Ls),ii=dn(Ls,zs);function ai(e){return rt((()=>ci()[e]))}const ci=Hs("safeAreaInsets"),ui=ai("bottom"),pi=ai("left"),li=ai("right"),fi=ai("top");function _i(e){return rt((()=>di()[e]))}const di=Hs("contentSafeAreaInsets"),bi=_i("bottom"),hi=_i("left"),gi=_i("right"),mi=_i("top"),wi=yt("requestContentSafeAreaInsets",(e=>ut(Bs,"content_safe_area_changed",e)),{isSupported:Bs}),yi=yt("requestSafeAreaInsets",(e=>ut(Vs,"safe_area_changed",e)),{isSupported:Vs});const vi=e=>{const{height:t}=e;Gs({isExpanded:e.is_expanded,height:t,width:e.width,stableHeight:e.is_state_stable?t:void 0})},Ei=e=>{Gs({isFullscreen:e.is_fullscreen})},Si=e=>{Gs({safeAreaInsets:e})},Ai=e=>{Gs({contentSafeAreaInsets:e})},Ri=si("mount",Ut(Ls,(e=>oe.resolve().then((async()=>{const t=Xe()&&ue(Ls);if(t)return t;const[n,r]=await oe.all([yi.ifAvailable(e)||ci(),wi.ifAvailable(e)||di()]),o=Me(),s={contentSafeAreaInsets:r,isFullscreen:!!o.fullscreen,safeAreaInsets:n};if(["macos","tdesktop","unigram","webk","weba","web"].includes(o.platform)){const e=window;return{...s,height:e.innerHeight,isExpanded:!0,stableHeight:e.innerHeight,width:e.innerWidth}}return function(e){return ut("web_app_request_viewport","viewport_changed",e).then((e=>({height:e.height,width:e.width,isExpanded:e.is_expanded,isStable:e.is_state_stable})))}(e).then((e=>({...s,height:e.height,isExpanded:e.isExpanded,stableHeight:e.isStable?e.height:0,width:e.width})))}))),(e=>{Re(Us,vi),Re(Ds,Ei),Re(Ns,Si),Re(qs,Ai),Gs(e)}),zs,ei,Qs));const Ci=tt(!1),Ti=Hs("height"),xi=Hs("stableHeight"),Pi=Hs("width"),$i=ii("bindCssVars",(e=>{Ci()&&Fr(),e||(e=e=>`--tg-viewport-${pe(e)}`);const t=[["height",Ti],["stableHeight",xi],["width",Pi],["safeAreaInsetTop",fi],["safeAreaInsetBottom",ui],["safeAreaInsetLeft",pi],["safeAreaInsetRight",li],["contentSafeAreaInsetTop",mi],["contentSafeAreaInsetBottom",bi],["contentSafeAreaInsetLeft",hi],["contentSafeAreaInsetRight",gi]].reduce(((t,[n,r])=>{const o=e(n);if(o){const e=()=>{fe(o,`${r()}px`)};t.push([e,r.sub(e),o])}return t}),[]);return t.forEach((e=>{e[0]()})),Ci.set(!0),()=>{t.forEach((e=>{e[1](),_e(e[2])})),Ci.set(!1)}})),ki=si("expand",(()=>{pt("web_app_expand")})),Oi=Hs("isExpanded"),Ii=rt((()=>Ti()===xi())),Li=(Symbol.toStringTag,Vt()("openLink",((e,t)=>{if("string"==typeof e)try{e=new URL(e)}catch(t){throw new K(_t,`"${e.toString()}" is invalid URL`,t)}t||(t={}),pt("web_app_open_link",{url:e.toString(),try_browser:t.tryBrowser,try_instant_view:t.tryInstantView})})),"web_app_open_tg_link"),ji=Vt()("openTelegramLink",(e=>{const t=e.toString();if(!t.match(/^https:\/\/t.me\/.+/))throw new K(_t,`"${t}" is invalid URL`);Ze(Li,it())?(e=new URL(e),pt(Li,{path_full:e.pathname+e.search})):window.location.href=t}));Vt()("shareURL",((e,t)=>{ji("https://t.me/share/url?"+new URLSearchParams({url:e,text:t||""}).toString().replace(/\+/g,"%20"))}));function Di(n){const r=(0,e.useMemo)(Me,[]);return t().createElement("div",null,"Start parameter: ",r.startParam)}!function(e){(function(e){e||(e={});const{postEvent:t}=e,n=e.version||Me().version;it.set(n),st.set("function"==typeof t?t:ze(n))})(e),[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach((e=>{let t=window;e.forEach(((e,n,r)=>{n!==r.length-1?(e in t||(t[e]={}),t=t[e]):t[e]=Fe}))}));const[t,n]=z(Re("reload_iframe",(()=>{pt("iframe_will_reload"),window.location.reload()})),He),{acceptCustomStyles:r=!0}=e||{};if(r){const e=document.createElement("style");e.id="telegram-custom-styles",document.head.appendChild(e),t(Re("set_custom_style",(t=>{e.innerHTML=t})),(()=>{document.head.removeChild(e)}))}pt("iframe_ready",{reload_supported:!0})}();const Ni=Di})(),o})()));
|
|
2
2
|
//# sourceMappingURL=onairos.bundle.js.map
|