@dcl/governance-site 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{ConstantsUtil-689989f0.js → ConstantsUtil-c3a75781.js} +1 -1
- package/assets/{ExchangeController-88f78111.js → ExchangeController-de6066de.js} +1 -1
- package/assets/{HelpersUtil-40f31189.js → HelpersUtil-47bce835.js} +1 -1
- package/assets/{NetworkUtil-2fb81493.js → NetworkUtil-cfdab321.js} +1 -1
- package/assets/{ReownAuthentication-e5d1d4cc.js → ReownAuthentication-c1098727.js} +1 -1
- package/assets/{SwapController-f47e6f17.js → SwapController-6f3f28da.js} +1 -1
- package/assets/{UserAvatar-0c19fd64.js → UserAvatar-4217a7be.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-33e9645e.js → W3MFrameProviderSingleton-316899f0.js} +2 -2
- package/assets/{basic-509eb412.js → basic-d9c0f288.js} +1 -1
- package/assets/{biconomy-6fa3eb98.js → biconomy-bc04f7cc.js} +1 -1
- package/assets/{ccip-040f274b.js → ccip-d88eddf3.js} +1 -1
- package/assets/{ccip-6d1e4a15.js → ccip-e509a2bd.js} +1 -1
- package/assets/{chains-bae55e5f.js → chains-12910e1f.js} +1 -1
- package/assets/{common-f2e88a7e.js → common-583dfda9.js} +1 -1
- package/assets/{compat-b432550d.js → compat-000e5801.js} +1 -1
- package/assets/{controller-83cf739b.js → controller-5a843a75.js} +1 -1
- package/assets/{core-71a03396.js → core-1a166f08.js} +3 -3
- package/assets/{custom-7ae31f11.js → custom-3c5e7814.js} +1 -1
- package/assets/{data-capture-f1f485c2.js → data-capture-a27f6e5c.js} +1 -1
- package/assets/decimals-50f9fee1.js +1 -0
- package/assets/{decimals-9d5fec14.js → decimals-bddbc743.js} +1 -1
- package/assets/{email-be31d86e.js → email-0c5024d9.js} +1 -1
- package/assets/{embedded-wallet-41341ab4.js → embedded-wallet-d5992bd8.js} +1 -1
- package/assets/{engine-8d2b111b.js → engine-9b39863f.js} +1 -1
- package/assets/{estimate-l1-fee-8acb8860.js → estimate-l1-fee-69110584.js} +1 -1
- package/assets/eth_estimateGas-945ce595.js +1 -0
- package/assets/{eth_getStorageAt-2d8a4700.js → eth_getStorageAt-125a2bc1.js} +1 -1
- package/assets/{eth_getTransactionCount-273004ec.js → eth_getTransactionCount-6240f912.js} +1 -1
- package/assets/{ethereum-667be7dc.js → ethereum-0d579241.js} +1 -1
- package/assets/{execute-6c88dd5f.js → execute-264a98ed.js} +1 -1
- package/assets/{extractIPFS-640303a3.js → extractIPFS-d48a2b7b.js} +1 -1
- package/assets/features-7c8dc530.js +1 -0
- package/assets/{fetchTokenMetadata-1e138f21.js → fetchTokenMetadata-f32fb87e.js} +1 -1
- package/assets/{fortmatic-d34f42c3.js → fortmatic-5f1bb82e.js} +1 -1
- package/assets/{get-bytecode-8cb4e224.js → get-bytecode-7a8c6215.js} +1 -1
- package/assets/{get-ecosystem-wallet-info-ec712acc.js → get-ecosystem-wallet-info-0a9d1fa7.js} +1 -1
- package/assets/{getBalance-0308f38f.js → getBalance-e2e6d859.js} +1 -1
- package/assets/{getInstalledModules-17fa1a09.js → getInstalledModules-4e23fa8a.js} +1 -1
- package/assets/{getNFT-06eb1406.js → getNFT-5486b2f7.js} +1 -1
- package/assets/{getNFT-30795fe1.js → getNFT-74f5ae81.js} +1 -1
- package/assets/{hashBytecode-a29db705.js → hashBytecode-7a0e56f5.js} +1 -1
- package/assets/{hashTypedData-23a00dc9.js → hashTypedData-03b693eb.js} +1 -1
- package/assets/{hashTypedData-ba8e399b.js → hashTypedData-cc1589a7.js} +1 -1
- package/assets/{in-app-9acc158b.js → in-app-1d212717.js} +1 -1
- package/assets/{in-app-wallet-calls-48ca2694.js → in-app-wallet-calls-7fdb5823.js} +1 -1
- package/assets/{index-89cbc69d.js → index-06d7a58c.js} +1 -1
- package/assets/{index-355751ab.js → index-10c73e9d.js} +245 -245
- package/assets/{index-9ecf773e.js → index-19891b89.js} +1 -1
- package/assets/{index-2ebd7a81.js → index-206ffe7d.js} +1 -1
- package/assets/{index-f4401a12.js → index-20b33848.js} +1 -1
- package/assets/{index-6e64d31e.js → index-23dd6251.js} +2 -2
- package/assets/{index-2124b7cd.js → index-2cab452e.js} +1 -1
- package/assets/{index-9c2f8893.js → index-2f82abe0.js} +1 -1
- package/assets/{index-a5c29e80.js → index-30a8f53e.js} +1 -1
- package/assets/{index-4bc8eee8.js → index-31022e63.js} +1 -1
- package/assets/{index-a5876580.js → index-32a45902.js} +1 -1
- package/assets/{index-b7605561.js → index-3b678484.js} +1 -1
- package/assets/{index-3cdab001.js → index-3bc5c9df.js} +1 -1
- package/assets/{index-d7ed4af8.js → index-3d19d06c.js} +1 -1
- package/assets/{index-1368749b.js → index-401eba13.js} +1 -1
- package/assets/{index-f4841b7d.js → index-5071722a.js} +1 -1
- package/assets/{index-e7f3149f.css → index-59db4a58.css} +4 -4
- package/assets/{index-e6ba4bbe.js → index-5d7b6c51.js} +1 -1
- package/assets/{index-78689969.js → index-5ece9033.js} +1 -1
- package/assets/{index-33bd3c33.js → index-610c7efb.js} +1 -1
- package/assets/{index-a91bb597.js → index-69a0492a.js} +1 -1
- package/assets/{index-76dbec48.js → index-6d8da0b7.js} +1 -1
- package/assets/{index-863b5c53.js → index-6ec6d7c7.js} +1 -1
- package/assets/{index-ec8cf158.js → index-780a2232.js} +1 -1
- package/assets/{index-b40ed19e.js → index-7ad05b06.js} +1 -1
- package/assets/{index-e332724b.js → index-7f01a27a.js} +1 -1
- package/assets/{index-69ac8519.js → index-877ffe4a.js} +1 -1
- package/assets/{index-e6d2ed90.js → index-8aeaab91.js} +1 -1
- package/assets/{index-66d53073.js → index-8cbb4ff7.js} +2 -2
- package/assets/{index-e2d1a06e.js → index-8d81098b.js} +1 -1
- package/assets/{index-3ad96675.js → index-8fa35f13.js} +1 -1
- package/assets/{index-5f847edd.js → index-93724bad.js} +2 -2
- package/assets/index-9bee2cc7.js +77 -0
- package/assets/{index-2e071cd2.js → index-9d37fa54.js} +1 -1
- package/assets/{index-57dbcd5d.js → index-a151f6d7.js} +1 -1
- package/assets/{index-54323fc3.js → index-a22875e4.js} +2 -2
- package/assets/{index-d7bf28d3.js → index-a69ba1cc.js} +1 -1
- package/assets/{index-6c8c5091.js → index-a6a44c61.js} +1 -1
- package/assets/{index-b41b719c.js → index-aae2726c.js} +1 -1
- package/assets/{index-8bdd54b7.js → index-ad63abcf.js} +1 -1
- package/assets/{index-375e28ad.js → index-b3691f6b.js} +1 -1
- package/assets/{index-276c1c99.js → index-b3889ac8.js} +1 -1
- package/assets/{index-2537319c.js → index-bb13bbcd.js} +1 -1
- package/assets/{index-05f3c18a.js → index-bcedc0e6.js} +1 -1
- package/assets/{index-9e3730d4.js → index-c49dee70.js} +1 -1
- package/assets/{index-c7839713.js → index-cafc0996.js} +1 -1
- package/assets/{index-1c9749d2.js → index-d22cfc35.js} +1 -1
- package/assets/{index-9c119afb.js → index-d2f37bee.js} +1 -1
- package/assets/{index-ffdeacb2.js → index-d44b19e2.js} +1 -1
- package/assets/{index-8b5a06dd.js → index-d77a63d3.js} +1 -1
- package/assets/{index-ab687c6f.js → index-e332040b.js} +1 -1
- package/assets/{index-5b4e7208.js → index-e583ff4e.js} +1 -1
- package/assets/{index-5947dd15.js → index-e9ab8876.js} +1 -1
- package/assets/{index-3c50ab3b.js → index-f49c89c1.js} +1 -1
- package/assets/{index-3d2bada3.js → index-fe892b11.js} +1 -1
- package/assets/{index.es-2aacf970.js → index.es-0f7943d8.js} +1 -1
- package/assets/{index.es-ce0aa5fd.js → index.es-30a0ec70.js} +3 -3
- package/assets/{index.es-ac60fff2.js → index.es-4520fb10.js} +1 -1
- package/assets/{index.web-1837e57d.js → index.web-e2526e19.js} +1 -1
- package/assets/{localBatchGatewayRequest-b2e2be89.js → localBatchGatewayRequest-ff5d42f6.js} +1 -1
- package/assets/{native-8dd45a06.js → native-3e8a86bb.js} +1 -1
- package/assets/{networks-2b49f856.js → networks-fc1b1902.js} +1 -1
- package/assets/{onramp-7ba26b97.js → onramp-cf41485f.js} +1 -1
- package/assets/{openzeppelin-56d83a0f.js → openzeppelin-e72c7daa.js} +1 -1
- package/assets/{ownerOf-558180d2.js → ownerOf-c09a8f45.js} +1 -1
- package/assets/parseNft-147a451f.js +1 -0
- package/assets/{parseSignature-16c7c561.js → parseSignature-6b0b4698.js} +2 -2
- package/assets/{parseSignature-7a759338.js → parseSignature-b975d9a6.js} +1 -1
- package/assets/{passkeys-fd92f407.js → passkeys-bb25d43e.js} +1 -1
- package/assets/{pay-with-exchange-542b5282.js → pay-with-exchange-cd96ece6.js} +1 -1
- package/assets/{prepare-contract-call-ac31a985.js → prepare-contract-call-4be4cc68.js} +1 -1
- package/assets/{qr-overlay-548b2074.js → qr-overlay-fd67e1ca.js} +1 -1
- package/assets/{receive-9119a0fc.js → receive-9ddd4e2d.js} +1 -1
- package/assets/{redirect-state-202ec690.js → redirect-state-301cb22c.js} +1 -1
- package/assets/{resolveImplementation-ffd32467.js → resolveImplementation-6b55308f.js} +1 -1
- package/assets/{rpc-4fa5fbde.js → rpc-83ca4b71.js} +1 -1
- package/assets/{secp256k1-61174a68.js → secp256k1-44255658.js} +1 -1
- package/assets/{secp256k1-587b447b.js → secp256k1-4ab38443.js} +1 -1
- package/assets/{secp256k1-2e39eaab.js → secp256k1-ac683ebc.js} +1 -1
- package/assets/{send-5e9549ca.js → send-7e34f1e6.js} +1 -1
- package/assets/{send-batch-transaction-16b5b747.js → send-batch-transaction-429c82ee.js} +1 -1
- package/assets/{send-eip712-transaction-67b51817.js → send-eip712-transaction-20a9b9ed.js} +1 -1
- package/assets/send-gasless-transaction-0435da18.js +1 -0
- package/assets/{send-transaction-5984dc09.js → send-transaction-c3053b90.js} +1 -1
- package/assets/{session-proposal-548687be.js → session-proposal-d1473b74.js} +1 -1
- package/assets/{session-request-543a34de.js → session-request-f0a8f695.js} +1 -1
- package/assets/{sha256-865a5e2e.js → sha256-937f482f.js} +1 -1
- package/assets/{signing-67cb53a5.js → signing-6d6682ec.js} +2 -2
- package/assets/{socials-1c5f45aa.js → socials-d1713bee.js} +1 -1
- package/assets/{swaps-a0b58cae.js → swaps-8bad12fe.js} +1 -1
- package/assets/{thirdweb-d54893e0.js → thirdweb-73096eef.js} +2 -2
- package/assets/{to-serializable-transaction-2ea802ff.js → to-serializable-transaction-9e540f8c.js} +2 -2
- package/assets/{totalSupply-f714505e.js → totalSupply-7e83596b.js} +1 -1
- package/assets/{transaction-e500e7c4.js → transaction-ea614a5a.js} +1 -1
- package/assets/{transactionReceipt-c6fe2381.js → transactionReceipt-1e425ab1.js} +1 -1
- package/assets/{transactions-9a79e8f9.js → transactions-a47e2cb5.js} +1 -1
- package/assets/{tslib.es6-b444c8f1.js → tslib.es6-24024d67.js} +1 -1
- package/assets/{utils-74c631d9.js → utils-dddc86ba.js} +1 -1
- package/assets/{verifyHash-34edded7.js → verifyHash-b21b75c2.js} +1 -1
- package/assets/{w3m-modal-0795c078.js → w3m-modal-e914d462.js} +1 -1
- package/assets/{w3m-modal-906aa735.js → w3m-modal-ff2f112d.js} +1 -1
- package/assets/{wait-for-tx-receipt-dbf6b521.js → wait-for-tx-receipt-50389b4e.js} +1 -1
- package/assets/{wallets-331c410d.js → wallets-4e23dd0f.js} +4 -4
- package/assets/{web-connector-3a1204fd.js → web-connector-351693f5.js} +2 -2
- package/assets/{writeContract-f6b81199.js → writeContract-03e44e49.js} +2 -2
- package/assets/{zora-sepolia-eaf59a0b.js → zora-sepolia-72e60034.js} +1 -1
- package/assets/{zoraTestnet-55836178.js → zoraTestnet-1485f0af.js} +1 -1
- package/index.html +4 -4
- package/package.json +3 -3
- package/assets/decimals-37678a25.js +0 -1
- package/assets/eth_estimateGas-79dc1763.js +0 -1
- package/assets/features-0025dc16.js +0 -1
- package/assets/index-7ee82e4f.js +0 -77
- package/assets/parseNft-93d99682.js +0 -1
- package/assets/send-gasless-transaction-8bdf3649.js +0 -1
package/assets/index-7ee82e4f.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
var eE=Object.defineProperty;var tE=(e,t,r)=>t in e?eE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ur=(e,t,r)=>(tE(e,typeof t!="symbol"?t+"":t,r),r),Hh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var ve=(e,t,r)=>(Hh(e,t,"read from private field"),r?r.call(e):t.get(e)),Ot=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Pt=(e,t,r,n)=>(Hh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var ad=(e,t,r,n)=>({set _(s){Pt(e,t,s,r)},get _(){return ve(e,t,n)}}),gt=(e,t,r)=>(Hh(e,t,"access private method"),r);import{M as rE,O as nE,P as iE,Q as j4,R as sE,S as aE,T as oE,U as cE,V as uE,W as lE,X as dE,Z as fE,Y as Xy,$ as _l,a0 as oh,a1 as la,a2 as $4,a3 as dy,a4 as V4,a5 as yg,a6 as qt,a7 as Ln,a8 as wl,a9 as jr,aa as xl,ab as js,ac as Ul,ad as Qy,ae as e2,af as eo,ag as F4,ah as H4,ai as Ss,aj as G4,ak as fy,al as to,am as z4,an as W4,ao as Y4,ap as hE,aq as pE,ar as yE,as as gE,at as mE,au as J4,av as Z4,aw as ef,ax as bE,ay as vE,az as _E,aA as wE,aB as EE,aC as AE,aD as SE,aE as PE,aF as TE,aG as IE,aH as CE,aI as RE,aJ as kE,aK as ME,aL as OE,aM as NE,aN as DE,aO as xE,aP as UE,aQ as BE,aR as LE,aS as KE,aT as qE,aU as jE,aV as $E,aW as VE,aX as FE,aY as HE,aZ as GE,a_ as zE,a$ as WE,b0 as YE,b1 as JE,b2 as ZE,b3 as XE,b4 as QE,b5 as eA,b6 as tA,b7 as rA,b8 as nA,b9 as iA,ba as sA,bb as aA,bc as oA,bd as cA,be as uA,bf as lA,bg as dA,bh as fA,bi as hA,bj as pA,bk as yA,bl as gA,bm as mA,bn as bA,bo as vA,bp as _A,bq as wA,br as EA,bs as AA,bt as SA,bu as PA,bv as TA,bw as IA,bx as CA,by as RA,bz as kA,bA as MA,bB as OA,bC as NA,bD as DA,bE as xA,bF as X4,bG as Q4,bH as e8,bI as t8,bJ as r8,bK as n8,bL as i8,bM as s8,bN as a8,bO as o8,f as Bl,B as at,b as Mr,i as Tt,K as uo,e as c8,c as UA,q as BA,w as LA,v as ro,bP as KA,g as qA}from"./index-355751ab.js";import{d as $e,e as u8,r as jA,a as $A,c as Kn,b as VA}from"./tslib.es6-b444c8f1.js";import{c as FA}from"./index-8b5a06dd.js";import{_ as HA}from"./index-2ebd7a81.js";import{c as Fr}from"./index-1c9749d2.js";import{r as GA,i as zA}from"./index-9c2f8893.js";import{s as WA,w as YA}from"./index-5b4e7208.js";function JA(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const ZA=Object.freeze(Object.defineProperty({__proto__:null,decode:rE,encode:nE},Symbol.toStringTag,{value:"Module"})),XA="Ξ",l8=Object.freeze(Object.defineProperty({__proto__:null,AddressZero:iE,EtherSymbol:XA,HashZero:j4,MaxInt256:sE,MaxUint256:aE,MinInt256:oE,NegativeOne:cE,One:uE,Two:lE,WeiPerEther:dE,Zero:fE},Symbol.toStringTag,{value:"Module"}));function QA(e){const t=Xy(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return _l(oh([t,j4]).slice(0,32))}function eS(e){const t=la(e);if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;t[r-1]===0;)r--;return $4(t.slice(0,r))}function tS(e){if(e.length%4!==0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function t2(e,t){t||(t=function(s){return[parseInt(s,16)]});let r=0,n={};return e.split(",").forEach(s=>{let i=s.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])}),n}function d8(e){let t=0;return e.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let s=t+parseInt(n[0],16);return t=parseInt(n[1],16),{l:s,h:t}})}function r2(e,t){let r=0;for(let n=0;n<t.length;n++){let s=t[n];if(r+=s.l,e>=r&&e<=r+s.h&&(e-r)%(s.d||1)===0){if(s.e&&s.e.indexOf(e-r)!==-1)continue;return s}}return null}const rS=d8("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),nS="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(e=>parseInt(e,16)),iS=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],sS=t2("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),aS=t2("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),oS=t2("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",tS),cS=d8("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function uS(e){return e.reduce((t,r)=>(r.forEach(n=>{t.push(n)}),t),[])}function lS(e){return!!r2(e,rS)}function dS(e){let t=r2(e,iS);if(t)return[e+t.s];let r=sS[e];if(r)return r;let n=aS[e];if(n)return[e+n[0]];let s=oS[e];return s||null}function fS(e){return!!r2(e,cS)}function hS(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=dy(e);t=uS(t.map(n=>{if(nS.indexOf(n)>=0)return[];if(n>=65024&&n<=65039)return[];let s=dS(n);return s||[n]})),t=dy(yg(t),V4.NFKC),t.forEach(n=>{if(fS(n))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),t.forEach(n=>{if(lS(n))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let r=yg(t);if(r.substring(0,1)==="-"||r.substring(2,4)==="--"||r.substring(r.length-1)==="-")throw new Error("invalid hyphen");return r}let al=null;try{if(al=WebSocket,al==null)throw new Error("inject please")}catch{const t=new qt(Ln);al=function(){t.throwError("WebSockets not supported in this environment",qt.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Gh=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function d(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,d)}c((n=n.apply(e,t||[])).next())})};const od=new qt(Ln);let pS=1;class ch extends wl{constructor(t,r){r==="any"&&od.throwError("WebSocketProvider does not support 'any' network yet",qt.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof t=="string"?super(t,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof t=="string"?jr(this,"_websocket",new al(this.connection.url)):jr(this,"_websocket",t),jr(this,"_requests",{}),jr(this,"_subs",{}),jr(this,"_subIds",{}),jr(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(s=>{this.websocket.send(this._requests[s].payload)})},this.websocket.onmessage=s=>{const i=s.data,o=JSON.parse(i);if(o.id!=null){const a=String(o.id),d=this._requests[a];if(delete this._requests[a],o.result!==void 0)d.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(d.payload),response:o.result,provider:this});else{let c=null;o.error?(c=new Error(o.error.message||"unknown error"),jr(c,"code",o.error.code||null),jr(c,"response",i)):c=new Error("unknown error"),d.callback(c,void 0),this.emit("debug",{action:"response",error:c,request:JSON.parse(d.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){od.throwError("cannot reset events block on WebSocketProvider",qt.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){od.throwError("cannot set polling interval on WebSocketProvider",qt.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Gh(this,void 0,void 0,function*(){return null})}set polling(t){t&&od.throwError("cannot set polling on WebSocketProvider",qt.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,r){const n=pS++;return new Promise((s,i)=>{function o(d,c){return d?i(d):s(c)}const a=JSON.stringify({method:t,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(n)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,r,n){return Gh(this,void 0,void 0,function*(){let s=this._subIds[t];s==null&&(s=Promise.all(r).then(o=>this.send("eth_subscribe",o)),this._subIds[t]=s);const i=yield s;this._subs[i]={tag:t,processFunc:n}})}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=xl.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(t.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const s=n.hash;this.getTransactionReceipt(s).then(i=>{i&&this.emit(s,i)})};r(t),this._subscribe("tx",["newHeads"],n=>{this._events.filter(s=>s.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t);break}}_stopEvent(t){let r=t.tag;if(t.type==="tx"){if(this._events.filter(s=>s.type==="tx").length)return;r="tx"}else if(this.listenerCount(t.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(s=>{this._subs[s]&&(delete this._subs[s],this.send("eth_unsubscribe",[s]))}))}destroy(){return Gh(this,void 0,void 0,function*(){this.websocket.readyState===al.CONNECTING&&(yield new Promise(t=>{this.websocket.onopen=function(){t(!0)},this.websocket.onerror=function(){t(!1)}})),this.websocket.close(1e3)})}}const gg=new qt(Ln),tf="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class f8 extends ch{constructor(t,r){const n=new n2(t,r),s=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(s,n.network),jr(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===tf}}class n2 extends js{static getWebSocketProvider(t,r){return new f8(t,r)}static getApiKey(t){return t==null?tf:(t&&typeof t!="string"&&gg.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"sepolia":n="eth-sepolia.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"arbitrum-sepolia":n="arb-sepolia.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;case"optimism-sepolia":n="opt-sepolia.g.alchemy.com/v2/";break;default:gg.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(s,i)=>(r===tf&&Ul(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===tf}}const yS=new qt(Ln),cd="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function gS(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"sepolia":return"rpc.ankr.com/eth_sepolia/";case"matic":return"rpc.ankr.com/polygon/";case"maticmum":return"rpc.ankr.com/polygon_mumbai/";case"optimism":return"rpc.ankr.com/optimism/";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet/";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return yS.throwArgumentError("unsupported network","name",e)}class h8 extends js{isCommunityResource(){return this.apiKey===cd}static getApiKey(t){return t??cd}static getUrl(t,r){r==null&&(r=cd);const n={allowGzip:!0,url:"https://"+gS(t.name)+r,throttleCallback:(s,i)=>(r.apiKey===cd&&Ul(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var mS=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function d(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,d)}c((n=n.apply(e,t||[])).next())})};const mg=new qt(Ln);class p8 extends js{static getApiKey(t){return t!=null&&mg.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="https://cloudflare-eth.com/";break;default:mg.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return mS(this,void 0,void 0,function*(){return t==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,t,r)})}}var ud=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function d(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,d)}c((n=n.apply(e,t||[])).next())})};const Ts=new qt(Ln);function bg(e){const t={};for(let r in e){if(e[r]==null)continue;let n=e[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=F4(_l(n)):r==="accessList"?n="["+H4(n).map(s=>`{address:"${s.address}",storageKeys:["${s.storageKeys.join('","')}"]}`).join(",")+"]":n=_l(n),t[r]=n)}return t}function bS(e){if(e.status==0&&(e.message==="No records found"||e.message==="No transactions found"))return e.result;if(e.status!=1||typeof e.message!="string"||!e.message.match(/^OK/)){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function vg(e){if(e&&e.status==0&&e.message=="NOTOK"&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if(e.jsonrpc!="2.0"){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function _g(e){if(e==="pending")throw new Error("pending not supported");return e==="latest"?e:parseInt(e.substring(2),16)}function zh(e,t,r){if(e==="call"&&t.code===qt.errors.SERVER_ERROR){const s=t.error;if(s&&(s.message.match(/reverted/i)||s.message.match(/VM execution error/i))){let i=s.data;if(i&&(i="0x"+i.replace(/^.*0x/i,"")),Ss(i))return i;Ts.throwError("missing revert data in call exception",qt.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===qt.errors.SERVER_ERROR&&(t.error&&typeof t.error.message=="string"?n=t.error.message:typeof t.body=="string"?n=t.body:typeof t.responseText=="string"&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&Ts.throwError("insufficient funds for intrinsic transaction cost",qt.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Ts.throwError("nonce has already been used",qt.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&Ts.throwError("replacement fee too low",qt.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&Ts.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",qt.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class y8 extends Qy{constructor(t,r){super(t),jr(this,"baseUrl",this.getBaseUrl()),jr(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return Ts.throwArgumentError("unsupported network","network",this.network.name)}getUrl(t,r){const n=Object.keys(r).reduce((i,o)=>{const a=r[o];return a!=null&&(i+=`&${o}=${a}`),i},""),s=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${n}${s}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}fetch(t,r,n){return ud(this,void 0,void 0,function*(){const s=n?this.getPostUrl():this.getUrl(t,r),i=n?this.getPostData(t,r):null,o=t==="proxy"?vg:bS;this.emit("debug",{action:"request",request:s,provider:this});const a={url:s,throttleSlotInterval:1e3,throttleCallback:(l,u)=>(this.isCommunityResource()&&Ul(),Promise.resolve(!0))};let d=null;i&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},d=Object.keys(i).map(l=>`${l}=${i[l]}`).join("&"));const c=yield e2(a,d,o||vg);return this.emit("debug",{action:"response",request:s,response:eo(c),provider:this}),c})}detectNetwork(){return ud(this,void 0,void 0,function*(){return this.network})}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return ud(this,void 0,void 0,function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(s=>zh("sendTransaction",s,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const s=bg(r.transaction);s.module="proxy",s.action="eth_call";try{return yield this.fetch("proxy",s,!0)}catch(i){return zh("call",i,r.transaction)}}case"estimateGas":{const s=bg(r.transaction);s.module="proxy",s.action="eth_estimateGas";try{return yield this.fetch("proxy",s,!0)}catch(i){return zh("estimateGas",i,r.transaction)}}case"getLogs":{const s={action:"getLogs"};if(r.filter.fromBlock&&(s.fromBlock=_g(r.filter.fromBlock)),r.filter.toBlock&&(s.toBlock=_g(r.filter.toBlock)),r.filter.address&&(s.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&Ts.throwError("unsupported topic count",qt.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&Ts.throwError("unsupported topic format",qt.errors.UNSUPPORTED_OPERATION,{topic0:a}),s.topic0=a}const i=yield this.fetch("logs",s);let o={};for(let a=0;a<i.length;a++){const d=i[a];if(d.blockHash==null){if(o[d.blockNumber]==null){const c=yield this.getBlock(d.blockNumber);c&&(o[d.blockNumber]=c.hash)}d.blockHash=o[d.blockNumber]}}return i}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd)}return n.perform.call(this,t,r)})}getHistory(t,r,n){return ud(this,void 0,void 0,function*(){const s={action:"txlist",address:yield this.resolveName(t),startblock:r??0,endblock:n??99999999,sort:"asc"};return(yield this.fetch("account",s)).map(o=>{["contractAddress","to"].forEach(function(d){o[d]==""&&delete o[d]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function g8(e){e=e.slice();for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var vf=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function d(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,d)}c((n=n.apply(e,t||[])).next())})};const da=new qt(Ln);function ld(){return new Date().getTime()}function wg(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(n==null)return null;t?t.name===n.name&&t.chainId===n.chainId&&(t.ensAddress===n.ensAddress||t.ensAddress==null&&n.ensAddress==null)||da.throwArgumentError("provider mismatch","networks",e):t=n}return t}function Eg(e,t){e=e.slice().sort();const r=Math.floor(e.length/2);if(e.length%2)return e[r];const n=e[r-1],s=e[r];return t!=null&&Math.abs(n-s)>t?null:(n+s)/2}function za(e){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return JSON.stringify(e);if(typeof e=="string")return e;if(xl.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map(t=>za(t)));if(typeof e=="object"){const t=Object.keys(e);return t.sort(),"{"+t.map(r=>{let n=e[r];return typeof n=="function"?n="[function]":n=za(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let vS=1;function Ag(e){let t=null,r=null,n=new Promise(o=>{t=function(){r&&(clearTimeout(r),r=null),o()},r=setTimeout(t,e)});const s=o=>(n=n.then(o),n);function i(){return n}return{cancel:t,getPromise:i,wait:s}}const _S=[qt.errors.CALL_EXCEPTION,qt.errors.INSUFFICIENT_FUNDS,qt.errors.NONCE_EXPIRED,qt.errors.REPLACEMENT_UNDERPRICED,qt.errors.UNPREDICTABLE_GAS_LIMIT],wS=["address","args","errorArgs","errorSignature","method","transaction"];function dd(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function ES(e,t){return function(r){const n={};r.forEach(i=>{const o=e(i.result);n[o]||(n[o]={count:0,result:i.result}),n[o].count++});const s=Object.keys(n);for(let i=0;i<s.length;i++){const o=n[s[i]];if(o.count>=t)return o.result}}}function AS(e,t,r){let n=za;switch(t){case"getBlockNumber":return function(s){const i=s.map(a=>a.result);let o=Eg(s.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),i.indexOf(o+1)>=0&&o++,o>=e._highestBlockNumber&&(e._highestBlockNumber=o),e._highestBlockNumber};case"getGasPrice":return function(s){const i=s.map(o=>o.result);return i.sort(),i[Math.floor(i.length/2)]};case"getEtherPrice":return function(s){return Eg(s.map(i=>i.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(s){return s==null?null:(s=to(s),s.confirmations=-1,za(s))};break;case"getBlock":r.includeTransactions?n=function(s){return s==null?null:(s=to(s),s.transactions=s.transactions.map(i=>(i=to(i),i.confirmations=-1,i)),za(s))}:n=function(s){return s==null?null:za(s)};break;default:throw new Error("unknown method: "+t)}return ES(n,e.quorum)}function Oo(e,t){return vf(this,void 0,void 0,function*(){const r=e.provider;return r.blockNumber!=null&&r.blockNumber>=t||t===-1?r:z4(()=>new Promise((n,s)=>{setTimeout(function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function SS(e,t,r,n){return vf(this,void 0,void 0,function*(){let s=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return s[r]();case"getEtherPrice":if(s.getEtherPrice)return s.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&Ss(n.blockTag)&&(s=yield Oo(e,t)),s[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&Ss(n.blockTag)&&(s=yield Oo(e,t)),s.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&Ss(n.blockTag)&&(s=yield Oo(e,t)),s[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&Ss(n.blockTag)&&(s=yield Oo(e,t)),r==="call"&&n.blockTag?s[r](n.transaction,n.blockTag):s[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return s[r](n.transactionHash);case"getLogs":{let i=n.filter;return(i.fromBlock&&Ss(i.fromBlock)||i.toBlock&&Ss(i.toBlock))&&(s=yield Oo(e,t)),s.getLogs(i)}}return da.throwError("unknown method error",qt.errors.UNKNOWN_ERROR,{method:r,params:n})})}class m8 extends Qy{constructor(t,r){t.length===0&&da.throwArgumentError("missing providers","providers",t);const n=t.map((o,a)=>{if(G4.isProvider(o)){const l=fy(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:l,priority:1})}const d=to(o);d.priority==null&&(d.priority=1),d.stallTimeout==null&&(d.stallTimeout=fy(o)?2e3:750),d.weight==null&&(d.weight=1);const c=d.weight;return(c%1||c>512||c<1)&&da.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,c),Object.freeze(d)}),s=n.reduce((o,a)=>o+a.weight,0);r==null?r=s/2:r>s&&da.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let i=wg(n.map(o=>o.provider.network));i==null&&(i=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(i),jr(this,"providerConfigs",Object.freeze(n)),jr(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return vf(this,void 0,void 0,function*(){const t=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return wg(t)})}perform(t,r){return vf(this,void 0,void 0,function*(){if(t==="sendTransaction"){const d=yield Promise.all(this.providerConfigs.map(c=>c.provider.sendTransaction(r.signedTransaction).then(l=>l.hash,l=>l)));for(let c=0;c<d.length;c++){const l=d[c];if(typeof l=="string")return l}throw d[0]}this._highestBlockNumber===-1&&t!=="getBlockNumber"&&(yield this.getBlockNumber());const n=AS(this,t,r),s=g8(this.providerConfigs.map(to));s.sort((d,c)=>d.priority-c.priority);const i=this._highestBlockNumber;let o=0,a=!0;for(;;){const d=ld();let c=s.filter(f=>f.runner&&d-f.start<f.stallTimeout).reduce((f,h)=>f+h.weight,0);for(;c<this.quorum&&o<s.length;){const f=s[o++],h=vS++;f.start=ld(),f.staller=Ag(f.stallTimeout),f.staller.wait(()=>{f.staller=null}),f.runner=SS(f,i,t,r).then(y=>{f.done=!0,f.result=y,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:dd(f,ld()),request:{method:t,params:eo(r)},provider:this})},y=>{f.done=!0,f.error=y,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:dd(f,ld()),request:{method:t,params:eo(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:dd(f,null),request:{method:t,params:eo(r)},provider:this}),c+=f.weight}const l=[];s.forEach(f=>{f.done||!f.runner||(l.push(f.runner),f.staller&&l.push(f.staller.getPromise()))}),l.length&&(yield Promise.race(l));const u=s.filter(f=>f.done&&f.error==null);if(u.length>=this.quorum){const f=n(u);if(f!==void 0)return s.forEach(h=>{h.staller&&h.staller.cancel(),h.cancelled=!0}),f;a||(yield Ag(100).getPromise()),a=!1}const p=s.reduce((f,h)=>{if(!h.done||h.error==null)return f;const y=h.error.code;return _S.indexOf(y)>=0&&(f[y]||(f[y]={error:h.error,weight:0}),f[y].weight+=h.weight),f},{});if(Object.keys(p).forEach(f=>{const h=p[f];if(h.weight<this.quorum)return;s.forEach(b=>{b.staller&&b.staller.cancel(),b.cancelled=!0});const y=h.error,m={};wS.forEach(b=>{y[b]!=null&&(m[b]=y[b])}),da.throwError(y.reason||y.message,f,m)}),s.filter(f=>!f.done).length===0)break}return s.forEach(d=>{d.staller&&d.staller.cancel(),d.cancelled=!0}),da.throwError("failed to meet quorum",qt.errors.SERVER_ERROR,{method:t,params:r,results:s.map(d=>dd(d)),provider:this})})}}const b8=null,rf=new qt(Ln),$u="84842078b09946638c03157f83405213";class v8 extends ch{constructor(t,r){const n=new i2(t,r),s=n.connection;s.password&&rf.throwError("INFURA WebSocket project secrets unsupported",qt.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const i=s.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(i,t),jr(this,"apiKey",n.projectId),jr(this,"projectId",n.projectId),jr(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===$u}}class i2 extends js{static getWebSocketProvider(t,r){return new v8(t,r)}static getApiKey(t){const r={apiKey:$u,projectId:$u,projectSecret:null};return t==null||(typeof t=="string"?r.projectId=t:t.projectSecret!=null?(rf.assertArgument(typeof t.projectId=="string","projectSecret requires a projectId","projectId",t.projectId),rf.assertArgument(typeof t.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=t.projectId,r.projectSecret=t.projectSecret):t.projectId&&(r.projectId=t.projectId),r.apiKey=r.projectId),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"optimism-sepolia":n="optimism-sepolia.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;case"arbitrum-sepolia":n="arbitrum-sepolia.infura.io";break;default:rf.throwError("unsupported network",qt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const s={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(i,o)=>(r.projectId===$u&&Ul(),Promise.resolve(!0))};return r.projectSecret!=null&&(s.user="",s.password=r.projectSecret),s}isCommunityResource(){return this.projectId===$u}}class PS extends wl{send(t,r){const n={method:t,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const s={request:n,resolve:null,reject:null},i=new Promise((o,a)=>{s.resolve=o,s.reject=a});return this._pendingBatch.push(s),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const o=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const a=o.map(d=>d.request);return this.emit("debug",{action:"requestBatch",request:eo(a),provider:this}),e2(this.connection,JSON.stringify(a)).then(d=>{this.emit("debug",{action:"response",request:a,response:d,provider:this}),o.forEach((c,l)=>{const u=d[l];if(u.error){const p=new Error(u.error.message);p.code=u.error.code,p.data=u.error.data,c.reject(p)}else c.resolve(u.result)})},d=>{this.emit("debug",{action:"response",error:d,request:a,provider:this}),o.forEach(c=>{c.reject(d)})})},10)),i}}const Wh=new qt(Ln),TS="ETHERS_JS_SHARED";class _8 extends js{static getApiKey(t){return t&&typeof t!="string"&&Wh.throwArgumentError("invalid apiKey","apiKey",t),t||TS}static getUrl(t,r){Wh.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(t.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Wh.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const Sg=new qt(Ln),Pg="62e1ad51b37b8e00394bda3b";class w8 extends js{static getApiKey(t){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return t==null?r.applicationId=Pg:typeof t=="string"?r.applicationId=t:t.applicationSecretKey!=null?(r.applicationId=t.applicationId,r.applicationSecretKey=t.applicationSecretKey):t.applicationId?r.applicationId=t.applicationId:Sg.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:Sg.throwError("unsupported network",qt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const s=`https://${n}/v1/lb/${r.applicationId}`,i={headers:{},url:s};return r.applicationSecretKey!=null&&(i.user="",i.password=r.applicationSecretKey),i}isCommunityResource(){return this.applicationId===Pg}}const Tg=new qt(Ln),IS="919b412a057b5e9c9b6dce193c5a60242d6efadb";class E8 extends js{static getApiKey(t){return t&&typeof t!="string"&&Tg.throwArgumentError("invalid apiKey","apiKey",t),t||IS}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="ethers.quiknode.pro";break;case"goerli":n="ethers.ethereum-goerli.quiknode.pro";break;case"sepolia":n="ethers.ethereum-sepolia.quiknode.pro";break;case"holesky":n="ethers.ethereum-holesky.quiknode.pro";break;case"arbitrum":n="ethers.arbitrum-mainnet.quiknode.pro";break;case"arbitrum-goerli":n="ethers.arbitrum-goerli.quiknode.pro";break;case"arbitrum-sepolia":n="ethers.arbitrum-sepolia.quiknode.pro";break;case"base":n="ethers.base-mainnet.quiknode.pro";break;case"base-goerli":n="ethers.base-goerli.quiknode.pro";break;case"base-spolia":n="ethers.base-sepolia.quiknode.pro";break;case"bnb":n="ethers.bsc.quiknode.pro";break;case"bnbt":n="ethers.bsc-testnet.quiknode.pro";break;case"matic":n="ethers.matic.quiknode.pro";break;case"maticmum":n="ethers.matic-testnet.quiknode.pro";break;case"optimism":n="ethers.optimism.quiknode.pro";break;case"optimism-goerli":n="ethers.optimism-goerli.quiknode.pro";break;case"optimism-sepolia":n="ethers.optimism-sepolia.quiknode.pro";break;case"xdai":n="ethers.xdai.quiknode.pro";break;default:Tg.throwArgumentError("unsupported network","network",arguments[0])}return"https://"+n+"/"+r}}const Ig=new qt(Ln);function s2(e,t){if(e==null&&(e="homestead"),typeof e=="string"){const n=e.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new wl(e);case"ws":case"wss":return new ch(e);default:Ig.throwArgumentError("unsupported URL scheme","network",e)}}const r=W4(e);return(!r||!r._defaultProvider)&&Ig.throwError("unsupported getDefaultProvider network",qt.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:m8,AlchemyProvider:n2,AnkrProvider:h8,CloudflareProvider:p8,EtherscanProvider:y8,InfuraProvider:i2,JsonRpcProvider:wl,NodesmithProvider:_8,PocketProvider:w8,QuickNodeProvider:E8,Web3Provider:Y4,IpcProvider:b8},t)}const A8=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:n2,AlchemyWebSocketProvider:f8,AnkrProvider:h8,BaseProvider:Qy,CloudflareProvider:p8,EtherscanProvider:y8,FallbackProvider:m8,Formatter:hE,InfuraProvider:i2,InfuraWebSocketProvider:v8,IpcProvider:b8,JsonRpcBatchProvider:PS,JsonRpcProvider:wl,JsonRpcSigner:pE,NodesmithProvider:_8,PocketProvider:w8,Provider:G4,QuickNodeProvider:E8,Resolver:yE,StaticJsonRpcProvider:gE,UrlJsonRpcProvider:js,Web3Provider:Y4,WebSocketProvider:ch,getDefaultProvider:s2,getNetwork:W4,isCommunityResourcable:mE,isCommunityResource:fy,showThrottleMessage:Ul},Symbol.toStringTag,{value:"Module"})),CS="solidity/5.8.0",RS=new RegExp("^bytes([0-9]+)$"),kS=new RegExp("^(u?int)([0-9]*)$"),MS=new RegExp("^(.*)\\[([0-9]*)\\]$"),OS="0000000000000000000000000000000000000000000000000000000000000000",Va=new qt(CS);function S8(e,t,r){switch(e){case"address":return r?ef(t,32):la(t);case"string":return Xy(t);case"bytes":return la(t);case"bool":return t=t?"0x01":"0x00",r?ef(t,32):la(t)}let n=e.match(kS);if(n){let s=parseInt(n[2]||"256");return(n[2]&&String(s)!==n[2]||s%8!==0||s===0||s>256)&&Va.throwArgumentError("invalid number type","type",e),r&&(s=256),t=xl.from(t).toTwos(s),ef(t,s/8)}if(n=e.match(RS),n){const s=parseInt(n[1]);return(String(s)!==n[1]||s===0||s>32)&&Va.throwArgumentError("invalid bytes type","type",e),la(t).byteLength!==s&&Va.throwArgumentError(`invalid value for ${e}`,"value",t),r?la((t+OS).substring(0,66)):t}if(n=e.match(MS),n&&Array.isArray(t)){const s=n[1];parseInt(n[2]||String(t.length))!=t.length&&Va.throwArgumentError(`invalid array length for ${e}`,"value",t);const o=[];return t.forEach(function(a){o.push(S8(s,a,!0))}),oh(o)}return Va.throwArgumentError("invalid type","type",e)}function a2(e,t){e.length!=t.length&&Va.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach(function(n,s){r.push(S8(n,t[s]))}),_l(oh(r))}function NS(e,t){return J4(a2(e,t))}function DS(e,t){return Z4(a2(e,t))}const P8=Object.freeze(Object.defineProperty({__proto__:null,AbiCoder:bE,ConstructorFragment:vE,ErrorFragment:_E,EventFragment:wE,FormatTypes:EE,Fragment:AE,FunctionFragment:SE,HDNode:PE,Indexed:TE,Interface:IE,LogDescription:CE,Logger:qt,ParamType:RE,RLP:kE,SigningKey:ME,get SupportedAlgorithm(){return OE},TransactionDescription:NE,get TransactionTypes(){return DE},get UnicodeNormalizationForm(){return V4},Utf8ErrorFuncs:xE,get Utf8ErrorReason(){return UE},_TypedDataEncoder:BE,_fetchData:LE,_toEscapedUtf8String:KE,accessListify:H4,arrayify:la,base58:qE,base64:ZA,checkProperties:jE,checkResultErrors:$E,commify:VE,computeAddress:FE,computeHmac:HE,computePublicKey:GE,concat:oh,deepCopy:eo,defaultAbiCoder:zE,defaultPath:WE,defineReadOnly:jr,dnsEncode:YE,entropyToMnemonic:JE,fetchJson:e2,formatBytes32String:QA,formatEther:ZE,formatUnits:XE,getAccountPath:QE,getAddress:eA,getContractAddress:tA,getCreate2Address:rA,getIcapAddress:nA,getJsonWalletAddress:iA,getStatic:sA,hashMessage:aA,hexConcat:oA,hexDataLength:cA,hexDataSlice:uA,hexStripZeros:lA,hexValue:F4,hexZeroPad:dA,hexlify:_l,id:fA,isAddress:hA,isBytes:pA,isBytesLike:yA,isHexString:Ss,isValidMnemonic:gA,isValidName:mA,joinSignature:bA,keccak256:J4,mnemonicToEntropy:vA,mnemonicToSeed:_A,namehash:wA,nameprep:hS,parseBytes32String:eS,parseEther:EA,parseTransaction:AA,parseUnits:SA,poll:z4,randomBytes:PA,recoverAddress:TA,recoverPublicKey:IA,resolveProperties:CA,ripemd160:RA,serializeTransaction:kA,sha256:Z4,sha512:MA,shallowCopy:to,shuffled:g8,solidityKeccak256:NS,solidityPack:a2,soliditySha256:DS,splitSignature:OA,stripZeros:NA,toUtf8Bytes:Xy,toUtf8CodePoints:dy,toUtf8String:$4,verifyMessage:DA,verifyTypedData:xA,zeroPad:ef},Symbol.toStringTag,{value:"Module"})),o2="ethers/5.8.0",T8=new qt(o2),I8=Object.freeze(Object.defineProperty({__proto__:null,BaseContract:X4,BigNumber:xl,Contract:Q4,ContractFactory:e8,FixedNumber:t8,Signer:r8,VoidSigner:n8,Wallet:i8,Wordlist:s8,constants:l8,get errors(){return a8},getDefaultProvider:s2,logger:T8,providers:A8,utils:P8,version:o2,wordlists:o8},Symbol.toStringTag,{value:"Module"}));try{const e=window;e._ethers==null&&(e._ethers=I8)}catch{}const xS=Object.freeze(Object.defineProperty({__proto__:null,BaseContract:X4,BigNumber:xl,Contract:Q4,ContractFactory:e8,FixedNumber:t8,Signer:r8,VoidSigner:n8,Wallet:i8,Wordlist:s8,constants:l8,get errors(){return a8},ethers:I8,getDefaultProvider:s2,logger:T8,providers:A8,utils:P8,version:o2,wordlists:o8},Symbol.toStringTag,{value:"Module"}));var c2={},Yh={},Jh={},No={},Zh={},Hs={},Xh={},Qh={};const US="@pushprotocol/restapi",BS="1.7.32",LS="commonjs",KS={registry:"https://registry.npmjs.org/"},qS={ethers:"^5.0.0 || ^6.0.0"},jS={ethers:{optional:!0}},$S={"@metamask/eth-sig-util":"^5.0.2",buffer:"^6.0.3","crypto-js":"^4.1.1",immer:"^10.0.2",joi:"^17.9.2",livepeer:"^2.5.8","lru-cache":"^10.1.0",openpgp:"^5.5.0","simple-peer":"^9.11.1","socket.io-client":"^4.7.2","video-stream-merger":"^4.0.1",viem:"^2.28.0",axios:"^0.27.2",uuid:"^9.0.0","unique-names-generator":"^4.7.1",tslib:"^2.3.0"},VS={test:"TS_NODE_PROJECT='./tsconfig.mocha.json' NODE_OPTIONS='--loader ts-node/esm' DOTENV_CONFIG_PATH='./tests/.env' mocha -r ts-node/register -r dotenv/config 'tests/**/*.test.ts' --timeout 1200000 --require tests/root.ts --serial"},FS={"@types/chai":"^4.3.4","@types/chai-as-promised":"^7.1.5","@types/crypto-js":"^4.1.1","@types/mocha":"^10.0.1",chai:"^4.3.7","chai-as-promised":"^7.1.1",envfile:"^7.1.0",mocha:"^10.2.0","mocha-typescript":"^1.1.17","ts-node":"^10.9.1",typescript:"^5.0.2",undici:"^6.21.2","web-streams-polyfill":"^4.1.0","@ethersproject/providers":"^5.7.2","@lit-protocol/auth-browser":"^7.0.5","@lit-protocol/auth-helpers":"^7.0.5","@lit-protocol/constants":"^7.0.5","@lit-protocol/contracts-sdk":"^7.0.5","@lit-protocol/lit-auth-client":"^7.0.5","@lit-protocol/lit-node-client":"^7.0.5","@lit-protocol/pkp-ethers":"^7.0.5","@lit-protocol/types":"^7.0.5","@lit-protocol/wrapped-keys":"^7.0.3","@pushprotocol/restapi":"^1.7.32-exp.1","@zerodev/hooks":"^5.3.0","@zerodev/intent":"^0.0.7","@zerodev/multi-chain-ecdsa-validator":"^5.4.2","@zerodev/permissions":"^5.5.0","@zerodev/remote-signer":"^5.3.0","@zerodev/session-key":"^5.5.0","@zerodev/weighted-ecdsa-validator":"^5.4.0",dotenv:"^16.3.1",ethers:"^5.7.2","isomorphic-fetch":"^3.0.0","@zerodev/ecdsa-validator":"^5.4.7","@zerodev/sdk":"^5.4.29"},HS="./src/index.js",GS="./src/index.d.ts",C8={name:US,version:BS,type:LS,publishConfig:KS,peerDependencies:qS,peerDependenciesMeta:jS,dependencies:$S,scripts:VS,devDependencies:FS,main:HS,typings:GS};var Cg;function Je(){return Cg||(Cg=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PACKAGE_BUILD=e.ALPHA_FEATURES=e.MessageType=e.ENCRYPTION_TYPE=e.ENV=void 0;const t=C8;var r;(function(i){i.PROD="prod",i.STAGING="staging",i.DEV="dev",i.LOCAL="local"})(r=e.ENV||(e.ENV={}));var n;(function(i){i.PGP_V1="x25519-xsalsa20-poly1305",i.PGP_V2="aes256GcmHkdfSha256",i.PGP_V3="eip191-aes256-gcm-hkdf-sha256",i.NFTPGP_V1="pgpv1:nft",i.SCWPGP_V1="pgpv1:scw"})(n=e.ENCRYPTION_TYPE||(e.ENCRYPTION_TYPE={})),function(i){i.TEXT="Text",i.IMAGE="Image",i.VIDEO="Video",i.AUDIO="Audio",i.FILE="File",i.GIF="GIF",i.MEDIA_EMBED="MediaEmbed",i.META="Meta",i.REACTION="Reaction",i.RECEIPT="Receipt",i.USER_ACTIVITY="UserActivity",i.INTENT="Intent",i.REPLY="Reply",i.COMPOSITE="Composite",i.PAYMENT="Payment"}(e.MessageType||(e.MessageType={})),e.ALPHA_FEATURES={SCALABILITY_V2:"SCALABILITY_V2"},e.PACKAGE_BUILD=t.version.includes("alpha")?"ALPHA":"STABLE";const s={ENV:r,ENCRYPTION_TYPE:n,PAGINATION:{INITIAL_PAGE:1,LIMIT:10,LIMIT_MIN:1,LIMIT_MAX:50},DEFAULT_CHAIN_ID:11155111,DEV_CHAIN_ID:99999,NON_ETH_CHAINS:[137,80002,56,97,10,11155420,2442,1101,421614,42161,122,123,80085,59141,59144,111557560,7560,84532,8453],ETH_CHAINS:[1,11155111],ENC_TYPE_V1:"x25519-xsalsa20-poly1305",ENC_TYPE_V2:"aes256GcmHkdfSha256",ENC_TYPE_V3:"eip191-aes256-gcm-hkdf-sha256",ENC_TYPE_V4:"pgpv1:nft",ENC_TYPE_V5:"pgpv1:scw",ALPHA_FEATURES:e.ALPHA_FEATURES};e.default=s}(Qh)),Qh}var Do={},Rg;function zS(){return Rg||(Rg=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.coreABI=void 0,Do.coreABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"channelType",type:"uint8"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"}],name:"AddChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"bytes",name:"_subGraphData",type:"bytes"}],name:"AddSubGraph",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"}],name:"ChannelBlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_channel",type:"address"},{indexed:!1,internalType:"uint256",name:"totalNotifOptions",type:"uint256"},{indexed:!1,internalType:"string",name:"_notifSettings",type:"string"},{indexed:!1,internalType:"string",name:"_notifDescription",type:"string"}],name:"ChannelNotifcationSettingsAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"ChannelOwnershipTransfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"revoker",type:"address"}],name:"ChannelVerificationRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"verifier",type:"address"}],name:"ChannelVerified",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountClaimed",type:"uint256"}],name:"ChatIncentiveClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountRefunded",type:"uint256"}],name:"DeactivateChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"requestSender",type:"address"},{indexed:!1,internalType:"address",name:"requestReceiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amountForReqReceiver",type:"uint256"},{indexed:!1,internalType:"uint256",name:"feePoolAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"IncentivizeChatReqReceived",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountDeposited",type:"uint256"}],name:"ReactivateChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"rewardAmount",type:"uint256"}],name:"RewardsClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"rewardAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fromEpoch",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tillEpoch",type:"uint256"}],name:"RewardsHarvested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountStaked",type:"uint256"}],name:"Staked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountRefunded",type:"uint256"}],name:"TimeBoundChannelDestroyed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountUnstaked",type:"uint256"}],name:"Unstaked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"},{indexed:!0,internalType:"uint256",name:"amountDeposited",type:"uint256"}],name:"UpdateChannel",type:"event"},{inputs:[],name:"ADD_CHANNEL_MIN_FEES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"CHANNEL_POOL_FUNDS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"CREATE_CHANNEL_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FEE_AMOUNT",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"MIN_POOL_CONTRIBUTION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROTOCOL_POOL_FEES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PUSH_TOKEN_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"REFERRAL_CODE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNISWAP_V2_ROUTER",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"WETH_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"aDaiAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_rewardAmount",type:"uint256"}],name:"addPoolFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_subGraphData",type:"bytes"}],name:"addSubGraph",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_startIndex",type:"uint256"},{internalType:"uint256",name:"_endIndex",type:"uint256"},{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchVerification",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channelAddress",type:"address"}],name:"blockChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_user",type:"address"},{internalType:"uint256",name:"_epochId",type:"uint256"}],name:"calculateEpochRewards",outputs:[{internalType:"uint256",name:"rewards",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"celebUserFunds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"channelById",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channelNotifSettings",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channelUpdateCounter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channels",outputs:[{internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"channelType",type:"uint8"},{internalType:"uint8",name:"channelState",type:"uint8"},{internalType:"address",name:"verifiedBy",type:"address"},{internalType:"uint256",name:"poolContribution",type:"uint256"},{internalType:"uint256",name:"channelHistoricalZ",type:"uint256"},{internalType:"uint256",name:"channelFairShareCount",type:"uint256"},{internalType:"uint256",name:"channelLastUpdate",type:"uint256"},{internalType:"uint256",name:"channelStartBlock",type:"uint256"},{internalType:"uint256",name:"channelUpdateBlock",type:"uint256"},{internalType:"uint256",name:"channelWeight",type:"uint256"},{internalType:"uint256",name:"expiryTime",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"channelsCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"claimChatIncentives",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_notifOptions",type:"uint256"},{internalType:"string",name:"_notifSettings",type:"string"},{internalType:"string",name:"_notifDescription",type:"string"},{internalType:"uint256",name:"_amountDeposited",type:"uint256"}],name:"createChannelSettings",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"_channelType",type:"uint8"},{internalType:"bytes",name:"_identity",type:"bytes"},{internalType:"uint256",name:"_amount",type:"uint256"},{internalType:"uint256",name:"_channelExpiryTime",type:"uint256"}],name:"createChannelWithPUSH",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"daiAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tillEpoch",type:"uint256"}],name:"daoHarvestPaginated",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deactivateChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channelAddress",type:"address"}],name:"destroyTimeBoundChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"epnsCommunicator",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epochDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"epochRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"epochToTotalStakedWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"genesisEpoch",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"getChannelVerfication",outputs:[{internalType:"uint8",name:"verificationStatus",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupFairShareCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupHistoricalZ",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupLastUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupNormalizedWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"requestSender",type:"address"},{internalType:"address",name:"requestReceiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"handleChatRequestData",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"harvestAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_tillEpoch",type:"uint256"}],name:"harvestPaginated",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_pushChannelAdmin",type:"address"},{internalType:"address",name:"_pushTokenAddress",type:"address"},{internalType:"address",name:"_wethAddress",type:"address"},{internalType:"address",name:"_uniswapRouterAddress",type:"address"},{internalType:"address",name:"_lendingPoolProviderAddress",type:"address"},{internalType:"address",name:"_daiAddress",type:"address"},{internalType:"address",name:"_aDaiAddress",type:"address"},{internalType:"uint256",name:"_referralCode",type:"uint256"}],name:"initialize",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initializeStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isMigrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_from",type:"uint256"},{internalType:"uint256",name:"_to",type:"uint256"}],name:"lastEpochRelative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"lendingPoolProviderAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pauseContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"previouslySetEpochRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pushChannelAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"reactivateChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_commAddress",type:"address"}],name:"setEpnsCommunicatorAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newFees",type:"uint256"}],name:"setFeeAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_governanceAddress",type:"address"}],name:"setGovernanceAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newFees",type:"uint256"}],name:"setMinChannelCreationFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newAmount",type:"uint256"}],name:"setMinPoolContribution",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"stake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalStakedAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_newAdmin",type:"address"}],name:"transferPushChannelAdminControl",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unPauseContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unstake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"unverifyChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"bytes",name:"_newIdentity",type:"bytes"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"updateChannelMeta",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"userFeesInfo",outputs:[{internalType:"uint256",name:"stakedAmount",type:"uint256"},{internalType:"uint256",name:"stakedWeight",type:"uint256"},{internalType:"uint256",name:"lastStakedBlock",type:"uint256"},{internalType:"uint256",name:"lastClaimedBlock",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"usersRewardsClaimed",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"verifyChannel",outputs:[],stateMutability:"nonpayable",type:"function"}]),Do}var xo={},kg;function WS(){return kg||(kg=1,Object.defineProperty(xo,"__esModule",{value:!0}),xo.commABI=void 0,xo.commABI=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"address",name:"delegate",type:"address"}],name:"AddDelegate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"_chainName",type:"string"},{indexed:!0,internalType:"uint256",name:"_chainID",type:"uint256"},{indexed:!0,internalType:"address",name:"_channelOwnerAddress",type:"address"},{indexed:!1,internalType:"string",name:"_ethereumChannelAddress",type:"string"}],name:"ChannelAlias",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"bytes",name:"publickey",type:"bytes"}],name:"PublicKeyRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"address",name:"delegate",type:"address"}],name:"RemoveDelegate",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"}],name:"SendNotification",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"}],name:"Subscribe",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"}],name:"Unsubscribe",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_channel",type:"address"},{indexed:!1,internalType:"address",name:"_user",type:"address"},{indexed:!1,internalType:"uint256",name:"_notifID",type:"uint256"},{indexed:!1,internalType:"string",name:"_notifSettings",type:"string"}],name:"UserNotifcationSettingsAdded",type:"event"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"EPNSCoreAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"NAME_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SEND_NOTIFICATION_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SUBSCRIBE_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNSUBSCRIBE_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_delegate",type:"address"}],name:"addDelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchSubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchUnsubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_publicKey",type:"bytes"}],name:"broadcastUserPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"chainID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainName",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"uint256",name:"_notifID",type:"uint256"},{internalType:"string",name:"_notifSettings",type:"string"}],name:"changeUserChannelSettings",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"completeMigration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"delegatedNotificationSenders",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_publicKey",type:"bytes"}],name:"getWalletFromPublicKey",outputs:[{internalType:"address",name:"wallet",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_pushChannelAdmin",type:"address"},{internalType:"string",name:"_chainName",type:"string"}],name:"initialize",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isMigrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_user",type:"address"}],name:"isUserSubscribed",outputs:[{internalType:"bool",name:"isSubscriber",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"mapAddressUsers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_startIndex",type:"uint256"},{internalType:"uint256",name:"_endIndex",type:"uint256"},{internalType:"address[]",name:"_channelList",type:"address[]"},{internalType:"address[]",name:"_usersList",type:"address[]"}],name:"migrateSubscribeData",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pushChannelAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_delegate",type:"address"}],name:"removeDelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_recipient",type:"address"},{internalType:"bytes",name:"_identity",type:"bytes"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"sendNotifBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_recipient",type:"address"},{internalType:"bytes",name:"_identity",type:"bytes"}],name:"sendNotification",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_coreAddress",type:"address"}],name:"setEPNSCoreAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_governanceAddress",type:"address"}],name:"setGovernanceAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"subscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"channel",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"subscribeBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_user",type:"address"}],name:"subscribeViaCore",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_newAdmin",type:"address"}],name:"transferPushChannelAdminControl",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"unsubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"channel",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"unsubscribeBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"userToChannelNotifs",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"users",outputs:[{internalType:"bool",name:"userActivated",type:"bool"},{internalType:"bool",name:"publicKeyRegistered",type:"bool"},{internalType:"uint256",name:"userStartBlock",type:"uint256"},{internalType:"uint256",name:"subscribedCount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"usersCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"_channelAddress",type:"string"}],name:"verifyChannelAlias",outputs:[],stateMutability:"nonpayable",type:"function"}]),xo}var Uo={},Mg;function YS(){return Mg||(Mg=1,Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.tokenABI=void 0,Uo.tokenABI=[{inputs:[{internalType:"address",name:"account",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"delegator",type:"address"},{indexed:!0,internalType:"address",name:"fromDelegate",type:"address"},{indexed:!0,internalType:"address",name:"toDelegate",type:"address"}],name:"DelegateChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!1,internalType:"uint256",name:"previousBalance",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newBalance",type:"uint256"}],name:"DelegateVotesChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"holder",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"HolderWeightChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DELEGATION_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"born",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint32",name:"",type:"uint32"}],name:"checkpoints",outputs:[{internalType:"uint32",name:"fromBlock",type:"uint32"},{internalType:"uint96",name:"votes",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delegatee",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"delegatee",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"delegateBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegates",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"getCurrentVotes",outputs:[{internalType:"uint96",name:"",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"blockNumber",type:"uint256"}],name:"getPriorVotes",outputs:[{internalType:"uint96",name:"",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"holderDelegation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"holderWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"numCheckpoints",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"holder",type:"address"}],name:"resetHolderWeight",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"delegate",type:"address"}],name:"returnHolderDelegation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"returnHolderRatio",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"value",type:"bool"}],name:"setHolderDelegation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"dst",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"src",type:"address"},{internalType:"address",name:"dst",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}]),Uo}const R8=Bl(FA);var sn={};const Aa=Bl(HA);var Og;function JS(){if(Og)return sn;Og=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.lineaSepoliaTestnet=sn.cyberConnectMainnet=sn.cyberConnectTestnet=sn.berachainTestnet=sn.polygonAmoy=sn.polygonZkEvmCordona=void 0;const e=Aa;return sn.polygonZkEvmCordona=(0,e.defineChain)({id:2442,name:"Polygon zkEVM Cardona Testnet",network:"polygon-zkevm-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.cardona.zkevm-rpc.com/"]},public:{http:["https://rpc.cardona.zkevm-rpc.com/"]}},blockExplorers:{default:{name:"Polygon zkEVM Cardona",url:" https://cardona-zkevm.polygonscan.com/"}},testnet:!0}),sn.polygonAmoy=(0,e.defineChain)({id:80002,name:"Polygon Amoy Testnet",network:"polygon-amoy",nativeCurrency:{decimals:18,name:"MATIC",symbol:"MATIC"},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology/"]},public:{http:["https://rpc-amoy.polygon.technology/"]}},blockExplorers:{default:{name:"Polygon Amoy",url:"https://www.oklink.com/amoy"}},testnet:!0}),sn.berachainTestnet=(0,e.defineChain)({id:80085,name:"Berachain Artio",network:"berachain-testnet",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]},public:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain",url:"https://artio.beratrail.io"}},testnet:!0}),sn.cyberConnectTestnet=(0,e.defineChain)({id:111557560,name:"Cyber Testnet",network:"cyberconnect-testent",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber-testnet.alt.technology"]},public:{http:["https://cyber-testnet.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet.cyberscan.co"}},contracts:{multicall3:{address:"0xffc391F0018269d4758AEA1a144772E8FB99545E",blockCreated:304545}},testnet:!0}),sn.cyberConnectMainnet=(0,e.defineChain)({id:7560,name:"Cyber",network:"cyberconnect-mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber.alt.technology"]},public:{http:["https://cyber.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://cyberscan.co",apiUrl:"https://cyberscan.co/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0}}}),sn.lineaSepoliaTestnet=(0,e.defineChain)({id:59141,name:"Linea Sepolia Testnet",network:"linea-sepolia-testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]},public:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.lineascan.build",apiUrl:"https://api-sepolia.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:227427}},testnet:!0}),sn}var Ng;function nn(){return Ng||(Ng=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ALPHA_FEATURE_CONFIG=e.VIEM_CONFIG=e.CHANNEL_TYPE=e.ABIS=e.MIN_TOKEN_BALANCE=e.TOKEN_VIEM_NETWORK_MAP=e.TOKEN=e.CORE_CONFIG=e.VIEM_CORE_CONFIG=e.CHAIN_NAME=e.CHAIN_ID=e.ALIAS_CHAIN_ID=e.ETH_CHAIN_ID=e.API_BASE_URL=void 0;const t=Je(),r=zS(),n=WS(),s=YS(),i=R8,o=JS();e.API_BASE_URL={[t.ENV.PROD]:"https://backend.epns.io/apis",[t.ENV.STAGING]:"https://backend-staging.epns.io/apis",[t.ENV.DEV]:"https://backend-dev.epns.io/apis",[t.ENV.LOCAL]:"http://localhost:4000/apis"};const a={ETH_MAINNET:"eip155:1",ETH_SEPOLIA:"eip155:11155111",POLYGON_MAINNET:"eip155:137",POLYGON_AMOY:"eip155:80002",BSC_MAINNET:"eip155:56",BSC_TESTNET:"eip155:97",OPTIMISM_TESTNET:"eip155:11155420",OPTIMISM_MAINNET:"eip155:10",POLYGON_ZK_EVM_TESTNET:"eip155:2442",POLYGON_ZK_EVM_MAINNET:"eip155:1101",ARBITRUM_TESTNET:"eip155:421614",ARBITRUMONE_MAINNET:"eip155:42161",FUSE_TESTNET:"eip155:123",FUSE_MAINNET:"eip155:122",BERACHAIN_TESTNET:"eip155:80085",LINEA_MAINNET:"eip155:59144",LINEA_TESTNET:"eip155:59141",CYBER_CONNECT_TESTNET:"eip155:111557560",CYBER_CONNECT_MAINNET:"eip155:7560",BASE_TESTNET:"eip155:84532",BASE_MAINNET:"eip155:8453"};e.ETH_CHAIN_ID={[t.ENV.PROD]:1,[t.ENV.STAGING]:11155111,[t.ENV.DEV]:11155111,[t.ENV.LOCAL]:11155111},e.ALIAS_CHAIN_ID={POLYGON:{[t.ENV.PROD]:137,[t.ENV.STAGING]:80002,[t.ENV.DEV]:80002,[t.ENV.LOCAL]:80002},BSC:{[t.ENV.PROD]:56,[t.ENV.STAGING]:97,[t.ENV.DEV]:97,[t.ENV.LOCAL]:97},OPTIMISM:{[t.ENV.PROD]:10,[t.ENV.STAGING]:11155420,[t.ENV.DEV]:11155420,[t.ENV.LOCAL]:11155420},POLYGONZKEVM:{[t.ENV.PROD]:1101,[t.ENV.STAGING]:2442,[t.ENV.DEV]:2442,[t.ENV.LOCAL]:2442},ARBITRUMONE:{[t.ENV.PROD]:42161,[t.ENV.STAGING]:421614,[t.ENV.DEV]:421614,[t.ENV.LOCAL]:421614},FUSE:{[t.ENV.PROD]:122,[t.ENV.STAGING]:123,[t.ENV.DEV]:123,[t.ENV.LOCAL]:123},BERACHAIN:{[t.ENV.PROD]:0,[t.ENV.STAGING]:80085,[t.ENV.DEV]:80085,[t.ENV.LOCAL]:80085},LINEA:{[t.ENV.PROD]:59144,[t.ENV.STAGING]:59141,[t.ENV.DEV]:59141,[t.ENV.LOCAL]:59141},CYBERCONNECT:{[t.ENV.PROD]:7560,[t.ENV.STAGING]:111557560,[t.ENV.DEV]:111557560,[t.ENV.LOCAL]:111557560},BASE:{[t.ENV.PROD]:8453,[t.ENV.STAGING]:84532,[t.ENV.DEV]:84532,[t.ENV.LOCAL]:84532}},e.CHAIN_ID=Object.assign({ETHEREUM:e.ETH_CHAIN_ID},e.ALIAS_CHAIN_ID),e.CHAIN_NAME={1:"ETHEREUM",11155111:"ETHEREUM",137:"POLYGON",80002:"POLYGON",56:"BSC",97:"BSC",10:"OPTIMISM",11155420:"OPTIMISM",1101:"POLYGONZKEVM",2442:"POLYGONZKEVM",421614:"ARBITRUN",42161:"ARBITRUM",122:"FUSE",123:"FUSE",80085:"BERACHAIN",59144:"LINEA",59141:"LINEA",7560:"CYBER_CONNECT_MAINNET",111557560:"CYBER_CONNECT_TESTNET",8453:"BASE_MAINNET",84532:"BASE_TESTNET"},e.VIEM_CORE_CONFIG={[t.ENV.PROD]:{NETWORK:i.mainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_CORE_CONTRACT:"0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE"},[t.ENV.STAGING]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_CORE_CONTRACT:"0x9d65129223451fbd58fc299c635cd919baf2564c"},[t.ENV.DEV]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"},[t.ENV.LOCAL]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"}},e.CORE_CONFIG={[t.ENV.PROD]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_CORE_CONTRACT:"0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE"},[t.ENV.STAGING]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_CORE_CONTRACT:"0x9d65129223451fbd58fc299c635cd919baf2564c"},[t.ENV.DEV]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"},[t.ENV.LOCAL]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"}};const d={[t.ENV.PROD]:{[a.ETH_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_ZK_EVM_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.ARBITRUMONE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.FUSE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.CYBER_CONNECT_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.LINEA_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0x0d8e75CB5d8873c43c5d9Add71Fd71a09F7Ef890"},[a.BASE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"}},[t.ENV.STAGING]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489b7af21ceb969f49a90e481274966ce9d74d"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x7b9C405e261ba671f008c20D0321f62d08C140EC"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"}},[t.ENV.DEV]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}},[t.ENV.LOCAL]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}}};e.default=d,e.TOKEN={[t.ENV.PROD]:"0xf418588522d5dd018b425E472991E52EBBeEEEEE",[t.ENV.STAGING]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804",[t.ENV.DEV]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804",[t.ENV.LOCAL]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804"},e.TOKEN_VIEM_NETWORK_MAP={[t.ENV.PROD]:i.mainnet,[t.ENV.STAGING]:i.sepolia,[t.ENV.DEV]:i.sepolia,[t.ENV.LOCAL]:i.sepolia},e.MIN_TOKEN_BALANCE={[t.ENV.PROD]:50,[t.ENV.STAGING]:50,[t.ENV.DEV]:50,[t.ENV.LOCAL]:50},e.ABIS={CORE:r.coreABI,COMM:n.commABI,TOKEN:s.tokenABI},e.CHANNEL_TYPE={TIMEBOUND:4,GENERAL:2},e.VIEM_CONFIG={[t.ENV.PROD]:{[a.ETH_MAINNET]:{NETWORK:i.mainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_MAINNET]:{NETWORK:i.polygon,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_MAINNET]:{NETWORK:i.bsc,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_MAINNET]:{NETWORK:i.optimism,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_ZK_EVM_MAINNET]:{NETWORK:i.polygonZkEvm,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.ARBITRUMONE_MAINNET]:{NETWORK:i.arbitrum,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.FUSE_MAINNET]:{NETWORK:i.fuse,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.LINEA_MAINNET]:{NETWORK:i.linea,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0x0d8e75CB5d8873c43c5d9Add71Fd71a09F7Ef890"},[a.CYBER_CONNECT_MAINNET]:{NETWORK:o.cyberConnectMainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BASE_MAINNET]:{NETWORK:i.base,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"}},[t.ENV.STAGING]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489b7af21ceb969f49a90e481274966ce9d74d"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x7b9C405e261ba671f008c20D0321f62d08C140EC"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"}},[t.ENV.DEV]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}},[t.ENV.LOCAL]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}}},e.ALPHA_FEATURE_CONFIG={STABLE:{feature:[]},ALPHA:{feature:[t.default.ALPHA_FEATURES.SCALABILITY_V2]}}}(Xh)),Xh}var Dg;function ZS(){if(Dg)return Hs;Dg=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.getAPIBaseUrls=Hs.getConfig=void 0;const e=nn(),t=(n,{blockchain:s,networkId:i})=>{const o=`${s}:${i}`,a=e.default[n][o];if(!a)throw Error(`
|
|
2
|
-
[Push SDK] - cannot determine config for
|
|
3
|
-
env: ${n},
|
|
4
|
-
blockchain: ${s},
|
|
5
|
-
networkId: ${i}
|
|
6
|
-
`);return a};Hs.getConfig=t;function r(n){if(!n)throw Error("ENV not provided!");return e.API_BASE_URL[n]}return Hs.getAPIBaseUrls=r,Hs}var e0={},t0={},r0={},n0={},Di={},xg;function Sa(){if(xg)return Di;xg=1,Object.defineProperty(Di,"__esModule",{value:!0}),Di.generateRandomSecret=Di.aesDecrypt=Di.aesEncrypt=void 0;const e=Fr,t=({plainText:s,secretKey:i})=>e.AES.encrypt(s,i).toString();Di.aesEncrypt=t;const r=({cipherText:s,secretKey:i})=>e.AES.decrypt(s,i).toString(e.enc.Utf8);Di.aesDecrypt=r;const n=s=>{let i="";const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=o.length;for(let d=0;d<s;d++)i+=o.charAt(Math.floor(Math.random()*a));return i};return Di.generateRandomSecret=n,Di}var an={};/*! OpenPGP.js v5.11.3 - 2025-05-19 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */const In=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Wa=Symbol("doneWritingPromise"),k8=Symbol("doneWritingResolve"),M8=Symbol("doneWritingReject"),Bo=Symbol("readingIndex");class bi extends Array{constructor(){super(),this[Wa]=new Promise((t,r)=>{this[k8]=t,this[M8]=r}),this[Wa].catch(()=>{})}}function _r(e){return e&&e.getReader&&Array.isArray(e)}function Vu(e){if(!_r(e)){const t=e.getWriter(),r=t.releaseLock;return t.releaseLock=()=>{t.closed.catch(function(){}),r.call(t)},t}this.stream=e}bi.prototype.getReader=function(){return this[Bo]===void 0&&(this[Bo]=0),{read:async()=>(await this[Wa],this[Bo]===this.length?{value:void 0,done:!0}:{value:this[this[Bo]++],done:!1})}},bi.prototype.readToEnd=async function(e){await this[Wa];const t=e(this.slice(this[Bo]));return this.length=0,t},bi.prototype.clone=function(){const e=new bi;return e[Wa]=this[Wa].then(()=>{e.push(...this)}),e},Vu.prototype.write=async function(e){this.stream.push(e)},Vu.prototype.close=async function(){this.stream[k8]()},Vu.prototype.abort=async function(e){return this.stream[M8](e),e},Vu.prototype.releaseLock=function(){};const uh=typeof In.process=="object"&&typeof In.process.versions=="object",Ug=uh&&void 0;function bn(e){return _r(e)?"array":In.ReadableStream&&In.ReadableStream.prototype.isPrototypeOf(e)?"web":es&&es.prototype.isPrototypeOf(e)?"ponyfill":Ug&&Ug.prototype.isPrototypeOf(e)?"node":!(!e||!e.getReader)&&"web-like"}function lh(e){return Uint8Array.prototype.isPrototypeOf(e)}function O8(e){if(e.length===1)return e[0];let t=0;for(let s=0;s<e.length;s++){if(!lh(e[s]))throw Error("concatUint8Array: Data must be in the form of a Uint8Array");t+=e[s].length}const r=new Uint8Array(t);let n=0;return e.forEach(function(s){r.set(s,n),n+=s.length}),r}const XS=uh&&void 0,Bg=uh&&void 0;let dh,u2;if(Bg){dh=function(t){let r=!1;return new es({start(n){t.pause(),t.on("data",s=>{r||(XS.isBuffer(s)&&(s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),n.enqueue(s),t.pause())}),t.on("end",()=>{r||n.close()}),t.on("error",s=>n.error(s))},pull(){t.resume()},cancel(n){r=!0,t.destroy(n)}})};class e extends Bg{constructor(r,n){super(n),this._reader=Mi(r)}async _read(r){try{for(;;){const{done:n,value:s}=await this._reader.read();if(n){this.push(null);break}if(!this.push(s))break}}catch(n){this.destroy(n)}}async _destroy(r,n){this._reader.cancel(r).then(n,n)}}u2=function(t,r){return new e(t,r)}}const Lg=new WeakSet,ir=Symbol("externalBuffer");function ui(e){if(this.stream=e,e[ir]&&(this[ir]=e[ir].slice()),_r(e)){const n=e.getReader();return this._read=n.read.bind(n),this._releaseLock=()=>{},void(this._cancel=async()=>{})}let t=bn(e);if(t==="node"&&(e=dh(e)),t){const n=e.getReader();return this._read=n.read.bind(n),this._releaseLock=()=>{n.closed.catch(function(){}),n.releaseLock()},void(this._cancel=n.cancel.bind(n))}let r=!1;this._read=async()=>r||Lg.has(e)?{value:void 0,done:!0}:(r=!0,{value:e,done:!1}),this._releaseLock=()=>{if(r)try{Lg.add(e)}catch{}}}ui.prototype.read=async function(){return this[ir]&&this[ir].length?{done:!1,value:this[ir].shift()}:this._read()},ui.prototype.releaseLock=function(){this[ir]&&(this.stream[ir]=this[ir]),this._releaseLock()},ui.prototype.cancel=function(e){return this._cancel(e)},ui.prototype.readLine=async function(){let e,t=[];for(;!e;){let{done:r,value:n}=await this.read();if(n+="",r)return t.length?ln(t):void 0;const s=n.indexOf(`
|
|
7
|
-
`)+1;s&&(e=ln(t.concat(n.substr(0,s))),t=[]),s!==n.length&&t.push(n.substr(s))}return this.unshift(...t),e},ui.prototype.readByte=async function(){const{done:e,value:t}=await this.read();if(e)return;const r=t[0];return this.unshift(Vr(t,1)),r},ui.prototype.readBytes=async function(e){const t=[];let r=0;for(;;){const{done:n,value:s}=await this.read();if(n)return t.length?ln(t):void 0;if(t.push(s),r+=s.length,r>=e){const i=ln(t);return this.unshift(Vr(i,e)),Vr(i,0,e)}}},ui.prototype.peekBytes=async function(e){const t=await this.readBytes(e);return this.unshift(t),t},ui.prototype.unshift=function(...e){this[ir]||(this[ir]=[]),e.length===1&&lh(e[0])&&this[ir].length&&e[0].length&&this[ir][0].byteOffset>=e[0].length?this[ir][0]=new Uint8Array(this[ir][0].buffer,this[ir][0].byteOffset-e[0].length,this[ir][0].byteLength+e[0].length):this[ir].unshift(...e.filter(t=>t&&t.length))},ui.prototype.readToEnd=async function(e=ln){const t=[];for(;;){const{done:r,value:n}=await this.read();if(r)break;t.push(n)}return e(t)};let hy,N8,{ReadableStream:es,WritableStream:D8,TransformStream:lo}=In;async function x8(){if(lo)return;const[e,t]=await Promise.all([Promise.resolve().then(function(){return AC}),Promise.resolve().then(function(){return CC})]);({ReadableStream:es,WritableStream:D8,TransformStream:lo}=e);const{createReadableStreamWrapper:r}=t;In.ReadableStream&&es!==In.ReadableStream&&(hy=r(es),N8=r(In.ReadableStream))}const ol=uh&&void 0;function Ll(e){let t=bn(e);return t==="node"?dh(e):t==="web"&&hy?hy(e):t?e:new es({start(r){r.enqueue(e),r.close()}})}function U8(e){if(bn(e))return e;const t=new bi;return(async()=>{const r=vn(t);await r.write(e),await r.close()})(),t}function ln(e){return e.some(t=>bn(t)&&!_r(t))?function(t){t=t.map(Ll);const r=L8(async function(i){await Promise.all(s.map(o=>py(o,i)))});let n=Promise.resolve();const s=t.map((i,o)=>Ii(i,(a,d)=>(n=n.then(()=>ts(a,r.writable,{preventClose:o!==t.length-1})),n)));return r.readable}(e):e.some(t=>_r(t))?function(t){const r=new bi;let n=Promise.resolve();return t.forEach((s,i)=>(n=n.then(()=>ts(s,r,{preventClose:i!==t.length-1})),n)),r}(e):typeof e[0]=="string"?e.join(""):ol&&ol.isBuffer(e[0])?ol.concat(e):O8(e)}function Mi(e){return new ui(e)}function vn(e){return new Vu(e)}async function ts(e,t,{preventClose:r=!1,preventAbort:n=!1,preventCancel:s=!1}={}){if(bn(e)&&!_r(e)){e=Ll(e);try{if(e[ir]){const a=vn(t);for(let d=0;d<e[ir].length;d++)await a.ready,await a.write(e[ir][d]);a.releaseLock()}await e.pipeTo(t,{preventClose:r,preventAbort:n,preventCancel:s})}catch{}return}const i=Mi(e=U8(e)),o=vn(t);try{for(;;){await o.ready;const{done:a,value:d}=await i.read();if(a){r||await o.close();break}await o.write(d)}}catch(a){n||await o.abort(a)}finally{i.releaseLock(),o.releaseLock()}}function B8(e,t){const r=new lo(t);return ts(e,r.writable),r.readable}function L8(e){let t,r,n,s=!1,i=!1;return{readable:new es({start(o){n=o},pull(){t?t():s=!0},async cancel(o){i=!0,e&&await e(o),r&&r(o)}},{highWaterMark:0}),writable:new D8({write:async function(o){if(i)throw Error("Stream is cancelled");n.enqueue(o),s?s=!1:(await new Promise((a,d)=>{t=a,r=d}),t=null,r=null)},close:n.close.bind(n),abort:n.error.bind(n)})}}function yr(e,t=()=>{},r=()=>{}){if(_r(e)){const i=new bi;return(async()=>{const o=vn(i);try{const a=await vr(e),d=t(a),c=r();let l;l=d!==void 0&&c!==void 0?ln([d,c]):d!==void 0?d:c,await o.write(l),await o.close()}catch(a){await o.abort(a)}})(),i}if(bn(e))return B8(e,{async transform(i,o){try{const a=await t(i);a!==void 0&&o.enqueue(a)}catch(a){o.error(a)}},async flush(i){try{const o=await r();o!==void 0&&i.enqueue(o)}catch(o){i.error(o)}}});const n=t(e),s=r();return n!==void 0&&s!==void 0?ln([n,s]):n!==void 0?n:s}function Ii(e,t){if(bn(e)&&!_r(e)){let n;const s=new lo({start(a){n=a}}),i=ts(e,s.writable),o=L8(async function(a){n.error(a),await i,await new Promise(setTimeout)});return t(s.readable,o.writable),o.readable}e=U8(e);const r=new bi;return t(e,r),r}function fh(e,t){let r;const n=Ii(e,(s,i)=>{const o=Mi(s);o.remainder=()=>(o.releaseLock(),ts(s,i),n),r=t(o)});return r}function Pa(e){if(_r(e))return e.clone();if(bn(e)){const t=function(r){if(_r(r))throw Error("ArrayStream cannot be tee()d, use clone() instead");if(bn(r)){const n=Ll(r).tee();return n[0][ir]=n[1][ir]=r[ir],n}return[Vr(r),Vr(r)]}(e);return K8(e,t[0]),t[1]}return Vr(e)}function no(e){return _r(e)?Pa(e):bn(e)?new es({start(t){const r=Ii(e,async(n,s)=>{const i=Mi(n),o=vn(s);try{for(;;){await o.ready;const{done:a,value:d}=await i.read();if(a){try{t.close()}catch{}return void await o.close()}try{t.enqueue(d)}catch{}await o.write(d)}}catch(a){t.error(a),await o.abort(a)}});K8(e,r)}}):Vr(e)}function K8(e,t){Object.entries(Object.getOwnPropertyDescriptors(e.constructor.prototype)).forEach(([r,n])=>{r!=="constructor"&&(n.value?n.value=n.value.bind(t):n.get=n.get.bind(t),Object.defineProperty(e,r,n))})}function Vr(e,t=0,r=1/0){if(_r(e))throw Error("Not implemented");if(bn(e)){if(t>=0&&r>=0){let n=0;return B8(e,{transform(s,i){n<r?(n+s.length>=t&&i.enqueue(Vr(s,Math.max(t-n,0),r-n)),n+=s.length):i.terminate()}})}if(t<0&&(r<0||r===1/0)){let n=[];return yr(e,s=>{s.length>=-t?n=[s]:n.push(s)},()=>Vr(ln(n),t,r))}if(t===0&&r<0){let n;return yr(e,s=>{const i=n?ln([n,s]):s;if(i.length>=-r)return n=Vr(i,r),Vr(i,t,r);n=i})}return console.warn(`stream.slice(input, ${t}, ${r}) not implemented efficiently.`),cs(async()=>Vr(await vr(e),t,r))}return e[ir]&&(e=ln(e[ir].concat([e]))),!lh(e)||ol&&ol.isBuffer(e)?e.slice(t,r):(r===1/0&&(r=e.length),e.subarray(t,r))}async function vr(e,t=ln){return _r(e)?e.readToEnd(t):bn(e)?Mi(e).readToEnd(t):e}async function py(e,t){if(bn(e)){if(e.cancel)return e.cancel(t);if(e.destroy)return e.destroy(t),await new Promise(setTimeout),t}}function cs(e){const t=new bi;return(async()=>{const r=vn(t);try{await r.write(await e()),await r.close()}catch(n){await r.abort(n)}})(),t}class cn{constructor(t){if(t===void 0)throw Error("Invalid BigInteger input");if(t instanceof Uint8Array){const r=t,n=Array(r.length);for(let s=0;s<r.length;s++){const i=r[s].toString(16);n[s]=r[s]<=15?"0"+i:i}this.value=BigInt("0x0"+n.join(""))}else this.value=BigInt(t)}clone(){return new cn(this.value)}iinc(){return this.value++,this}inc(){return this.clone().iinc()}idec(){return this.value--,this}dec(){return this.clone().idec()}iadd(t){return this.value+=t.value,this}add(t){return this.clone().iadd(t)}isub(t){return this.value-=t.value,this}sub(t){return this.clone().isub(t)}imul(t){return this.value*=t.value,this}mul(t){return this.clone().imul(t)}imod(t){return this.value%=t.value,this.isNegative()&&this.iadd(t),this}mod(t){return this.clone().imod(t)}modExp(t,r){if(r.isZero())throw Error("Modulo cannot be zero");if(r.isOne())return new cn(0);if(t.isNegative())throw Error("Unsopported negative exponent");let n=t.value,s=this.value;s%=r.value;let i=BigInt(1);for(;n>BigInt(0);){const o=n&BigInt(1);n>>=BigInt(1);const a=i*s%r.value;i=o?a:i,s=s*s%r.value}return new cn(i)}modInv(t){const{gcd:r,x:n}=this._egcd(t);if(!r.isOne())throw Error("Inverse does not exist");return n.add(t).mod(t)}_egcd(t){let r=BigInt(0),n=BigInt(1),s=BigInt(1),i=BigInt(0),o=this.value;for(t=t.value;t!==BigInt(0);){const a=o/t;let d=r;r=s-a*r,s=d,d=n,n=i-a*n,i=d,d=t,t=o%t,o=d}return{x:new cn(s),y:new cn(i),gcd:new cn(o)}}gcd(t){let r=this.value;for(t=t.value;t!==BigInt(0);){const n=t;t=r%t,r=n}return new cn(r)}ileftShift(t){return this.value<<=t.value,this}leftShift(t){return this.clone().ileftShift(t)}irightShift(t){return this.value>>=t.value,this}rightShift(t){return this.clone().irightShift(t)}equal(t){return this.value===t.value}lt(t){return this.value<t.value}lte(t){return this.value<=t.value}gt(t){return this.value>t.value}gte(t){return this.value>=t.value}isZero(){return this.value===BigInt(0)}isOne(){return this.value===BigInt(1)}isNegative(){return this.value<BigInt(0)}isEven(){return!(this.value&BigInt(1))}abs(){const t=this.clone();return this.isNegative()&&(t.value=-t.value),t}toString(){return this.value.toString()}toNumber(){const t=Number(this.value);if(t>Number.MAX_SAFE_INTEGER)throw Error("Number can only safely store up to 53 bits");return t}getBit(t){return(this.value>>BigInt(t)&BigInt(1))===BigInt(0)?0:1}bitLength(){const t=new cn(0),r=new cn(1),n=new cn(-1),s=this.isNegative()?n:t;let i=1;const o=this.clone();for(;!o.irightShift(r).equal(s);)i++;return i}byteLength(){const t=new cn(0),r=new cn(-1),n=this.isNegative()?r:t,s=new cn(8);let i=1;const o=this.clone();for(;!o.irightShift(s).equal(n);)i++;return i}toUint8Array(t="be",r){let n=this.value.toString(16);n.length%2==1&&(n="0"+n);const s=n.length/2,i=new Uint8Array(r||s),o=r?r-s:0;let a=0;for(;a<s;)i[a+o]=parseInt(n.slice(2*a,2*a+2),16),a++;return t!=="be"&&i.reverse(),i}}const QS=()=>typeof BigInt<"u",Lo=Symbol("byValue");var H={curve:{p256:"p256","P-256":"p256",secp256r1:"p256",prime256v1:"p256","1.2.840.10045.3.1.7":"p256","2a8648ce3d030107":"p256","2A8648CE3D030107":"p256",p384:"p384","P-384":"p384",secp384r1:"p384","1.3.132.0.34":"p384","2b81040022":"p384","2B81040022":"p384",p521:"p521","P-521":"p521",secp521r1:"p521","1.3.132.0.35":"p521","2b81040023":"p521","2B81040023":"p521",secp256k1:"secp256k1","1.3.132.0.10":"secp256k1","2b8104000a":"secp256k1","2B8104000A":"secp256k1",ed25519Legacy:"ed25519",ED25519:"ed25519",ed25519:"ed25519",Ed25519:"ed25519","1.3.6.1.4.1.11591.15.1":"ed25519","2b06010401da470f01":"ed25519","2B06010401DA470F01":"ed25519",curve25519Legacy:"curve25519",X25519:"curve25519",cv25519:"curve25519",curve25519:"curve25519",Curve25519:"curve25519","1.3.6.1.4.1.3029.1.5.1":"curve25519","2b060104019755010501":"curve25519","2B060104019755010501":"curve25519",brainpoolP256r1:"brainpoolP256r1","1.3.36.3.3.2.8.1.1.7":"brainpoolP256r1","2b2403030208010107":"brainpoolP256r1","2B2403030208010107":"brainpoolP256r1",brainpoolP384r1:"brainpoolP384r1","1.3.36.3.3.2.8.1.1.11":"brainpoolP384r1","2b240303020801010b":"brainpoolP384r1","2B240303020801010B":"brainpoolP384r1",brainpoolP512r1:"brainpoolP512r1","1.3.36.3.3.2.8.1.1.13":"brainpoolP512r1","2b240303020801010d":"brainpoolP512r1","2B240303020801010D":"brainpoolP512r1"},s2k:{simple:0,salted:1,iterated:3,gnu:101},publicKey:{rsaEncryptSign:1,rsaEncrypt:2,rsaSign:3,elgamal:16,dsa:17,ecdh:18,ecdsa:19,eddsaLegacy:22,ed25519Legacy:22,eddsa:22,aedh:23,aedsa:24,x25519:25,x448:26,ed25519:27,ed448:28},symmetric:{plaintext:0,idea:1,tripledes:2,cast5:3,blowfish:4,aes128:7,aes192:8,aes256:9,twofish:10},compression:{uncompressed:0,zip:1,zlib:2,bzip2:3},hash:{md5:1,sha1:2,ripemd:3,sha256:8,sha384:9,sha512:10,sha224:11},webHash:{"SHA-1":2,"SHA-256":8,"SHA-384":9,"SHA-512":10},aead:{eax:1,ocb:2,experimentalGCM:100},packet:{publicKeyEncryptedSessionKey:1,signature:2,symEncryptedSessionKey:3,onePassSignature:4,secretKey:5,publicKey:6,secretSubkey:7,compressedData:8,symmetricallyEncryptedData:9,marker:10,literalData:11,trust:12,userID:13,publicSubkey:14,userAttribute:17,symEncryptedIntegrityProtectedData:18,modificationDetectionCode:19,aeadEncryptedData:20},literal:{binary:98,text:116,utf8:117,mime:109},signature:{binary:0,text:1,standalone:2,certGeneric:16,certPersona:17,certCasual:18,certPositive:19,certRevocation:48,subkeyBinding:24,keyBinding:25,key:31,keyRevocation:32,subkeyRevocation:40,timestamp:64,thirdParty:80},signatureSubpacket:{signatureCreationTime:2,signatureExpirationTime:3,exportableCertification:4,trustSignature:5,regularExpression:6,revocable:7,keyExpirationTime:9,placeholderBackwardsCompatibility:10,preferredSymmetricAlgorithms:11,revocationKey:12,issuer:16,notationData:20,preferredHashAlgorithms:21,preferredCompressionAlgorithms:22,keyServerPreferences:23,preferredKeyServer:24,primaryUserID:25,policyURI:26,keyFlags:27,signersUserID:28,reasonForRevocation:29,features:30,signatureTarget:31,embeddedSignature:32,issuerFingerprint:33,preferredAEADAlgorithms:34},keyFlags:{certifyKeys:1,signData:2,encryptCommunication:4,encryptStorage:8,splitPrivateKey:16,authentication:32,sharedPrivateKey:128},armor:{multipartSection:0,multipartLast:1,signed:2,message:3,publicKey:4,privateKey:5,signature:6},reasonForRevocation:{noReason:0,keySuperseded:1,keyCompromised:2,keyRetired:3,userIDInvalid:32},features:{modificationDetection:1,aead:2,v5Keys:4},write:function(e,t){if(typeof t=="number"&&(t=this.read(e,t)),e[t]!==void 0)return e[t];throw Error("Invalid enum value.")},read:function(e,t){if(e[Lo]||(e[Lo]=[],Object.entries(e).forEach(([r,n])=>{e[Lo][n]=r})),e[Lo][t]!==void 0)return e[Lo][t];throw Error("Invalid enum value.")}};const Kg=(()=>{try{return!1}catch{}return!1})(),te={isString:function(e){return typeof e=="string"||e instanceof String},isArray:function(e){return e instanceof Array},isUint8Array:lh,isStream:bn,readNumber:function(e){let t=0;for(let r=0;r<e.length;r++)t+=256**r*e[e.length-1-r];return t},writeNumber:function(e,t){const r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=e>>8*(t-n-1)&255;return r},readDate:function(e){const t=te.readNumber(e);return new Date(1e3*t)},writeDate:function(e){const t=Math.floor(e.getTime()/1e3);return te.writeNumber(t,4)},normalizeDate:function(e=Date.now()){return e===null||e===1/0?e:new Date(1e3*Math.floor(+e/1e3))},readMPI:function(e){const t=(e[0]<<8|e[1])+7>>>3;return e.subarray(2,2+t)},leftPad(e,t){const r=new Uint8Array(t),n=t-e.length;return r.set(e,n),r},uint8ArrayToMPI:function(e){const t=te.uint8ArrayBitLength(e);if(t===0)throw Error("Zero MPI");const r=e.subarray(e.length-Math.ceil(t/8)),n=new Uint8Array([(65280&t)>>8,255&t]);return te.concatUint8Array([n,r])},uint8ArrayBitLength:function(e){let t;for(t=0;t<e.length&&e[t]===0;t++);if(t===e.length)return 0;const r=e.subarray(t);return 8*(r.length-1)+te.nbits(r[0])},hexToUint8Array:function(e){const t=new Uint8Array(e.length>>1);for(let r=0;r<e.length>>1;r++)t[r]=parseInt(e.substr(r<<1,2),16);return t},uint8ArrayToHex:function(e){const t=[],r=e.length;let n,s=0;for(;s<r;){for(n=e[s++].toString(16);n.length<2;)n="0"+n;t.push(""+n)}return t.join("")},stringToUint8Array:function(e){return yr(e,t=>{if(!te.isString(t))throw Error("stringToUint8Array: Data must be in the form of a string");const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r})},uint8ArrayToString:function(e){const t=[],n=(e=new Uint8Array(e)).length;for(let s=0;s<n;s+=16384)t.push(String.fromCharCode.apply(String,e.subarray(s,s+16384<n?s+16384:n)));return t.join("")},encodeUTF8:function(e){const t=new TextEncoder("utf-8");function r(n,s=!1){return t.encode(n,{stream:!s})}return yr(e,r,()=>r("",!0))},decodeUTF8:function(e){const t=new TextDecoder("utf-8");function r(n,s=!1){return t.decode(n,{stream:!s})}return yr(e,r,()=>r(new Uint8Array,!0))},concat:ln,concatUint8Array:O8,equalsUint8Array:function(e,t){if(!te.isUint8Array(e)||!te.isUint8Array(t))throw Error("Data must be in the form of a Uint8Array");if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},writeChecksum:function(e){let t=0;for(let r=0;r<e.length;r++)t=t+e[r]&65535;return te.writeNumber(t,2)},printDebug:function(e){Kg&&console.log("[OpenPGP.js debug]",e)},printDebugError:function(e){Kg&&console.error("[OpenPGP.js debug]",e)},nbits:function(e){let t=1,r=e>>>16;return r!==0&&(e=r,t+=16),r=e>>8,r!==0&&(e=r,t+=8),r=e>>4,r!==0&&(e=r,t+=4),r=e>>2,r!==0&&(e=r,t+=2),r=e>>1,r!==0&&(e=r,t+=1),t},double:function(e){const t=new Uint8Array(e.length),r=e.length-1;for(let n=0;n<r;n++)t[n]=e[n]<<1^e[n+1]>>7;return t[r]=e[r]<<1^135*(e[0]>>7),t},shiftRight:function(e,t){if(t)for(let r=e.length-1;r>=0;r--)e[r]>>=t,r>0&&(e[r]|=e[r-1]<<8-t);return e},getWebCrypto:function(){return In!==void 0&&In.crypto&&In.crypto.subtle},getBigInteger:async function(){if(QS())return cn;{const{default:e}=await Promise.resolve().then(function(){return RC});return e}},getNodeCrypto:function(){},getNodeZlib:function(){},getNodeBuffer:function(){return{}.Buffer},getHardwareConcurrency:function(){return typeof navigator<"u"?navigator.hardwareConcurrency||1:(void 0).cpus().length},isEmailAddress:function(e){return te.isString(e)?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}[0-9]*|xn--[a-zA-Z\-0-9]+)))$/.test(e):!1},canonicalizeEOL:function(e){let t=!1;return yr(e,r=>{let n;t&&(r=te.concatUint8Array([new Uint8Array([13]),r])),r[r.length-1]===13?(t=!0,r=r.subarray(0,-1)):t=!1;const s=[];for(let a=0;n=r.indexOf(10,a)+1,n;a=n)r[n-2]!==13&&s.push(n);if(!s.length)return r;const i=new Uint8Array(r.length+s.length);let o=0;for(let a=0;a<s.length;a++){const d=r.subarray(s[a-1]||0,s[a]);i.set(d,o),o+=d.length,i[o-1]=13,i[o]=10,o++}return i.set(r.subarray(s[s.length-1]||0),o),i},()=>t?new Uint8Array([13]):void 0)},nativeEOL:function(e){let t=!1;return yr(e,r=>{let n;(r=t&&r[0]!==10?te.concatUint8Array([new Uint8Array([13]),r]):new Uint8Array(r))[r.length-1]===13?(t=!0,r=r.subarray(0,-1)):t=!1;let s=0;for(let i=0;i!==r.length;i=n){n=r.indexOf(13,i)+1,n||(n=r.length);const o=n-(r[n]===10?1:0);i&&r.copyWithin(s,i,o),s+=o-i}return r.subarray(0,s)},()=>t?new Uint8Array([13]):void 0)},removeTrailingSpaces:function(e){return e.split(`
|
|
8
|
-
`).map(t=>{let r=t.length-1;for(;r>=0&&(t[r]===" "||t[r]===" "||t[r]==="\r");r--);return t.substr(0,r+1)}).join(`
|
|
9
|
-
`)},wrapError:function(e,t){if(!t)return Error(e);try{t.message=e+": "+t.message}catch{}return t},constructAllowedPackets:function(e){const t={};return e.forEach(r=>{if(!r.tag)throw Error("Invalid input: expected a packet class");t[r.tag]=r}),t},anyPromise:function(e){return new Promise(async(t,r)=>{let n;await Promise.all(e.map(async s=>{try{t(await s)}catch(i){n=i}})),r(n)})},selectUint8Array:function(e,t,r){const n=Math.max(t.length,r.length),s=new Uint8Array(n);let i=0;for(let o=0;o<s.length;o++)s[o]=t[o]&256-e|r[o]&255+e,i+=e&o<t.length|1-e&o<r.length;return s.subarray(0,i)},selectUint8:function(e,t,r){return t&256-e|r&255+e},isAES:function(e){return e===H.symmetric.aes128||e===H.symmetric.aes192||e===H.symmetric.aes256}},i0=te.getNodeBuffer();let _f,wf;function Fi(e){let t=new Uint8Array;return yr(e,r=>{t=te.concatUint8Array([t,r]);const n=[],s=Math.floor(t.length/45),i=45*s,o=_f(t.subarray(0,i));for(let a=0;a<s;a++)n.push(o.substr(60*a,60)),n.push(`
|
|
10
|
-
`);return t=t.subarray(i),n.join("")},()=>t.length?_f(t)+`
|
|
11
|
-
`:"")}function q8(e){let t="";return yr(e,r=>{t+=r;let n=0;const s=[" "," ","\r",`
|
|
12
|
-
`];for(let a=0;a<s.length;a++){const d=s[a];for(let c=t.indexOf(d);c!==-1;c=t.indexOf(d,c+1))n++}let i=t.length;for(;i>0&&(i-n)%4!=0;i--)s.includes(t[i])&&n--;const o=wf(t.substr(0,i));return t=t.substr(i),o},()=>wf(t))}function zi(e){return q8(e.replace(/-/g,"+").replace(/_/g,"/"))}function Tn(e,t){let r=Fi(e).replace(/[\r\n]/g,"");return t&&(r=r.replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")),r}i0?(_f=e=>i0.from(e).toString("base64"),wf=e=>{const t=i0.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}):(_f=e=>btoa(te.uint8ArrayToString(e)),wf=e=>te.stringToUint8Array(atob(e)));var Xe={preferredHashAlgorithm:H.hash.sha256,preferredSymmetricAlgorithm:H.symmetric.aes256,preferredCompressionAlgorithm:H.compression.uncompressed,deflateLevel:6,aeadProtect:!1,preferredAEADAlgorithm:H.aead.eax,aeadChunkSizeByte:12,v5Keys:!1,s2kIterationCountByte:224,allowUnauthenticatedMessages:!1,allowUnauthenticatedStream:!1,checksumRequired:!1,minRSABits:2047,passwordCollisionCheck:!1,revocationsExpire:!1,allowInsecureDecryptionWithSigningKeys:!1,allowInsecureVerificationWithReformattedKeys:!1,constantTimePKCS1Decryption:!1,constantTimePKCS1DecryptionSupportedSymmetricAlgorithms:new Set([H.symmetric.aes128,H.symmetric.aes192,H.symmetric.aes256]),minBytesForWebCrypto:1e3,ignoreUnsupportedPackets:!0,ignoreMalformedPackets:!1,additionalAllowedPackets:[],showVersion:!1,showComment:!1,versionString:"OpenPGP.js 5.11.3",commentString:"https://openpgpjs.org",maxUserIDLength:5120,knownNotations:[],useIndutnyElliptic:!0,rejectHashAlgorithms:new Set([H.hash.md5,H.hash.ripemd]),rejectMessageHashAlgorithms:new Set([H.hash.md5,H.hash.ripemd,H.hash.sha1]),rejectPublicKeyAlgorithms:new Set([H.publicKey.elgamal,H.publicKey.dsa]),rejectCurves:new Set([H.curve.secp256k1])};function eP(e){const t=e.match(/^-----BEGIN PGP (MESSAGE, PART \d+\/\d+|MESSAGE, PART \d+|SIGNED MESSAGE|MESSAGE|PUBLIC KEY BLOCK|PRIVATE KEY BLOCK|SIGNATURE)-----$/m);if(!t)throw Error("Unknown ASCII armor type");return/MESSAGE, PART \d+\/\d+/.test(t[1])?H.armor.multipartSection:/MESSAGE, PART \d+/.test(t[1])?H.armor.multipartLast:/SIGNED MESSAGE/.test(t[1])?H.armor.signed:/MESSAGE/.test(t[1])?H.armor.message:/PUBLIC KEY BLOCK/.test(t[1])?H.armor.publicKey:/PRIVATE KEY BLOCK/.test(t[1])?H.armor.privateKey:/SIGNATURE/.test(t[1])?H.armor.signature:void 0}function Gs(e,t){let r="";return t.showVersion&&(r+="Version: "+t.versionString+`
|
|
13
|
-
`),t.showComment&&(r+="Comment: "+t.commentString+`
|
|
14
|
-
`),e&&(r+="Comment: "+e+`
|
|
15
|
-
`),r+=`
|
|
16
|
-
`,r}function ps(e){return Fi(function(t){let r=13501623;return yr(t,n=>{const s=tP?Math.floor(n.length/4):0,i=new Uint32Array(n.buffer,n.byteOffset,s);for(let o=0;o<s;o++)r^=i[o],r=Nr[0][r>>24&255]^Nr[1][r>>16&255]^Nr[2][r>>8&255]^Nr[3][r>>0&255];for(let o=4*s;o<n.length;o++)r=r>>8^Nr[0][255&r^n[o]]},()=>new Uint8Array([r,r>>8,r>>16]))}(e))}const Nr=[Array(255),Array(255),Array(255),Array(255)];for(let e=0;e<=255;e++){let t=e<<16;for(let r=0;r<8;r++)t=t<<1^(8388608&t?8801531:0);Nr[0][e]=(16711680&t)>>16|65280&t|(255&t)<<16}for(let e=0;e<=255;e++)Nr[1][e]=Nr[0][e]>>8^Nr[0][255&Nr[0][e]];for(let e=0;e<=255;e++)Nr[2][e]=Nr[1][e]>>8^Nr[0][255&Nr[1][e]];for(let e=0;e<=255;e++)Nr[3][e]=Nr[2][e]>>8^Nr[0][255&Nr[2][e]];const tP=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,255,!0),new Int16Array(e)[0]===255}();function qg(e){for(let t=0;t<e.length;t++)/^([^\s:]|[^\s:][^:]*[^\s:]): .+$/.test(e[t])||te.printDebugError(Error("Improperly formatted armor header: "+e[t])),/^(Version|Comment|MessageID|Hash|Charset): .+$/.test(e[t])||te.printDebugError(Error("Unknown header: "+e[t]))}function rP(e){let t=e,r="";const n=e.lastIndexOf("=");return n>=0&&n!==e.length-1&&(t=e.slice(0,n),r=e.slice(n+1).substr(0,4)),{body:t,checksum:r}}function Oi(e,t=Xe){return new Promise(async(r,n)=>{try{const s=/^-----[^-]+-----$/m,i=/^[ \f\r\t\u00a0\u2000-\u200a\u202f\u205f\u3000]*$/;let o;const a=[];let d,c,l,u=a,p=[],f=q8(Ii(e,async(h,y)=>{const m=Mi(h);try{for(;;){let v=await m.readLine();if(v===void 0)throw Error("Misformed armored text");if(v=te.removeTrailingSpaces(v.replace(/[\r\n]/g,"")),o)if(d)c||o!==2||(s.test(v)?(p=p.join(`\r
|
|
17
|
-
`),c=!0,qg(u),u=[],d=!1):p.push(v.replace(/^- /,"")));else if(s.test(v)&&n(Error("Mandatory blank line missing between armor headers and armor data")),i.test(v)){if(qg(u),d=!0,c||o!==2){r({text:p,data:f,headers:a,type:o});break}}else u.push(v);else s.test(v)&&(o=eP(v))}}catch(v){return void n(v)}const b=vn(y);try{for(;;){await b.ready;const{done:v,value:E}=await m.read();if(v)throw Error("Misformed armored text");const _=E+"";if(_.indexOf("=")!==-1||_.indexOf("-")!==-1){let C=await m.readToEnd();C.length||(C=""),C=_+C,C=te.removeTrailingSpaces(C.replace(/\r/g,""));const k=C.split(s);if(k.length===1)throw Error("Misformed armored text");const D=rP(k[0].slice(0,-1));l=D.checksum,await b.write(D.body);break}await b.write(_)}await b.ready,await b.close()}catch(v){await b.abort(v)}}));f=Ii(f,async(h,y)=>{const m=vr(ps(no(h)));m.catch(()=>{}),await ts(h,y,{preventClose:!0});const b=vn(y);try{const v=(await m).replace(`
|
|
18
|
-
`,"");if(l!==v&&(l||t.checksumRequired))throw Error("Ascii armor integrity check failed");await b.ready,await b.close()}catch(v){await b.abort(v)}})}catch(s){n(s)}}).then(async r=>(_r(r.data)&&(r.data=await vr(r.data)),r))}function ka(e,t,r,n,s,i=Xe){let o,a;e===H.armor.signed&&(o=t.text,a=t.hash,t=t.data);const d=no(t),c=[];switch(e){case H.armor.multipartSection:c.push("-----BEGIN PGP MESSAGE, PART "+r+"/"+n+`-----
|
|
19
|
-
`),c.push(Gs(s,i)),c.push(Fi(t)),c.push("=",ps(d)),c.push("-----END PGP MESSAGE, PART "+r+"/"+n+`-----
|
|
20
|
-
`);break;case H.armor.multipartLast:c.push("-----BEGIN PGP MESSAGE, PART "+r+`-----
|
|
21
|
-
`),c.push(Gs(s,i)),c.push(Fi(t)),c.push("=",ps(d)),c.push("-----END PGP MESSAGE, PART "+r+`-----
|
|
22
|
-
`);break;case H.armor.signed:c.push(`-----BEGIN PGP SIGNED MESSAGE-----
|
|
23
|
-
`),c.push("Hash: "+a+`
|
|
24
|
-
|
|
25
|
-
`),c.push(o.replace(/^-/gm,"- -")),c.push(`
|
|
26
|
-
-----BEGIN PGP SIGNATURE-----
|
|
27
|
-
`),c.push(Gs(s,i)),c.push(Fi(t)),c.push("=",ps(d)),c.push(`-----END PGP SIGNATURE-----
|
|
28
|
-
`);break;case H.armor.message:c.push(`-----BEGIN PGP MESSAGE-----
|
|
29
|
-
`),c.push(Gs(s,i)),c.push(Fi(t)),c.push("=",ps(d)),c.push(`-----END PGP MESSAGE-----
|
|
30
|
-
`);break;case H.armor.publicKey:c.push(`-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
31
|
-
`),c.push(Gs(s,i)),c.push(Fi(t)),c.push("=",ps(d)),c.push(`-----END PGP PUBLIC KEY BLOCK-----
|
|
32
|
-
`);break;case H.armor.privateKey:c.push(`-----BEGIN PGP PRIVATE KEY BLOCK-----
|
|
33
|
-
`),c.push(Gs(s,i)),c.push(Fi(t)),c.push("=",ps(d)),c.push(`-----END PGP PRIVATE KEY BLOCK-----
|
|
34
|
-
`);break;case H.armor.signature:c.push(`-----BEGIN PGP SIGNATURE-----
|
|
35
|
-
`),c.push(Gs(s,i)),c.push(Fi(t)),c.push("=",ps(d)),c.push(`-----END PGP SIGNATURE-----
|
|
36
|
-
`)}return te.concat(c)}class Ls{constructor(){this.bytes=""}read(t){return this.bytes=te.uint8ArrayToString(t.subarray(0,8)),this.bytes.length}write(){return te.stringToUint8Array(this.bytes)}toHex(){return te.uint8ArrayToHex(te.stringToUint8Array(this.bytes))}equals(t,r=!1){return r&&(t.isWildcard()||this.isWildcard())||this.bytes===t.bytes}isNull(){return this.bytes===""}isWildcard(){return/^0+$/.test(this.toHex())}static mapToHex(t){return t.toHex()}static fromID(t){const r=new Ls;return r.read(te.hexToUint8Array(t)),r}static wildcard(){const t=new Ls;return t.read(new Uint8Array(8)),t}}var Lt=function(){var e,t,r=!1;function n(u,p){var f=e[(t[u]+t[p])%255];return u!==0&&p!==0||(f=0),f}var s,i,o,a,d=!1;function c(){function u(y){var m,b,v;for(b=v=function(E){var _=e[255-t[E]];return E===0&&(_=0),_}(y),m=0;m<4;m++)v^=b=255&(b<<1|b>>>7);return v^=99}r||function(){e=[],t=[];var y,m,b=1;for(y=0;y<255;y++)e[y]=b,m=128&b,b<<=1,b&=255,m===128&&(b^=27),b^=e[y],t[e[y]]=y;e[255]=e[0],t[0]=0,r=!0}(),s=[],i=[],o=[[],[],[],[]],a=[[],[],[],[]];for(var p=0;p<256;p++){var f=u(p);s[p]=f,i[f]=p,o[0][p]=n(2,f)<<24|f<<16|f<<8|n(3,f),a[0][f]=n(14,p)<<24|n(9,p)<<16|n(13,p)<<8|n(11,p);for(var h=1;h<4;h++)o[h][p]=o[h-1][p]>>>8|o[h-1][p]<<24,a[h][f]=a[h-1][f]>>>8|a[h-1][f]<<24}d=!0}var l=function(u,p){d||c();var f=new Uint32Array(p);f.set(s,512),f.set(i,768);for(var h=0;h<4;h++)f.set(o[h],4096+1024*h>>2),f.set(a[h],8192+1024*h>>2);var y=function(m,b,v){var E=0,_=0,C=0,k=0,D=0,w=0,S=0,I=0,T=0,g=0,A=0,P=0,O=0,N=0,M=0,L=0,x=0,R=0,K=0,V=0,J=0,se=new m.Uint32Array(v),j=new m.Uint8Array(v);function re(ie,Q,qe,He,Qe,dt,rt,be){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,Qe=Qe|0,dt=dt|0,rt=rt|0,be=be|0;var W=0,oe=0,me=0,Te=0,Pe=0,ke=0,Ne=0,Ue=0;for(W=qe|1024,oe=qe|2048,me=qe|3072,Qe=Qe^se[(ie|0)>>2],dt=dt^se[(ie|4)>>2],rt=rt^se[(ie|8)>>2],be=be^se[(ie|12)>>2],Ue=16;(Ue|0)<=He<<4;Ue=Ue+16|0)Te=se[(qe|Qe>>22&1020)>>2]^se[(W|dt>>14&1020)>>2]^se[(oe|rt>>6&1020)>>2]^se[(me|be<<2&1020)>>2]^se[(ie|Ue|0)>>2],Pe=se[(qe|dt>>22&1020)>>2]^se[(W|rt>>14&1020)>>2]^se[(oe|be>>6&1020)>>2]^se[(me|Qe<<2&1020)>>2]^se[(ie|Ue|4)>>2],ke=se[(qe|rt>>22&1020)>>2]^se[(W|be>>14&1020)>>2]^se[(oe|Qe>>6&1020)>>2]^se[(me|dt<<2&1020)>>2]^se[(ie|Ue|8)>>2],Ne=se[(qe|be>>22&1020)>>2]^se[(W|Qe>>14&1020)>>2]^se[(oe|dt>>6&1020)>>2]^se[(me|rt<<2&1020)>>2]^se[(ie|Ue|12)>>2],Qe=Te,dt=Pe,rt=ke,be=Ne;E=se[(Q|Qe>>22&1020)>>2]<<24^se[(Q|dt>>14&1020)>>2]<<16^se[(Q|rt>>6&1020)>>2]<<8^se[(Q|be<<2&1020)>>2]^se[(ie|Ue|0)>>2],_=se[(Q|dt>>22&1020)>>2]<<24^se[(Q|rt>>14&1020)>>2]<<16^se[(Q|be>>6&1020)>>2]<<8^se[(Q|Qe<<2&1020)>>2]^se[(ie|Ue|4)>>2],C=se[(Q|rt>>22&1020)>>2]<<24^se[(Q|be>>14&1020)>>2]<<16^se[(Q|Qe>>6&1020)>>2]<<8^se[(Q|dt<<2&1020)>>2]^se[(ie|Ue|8)>>2],k=se[(Q|be>>22&1020)>>2]<<24^se[(Q|Qe>>14&1020)>>2]<<16^se[(Q|dt>>6&1020)>>2]<<8^se[(Q|rt<<2&1020)>>2]^se[(ie|Ue|12)>>2]}function G(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,re(0,2048,4096,J,ie,Q,qe,He)}function B(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0;var Qe=0;re(1024,3072,8192,J,ie,He,qe,Q),Qe=_,_=k,k=Qe}function X(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,re(0,2048,4096,J,D^ie,w^Q,S^qe,I^He),D=E,w=_,S=C,I=k}function ge(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0;var Qe=0;re(1024,3072,8192,J,ie,He,qe,Q),Qe=_,_=k,k=Qe,E=E^D,_=_^w,C=C^S,k=k^I,D=ie,w=Q,S=qe,I=He}function _e(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,re(0,2048,4096,J,D,w,S,I),D=E=E^ie,w=_=_^Q,S=C=C^qe,I=k=k^He}function Se(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,re(0,2048,4096,J,D,w,S,I),E=E^ie,_=_^Q,C=C^qe,k=k^He,D=ie,w=Q,S=qe,I=He}function F(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,re(0,2048,4096,J,D,w,S,I),D=E,w=_,S=C,I=k,E=E^ie,_=_^Q,C=C^qe,k=k^He}function q(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,re(0,2048,4096,J,T,g,A,P),P=~L&P|L&P+1,A=~M&A|M&A+((P|0)==0),g=~N&g|N&g+((A|0)==0),T=~O&T|O&T+((g|0)==0),E=E^ie,_=_^Q,C=C^qe,k=k^He}function z(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0;var Qe=0,dt=0,rt=0,be=0,W=0,oe=0,me=0,Te=0,Pe=0,ke=0;for(ie=ie^D,Q=Q^w,qe=qe^S,He=He^I,Qe=x|0,dt=R|0,rt=K|0,be=V|0;(Pe|0)<128;Pe=Pe+1|0)Qe>>>31&&(W=W^ie,oe=oe^Q,me=me^qe,Te=Te^He),Qe=Qe<<1|dt>>>31,dt=dt<<1|rt>>>31,rt=rt<<1|be>>>31,be=be<<1,ke=He&1,He=He>>>1|qe<<31,qe=qe>>>1|Q<<31,Q=Q>>>1|ie<<31,ie=ie>>>1,ke&&(ie=ie^3774873600);D=W,w=oe,S=me,I=Te}function ee(ie){ie=ie|0,J=ie}function le(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,E=ie,_=Q,C=qe,k=He}function ce(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,D=ie,w=Q,S=qe,I=He}function ne(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,T=ie,g=Q,A=qe,P=He}function je(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,O=ie,N=Q,M=qe,L=He}function De(ie,Q,qe,He){ie=ie|0,Q=Q|0,qe=qe|0,He=He|0,P=~L&P|L&He,A=~M&A|M&qe,g=~N&g|N&Q,T=~O&T|O&ie}function Fe(ie){return ie=ie|0,ie&15?-1:(j[ie|0]=E>>>24,j[ie|1]=E>>>16&255,j[ie|2]=E>>>8&255,j[ie|3]=E&255,j[ie|4]=_>>>24,j[ie|5]=_>>>16&255,j[ie|6]=_>>>8&255,j[ie|7]=_&255,j[ie|8]=C>>>24,j[ie|9]=C>>>16&255,j[ie|10]=C>>>8&255,j[ie|11]=C&255,j[ie|12]=k>>>24,j[ie|13]=k>>>16&255,j[ie|14]=k>>>8&255,j[ie|15]=k&255,16)}function he(ie){return ie=ie|0,ie&15?-1:(j[ie|0]=D>>>24,j[ie|1]=D>>>16&255,j[ie|2]=D>>>8&255,j[ie|3]=D&255,j[ie|4]=w>>>24,j[ie|5]=w>>>16&255,j[ie|6]=w>>>8&255,j[ie|7]=w&255,j[ie|8]=S>>>24,j[ie|9]=S>>>16&255,j[ie|10]=S>>>8&255,j[ie|11]=S&255,j[ie|12]=I>>>24,j[ie|13]=I>>>16&255,j[ie|14]=I>>>8&255,j[ie|15]=I&255,16)}function ue(){G(0,0,0,0),x=E,R=_,K=C,V=k}function pe(ie,Q,qe){ie=ie|0,Q=Q|0,qe=qe|0;var He=0;if(Q&15)return-1;for(;(qe|0)>=16;)fe[ie&7](j[Q|0]<<24|j[Q|1]<<16|j[Q|2]<<8|j[Q|3],j[Q|4]<<24|j[Q|5]<<16|j[Q|6]<<8|j[Q|7],j[Q|8]<<24|j[Q|9]<<16|j[Q|10]<<8|j[Q|11],j[Q|12]<<24|j[Q|13]<<16|j[Q|14]<<8|j[Q|15]),j[Q|0]=E>>>24,j[Q|1]=E>>>16&255,j[Q|2]=E>>>8&255,j[Q|3]=E&255,j[Q|4]=_>>>24,j[Q|5]=_>>>16&255,j[Q|6]=_>>>8&255,j[Q|7]=_&255,j[Q|8]=C>>>24,j[Q|9]=C>>>16&255,j[Q|10]=C>>>8&255,j[Q|11]=C&255,j[Q|12]=k>>>24,j[Q|13]=k>>>16&255,j[Q|14]=k>>>8&255,j[Q|15]=k&255,He=He+16|0,Q=Q+16|0,qe=qe-16|0;return He|0}function de(ie,Q,qe){ie=ie|0,Q=Q|0,qe=qe|0;var He=0;if(Q&15)return-1;for(;(qe|0)>=16;)ye[ie&1](j[Q|0]<<24|j[Q|1]<<16|j[Q|2]<<8|j[Q|3],j[Q|4]<<24|j[Q|5]<<16|j[Q|6]<<8|j[Q|7],j[Q|8]<<24|j[Q|9]<<16|j[Q|10]<<8|j[Q|11],j[Q|12]<<24|j[Q|13]<<16|j[Q|14]<<8|j[Q|15]),He=He+16|0,Q=Q+16|0,qe=qe-16|0;return He|0}var fe=[G,B,X,ge,_e,Se,F,q],ye=[X,z];return{set_rounds:ee,set_state:le,set_iv:ce,set_nonce:ne,set_mask:je,set_counter:De,get_state:Fe,get_iv:he,gcm_init:ue,cipher:pe,mac:de}}({Uint8Array,Uint32Array},u,p);return y.set_key=function(m,b,v,E,_,C,k,D,w){var S=f.subarray(0,60),I=f.subarray(256,316);S.set([b,v,E,_,C,k,D,w]);for(var T=m,g=1;T<4*m+28;T++){var A=S[T-1];(T%m==0||m===8&&T%m==4)&&(A=s[A>>>24]<<24^s[A>>>16&255]<<16^s[A>>>8&255]<<8^s[255&A]),T%m==0&&(A=A<<8^A>>>24^g<<24,g=g<<1^(128&g?27:0)),S[T]=S[T-m]^A}for(var P=0;P<T;P+=4)for(var O=0;O<4;O++)A=S[T-(4+P)+(4-O)%4],I[P+O]=P<4||P>=T-4?A:a[0][s[A>>>24]]^a[1][s[A>>>16&255]]^a[2][s[A>>>8&255]]^a[3][s[255&A]];y.set_rounds(m+5)},y};return l.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},l.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},l.MAC={CBC:0,GCM:1},l.HEAP_DATA=16384,l}();function jg(e){return e instanceof Uint8Array}function l2(e,t){const r=e?e.byteLength:t||65536;if(4095&r||r<=0)throw Error("heap size must be a positive integer and a multiple of 4096");return e=e||new Uint8Array(new ArrayBuffer(r))}function fa(e,t,r,n,s){const i=e.length-t,o=i<s?i:s;return e.set(r.subarray(n,n+o),t),o}function Ks(...e){const t=e.reduce((s,i)=>s+i.length,0),r=new Uint8Array(t);let n=0;for(let s=0;s<e.length;s++)r.set(e[s],n),n+=e[s].length;return r}class yy extends Error{constructor(...t){super(...t)}}class Ji extends Error{constructor(...t){super(...t)}}class gy extends Error{constructor(...t){super(...t)}}const $g=[],Vg=[];class Kl{constructor(t,r,n=!0,s,i,o){this.pos=0,this.len=0,this.mode=s,this.pos=0,this.len=0,this.key=t,this.iv=r,this.padding=n,this.acquire_asm(i,o)}acquire_asm(t,r){return this.heap!==void 0&&this.asm!==void 0||(this.heap=t||$g.pop()||l2().subarray(Lt.HEAP_DATA),this.asm=r||Vg.pop()||new Lt(null,this.heap.buffer),this.reset(this.key,this.iv)),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&($g.push(this.heap),Vg.push(this.asm)),this.heap=void 0,this.asm=void 0}reset(t,r){const{asm:n}=this.acquire_asm(),s=t.length;if(s!==16&&s!==24&&s!==32)throw new Ji("illegal key size");const i=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.set_key(s>>2,i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12),s>16?i.getUint32(16):0,s>16?i.getUint32(20):0,s>24?i.getUint32(24):0,s>24?i.getUint32(28):0),r!==void 0){if(r.length!==16)throw new Ji("illegal iv size");let o=new DataView(r.buffer,r.byteOffset,r.byteLength);n.set_iv(o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12))}else n.set_iv(0,0,0,0)}AES_Encrypt_process(t){if(!jg(t))throw new TypeError("data isn't of expected type");let{heap:r,asm:n}=this.acquire_asm(),s=Lt.ENC[this.mode],i=Lt.HEAP_DATA,o=this.pos,a=this.len,d=0,c=t.length||0,l=0,u=0,p=new Uint8Array(a+c&-16);for(;c>0;)u=fa(r,o+a,t,d,c),a+=u,d+=u,c-=u,u=n.cipher(s,i+o,a),u&&p.set(r.subarray(o,o+u),l),l+=u,u<a?(o+=u,a-=u):(o=0,a=0);return this.pos=o,this.len=a,p}AES_Encrypt_finish(){let{heap:t,asm:r}=this.acquire_asm(),n=Lt.ENC[this.mode],s=Lt.HEAP_DATA,i=this.pos,o=this.len,a=16-o%16,d=o;if(this.hasOwnProperty("padding")){if(this.padding){for(let l=0;l<a;++l)t[i+o+l]=a;o+=a,d=o}else if(o%16)throw new Ji("data length must be a multiple of the block size")}else o+=a;const c=new Uint8Array(d);return o&&r.cipher(n,s+i,o),d&&c.set(t.subarray(i,i+d)),this.pos=0,this.len=0,this.release_asm(),c}AES_Decrypt_process(t){if(!jg(t))throw new TypeError("data isn't of expected type");let{heap:r,asm:n}=this.acquire_asm(),s=Lt.DEC[this.mode],i=Lt.HEAP_DATA,o=this.pos,a=this.len,d=0,c=t.length||0,l=0,u=a+c&-16,p=0,f=0;this.padding&&(p=a+c-u||16,u-=p);const h=new Uint8Array(u);for(;c>0;)f=fa(r,o+a,t,d,c),a+=f,d+=f,c-=f,f=n.cipher(s,i+o,a-(c?0:p)),f&&h.set(r.subarray(o,o+f),l),l+=f,f<a?(o+=f,a-=f):(o=0,a=0);return this.pos=o,this.len=a,h}AES_Decrypt_finish(){let{heap:t,asm:r}=this.acquire_asm(),n=Lt.DEC[this.mode],s=Lt.HEAP_DATA,i=this.pos,o=this.len,a=o;if(o>0){if(o%16){if(this.hasOwnProperty("padding"))throw new Ji("data length must be a multiple of the block size");o+=16-o%16}if(r.cipher(n,s+i,o),this.hasOwnProperty("padding")&&this.padding){let c=t[i+a-1];if(c<1||c>16||c>a)throw new gy("bad padding");let l=0;for(let u=c;u>1;u--)l|=c^t[i+a-u];if(l)throw new gy("bad padding");a-=c}}const d=new Uint8Array(a);return a>0&&d.set(t.subarray(i,i+a)),this.pos=0,this.len=0,this.release_asm(),d}}class Ef{static encrypt(t,r,n=!1){return new Ef(r,n).encrypt(t)}static decrypt(t,r,n=!1){return new Ef(r,n).decrypt(t)}constructor(t,r=!1,n){this.aes=n||new Kl(t,void 0,r,"ECB")}encrypt(t){return Ks(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Ks(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}function d2(e){const t=function(r){const n=new Ef(r);this.encrypt=function(s){return n.encrypt(s)},this.decrypt=function(s){return n.decrypt(s)}};return t.blockSize=t.prototype.blockSize=16,t.keySize=t.prototype.keySize=e/8,t}function cl(e,t,r,n,s,i){const o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],d=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];let h,y,m,b,v,E,_,C,k,D,w,S,I,T,g=0,A=t.length;const P=e.length===32?3:9;C=P===3?r?[0,32,2]:[30,-2,-2]:r?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2],r&&(t=function(M,L){const x=8-M.length%8;let R;if(L===2&&x<8)R=32;else if(L===1)R=x;else{if(L||!(x<8)){if(x===8)return M;throw Error("des: invalid padding")}R=0}const K=new Uint8Array(M.length+x);for(let V=0;V<M.length;V++)K[V]=M[V];for(let V=0;V<x;V++)K[M.length+V]=R;return K}(t,i),A=t.length);let O=new Uint8Array(A),N=0;for(n===1&&(k=s[g++]<<24|s[g++]<<16|s[g++]<<8|s[g++],w=s[g++]<<24|s[g++]<<16|s[g++]<<8|s[g++],g=0);g<A;){for(E=t[g++]<<24|t[g++]<<16|t[g++]<<8|t[g++],_=t[g++]<<24|t[g++]<<16|t[g++]<<8|t[g++],n===1&&(r?(E^=k,_^=w):(D=k,S=w,k=E,w=_)),m=252645135&(E>>>4^_),_^=m,E^=m<<4,m=65535&(E>>>16^_),_^=m,E^=m<<16,m=858993459&(_>>>2^E),E^=m,_^=m<<2,m=16711935&(_>>>8^E),E^=m,_^=m<<8,m=1431655765&(E>>>1^_),_^=m,E^=m<<1,E=E<<1|E>>>31,_=_<<1|_>>>31,y=0;y<P;y+=3){for(I=C[y+1],T=C[y+2],h=C[y];h!==I;h+=T)b=_^e[h],v=(_>>>4|_<<28)^e[h+1],m=E,E=_,_=m^(a[b>>>24&63]|c[b>>>16&63]|u[b>>>8&63]|f[63&b]|o[v>>>24&63]|d[v>>>16&63]|l[v>>>8&63]|p[63&v]);m=E,E=_,_=m}E=E>>>1|E<<31,_=_>>>1|_<<31,m=1431655765&(E>>>1^_),_^=m,E^=m<<1,m=16711935&(_>>>8^E),E^=m,_^=m<<8,m=858993459&(_>>>2^E),E^=m,_^=m<<2,m=65535&(E>>>16^_),_^=m,E^=m<<16,m=252645135&(E>>>4^_),_^=m,E^=m<<4,n===1&&(r?(k=E,w=_):(E^=D,_^=S)),O[N++]=E>>>24,O[N++]=E>>>16&255,O[N++]=E>>>8&255,O[N++]=255&E,O[N++]=_>>>24,O[N++]=_>>>16&255,O[N++]=_>>>8&255,O[N++]=255&_}return r||(O=function(M,L){let x,R=null;if(L===2)x=32;else if(L===1)R=M[M.length-1];else{if(L)throw Error("des: invalid padding");x=0}if(!R){for(R=1;M[M.length-R]===x;)R++;R--}return M.subarray(0,M.length-R)}(O,i)),O}function ul(e){const t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],d=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],u=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],f=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length>8?3:1,m=Array(32*y),b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0];let v,E,_,C=0,k=0;for(let D=0;D<y;D++){let w=e[C++]<<24|e[C++]<<16|e[C++]<<8|e[C++],S=e[C++]<<24|e[C++]<<16|e[C++]<<8|e[C++];_=252645135&(w>>>4^S),S^=_,w^=_<<4,_=65535&(S>>>-16^w),w^=_,S^=_<<-16,_=858993459&(w>>>2^S),S^=_,w^=_<<2,_=65535&(S>>>-16^w),w^=_,S^=_<<-16,_=1431655765&(w>>>1^S),S^=_,w^=_<<1,_=16711935&(S>>>8^w),w^=_,S^=_<<8,_=1431655765&(w>>>1^S),S^=_,w^=_<<1,_=w<<8|S>>>20&240,w=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=_;for(let I=0;I<16;I++)b[I]?(w=w<<2|w>>>26,S=S<<2|S>>>26):(w=w<<1|w>>>27,S=S<<1|S>>>27),w&=-15,S&=-15,v=t[w>>>28]|r[w>>>24&15]|n[w>>>20&15]|s[w>>>16&15]|i[w>>>12&15]|o[w>>>8&15]|a[w>>>4&15],E=d[S>>>28]|c[S>>>24&15]|l[S>>>20&15]|u[S>>>16&15]|p[S>>>12&15]|f[S>>>8&15]|h[S>>>4&15],_=65535&(E>>>16^v),m[k++]=v^_,m[k++]=E^_<<16}return m}function Fu(e){this.key=[];for(let t=0;t<3;t++)this.key.push(new Uint8Array(e.subarray(8*t,8*t+8)));this.encrypt=function(t){return cl(ul(this.key[2]),cl(ul(this.key[1]),cl(ul(this.key[0]),t,!0,0,null,null),!1,0,null,null),!0,0,null,null)}}function nP(){this.BlockSize=8,this.KeySize=16,this.setKey=function(o){if(this.masking=Array(16),this.rotate=Array(16),this.reset(),o.length!==this.KeySize)throw Error("CAST-128: keys must be 16 bytes");return this.keySchedule(o),!0},this.reset=function(){for(let o=0;o<16;o++)this.masking[o]=0,this.rotate[o]=0},this.getBlockSize=function(){return this.BlockSize},this.encrypt=function(o){const a=Array(o.length);for(let d=0;d<o.length;d+=8){let c,l=o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3],u=o[d+4]<<24|o[d+5]<<16|o[d+6]<<8|o[d+7];c=u,u=l^r(u,this.masking[0],this.rotate[0]),l=c,c=u,u=l^n(u,this.masking[1],this.rotate[1]),l=c,c=u,u=l^s(u,this.masking[2],this.rotate[2]),l=c,c=u,u=l^r(u,this.masking[3],this.rotate[3]),l=c,c=u,u=l^n(u,this.masking[4],this.rotate[4]),l=c,c=u,u=l^s(u,this.masking[5],this.rotate[5]),l=c,c=u,u=l^r(u,this.masking[6],this.rotate[6]),l=c,c=u,u=l^n(u,this.masking[7],this.rotate[7]),l=c,c=u,u=l^s(u,this.masking[8],this.rotate[8]),l=c,c=u,u=l^r(u,this.masking[9],this.rotate[9]),l=c,c=u,u=l^n(u,this.masking[10],this.rotate[10]),l=c,c=u,u=l^s(u,this.masking[11],this.rotate[11]),l=c,c=u,u=l^r(u,this.masking[12],this.rotate[12]),l=c,c=u,u=l^n(u,this.masking[13],this.rotate[13]),l=c,c=u,u=l^s(u,this.masking[14],this.rotate[14]),l=c,c=u,u=l^r(u,this.masking[15],this.rotate[15]),l=c,a[d]=u>>>24&255,a[d+1]=u>>>16&255,a[d+2]=u>>>8&255,a[d+3]=255&u,a[d+4]=l>>>24&255,a[d+5]=l>>>16&255,a[d+6]=l>>>8&255,a[d+7]=255&l}return a},this.decrypt=function(o){const a=Array(o.length);for(let d=0;d<o.length;d+=8){let c,l=o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3],u=o[d+4]<<24|o[d+5]<<16|o[d+6]<<8|o[d+7];c=u,u=l^r(u,this.masking[15],this.rotate[15]),l=c,c=u,u=l^s(u,this.masking[14],this.rotate[14]),l=c,c=u,u=l^n(u,this.masking[13],this.rotate[13]),l=c,c=u,u=l^r(u,this.masking[12],this.rotate[12]),l=c,c=u,u=l^s(u,this.masking[11],this.rotate[11]),l=c,c=u,u=l^n(u,this.masking[10],this.rotate[10]),l=c,c=u,u=l^r(u,this.masking[9],this.rotate[9]),l=c,c=u,u=l^s(u,this.masking[8],this.rotate[8]),l=c,c=u,u=l^n(u,this.masking[7],this.rotate[7]),l=c,c=u,u=l^r(u,this.masking[6],this.rotate[6]),l=c,c=u,u=l^s(u,this.masking[5],this.rotate[5]),l=c,c=u,u=l^n(u,this.masking[4],this.rotate[4]),l=c,c=u,u=l^r(u,this.masking[3],this.rotate[3]),l=c,c=u,u=l^s(u,this.masking[2],this.rotate[2]),l=c,c=u,u=l^n(u,this.masking[1],this.rotate[1]),l=c,c=u,u=l^r(u,this.masking[0],this.rotate[0]),l=c,a[d]=u>>>24&255,a[d+1]=u>>>16&255,a[d+2]=u>>>8&255,a[d+3]=255&u,a[d+4]=l>>>24&255,a[d+5]=l>>16&255,a[d+6]=l>>8&255,a[d+7]=255&l}return a};const e=[,,,,];e[0]=[,,,,],e[0][0]=[4,0,13,15,12,14,8],e[0][1]=[5,2,16,18,17,19,10],e[0][2]=[6,3,23,22,21,20,9],e[0][3]=[7,1,26,25,27,24,11],e[1]=[,,,,],e[1][0]=[0,6,21,23,20,22,16],e[1][1]=[1,4,0,2,1,3,18],e[1][2]=[2,5,7,6,5,4,17],e[1][3]=[3,7,10,9,11,8,19],e[2]=[,,,,],e[2][0]=[4,0,13,15,12,14,8],e[2][1]=[5,2,16,18,17,19,10],e[2][2]=[6,3,23,22,21,20,9],e[2][3]=[7,1,26,25,27,24,11],e[3]=[,,,,],e[3][0]=[0,6,21,23,20,22,16],e[3][1]=[1,4,0,2,1,3,18],e[3][2]=[2,5,7,6,5,4,17],e[3][3]=[3,7,10,9,11,8,19];const t=[,,,,];function r(o,a,d){const c=a+o,l=c<<d|c>>>32-d;return(i[0][l>>>24]^i[1][l>>>16&255])-i[2][l>>>8&255]+i[3][255&l]}function n(o,a,d){const c=a^o,l=c<<d|c>>>32-d;return i[0][l>>>24]-i[1][l>>>16&255]+i[2][l>>>8&255]^i[3][255&l]}function s(o,a,d){const c=a-o,l=c<<d|c>>>32-d;return(i[0][l>>>24]+i[1][l>>>16&255]^i[2][l>>>8&255])-i[3][255&l]}t[0]=[,,,,],t[0][0]=[24,25,23,22,18],t[0][1]=[26,27,21,20,22],t[0][2]=[28,29,19,18,25],t[0][3]=[30,31,17,16,28],t[1]=[,,,,],t[1][0]=[3,2,12,13,8],t[1][1]=[1,0,14,15,13],t[1][2]=[7,6,8,9,3],t[1][3]=[5,4,10,11,7],t[2]=[,,,,],t[2][0]=[19,18,28,29,25],t[2][1]=[17,16,30,31,28],t[2][2]=[23,22,24,25,18],t[2][3]=[21,20,26,27,22],t[3]=[,,,,],t[3][0]=[8,9,7,6,3],t[3][1]=[10,11,5,4,7],t[3][2]=[12,13,3,2,8],t[3][3]=[14,15,1,0,13],this.keySchedule=function(o){const a=[,,,,,,,,],d=Array(32);let c;for(let f=0;f<4;f++)c=4*f,a[f]=o[c]<<24|o[c+1]<<16|o[c+2]<<8|o[c+3];const l=[6,7,4,5];let u,p=0;for(let f=0;f<2;f++)for(let h=0;h<4;h++){for(c=0;c<4;c++){const y=e[h][c];u=a[y[1]],u^=i[4][a[y[2]>>>2]>>>24-8*(3&y[2])&255],u^=i[5][a[y[3]>>>2]>>>24-8*(3&y[3])&255],u^=i[6][a[y[4]>>>2]>>>24-8*(3&y[4])&255],u^=i[7][a[y[5]>>>2]>>>24-8*(3&y[5])&255],u^=i[l[c]][a[y[6]>>>2]>>>24-8*(3&y[6])&255],a[y[0]]=u}for(c=0;c<4;c++){const y=t[h][c];u=i[4][a[y[0]>>>2]>>>24-8*(3&y[0])&255],u^=i[5][a[y[1]>>>2]>>>24-8*(3&y[1])&255],u^=i[6][a[y[2]>>>2]>>>24-8*(3&y[2])&255],u^=i[7][a[y[3]>>>2]>>>24-8*(3&y[3])&255],u^=i[4+c][a[y[4]>>>2]>>>24-8*(3&y[4])&255],d[p]=u,p++}}for(let f=0;f<16;f++)this.masking[f]=d[f],this.rotate[f]=31&d[16+f]};const i=[,,,,,,,,];i[0]=[821772500,2678128395,1810681135,1059425402,505495343,2617265619,1610868032,3483355465,3218386727,2294005173,3791863952,2563806837,1852023008,365126098,3269944861,584384398,677919599,3229601881,4280515016,2002735330,1136869587,3744433750,2289869850,2731719981,2714362070,879511577,1639411079,575934255,717107937,2857637483,576097850,2731753936,1725645e3,2810460463,5111599,767152862,2543075244,1251459544,1383482551,3052681127,3089939183,3612463449,1878520045,1510570527,2189125840,2431448366,582008916,3163445557,1265446783,1354458274,3529918736,3202711853,3073581712,3912963487,3029263377,1275016285,4249207360,2905708351,3304509486,1442611557,3585198765,2712415662,2731849581,3248163920,2283946226,208555832,2766454743,1331405426,1447828783,3315356441,3108627284,2957404670,2981538698,3339933917,1669711173,286233437,1465092821,1782121619,3862771680,710211251,980974943,1651941557,430374111,2051154026,704238805,4128970897,3144820574,2857402727,948965521,3333752299,2227686284,718756367,2269778983,2731643755,718440111,2857816721,3616097120,1113355533,2478022182,410092745,1811985197,1944238868,2696854588,1415722873,1682284203,1060277122,1998114690,1503841958,82706478,2315155686,1068173648,845149890,2167947013,1768146376,1993038550,3566826697,3390574031,940016341,3355073782,2328040721,904371731,1205506512,4094660742,2816623006,825647681,85914773,2857843460,1249926541,1417871568,3287612,3211054559,3126306446,1975924523,1353700161,2814456437,2438597621,1800716203,722146342,2873936343,1151126914,4160483941,2877670899,458611604,2866078500,3483680063,770352098,2652916994,3367839148,3940505011,3585973912,3809620402,718646636,2504206814,2914927912,3631288169,2857486607,2860018678,575749918,2857478043,718488780,2069512688,3548183469,453416197,1106044049,3032691430,52586708,3378514636,3459808877,3211506028,1785789304,218356169,3571399134,3759170522,1194783844,1523787992,3007827094,1975193539,2555452411,1341901877,3045838698,3776907964,3217423946,2802510864,2889438986,1057244207,1636348243,3761863214,1462225785,2632663439,481089165,718503062,24497053,3332243209,3344655856,3655024856,3960371065,1195698900,2971415156,3710176158,2115785917,4027663609,3525578417,2524296189,2745972565,3564906415,1372086093,1452307862,2780501478,1476592880,3389271281,18495466,2378148571,901398090,891748256,3279637769,3157290713,2560960102,1447622437,4284372637,216884176,2086908623,1879786977,3588903153,2242455666,2938092967,3559082096,2810645491,758861177,1121993112,215018983,642190776,4169236812,1196255959,2081185372,3508738393,941322904,4124243163,2877523539,1848581667,2205260958,3180453958,2589345134,3694731276,550028657,2519456284,3789985535,2973870856,2093648313,443148163,46942275,2734146937,1117713533,1115362972,1523183689,3717140224,1551984063],i[1]=[522195092,4010518363,1776537470,960447360,4267822970,4005896314,1435016340,1929119313,2913464185,1310552629,3579470798,3724818106,2579771631,1594623892,417127293,2715217907,2696228731,1508390405,3994398868,3925858569,3695444102,4019471449,3129199795,3770928635,3520741761,990456497,4187484609,2783367035,21106139,3840405339,631373633,3783325702,532942976,396095098,3548038825,4267192484,2564721535,2011709262,2039648873,620404603,3776170075,2898526339,3612357925,4159332703,1645490516,223693667,1567101217,3362177881,1029951347,3470931136,3570957959,1550265121,119497089,972513919,907948164,3840628539,1613718692,3594177948,465323573,2659255085,654439692,2575596212,2699288441,3127702412,277098644,624404830,4100943870,2717858591,546110314,2403699828,3655377447,1321679412,4236791657,1045293279,4010672264,895050893,2319792268,494945126,1914543101,2777056443,3894764339,2219737618,311263384,4275257268,3458730721,669096869,3584475730,3835122877,3319158237,3949359204,2005142349,2713102337,2228954793,3769984788,569394103,3855636576,1425027204,108000370,2736431443,3671869269,3043122623,1750473702,2211081108,762237499,3972989403,2798899386,3061857628,2943854345,867476300,964413654,1591880597,1594774276,2179821409,552026980,3026064248,3726140315,2283577634,3110545105,2152310760,582474363,1582640421,1383256631,2043843868,3322775884,1217180674,463797851,2763038571,480777679,2718707717,2289164131,3118346187,214354409,200212307,3810608407,3025414197,2674075964,3997296425,1847405948,1342460550,510035443,4080271814,815934613,833030224,1620250387,1945732119,2703661145,3966000196,1388869545,3456054182,2687178561,2092620194,562037615,1356438536,3409922145,3261847397,1688467115,2150901366,631725691,3840332284,549916902,3455104640,394546491,837744717,2114462948,751520235,2221554606,2415360136,3999097078,2063029875,803036379,2702586305,821456707,3019566164,360699898,4018502092,3511869016,3677355358,2402471449,812317050,49299192,2570164949,3259169295,2816732080,3331213574,3101303564,2156015656,3705598920,3546263921,143268808,3200304480,1638124008,3165189453,3341807610,578956953,2193977524,3638120073,2333881532,807278310,658237817,2969561766,1641658566,11683945,3086995007,148645947,1138423386,4158756760,1981396783,2401016740,3699783584,380097457,2680394679,2803068651,3334260286,441530178,4016580796,1375954390,761952171,891809099,2183123478,157052462,3683840763,1592404427,341349109,2438483839,1417898363,644327628,2233032776,2353769706,2201510100,220455161,1815641738,182899273,2995019788,3627381533,3702638151,2890684138,1052606899,588164016,1681439879,4038439418,2405343923,4229449282,167996282,1336969661,1688053129,2739224926,1543734051,1046297529,1138201970,2121126012,115334942,1819067631,1902159161,1941945968,2206692869,1159982321],i[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612,2932787856,3199334847,4009478890,3905886544,1373570990,2450425862,4037870920,3778841987,2456817877,286293407,124026297,3001279700,1028597854,3115296800,4208886496,2691114635,2188540206,1430237888,1218109995,3572471700,308166588,570424558,2187009021,2455094765,307733056,1310360322,3135275007,1384269543,2388071438,863238079,2359263624,2801553128,3380786597,2831162807,1470087780,1728663345,4072488799,1090516929,532123132,2389430977,1132193179,2578464191,3051079243,1670234342,1434557849,2711078940,1241591150,3314043432,3435360113,3091448339,1812415473,2198440252,267246943,796911696,3619716990,38830015,1526438404,2806502096,374413614,2943401790,1489179520,1603809326,1920779204,168801282,260042626,2358705581,1563175598,2397674057,1356499128,2217211040,514611088,2037363785,2186468373,4022173083,2792511869,2913485016,1173701892,4200428547,3896427269,1334932762,2455136706,602925377,2835607854,1613172210,41346230,2499634548,2457437618,2188827595,41386358,4172255629,1313404830,2405527007,3801973774,2217704835,873260488,2528884354,2478092616,4012915883,2555359016,2006953883,2463913485,575479328,2218240648,2099895446,660001756,2341502190,3038761536,3888151779,3848713377,3286851934,1022894237,1620365795,3449594689,1551255054,15374395,3570825345,4249311020,4151111129,3181912732,310226346,1133119310,530038928,136043402,2476768958,3107506709,2544909567,1036173560,2367337196,1681395281,1758231547,3641649032,306774401,1575354324,3716085866,1990386196,3114533736,2455606671,1262092282,3124342505,2768229131,4210529083,1833535011,423410938,660763973,2187129978,1639812e3,3508421329,3467445492,310289298,272797111,2188552562,2456863912,310240523,677093832,1013118031,901835429,3892695601,1116285435,3036471170,1337354835,243122523,520626091,277223598,4244441197,4194248841,1766575121,594173102,316590669,742362309,3536858622,4176435350,3838792410,2501204839,1229605004,3115755532,1552908988,2312334149,979407927,3959474601,1148277331,176638793,3614686272,2083809052,40992502,1340822838,2731552767,3535757508,3560899520,1354035053,122129617,7215240,2732932949,3118912700,2718203926,2539075635,3609230695,3725561661,1928887091,2882293555,1988674909,2063640240,2491088897,1459647954,4189817080,2302804382,1113892351,2237858528,1927010603,4002880361,1856122846,1594404395,2944033133,3855189863,3474975698,1643104450,4054590833,3431086530,1730235576,2984608721,3084664418,2131803598,4178205752,267404349,1617849798,1616132681,1462223176,736725533,2327058232,551665188,2945899023,1749386277,2575514597,1611482493,674206544,2201269090,3642560800,728599968,1680547377,2620414464,1388111496,453204106,4156223445,1094905244,2754698257,2201108165,3757000246,2704524545,3922940700,3996465027],i[3]=[2645754912,532081118,2814278639,3530793624,1246723035,1689095255,2236679235,4194438865,2116582143,3859789411,157234593,2045505824,4245003587,1687664561,4083425123,605965023,672431967,1336064205,3376611392,214114848,4258466608,3232053071,489488601,605322005,3998028058,264917351,1912574028,756637694,436560991,202637054,135989450,85393697,2152923392,3896401662,2895836408,2145855233,3535335007,115294817,3147733898,1922296357,3464822751,4117858305,1037454084,2725193275,2127856640,1417604070,1148013728,1827919605,642362335,2929772533,909348033,1346338451,3547799649,297154785,1917849091,4161712827,2883604526,3968694238,1469521537,3780077382,3375584256,1763717519,136166297,4290970789,1295325189,2134727907,2798151366,1566297257,3672928234,2677174161,2672173615,965822077,2780786062,289653839,1133871874,3491843819,35685304,1068898316,418943774,672553190,642281022,2346158704,1954014401,3037126780,4079815205,2030668546,3840588673,672283427,1776201016,359975446,3750173538,555499703,2769985273,1324923,69110472,152125443,3176785106,3822147285,1340634837,798073664,1434183902,15393959,216384236,1303690150,3881221631,3711134124,3960975413,106373927,2578434224,1455997841,1801814300,1578393881,1854262133,3188178946,3258078583,2302670060,1539295533,3505142565,3078625975,2372746020,549938159,3278284284,2620926080,181285381,2865321098,3970029511,68876850,488006234,1728155692,2608167508,836007927,2435231793,919367643,3339422534,3655756360,1457871481,40520939,1380155135,797931188,234455205,2255801827,3990488299,397000196,739833055,3077865373,2871719860,4022553888,772369276,390177364,3853951029,557662966,740064294,1640166671,1699928825,3535942136,622006121,3625353122,68743880,1742502,219489963,1664179233,1577743084,1236991741,410585305,2366487942,823226535,1050371084,3426619607,3586839478,212779912,4147118561,1819446015,1911218849,530248558,3486241071,3252585495,2886188651,3410272728,2342195030,20547779,2982490058,3032363469,3631753222,312714466,1870521650,1493008054,3491686656,615382978,4103671749,2534517445,1932181,2196105170,278426614,6369430,3274544417,2913018367,697336853,2143000447,2946413531,701099306,1558357093,2805003052,3500818408,2321334417,3567135975,216290473,3591032198,23009561,1996984579,3735042806,2024298078,3739440863,569400510,2339758983,3016033873,3097871343,3639523026,3844324983,3256173865,795471839,2951117563,4101031090,4091603803,3603732598,971261452,534414648,428311343,3389027175,2844869880,694888862,1227866773,2456207019,3043454569,2614353370,3749578031,3676663836,459166190,4132644070,1794958188,51825668,2252611902,3084671440,2036672799,3436641603,1099053433,2469121526,3059204941,1323291266,2061838604,1018778475,2233344254,2553501054,334295216,3556750194,1065731521,183467730],i[4]=[2127105028,745436345,2601412319,2788391185,3093987327,500390133,1155374404,389092991,150729210,3891597772,3523549952,1935325696,716645080,946045387,2901812282,1774124410,3869435775,4039581901,3293136918,3438657920,948246080,363898952,3867875531,1286266623,1598556673,68334250,630723836,1104211938,1312863373,613332731,2377784574,1101634306,441780740,3129959883,1917973735,2510624549,3238456535,2544211978,3308894634,1299840618,4076074851,1756332096,3977027158,297047435,3790297736,2265573040,3621810518,1311375015,1667687725,47300608,3299642885,2474112369,201668394,1468347890,576830978,3594690761,3742605952,1958042578,1747032512,3558991340,1408974056,3366841779,682131401,1033214337,1545599232,4265137049,206503691,103024618,2855227313,1337551222,2428998917,2963842932,4015366655,3852247746,2796956967,3865723491,3747938335,247794022,3755824572,702416469,2434691994,397379957,851939612,2314769512,218229120,1380406772,62274761,214451378,3170103466,2276210409,3845813286,28563499,446592073,1693330814,3453727194,29968656,3093872512,220656637,2470637031,77972100,1667708854,1358280214,4064765667,2395616961,325977563,4277240721,4220025399,3605526484,3355147721,811859167,3069544926,3962126810,652502677,3075892249,4132761541,3498924215,1217549313,3250244479,3858715919,3053989961,1538642152,2279026266,2875879137,574252750,3324769229,2651358713,1758150215,141295887,2719868960,3515574750,4093007735,4194485238,1082055363,3417560400,395511885,2966884026,179534037,3646028556,3738688086,1092926436,2496269142,257381841,3772900718,1636087230,1477059743,2499234752,3811018894,2675660129,3285975680,90732309,1684827095,1150307763,1723134115,3237045386,1769919919,1240018934,815675215,750138730,2239792499,1234303040,1995484674,138143821,675421338,1145607174,1936608440,3238603024,2345230278,2105974004,323969391,779555213,3004902369,2861610098,1017501463,2098600890,2628620304,2940611490,2682542546,1171473753,3656571411,3687208071,4091869518,393037935,159126506,1662887367,1147106178,391545844,3452332695,1891500680,3016609650,1851642611,546529401,1167818917,3194020571,2848076033,3953471836,575554290,475796850,4134673196,450035699,2351251534,844027695,1080539133,86184846,1554234488,3692025454,1972511363,2018339607,1491841390,1141460869,1061690759,4244549243,2008416118,2351104703,2868147542,1598468138,722020353,1027143159,212344630,1387219594,1725294528,3745187956,2500153616,458938280,4129215917,1828119673,544571780,3503225445,2297937496,1241802790,267843827,2694610800,1397140384,1558801448,3782667683,1806446719,929573330,2234912681,400817706,616011623,4121520928,3603768725,1761550015,1968522284,4053731006,4192232858,4005120285,872482584,3140537016,3894607381,2287405443,1963876937,3663887957,1584857e3,2975024454,1833426440,4025083860],i[5]=[4143615901,749497569,1285769319,3795025788,2514159847,23610292,3974978748,844452780,3214870880,3751928557,2213566365,1676510905,448177848,3730751033,4086298418,2307502392,871450977,3222878141,4110862042,3831651966,2735270553,1310974780,2043402188,1218528103,2736035353,4274605013,2702448458,3936360550,2693061421,162023535,2827510090,687910808,23484817,3784910947,3371371616,779677500,3503626546,3473927188,4157212626,3500679282,4248902014,2466621104,3899384794,1958663117,925738300,1283408968,3669349440,1840910019,137959847,2679828185,1239142320,1315376211,1547541505,1690155329,739140458,3128809933,3933172616,3876308834,905091803,1548541325,4040461708,3095483362,144808038,451078856,676114313,2861728291,2469707347,993665471,373509091,2599041286,4025009006,4170239449,2149739950,3275793571,3749616649,2794760199,1534877388,572371878,2590613551,1753320020,3467782511,1405125690,4270405205,633333386,3026356924,3475123903,632057672,2846462855,1404951397,3882875879,3915906424,195638627,2385783745,3902872553,1233155085,3355999740,2380578713,2702246304,2144565621,3663341248,3894384975,2502479241,4248018925,3094885567,1594115437,572884632,3385116731,767645374,1331858858,1475698373,3793881790,3532746431,1321687957,619889600,1121017241,3440213920,2070816767,2833025776,1933951238,4095615791,890643334,3874130214,859025556,360630002,925594799,1764062180,3920222280,4078305929,979562269,2810700344,4087740022,1949714515,546639971,1165388173,3069891591,1495988560,922170659,1291546247,2107952832,1813327274,3406010024,3306028637,4241950635,153207855,2313154747,1608695416,1150242611,1967526857,721801357,1220138373,3691287617,3356069787,2112743302,3281662835,1111556101,1778980689,250857638,2298507990,673216130,2846488510,3207751581,3562756981,3008625920,3417367384,2198807050,529510932,3547516680,3426503187,2364944742,102533054,2294910856,1617093527,1204784762,3066581635,1019391227,1069574518,1317995090,1691889997,3661132003,510022745,3238594800,1362108837,1817929911,2184153760,805817662,1953603311,3699844737,120799444,2118332377,207536705,2282301548,4120041617,145305846,2508124933,3086745533,3261524335,1877257368,2977164480,3160454186,2503252186,4221677074,759945014,254147243,2767453419,3801518371,629083197,2471014217,907280572,3900796746,940896768,2751021123,2625262786,3161476951,3661752313,3260732218,1425318020,2977912069,1496677566,3988592072,2140652971,3126511541,3069632175,977771578,1392695845,1698528874,1411812681,1369733098,1343739227,3620887944,1142123638,67414216,3102056737,3088749194,1626167401,2546293654,3941374235,697522451,33404913,143560186,2595682037,994885535,1247667115,3859094837,2699155541,3547024625,4114935275,2968073508,3199963069,2732024527,1237921620,951448369,1898488916,1211705605,2790989240,2233243581,3598044975],i[6]=[2246066201,858518887,1714274303,3485882003,713916271,2879113490,3730835617,539548191,36158695,1298409750,419087104,1358007170,749914897,2989680476,1261868530,2995193822,2690628854,3443622377,3780124940,3796824509,2976433025,4259637129,1551479e3,512490819,1296650241,951993153,2436689437,2460458047,144139966,3136204276,310820559,3068840729,643875328,1969602020,1680088954,2185813161,3283332454,672358534,198762408,896343282,276269502,3014846926,84060815,197145886,376173866,3943890818,3813173521,3545068822,1316698879,1598252827,2633424951,1233235075,859989710,2358460855,3503838400,3409603720,1203513385,1193654839,2792018475,2060853022,207403770,1144516871,3068631394,1121114134,177607304,3785736302,326409831,1929119770,2983279095,4183308101,3474579288,3200513878,3228482096,119610148,1170376745,3378393471,3163473169,951863017,3337026068,3135789130,2907618374,1183797387,2015970143,4045674555,2182986399,2952138740,3928772205,384012900,2454997643,10178499,2879818989,2596892536,111523738,2995089006,451689641,3196290696,235406569,1441906262,3890558523,3013735005,4158569349,1644036924,376726067,1006849064,3664579700,2041234796,1021632941,1374734338,2566452058,371631263,4007144233,490221539,206551450,3140638584,1053219195,1853335209,3412429660,3562156231,735133835,1623211703,3104214392,2738312436,4096837757,3366392578,3110964274,3956598718,3196820781,2038037254,3877786376,2339753847,300912036,3766732888,2372630639,1516443558,4200396704,1574567987,4069441456,4122592016,2699739776,146372218,2748961456,2043888151,35287437,2596680554,655490400,1132482787,110692520,1031794116,2188192751,1324057718,1217253157,919197030,686247489,3261139658,1028237775,3135486431,3059715558,2460921700,986174950,2661811465,4062904701,2752986992,3709736643,367056889,1353824391,731860949,1650113154,1778481506,784341916,357075625,3608602432,1074092588,2480052770,3811426202,92751289,877911070,3600361838,1231880047,480201094,3756190983,3094495953,434011822,87971354,363687820,1717726236,1901380172,3926403882,2481662265,400339184,1490350766,2661455099,1389319756,2558787174,784598401,1983468483,30828846,3550527752,2716276238,3841122214,1765724805,1955612312,1277890269,1333098070,1564029816,2704417615,1026694237,3287671188,1260819201,3349086767,1016692350,1582273796,1073413053,1995943182,694588404,1025494639,3323872702,3551898420,4146854327,453260480,1316140391,1435673405,3038941953,3486689407,1622062951,403978347,817677117,950059133,4246079218,3278066075,1486738320,1417279718,481875527,2549965225,3933690356,760697757,1452955855,3897451437,1177426808,1702951038,4085348628,2447005172,1084371187,3516436277,3068336338,1073369276,1027665953,3284188590,1230553676,1368340146,2226246512,267243139,2274220762,4070734279,2497715176,2423353163,2504755875],i[7]=[3793104909,3151888380,2817252029,895778965,2005530807,3871412763,237245952,86829237,296341424,3851759377,3974600970,2475086196,709006108,1994621201,2972577594,937287164,3734691505,168608556,3189338153,2225080640,3139713551,3033610191,3025041904,77524477,185966941,1208824168,2344345178,1721625922,3354191921,1066374631,1927223579,1971335949,2483503697,1551748602,2881383779,2856329572,3003241482,48746954,1398218158,2050065058,313056748,4255789917,393167848,1912293076,940740642,3465845460,3091687853,2522601570,2197016661,1727764327,364383054,492521376,1291706479,3264136376,1474851438,1685747964,2575719748,1619776915,1814040067,970743798,1561002147,2925768690,2123093554,1880132620,3151188041,697884420,2550985770,2607674513,2659114323,110200136,1489731079,997519150,1378877361,3527870668,478029773,2766872923,1022481122,431258168,1112503832,897933369,2635587303,669726182,3383752315,918222264,163866573,3246985393,3776823163,114105080,1903216136,761148244,3571337562,1690750982,3166750252,1037045171,1888456500,2010454850,642736655,616092351,365016990,1185228132,4174898510,1043824992,2023083429,2241598885,3863320456,3279669087,3674716684,108438443,2132974366,830746235,606445527,4173263986,2204105912,1844756978,2532684181,4245352700,2969441100,3796921661,1335562986,4061524517,2720232303,2679424040,634407289,885462008,3294724487,3933892248,2094100220,339117932,4048830727,3202280980,1458155303,2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}function Hu(e){this.cast5=new nP,this.cast5.setKey(e),this.encrypt=function(t){return this.cast5.encrypt(t)}}Fu.keySize=Fu.prototype.keySize=24,Fu.blockSize=Fu.prototype.blockSize=8,Hu.blockSize=Hu.prototype.blockSize=8,Hu.keySize=Hu.prototype.keySize=16;const Nn=4294967295;function si(e,t){return(e<<t|e>>>32-t)&Nn}function xi(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function us(e,t,r){e.splice(t,4,255&r,r>>>8&255,r>>>16&255,r>>>24&255)}function Nt(e,t){return e>>>8*t&255}function Gu(e){this.tf=function(){let t=null,r=null,n=-1,s=[],i=[[],[],[],[]];function o(l){return i[0][Nt(l,0)]^i[1][Nt(l,1)]^i[2][Nt(l,2)]^i[3][Nt(l,3)]}function a(l){return i[0][Nt(l,3)]^i[1][Nt(l,0)]^i[2][Nt(l,1)]^i[3][Nt(l,2)]}function d(l,u){let p=o(u[0]),f=a(u[1]);u[2]=si(u[2]^p+f+s[4*l+8]&Nn,31),u[3]=si(u[3],1)^p+2*f+s[4*l+9]&Nn,p=o(u[2]),f=a(u[3]),u[0]=si(u[0]^p+f+s[4*l+10]&Nn,31),u[1]=si(u[1],1)^p+2*f+s[4*l+11]&Nn}function c(l,u){let p=o(u[0]),f=a(u[1]);u[2]=si(u[2],1)^p+f+s[4*l+10]&Nn,u[3]=si(u[3]^p+2*f+s[4*l+11]&Nn,31),p=o(u[2]),f=a(u[3]),u[0]=si(u[0],1)^p+f+s[4*l+8]&Nn,u[1]=si(u[1]^p+2*f+s[4*l+9]&Nn,31)}return{name:"twofish",blocksize:16,open:function(l){let u,p,f,h,y;t=l;const m=[],b=[],v=[];let E;const _=[];let C,k,D;const w=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],S=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],I=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],T=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],g=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],A=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,7],P=[[],[]],O=[[],[],[],[]];function N(K){return K^K>>2^[0,90,180,238][3&K]}function M(K){return K^K>>1^K>>2^[0,238,180,90][3&K]}function L(K,V){let J,se,j;for(J=0;J<8;J++)se=V>>>24,V=V<<8&Nn|K>>>24,K=K<<8&Nn,j=se<<1,128&se&&(j^=333),V^=se^j<<16,j^=se>>>1,1&se&&(j^=166),V^=j<<24|j<<8;return V}function x(K,V){const J=V>>4,se=15&V,j=w[K][J^se],re=S[K][g[se]^A[J]];return T[K][g[re]^A[j]]<<4|I[K][j^re]}function R(K,V){let J=Nt(K,0),se=Nt(K,1),j=Nt(K,2),re=Nt(K,3);switch(E){case 4:J=P[1][J]^Nt(V[3],0),se=P[0][se]^Nt(V[3],1),j=P[0][j]^Nt(V[3],2),re=P[1][re]^Nt(V[3],3);case 3:J=P[1][J]^Nt(V[2],0),se=P[1][se]^Nt(V[2],1),j=P[0][j]^Nt(V[2],2),re=P[0][re]^Nt(V[2],3);case 2:J=P[0][P[0][J]^Nt(V[1],0)]^Nt(V[0],0),se=P[0][P[1][se]^Nt(V[1],1)]^Nt(V[0],1),j=P[1][P[0][j]^Nt(V[1],2)]^Nt(V[0],2),re=P[1][P[1][re]^Nt(V[1],3)]^Nt(V[0],3)}return O[0][J]^O[1][se]^O[2][j]^O[3][re]}for(t=t.slice(0,32),u=t.length;u!==16&&u!==24&&u!==32;)t[u++]=0;for(u=0;u<t.length;u+=4)v[u>>2]=xi(t,u);for(u=0;u<256;u++)P[0][u]=x(0,u),P[1][u]=x(1,u);for(u=0;u<256;u++)C=P[1][u],k=N(C),D=M(C),O[0][u]=C+(k<<8)+(D<<16)+(D<<24),O[2][u]=k+(D<<8)+(C<<16)+(D<<24),C=P[0][u],k=N(C),D=M(C),O[1][u]=D+(D<<8)+(k<<16)+(C<<24),O[3][u]=k+(C<<8)+(D<<16)+(k<<24);for(E=v.length/2,u=0;u<E;u++)p=v[u+u],m[u]=p,f=v[u+u+1],b[u]=f,_[E-u-1]=L(p,f);for(u=0;u<40;u+=2)p=16843009*u,f=p+16843009,p=R(p,m),f=si(R(f,b),8),s[u]=p+f&Nn,s[u+1]=si(p+2*f,9);for(u=0;u<256;u++)switch(p=f=h=y=u,E){case 4:p=P[1][p]^Nt(_[3],0),f=P[0][f]^Nt(_[3],1),h=P[0][h]^Nt(_[3],2),y=P[1][y]^Nt(_[3],3);case 3:p=P[1][p]^Nt(_[2],0),f=P[1][f]^Nt(_[2],1),h=P[0][h]^Nt(_[2],2),y=P[0][y]^Nt(_[2],3);case 2:i[0][u]=O[0][P[0][P[0][p]^Nt(_[1],0)]^Nt(_[0],0)],i[1][u]=O[1][P[0][P[1][f]^Nt(_[1],1)]^Nt(_[0],1)],i[2][u]=O[2][P[1][P[0][h]^Nt(_[1],2)]^Nt(_[0],2)],i[3][u]=O[3][P[1][P[1][y]^Nt(_[1],3)]^Nt(_[0],3)]}},close:function(){s=[],i=[[],[],[],[]]},encrypt:function(l,u){r=l,n=u;const p=[xi(r,n)^s[0],xi(r,n+4)^s[1],xi(r,n+8)^s[2],xi(r,n+12)^s[3]];for(let f=0;f<8;f++)d(f,p);return us(r,n,p[2]^s[4]),us(r,n+4,p[3]^s[5]),us(r,n+8,p[0]^s[6]),us(r,n+12,p[1]^s[7]),n+=16,r},decrypt:function(l,u){r=l,n=u;const p=[xi(r,n)^s[4],xi(r,n+4)^s[5],xi(r,n+8)^s[6],xi(r,n+12)^s[7]];for(let f=7;f>=0;f--)c(f,p);us(r,n,p[2]^s[0]),us(r,n+4,p[3]^s[1]),us(r,n+8,p[0]^s[2]),us(r,n+12,p[1]^s[3]),n+=16},finalize:function(){return r}}}(),this.tf.open(Array.from(e),0),this.encrypt=function(t){return this.tf.encrypt(Array.from(t),0)}}function Yn(){}function zu(e){this.bf=new Yn,this.bf.init(e),this.encrypt=function(t){return this.bf.encryptBlock(t)}}Gu.keySize=Gu.prototype.keySize=32,Gu.blockSize=Gu.prototype.blockSize=16,Yn.prototype.BLOCKSIZE=8,Yn.prototype.SBOXES=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]],Yn.prototype.PARRAY=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],Yn.prototype.NN=16,Yn.prototype._clean=function(e){return e<0&&(e=(2147483647&e)+2147483648),e},Yn.prototype._F=function(e){let t;const r=255&e,n=255&(e>>>=8),s=255&(e>>>=8),i=255&(e>>>=8);return t=this.sboxes[0][i]+this.sboxes[1][s],t^=this.sboxes[2][n],t+=this.sboxes[3][r],t},Yn.prototype._encryptBlock=function(e){let t,r=e[0],n=e[1];for(t=0;t<this.NN;++t){r^=this.parray[t],n=this._F(r)^n;const s=r;r=n,n=s}r^=this.parray[this.NN+0],n^=this.parray[this.NN+1],e[0]=this._clean(n),e[1]=this._clean(r)},Yn.prototype.encryptBlock=function(e){let t;const r=[0,0],n=this.BLOCKSIZE/2;for(t=0;t<this.BLOCKSIZE/2;++t)r[0]=r[0]<<8|255&e[t+0],r[1]=r[1]<<8|255&e[t+n];this._encryptBlock(r);const s=[];for(t=0;t<this.BLOCKSIZE/2;++t)s[t+0]=r[0]>>>24-8*t&255,s[t+n]=r[1]>>>24-8*t&255;return s},Yn.prototype._decryptBlock=function(e){let t,r=e[0],n=e[1];for(t=this.NN+1;t>1;--t){r^=this.parray[t],n=this._F(r)^n;const s=r;r=n,n=s}r^=this.parray[1],n^=this.parray[0],e[0]=this._clean(n),e[1]=this._clean(r)},Yn.prototype.init=function(e){let t,r=0;for(this.parray=[],t=0;t<this.NN+2;++t){let s=0;for(let i=0;i<4;++i)s=s<<8|255&e[r],++r>=e.length&&(r=0);this.parray[t]=this.PARRAY[t]^s}for(this.sboxes=[],t=0;t<4;++t)for(this.sboxes[t]=[],r=0;r<256;++r)this.sboxes[t][r]=this.SBOXES[t][r];const n=[0,0];for(t=0;t<this.NN+2;t+=2)this._encryptBlock(n),this.parray[t+0]=n[0],this.parray[t+1]=n[1];for(t=0;t<4;++t)for(r=0;r<256;r+=2)this._encryptBlock(n),this.sboxes[t][r+0]=n[0],this.sboxes[t][r+1]=n[1]},zu.keySize=zu.prototype.keySize=16,zu.blockSize=zu.prototype.blockSize=8;const iP=d2(128),sP=d2(192),aP=d2(256),oP=function(e){this.key=e,this.encrypt=function(t,r){return cl(ul(this.key),t,!0,0,null,r)},this.decrypt=function(t,r){return cl(ul(this.key),t,!1,0,null,r)}};var ql=Object.freeze({__proto__:null,aes128:iP,aes192:sP,aes256:aP,des:oP,tripledes:Fu,cast5:Hu,twofish:Gu,blowfish:zu,idea:function(){throw Error("IDEA symmetric-key algorithm not implemented")}}),j8=function(e,t,r){var n=0,s=0,i=0,o=0,a=0,d=0,c=0,l=0,u=0,p=0,f=0,h=0,y=0,m=0,b=0,v=0,E=0,_=new e.Uint8Array(r);function C(M,L,x,R,K,V,J,se,j,re,G,B,X,ge,_e,Se){M=M|0,L=L|0,x=x|0,R=R|0,K=K|0,V=V|0,J=J|0,se=se|0,j=j|0,re=re|0,G=G|0,B=B|0,X=X|0,ge=ge|0,_e=_e|0,Se=Se|0;var F=0,q=0,z=0,ee=0,le=0,ce=0,ne=0,je=0,De=0,Fe=0,he=0,ue=0,pe=0,de=0,fe=0,ye=0,ie=0,Q=0,qe=0,He=0,Qe=0,dt=0,rt=0,be=0,W=0,oe=0,me=0,Te=0,Pe=0,ke=0,Ne=0,Ue=0,Re=0,Me=0,et=0,Ee=0,Ce=0,Oe=0,Be=0,Ve=0,$=0,Y=0,Z=0,U=0,ae=0,Ae=0,Ie=0,xe=0,Ge=0,ut=0,nt=0,Ct=0,st=0,mt=0,bt=0,At=0,Et=0,vt=0,wt=0,_t=0,ct=0,ft=0,it=0,lt=0,ht=0,ot=0,Le=0,Ke=0,Ye=0,ze=0,We=0;F=n,q=s,z=i,ee=o,le=a,ne=M+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=L+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=x+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=R+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=K+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=V+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=J+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=se+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=j+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=re+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=G+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=B+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=X+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=ge+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=_e+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ne=Se+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ge^j^x^M,je=ce<<1|ce>>>31,ne=je+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=_e^re^R^L,De=ce<<1|ce>>>31,ne=De+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Se^G^K^x,Fe=ce<<1|ce>>>31,ne=Fe+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=je^B^V^R,he=ce<<1|ce>>>31,ne=he+(F<<5|F>>>27)+le+(q&z|~q&ee)+1518500249|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=De^X^J^K,ue=ce<<1|ce>>>31,ne=ue+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Fe^ge^se^V,pe=ce<<1|ce>>>31,ne=pe+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=he^_e^j^J,de=ce<<1|ce>>>31,ne=de+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ue^Se^re^se,fe=ce<<1|ce>>>31,ne=fe+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=pe^je^G^j,ye=ce<<1|ce>>>31,ne=ye+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=de^De^B^re,ie=ce<<1|ce>>>31,ne=ie+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=fe^Fe^X^G,Q=ce<<1|ce>>>31,ne=Q+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ye^he^ge^B,qe=ce<<1|ce>>>31,ne=qe+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ie^ue^_e^X,He=ce<<1|ce>>>31,ne=He+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Q^pe^Se^ge,Qe=ce<<1|ce>>>31,ne=Qe+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=qe^de^je^_e,dt=ce<<1|ce>>>31,ne=dt+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=He^fe^De^Se,rt=ce<<1|ce>>>31,ne=rt+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Qe^ye^Fe^je,be=ce<<1|ce>>>31,ne=be+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=dt^ie^he^De,W=ce<<1|ce>>>31,ne=W+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=rt^Q^ue^Fe,oe=ce<<1|ce>>>31,ne=oe+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=be^qe^pe^he,me=ce<<1|ce>>>31,ne=me+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=W^He^de^ue,Te=ce<<1|ce>>>31,ne=Te+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=oe^Qe^fe^pe,Pe=ce<<1|ce>>>31,ne=Pe+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=me^dt^ye^de,ke=ce<<1|ce>>>31,ne=ke+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Te^rt^ie^fe,Ne=ce<<1|ce>>>31,ne=Ne+(F<<5|F>>>27)+le+(q^z^ee)+1859775393|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Pe^be^Q^ye,Ue=ce<<1|ce>>>31,ne=Ue+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ke^W^qe^ie,Re=ce<<1|ce>>>31,ne=Re+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ne^oe^He^Q,Me=ce<<1|ce>>>31,ne=Me+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ue^me^Qe^qe,et=ce<<1|ce>>>31,ne=et+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Re^Te^dt^He,Ee=ce<<1|ce>>>31,ne=Ee+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Me^Pe^rt^Qe,Ce=ce<<1|ce>>>31,ne=Ce+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=et^ke^be^dt,Oe=ce<<1|ce>>>31,ne=Oe+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ee^Ne^W^rt,Be=ce<<1|ce>>>31,ne=Be+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ce^Ue^oe^be,Ve=ce<<1|ce>>>31,ne=Ve+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Oe^Re^me^W,$=ce<<1|ce>>>31,ne=$+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Be^Me^Te^oe,Y=ce<<1|ce>>>31,ne=Y+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ve^et^Pe^me,Z=ce<<1|ce>>>31,ne=Z+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=$^Ee^ke^Te,U=ce<<1|ce>>>31,ne=U+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Y^Ce^Ne^Pe,ae=ce<<1|ce>>>31,ne=ae+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Z^Oe^Ue^ke,Ae=ce<<1|ce>>>31,ne=Ae+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=U^Be^Re^Ne,Ie=ce<<1|ce>>>31,ne=Ie+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ae^Ve^Me^Ue,xe=ce<<1|ce>>>31,ne=xe+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ae^$^et^Re,Ge=ce<<1|ce>>>31,ne=Ge+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ie^Y^Ee^Me,ut=ce<<1|ce>>>31,ne=ut+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=xe^Z^Ce^et,nt=ce<<1|ce>>>31,ne=nt+(F<<5|F>>>27)+le+(q&z|q&ee|z&ee)-1894007588|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ge^U^Oe^Ee,Ct=ce<<1|ce>>>31,ne=Ct+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ut^ae^Be^Ce,st=ce<<1|ce>>>31,ne=st+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=nt^Ae^Ve^Oe,mt=ce<<1|ce>>>31,ne=mt+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ct^Ie^$^Be,bt=ce<<1|ce>>>31,ne=bt+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=st^xe^Y^Ve,At=ce<<1|ce>>>31,ne=At+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=mt^Ge^Z^$,Et=ce<<1|ce>>>31,ne=Et+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=bt^ut^U^Y,vt=ce<<1|ce>>>31,ne=vt+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=At^nt^ae^Z,wt=ce<<1|ce>>>31,ne=wt+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Et^Ct^Ae^U,_t=ce<<1|ce>>>31,ne=_t+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=vt^st^Ie^ae,ct=ce<<1|ce>>>31,ne=ct+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=wt^mt^xe^Ae,ft=ce<<1|ce>>>31,ne=ft+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=_t^bt^Ge^Ie,it=ce<<1|ce>>>31,ne=it+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ct^At^ut^xe,lt=ce<<1|ce>>>31,ne=lt+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ft^Et^nt^Ge,ht=ce<<1|ce>>>31,ne=ht+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=it^vt^Ct^ut,ot=ce<<1|ce>>>31,ne=ot+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=lt^wt^st^nt,Le=ce<<1|ce>>>31,ne=Le+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ht^_t^mt^Ct,Ke=ce<<1|ce>>>31,ne=Ke+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=ot^ct^bt^st,Ye=ce<<1|ce>>>31,ne=Ye+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Le^ft^At^mt,ze=ce<<1|ce>>>31,ne=ze+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,ce=Ke^it^Et^bt,We=ce<<1|ce>>>31,ne=We+(F<<5|F>>>27)+le+(q^z^ee)-899497514|0,le=ee,ee=z,z=q<<30|q>>>2,q=F,F=ne,n=n+F|0,s=s+q|0,i=i+z|0,o=o+ee|0,a=a+le|0}function k(M){M=M|0,C(_[M|0]<<24|_[M|1]<<16|_[M|2]<<8|_[M|3],_[M|4]<<24|_[M|5]<<16|_[M|6]<<8|_[M|7],_[M|8]<<24|_[M|9]<<16|_[M|10]<<8|_[M|11],_[M|12]<<24|_[M|13]<<16|_[M|14]<<8|_[M|15],_[M|16]<<24|_[M|17]<<16|_[M|18]<<8|_[M|19],_[M|20]<<24|_[M|21]<<16|_[M|22]<<8|_[M|23],_[M|24]<<24|_[M|25]<<16|_[M|26]<<8|_[M|27],_[M|28]<<24|_[M|29]<<16|_[M|30]<<8|_[M|31],_[M|32]<<24|_[M|33]<<16|_[M|34]<<8|_[M|35],_[M|36]<<24|_[M|37]<<16|_[M|38]<<8|_[M|39],_[M|40]<<24|_[M|41]<<16|_[M|42]<<8|_[M|43],_[M|44]<<24|_[M|45]<<16|_[M|46]<<8|_[M|47],_[M|48]<<24|_[M|49]<<16|_[M|50]<<8|_[M|51],_[M|52]<<24|_[M|53]<<16|_[M|54]<<8|_[M|55],_[M|56]<<24|_[M|57]<<16|_[M|58]<<8|_[M|59],_[M|60]<<24|_[M|61]<<16|_[M|62]<<8|_[M|63])}function D(M){M=M|0,_[M|0]=n>>>24,_[M|1]=n>>>16&255,_[M|2]=n>>>8&255,_[M|3]=n&255,_[M|4]=s>>>24,_[M|5]=s>>>16&255,_[M|6]=s>>>8&255,_[M|7]=s&255,_[M|8]=i>>>24,_[M|9]=i>>>16&255,_[M|10]=i>>>8&255,_[M|11]=i&255,_[M|12]=o>>>24,_[M|13]=o>>>16&255,_[M|14]=o>>>8&255,_[M|15]=o&255,_[M|16]=a>>>24,_[M|17]=a>>>16&255,_[M|18]=a>>>8&255,_[M|19]=a&255}function w(){n=1732584193,s=4023233417,i=2562383102,o=271733878,a=3285377520,d=c=0}function S(M,L,x,R,K,V,J){M=M|0,L=L|0,x=x|0,R=R|0,K=K|0,V=V|0,J=J|0,n=M,s=L,i=x,o=R,a=K,d=V,c=J}function I(M,L){M=M|0,L=L|0;var x=0;if(M&63)return-1;for(;(L|0)>=64;)k(M),M=M+64|0,L=L-64|0,x=x+64|0;return d=d+x|0,d>>>0<x>>>0&&(c=c+1|0),x|0}function T(M,L,x){M=M|0,L=L|0,x=x|0;var R=0,K=0;if(M&63||~x&&x&31)return-1;if((L|0)>=64){if(R=I(M,L)|0,(R|0)==-1)return-1;M=M+R|0,L=L-R|0}if(R=R+L|0,d=d+L|0,d>>>0<L>>>0&&(c=c+1|0),_[M|L]=128,(L|0)>=56){for(K=L+1|0;(K|0)<64;K=K+1|0)_[M|K]=0;k(M),L=0,_[M|0]=0}for(K=L+1|0;(K|0)<59;K=K+1|0)_[M|K]=0;return _[M|56]=c>>>21&255,_[M|57]=c>>>13&255,_[M|58]=c>>>5&255,_[M|59]=c<<3&255|d>>>29,_[M|60]=d>>>21&255,_[M|61]=d>>>13&255,_[M|62]=d>>>5&255,_[M|63]=d<<3&255,k(M),~x&&D(x),R|0}function g(){n=l,s=u,i=p,o=f,a=h,d=64,c=0}function A(){n=y,s=m,i=b,o=v,a=E,d=64,c=0}function P(M,L,x,R,K,V,J,se,j,re,G,B,X,ge,_e,Se){M=M|0,L=L|0,x=x|0,R=R|0,K=K|0,V=V|0,J=J|0,se=se|0,j=j|0,re=re|0,G=G|0,B=B|0,X=X|0,ge=ge|0,_e=_e|0,Se=Se|0,w(),C(M^1549556828,L^1549556828,x^1549556828,R^1549556828,K^1549556828,V^1549556828,J^1549556828,se^1549556828,j^1549556828,re^1549556828,G^1549556828,B^1549556828,X^1549556828,ge^1549556828,_e^1549556828,Se^1549556828),y=n,m=s,b=i,v=o,E=a,w(),C(M^909522486,L^909522486,x^909522486,R^909522486,K^909522486,V^909522486,J^909522486,se^909522486,j^909522486,re^909522486,G^909522486,B^909522486,X^909522486,ge^909522486,_e^909522486,Se^909522486),l=n,u=s,p=i,f=o,h=a,d=64,c=0}function O(M,L,x){M=M|0,L=L|0,x=x|0;var R=0,K=0,V=0,J=0,se=0,j=0;return M&63||~x&&x&31?-1:(j=T(M,L,-1)|0,R=n,K=s,V=i,J=o,se=a,A(),C(R,K,V,J,se,2147483648,0,0,0,0,0,0,0,0,0,672),~x&&D(x),j|0)}function N(M,L,x,R,K){M=M|0,L=L|0,x=x|0,R=R|0,K=K|0;var V=0,J=0,se=0,j=0,re=0,G=0,B=0,X=0,ge=0,_e=0;if(M&63||~K&&K&31)return-1;for(_[M+L|0]=x>>>24,_[M+L+1|0]=x>>>16&255,_[M+L+2|0]=x>>>8&255,_[M+L+3|0]=x&255,O(M,L+4|0,-1)|0,V=G=n,J=B=s,se=X=i,j=ge=o,re=_e=a,R=R-1|0;(R|0)>0;)g(),C(G,B,X,ge,_e,2147483648,0,0,0,0,0,0,0,0,0,672),G=n,B=s,X=i,ge=o,_e=a,A(),C(G,B,X,ge,_e,2147483648,0,0,0,0,0,0,0,0,0,672),G=n,B=s,X=i,ge=o,_e=a,V=V^n,J=J^s,se=se^i,j=j^o,re=re^a,R=R-1|0;return n=V,s=J,i=se,o=j,a=re,~K&&D(K),0}return{reset:w,init:S,process:I,finish:T,hmac_reset:g,hmac_init:P,hmac_finish:O,pbkdf2_generate_block:N}};class $8{constructor(){this.pos=0,this.len=0}reset(){const{asm:t}=this.acquire_asm();return this.result=null,this.pos=0,this.len=0,t.reset(),this}process(t){if(this.result!==null)throw new yy("state must be reset before processing new data");const{asm:r,heap:n}=this.acquire_asm();let s=this.pos,i=this.len,o=0,a=t.length,d=0;for(;a>0;)d=fa(n,s+i,t,o,a),i+=d,o+=d,a-=d,d=r.process(s,i),s+=d,i-=d,i||(s=0);return this.pos=s,this.len=i,this}finish(){if(this.result!==null)throw new yy("state must be reset before processing new data");const{asm:t,heap:r}=this.acquire_asm();return t.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(r.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this.release_asm(),this}}const Fg=[],Hg=[];class ha extends $8{constructor(){super(),this.NAME="sha1",this.BLOCK_SIZE=64,this.HASH_SIZE=20,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=Fg.pop()||l2(),this.asm=Hg.pop()||j8({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(Fg.push(this.heap),Hg.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new ha().process(t).finish().result}}ha.NAME="sha1",ha.heap_pool=[],ha.asm_pool=[],ha.asm_function=j8;const Gg=[],zg=[];class hh extends $8{constructor(){super(),this.NAME="sha256",this.BLOCK_SIZE=64,this.HASH_SIZE=32,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=Gg.pop()||l2(),this.asm=zg.pop()||function(t,r,n){var s=0,i=0,o=0,a=0,d=0,c=0,l=0,u=0,p=0,f=0,h=0,y=0,m=0,b=0,v=0,E=0,_=0,C=0,k=0,D=0,w=0,S=0,I=0,T=0,g=0,A=0,P=new t.Uint8Array(n);function O(G,B,X,ge,_e,Se,F,q,z,ee,le,ce,ne,je,De,Fe){G=G|0,B=B|0,X=X|0,ge=ge|0,_e=_e|0,Se=Se|0,F=F|0,q=q|0,z=z|0,ee=ee|0,le=le|0,ce=ce|0,ne=ne|0,je=je|0,De=De|0,Fe=Fe|0;var he=0,ue=0,pe=0,de=0,fe=0,ye=0,ie=0,Q=0;he=s,ue=i,pe=o,de=a,fe=d,ye=c,ie=l,Q=u,Q=G+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+1116352408|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ie=B+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+1899447441|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,ye=X+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+3049323471|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,fe=ge+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+3921009573|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+961987163|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,pe=Se+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+1508970993|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,ue=F+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+2453635748|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,he=q+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+2870763221|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,Q=z+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+3624381080|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ie=ee+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+310598401|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,ye=le+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+607225278|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+1426881987|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,de=ne+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+1925078388|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,pe=je+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+2162078206|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,ue=De+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+2614888103|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,he=Fe+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+3248222580|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,G=(B>>>7^B>>>18^B>>>3^B<<25^B<<14)+(De>>>17^De>>>19^De>>>10^De<<15^De<<13)+G+ee|0,Q=G+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+3835390401|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,B=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+B+le|0,ie=B+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+4022224774|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,X=(ge>>>7^ge>>>18^ge>>>3^ge<<25^ge<<14)+(G>>>17^G>>>19^G>>>10^G<<15^G<<13)+X+ce|0,ye=X+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+264347078|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,ge=(_e>>>7^_e>>>18^_e>>>3^_e<<25^_e<<14)+(B>>>17^B>>>19^B>>>10^B<<15^B<<13)+ge+ne|0,fe=ge+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+604807628|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,_e=(Se>>>7^Se>>>18^Se>>>3^Se<<25^Se<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+_e+je|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+770255983|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Se=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(ge>>>17^ge>>>19^ge>>>10^ge<<15^ge<<13)+Se+De|0,pe=Se+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+1249150122|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,F=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(_e>>>17^_e>>>19^_e>>>10^_e<<15^_e<<13)+F+Fe|0,ue=F+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+1555081692|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,q=(z>>>7^z>>>18^z>>>3^z<<25^z<<14)+(Se>>>17^Se>>>19^Se>>>10^Se<<15^Se<<13)+q+G|0,he=q+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+1996064986|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,z=(ee>>>7^ee>>>18^ee>>>3^ee<<25^ee<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+z+B|0,Q=z+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+2554220882|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=(le>>>7^le>>>18^le>>>3^le<<25^le<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+ee+X|0,ie=ee+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+2821834349|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,le=(ce>>>7^ce>>>18^ce>>>3^ce<<25^ce<<14)+(z>>>17^z>>>19^z>>>10^z<<15^z<<13)+le+ge|0,ye=le+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+2952996808|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,ce=(ne>>>7^ne>>>18^ne>>>3^ne<<25^ne<<14)+(ee>>>17^ee>>>19^ee>>>10^ee<<15^ee<<13)+ce+_e|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+3210313671|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,ne=(je>>>7^je>>>18^je>>>3^je<<25^je<<14)+(le>>>17^le>>>19^le>>>10^le<<15^le<<13)+ne+Se|0,de=ne+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+3336571891|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,je=(De>>>7^De>>>18^De>>>3^De<<25^De<<14)+(ce>>>17^ce>>>19^ce>>>10^ce<<15^ce<<13)+je+F|0,pe=je+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+3584528711|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,De=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(ne>>>17^ne>>>19^ne>>>10^ne<<15^ne<<13)+De+q|0,ue=De+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+113926993|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,Fe=(G>>>7^G>>>18^G>>>3^G<<25^G<<14)+(je>>>17^je>>>19^je>>>10^je<<15^je<<13)+Fe+z|0,he=Fe+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+338241895|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,G=(B>>>7^B>>>18^B>>>3^B<<25^B<<14)+(De>>>17^De>>>19^De>>>10^De<<15^De<<13)+G+ee|0,Q=G+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+666307205|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,B=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+B+le|0,ie=B+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+773529912|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,X=(ge>>>7^ge>>>18^ge>>>3^ge<<25^ge<<14)+(G>>>17^G>>>19^G>>>10^G<<15^G<<13)+X+ce|0,ye=X+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+1294757372|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,ge=(_e>>>7^_e>>>18^_e>>>3^_e<<25^_e<<14)+(B>>>17^B>>>19^B>>>10^B<<15^B<<13)+ge+ne|0,fe=ge+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+1396182291|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,_e=(Se>>>7^Se>>>18^Se>>>3^Se<<25^Se<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+_e+je|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+1695183700|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Se=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(ge>>>17^ge>>>19^ge>>>10^ge<<15^ge<<13)+Se+De|0,pe=Se+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+1986661051|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,F=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(_e>>>17^_e>>>19^_e>>>10^_e<<15^_e<<13)+F+Fe|0,ue=F+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+2177026350|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,q=(z>>>7^z>>>18^z>>>3^z<<25^z<<14)+(Se>>>17^Se>>>19^Se>>>10^Se<<15^Se<<13)+q+G|0,he=q+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+2456956037|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,z=(ee>>>7^ee>>>18^ee>>>3^ee<<25^ee<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+z+B|0,Q=z+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+2730485921|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=(le>>>7^le>>>18^le>>>3^le<<25^le<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+ee+X|0,ie=ee+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+2820302411|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,le=(ce>>>7^ce>>>18^ce>>>3^ce<<25^ce<<14)+(z>>>17^z>>>19^z>>>10^z<<15^z<<13)+le+ge|0,ye=le+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+3259730800|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,ce=(ne>>>7^ne>>>18^ne>>>3^ne<<25^ne<<14)+(ee>>>17^ee>>>19^ee>>>10^ee<<15^ee<<13)+ce+_e|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+3345764771|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,ne=(je>>>7^je>>>18^je>>>3^je<<25^je<<14)+(le>>>17^le>>>19^le>>>10^le<<15^le<<13)+ne+Se|0,de=ne+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+3516065817|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,je=(De>>>7^De>>>18^De>>>3^De<<25^De<<14)+(ce>>>17^ce>>>19^ce>>>10^ce<<15^ce<<13)+je+F|0,pe=je+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+3600352804|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,De=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(ne>>>17^ne>>>19^ne>>>10^ne<<15^ne<<13)+De+q|0,ue=De+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+4094571909|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,Fe=(G>>>7^G>>>18^G>>>3^G<<25^G<<14)+(je>>>17^je>>>19^je>>>10^je<<15^je<<13)+Fe+z|0,he=Fe+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+275423344|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,G=(B>>>7^B>>>18^B>>>3^B<<25^B<<14)+(De>>>17^De>>>19^De>>>10^De<<15^De<<13)+G+ee|0,Q=G+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+430227734|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,B=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+B+le|0,ie=B+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+506948616|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,X=(ge>>>7^ge>>>18^ge>>>3^ge<<25^ge<<14)+(G>>>17^G>>>19^G>>>10^G<<15^G<<13)+X+ce|0,ye=X+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+659060556|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,ge=(_e>>>7^_e>>>18^_e>>>3^_e<<25^_e<<14)+(B>>>17^B>>>19^B>>>10^B<<15^B<<13)+ge+ne|0,fe=ge+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+883997877|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,_e=(Se>>>7^Se>>>18^Se>>>3^Se<<25^Se<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+_e+je|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+958139571|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Se=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(ge>>>17^ge>>>19^ge>>>10^ge<<15^ge<<13)+Se+De|0,pe=Se+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+1322822218|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,F=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(_e>>>17^_e>>>19^_e>>>10^_e<<15^_e<<13)+F+Fe|0,ue=F+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+1537002063|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,q=(z>>>7^z>>>18^z>>>3^z<<25^z<<14)+(Se>>>17^Se>>>19^Se>>>10^Se<<15^Se<<13)+q+G|0,he=q+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+1747873779|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,z=(ee>>>7^ee>>>18^ee>>>3^ee<<25^ee<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+z+B|0,Q=z+Q+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ie^fe&(ye^ie))+1955562222|0,de=de+Q|0,Q=Q+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=(le>>>7^le>>>18^le>>>3^le<<25^le<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+ee+X|0,ie=ee+ie+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ye^de&(fe^ye))+2024104815|0,pe=pe+ie|0,ie=ie+(Q&he^ue&(Q^he))+(Q>>>2^Q>>>13^Q>>>22^Q<<30^Q<<19^Q<<10)|0,le=(ce>>>7^ce>>>18^ce>>>3^ce<<25^ce<<14)+(z>>>17^z>>>19^z>>>10^z<<15^z<<13)+le+ge|0,ye=le+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+2227730452|0,ue=ue+ye|0,ye=ye+(ie&Q^he&(ie^Q))+(ie>>>2^ie>>>13^ie>>>22^ie<<30^ie<<19^ie<<10)|0,ce=(ne>>>7^ne>>>18^ne>>>3^ne<<25^ne<<14)+(ee>>>17^ee>>>19^ee>>>10^ee<<15^ee<<13)+ce+_e|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+2361852424|0,he=he+fe|0,fe=fe+(ye&ie^Q&(ye^ie))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,ne=(je>>>7^je>>>18^je>>>3^je<<25^je<<14)+(le>>>17^le>>>19^le>>>10^le<<15^le<<13)+ne+Se|0,de=ne+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+2428436474|0,Q=Q+de|0,de=de+(fe&ye^ie&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,je=(De>>>7^De>>>18^De>>>3^De<<25^De<<14)+(ce>>>17^ce>>>19^ce>>>10^ce<<15^ce<<13)+je+F|0,pe=je+pe+(Q>>>6^Q>>>11^Q>>>25^Q<<26^Q<<21^Q<<7)+(ue^Q&(he^ue))+2756734187|0,ie=ie+pe|0,pe=pe+(de&fe^ye&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,De=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(ne>>>17^ne>>>19^ne>>>10^ne<<15^ne<<13)+De+q|0,ue=De+ue+(ie>>>6^ie>>>11^ie>>>25^ie<<26^ie<<21^ie<<7)+(he^ie&(Q^he))+3204031479|0,ye=ye+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,Fe=(G>>>7^G>>>18^G>>>3^G<<25^G<<14)+(je>>>17^je>>>19^je>>>10^je<<15^je<<13)+Fe+z|0,he=Fe+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Q^ye&(ie^Q))+3329325298|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,s=s+he|0,i=i+ue|0,o=o+pe|0,a=a+de|0,d=d+fe|0,c=c+ye|0,l=l+ie|0,u=u+Q|0}function N(G){G=G|0,O(P[G|0]<<24|P[G|1]<<16|P[G|2]<<8|P[G|3],P[G|4]<<24|P[G|5]<<16|P[G|6]<<8|P[G|7],P[G|8]<<24|P[G|9]<<16|P[G|10]<<8|P[G|11],P[G|12]<<24|P[G|13]<<16|P[G|14]<<8|P[G|15],P[G|16]<<24|P[G|17]<<16|P[G|18]<<8|P[G|19],P[G|20]<<24|P[G|21]<<16|P[G|22]<<8|P[G|23],P[G|24]<<24|P[G|25]<<16|P[G|26]<<8|P[G|27],P[G|28]<<24|P[G|29]<<16|P[G|30]<<8|P[G|31],P[G|32]<<24|P[G|33]<<16|P[G|34]<<8|P[G|35],P[G|36]<<24|P[G|37]<<16|P[G|38]<<8|P[G|39],P[G|40]<<24|P[G|41]<<16|P[G|42]<<8|P[G|43],P[G|44]<<24|P[G|45]<<16|P[G|46]<<8|P[G|47],P[G|48]<<24|P[G|49]<<16|P[G|50]<<8|P[G|51],P[G|52]<<24|P[G|53]<<16|P[G|54]<<8|P[G|55],P[G|56]<<24|P[G|57]<<16|P[G|58]<<8|P[G|59],P[G|60]<<24|P[G|61]<<16|P[G|62]<<8|P[G|63])}function M(G){G=G|0,P[G|0]=s>>>24,P[G|1]=s>>>16&255,P[G|2]=s>>>8&255,P[G|3]=s&255,P[G|4]=i>>>24,P[G|5]=i>>>16&255,P[G|6]=i>>>8&255,P[G|7]=i&255,P[G|8]=o>>>24,P[G|9]=o>>>16&255,P[G|10]=o>>>8&255,P[G|11]=o&255,P[G|12]=a>>>24,P[G|13]=a>>>16&255,P[G|14]=a>>>8&255,P[G|15]=a&255,P[G|16]=d>>>24,P[G|17]=d>>>16&255,P[G|18]=d>>>8&255,P[G|19]=d&255,P[G|20]=c>>>24,P[G|21]=c>>>16&255,P[G|22]=c>>>8&255,P[G|23]=c&255,P[G|24]=l>>>24,P[G|25]=l>>>16&255,P[G|26]=l>>>8&255,P[G|27]=l&255,P[G|28]=u>>>24,P[G|29]=u>>>16&255,P[G|30]=u>>>8&255,P[G|31]=u&255}function L(){s=1779033703,i=3144134277,o=1013904242,a=2773480762,d=1359893119,c=2600822924,l=528734635,u=1541459225,p=f=0}function x(G,B,X,ge,_e,Se,F,q,z,ee){G=G|0,B=B|0,X=X|0,ge=ge|0,_e=_e|0,Se=Se|0,F=F|0,q=q|0,z=z|0,ee=ee|0,s=G,i=B,o=X,a=ge,d=_e,c=Se,l=F,u=q,p=z,f=ee}function R(G,B){G=G|0,B=B|0;var X=0;if(G&63)return-1;for(;(B|0)>=64;)N(G),G=G+64|0,B=B-64|0,X=X+64|0;return p=p+X|0,p>>>0<X>>>0&&(f=f+1|0),X|0}function K(G,B,X){G=G|0,B=B|0,X=X|0;var ge=0,_e=0;if(G&63||~X&&X&31)return-1;if((B|0)>=64){if(ge=R(G,B)|0,(ge|0)==-1)return-1;G=G+ge|0,B=B-ge|0}if(ge=ge+B|0,p=p+B|0,p>>>0<B>>>0&&(f=f+1|0),P[G|B]=128,(B|0)>=56){for(_e=B+1|0;(_e|0)<64;_e=_e+1|0)P[G|_e]=0;N(G),B=0,P[G|0]=0}for(_e=B+1|0;(_e|0)<59;_e=_e+1|0)P[G|_e]=0;return P[G|56]=f>>>21&255,P[G|57]=f>>>13&255,P[G|58]=f>>>5&255,P[G|59]=f<<3&255|p>>>29,P[G|60]=p>>>21&255,P[G|61]=p>>>13&255,P[G|62]=p>>>5&255,P[G|63]=p<<3&255,N(G),~X&&M(X),ge|0}function V(){s=h,i=y,o=m,a=b,d=v,c=E,l=_,u=C,p=64,f=0}function J(){s=k,i=D,o=w,a=S,d=I,c=T,l=g,u=A,p=64,f=0}function se(G,B,X,ge,_e,Se,F,q,z,ee,le,ce,ne,je,De,Fe){G=G|0,B=B|0,X=X|0,ge=ge|0,_e=_e|0,Se=Se|0,F=F|0,q=q|0,z=z|0,ee=ee|0,le=le|0,ce=ce|0,ne=ne|0,je=je|0,De=De|0,Fe=Fe|0,L(),O(G^1549556828,B^1549556828,X^1549556828,ge^1549556828,_e^1549556828,Se^1549556828,F^1549556828,q^1549556828,z^1549556828,ee^1549556828,le^1549556828,ce^1549556828,ne^1549556828,je^1549556828,De^1549556828,Fe^1549556828),k=s,D=i,w=o,S=a,I=d,T=c,g=l,A=u,L(),O(G^909522486,B^909522486,X^909522486,ge^909522486,_e^909522486,Se^909522486,F^909522486,q^909522486,z^909522486,ee^909522486,le^909522486,ce^909522486,ne^909522486,je^909522486,De^909522486,Fe^909522486),h=s,y=i,m=o,b=a,v=d,E=c,_=l,C=u,p=64,f=0}function j(G,B,X){G=G|0,B=B|0,X=X|0;var ge=0,_e=0,Se=0,F=0,q=0,z=0,ee=0,le=0,ce=0;return G&63||~X&&X&31?-1:(ce=K(G,B,-1)|0,ge=s,_e=i,Se=o,F=a,q=d,z=c,ee=l,le=u,J(),O(ge,_e,Se,F,q,z,ee,le,2147483648,0,0,0,0,0,0,768),~X&&M(X),ce|0)}function re(G,B,X,ge,_e){G=G|0,B=B|0,X=X|0,ge=ge|0,_e=_e|0;var Se=0,F=0,q=0,z=0,ee=0,le=0,ce=0,ne=0,je=0,De=0,Fe=0,he=0,ue=0,pe=0,de=0,fe=0;if(G&63||~_e&&_e&31)return-1;for(P[G+B|0]=X>>>24,P[G+B+1|0]=X>>>16&255,P[G+B+2|0]=X>>>8&255,P[G+B+3|0]=X&255,j(G,B+4|0,-1)|0,Se=je=s,F=De=i,q=Fe=o,z=he=a,ee=ue=d,le=pe=c,ce=de=l,ne=fe=u,ge=ge-1|0;(ge|0)>0;)V(),O(je,De,Fe,he,ue,pe,de,fe,2147483648,0,0,0,0,0,0,768),je=s,De=i,Fe=o,he=a,ue=d,pe=c,de=l,fe=u,J(),O(je,De,Fe,he,ue,pe,de,fe,2147483648,0,0,0,0,0,0,768),je=s,De=i,Fe=o,he=a,ue=d,pe=c,de=l,fe=u,Se=Se^s,F=F^i,q=q^o,z=z^a,ee=ee^d,le=le^c,ce=ce^l,ne=ne^u,ge=ge-1|0;return s=Se,i=F,o=q,a=z,d=ee,c=le,l=ce,u=ne,~_e&&M(_e),0}return{reset:L,init:x,process:R,finish:K,hmac_reset:V,hmac_init:se,hmac_finish:j,pbkdf2_generate_block:re}}({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(Gg.push(this.heap),zg.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new hh().process(t).finish().result}}hh.NAME="sha256";var $s=V8;function V8(e,t){if(!e)throw Error(t||"Assertion failed")}V8.equal=function(e,t,r){if(e!=t)throw Error(r||"Assertion failed: "+e+" != "+t)};var cP=In!==void 0?In:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ni(e,t){return e(t={exports:{}},t.exports),t.exports}function uP(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Ds=Ni(function(e){e.exports=typeof Object.create=="function"?function(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}),lP=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var n=0;n<e.length;n++){var s=e.charCodeAt(n),i=s>>8,o=255&s;i?r.push(i,o):r.push(o)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},dP=function(e){for(var t="",r=0;r<e.length;r++)t+=H8(e[r].toString(16));return t};function F8(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}var fP=function(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];t==="little"&&(s=F8(s)),r+=G8(s.toString(16))}return r};function H8(e){return e.length===1?"0"+e:e}function G8(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}var hP=function(e,t,r,n){var s=r-t;$s(s%4==0);for(var i=Array(s/4),o=0,a=t;o<i.length;o++,a+=4){var d;d=n==="big"?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],i[o]=d>>>0}return i},pP=function(e,t){for(var r=Array(4*e.length),n=0,s=0;n<e.length;n++,s+=4){var i=e[n];t==="big"?(r[s]=i>>>24,r[s+1]=i>>>16&255,r[s+2]=i>>>8&255,r[s+3]=255&i):(r[s+3]=i>>>24,r[s+2]=i>>>16&255,r[s+1]=i>>>8&255,r[s]=255&i)}return r},Dt={inherits:Ds,toArray:lP,toHex:dP,htonl:F8,toHex32:fP,zero2:H8,zero8:G8,join32:hP,split32:pP,rotr32:function(e,t){return e>>>t|e<<32-t},rotl32:function(e,t){return e<<t|e>>>32-t},sum32:function(e,t){return e+t>>>0},sum32_3:function(e,t,r){return e+t+r>>>0},sum32_4:function(e,t,r,n){return e+t+r+n>>>0},sum32_5:function(e,t,r,n,s){return e+t+r+n+s>>>0},sum64:function(e,t,r,n){var s=e[t],i=n+e[t+1]>>>0,o=(i<n?1:0)+r+s;e[t]=o>>>0,e[t+1]=i},sum64_hi:function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},sum64_lo:function(e,t,r,n){return t+n>>>0},sum64_4_hi:function(e,t,r,n,s,i,o,a){var d=0,c=t;return d+=(c=c+n>>>0)<t?1:0,d+=(c=c+i>>>0)<i?1:0,e+r+s+o+(d+=(c=c+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(e,t,r,n,s,i,o,a){return t+n+i+a>>>0},sum64_5_hi:function(e,t,r,n,s,i,o,a,d,c){var l=0,u=t;return l+=(u=u+n>>>0)<t?1:0,l+=(u=u+i>>>0)<i?1:0,l+=(u=u+a>>>0)<a?1:0,e+r+s+o+d+(l+=(u=u+c>>>0)<c?1:0)>>>0},sum64_5_lo:function(e,t,r,n,s,i,o,a,d,c){return t+n+i+a+c>>>0},rotr64_hi:function(e,t,r){return(t<<32-r|e>>>r)>>>0},rotr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0},shr64_hi:function(e,t,r){return e>>>r},shr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0}};function nf(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var yP=nf;nf.prototype.update=function(e,t){if(e=Dt.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Dt.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},nf.prototype.digest=function(e){return this.update(this._pad()),$s(this.pending===null),this._digest(e)},nf.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=Array(r+this.padLength);n[0]=128;for(var s=1;s<r;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var i=8;i<this.padLength;i++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=255&e}else for(n[s++]=255&e,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,i=8;i<this.padLength;i++)n[s++]=0;return n};var jl={BlockHash:yP},ai=Dt.rotr32,gP=function(e,t,r,n){return e===0?z8(t,r,n):e===1||e===3?Y8(t,r,n):e===2?W8(t,r,n):void 0};function z8(e,t,r){return e&t^~e&r}function W8(e,t,r){return e&t^e&r^t&r}function Y8(e,t,r){return e^t^r}var Ma={ft_1:gP,ch32:z8,maj32:W8,p32:Y8,s0_256:function(e){return ai(e,2)^ai(e,13)^ai(e,22)},s1_256:function(e){return ai(e,6)^ai(e,11)^ai(e,25)},g0_256:function(e){return ai(e,7)^ai(e,18)^e>>>3},g1_256:function(e){return ai(e,17)^ai(e,19)^e>>>10}},jn=Dt.sum32,mP=Dt.sum32_4,bP=Dt.sum32_5,vP=Ma.ch32,_P=Ma.maj32,wP=Ma.s0_256,EP=Ma.s1_256,AP=Ma.g0_256,SP=Ma.g1_256,J8=jl.BlockHash,PP=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function fi(){if(!(this instanceof fi))return new fi;J8.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=PP,this.W=Array(64)}Dt.inherits(fi,J8);var f2=fi;function Wi(){if(!(this instanceof Wi))return new Wi;f2.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}fi.blockSize=512,fi.outSize=256,fi.hmacStrength=192,fi.padLength=64,fi.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=mP(SP(r[n-2]),r[n-7],AP(r[n-15]),r[n-16]);var s=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],d=this.h[4],c=this.h[5],l=this.h[6],u=this.h[7];for($s(this.k.length===r.length),n=0;n<r.length;n++){var p=bP(u,EP(d),vP(d,c,l),this.k[n],r[n]),f=jn(wP(s),_P(s,i,o));u=l,l=c,c=d,d=jn(a,p),a=o,o=i,i=s,s=jn(p,f)}this.h[0]=jn(this.h[0],s),this.h[1]=jn(this.h[1],i),this.h[2]=jn(this.h[2],o),this.h[3]=jn(this.h[3],a),this.h[4]=jn(this.h[4],d),this.h[5]=jn(this.h[5],c),this.h[6]=jn(this.h[6],l),this.h[7]=jn(this.h[7],u)},fi.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"big"):Dt.split32(this.h,"big")},Dt.inherits(Wi,f2);var Z8=Wi;Wi.blockSize=512,Wi.outSize=224,Wi.hmacStrength=192,Wi.padLength=64,Wi.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h.slice(0,7),"big"):Dt.split32(this.h.slice(0,7),"big")};var wi=Dt.rotr64_hi,Ei=Dt.rotr64_lo,X8=Dt.shr64_hi,Q8=Dt.shr64_lo,ls=Dt.sum64,s0=Dt.sum64_hi,a0=Dt.sum64_lo,TP=Dt.sum64_4_hi,IP=Dt.sum64_4_lo,CP=Dt.sum64_5_hi,RP=Dt.sum64_5_lo,ew=jl.BlockHash,kP=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Jn(){if(!(this instanceof Jn))return new Jn;ew.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=kP,this.W=Array(160)}Dt.inherits(Jn,ew);var mo=Jn;function MP(e,t,r,n,s){var i=e&r^~e&s;return i<0&&(i+=4294967296),i}function OP(e,t,r,n,s,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function NP(e,t,r,n,s){var i=e&r^e&s^r&s;return i<0&&(i+=4294967296),i}function DP(e,t,r,n,s,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function xP(e,t){var r=wi(e,t,28)^wi(t,e,2)^wi(t,e,7);return r<0&&(r+=4294967296),r}function UP(e,t){var r=Ei(e,t,28)^Ei(t,e,2)^Ei(t,e,7);return r<0&&(r+=4294967296),r}function BP(e,t){var r=wi(e,t,14)^wi(e,t,18)^wi(t,e,9);return r<0&&(r+=4294967296),r}function LP(e,t){var r=Ei(e,t,14)^Ei(e,t,18)^Ei(t,e,9);return r<0&&(r+=4294967296),r}function KP(e,t){var r=wi(e,t,1)^wi(e,t,8)^X8(e,t,7);return r<0&&(r+=4294967296),r}function qP(e,t){var r=Ei(e,t,1)^Ei(e,t,8)^Q8(e,t,7);return r<0&&(r+=4294967296),r}function jP(e,t){var r=wi(e,t,19)^wi(t,e,29)^X8(e,t,6);return r<0&&(r+=4294967296),r}function $P(e,t){var r=Ei(e,t,19)^Ei(t,e,29)^Q8(e,t,6);return r<0&&(r+=4294967296),r}function Yi(){if(!(this instanceof Yi))return new Yi;mo.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Jn.blockSize=1024,Jn.outSize=512,Jn.hmacStrength=192,Jn.padLength=128,Jn.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var s=jP(r[n-4],r[n-3]),i=$P(r[n-4],r[n-3]),o=r[n-14],a=r[n-13],d=KP(r[n-30],r[n-29]),c=qP(r[n-30],r[n-29]),l=r[n-32],u=r[n-31];r[n]=TP(s,i,o,a,d,c,l,u),r[n+1]=IP(s,i,o,a,d,c,l,u)}},Jn.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],s=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],d=this.h[5],c=this.h[6],l=this.h[7],u=this.h[8],p=this.h[9],f=this.h[10],h=this.h[11],y=this.h[12],m=this.h[13],b=this.h[14],v=this.h[15];$s(this.k.length===r.length);for(var E=0;E<r.length;E+=2){var _=b,C=v,k=BP(u,p),D=LP(u,p),w=MP(u,p,f,h,y),S=OP(u,p,f,h,y,m),I=this.k[E],T=this.k[E+1],g=r[E],A=r[E+1],P=CP(_,C,k,D,w,S,I,T,g,A),O=RP(_,C,k,D,w,S,I,T,g,A);_=xP(n,s),C=UP(n,s),k=NP(n,s,i,o,a),D=DP(n,s,i,o,a,d);var N=s0(_,C,k,D),M=a0(_,C,k,D);b=y,v=m,y=f,m=h,f=u,h=p,u=s0(c,l,P,O),p=a0(l,l,P,O),c=a,l=d,a=i,d=o,i=n,o=s,n=s0(P,O,N,M),s=a0(P,O,N,M)}ls(this.h,0,n,s),ls(this.h,2,i,o),ls(this.h,4,a,d),ls(this.h,6,c,l),ls(this.h,8,u,p),ls(this.h,10,f,h),ls(this.h,12,y,m),ls(this.h,14,b,v)},Jn.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"big"):Dt.split32(this.h,"big")},Dt.inherits(Yi,mo);var tw=Yi;Yi.blockSize=1024,Yi.outSize=384,Yi.hmacStrength=192,Yi.padLength=128,Yi.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h.slice(0,12),"big"):Dt.split32(this.h.slice(0,12),"big")};var fd=Dt.rotl32,Wg=Dt.sum32,Ko=Dt.sum32_3,Yg=Dt.sum32_4,rw=jl.BlockHash;function hi(){if(!(this instanceof hi))return new hi;rw.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Dt.inherits(hi,rw);var nw=hi;function Jg(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function VP(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function FP(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}hi.blockSize=512,hi.outSize=160,hi.hmacStrength=192,hi.padLength=64,hi.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],s=this.h[2],i=this.h[3],o=this.h[4],a=r,d=n,c=s,l=i,u=o,p=0;p<80;p++){var f=Wg(fd(Yg(r,Jg(p,n,s,i),e[HP[p]+t],VP(p)),zP[p]),o);r=o,o=i,i=fd(s,10),s=n,n=f,f=Wg(fd(Yg(a,Jg(79-p,d,c,l),e[GP[p]+t],FP(p)),WP[p]),u),a=u,u=l,l=fd(c,10),c=d,d=f}f=Ko(this.h[1],s,l),this.h[1]=Ko(this.h[2],i,u),this.h[2]=Ko(this.h[3],o,a),this.h[3]=Ko(this.h[4],r,d),this.h[4]=Ko(this.h[0],n,c),this.h[0]=f},hi.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"little"):Dt.split32(this.h,"little")};var HP=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],GP=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],zP=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],WP=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],YP={ripemd160:nw};function o0(e,t){let r=e[0],n=e[1],s=e[2],i=e[3];r=Yr(r,n,s,i,t[0],7,-680876936),i=Yr(i,r,n,s,t[1],12,-389564586),s=Yr(s,i,r,n,t[2],17,606105819),n=Yr(n,s,i,r,t[3],22,-1044525330),r=Yr(r,n,s,i,t[4],7,-176418897),i=Yr(i,r,n,s,t[5],12,1200080426),s=Yr(s,i,r,n,t[6],17,-1473231341),n=Yr(n,s,i,r,t[7],22,-45705983),r=Yr(r,n,s,i,t[8],7,1770035416),i=Yr(i,r,n,s,t[9],12,-1958414417),s=Yr(s,i,r,n,t[10],17,-42063),n=Yr(n,s,i,r,t[11],22,-1990404162),r=Yr(r,n,s,i,t[12],7,1804603682),i=Yr(i,r,n,s,t[13],12,-40341101),s=Yr(s,i,r,n,t[14],17,-1502002290),n=Yr(n,s,i,r,t[15],22,1236535329),r=Jr(r,n,s,i,t[1],5,-165796510),i=Jr(i,r,n,s,t[6],9,-1069501632),s=Jr(s,i,r,n,t[11],14,643717713),n=Jr(n,s,i,r,t[0],20,-373897302),r=Jr(r,n,s,i,t[5],5,-701558691),i=Jr(i,r,n,s,t[10],9,38016083),s=Jr(s,i,r,n,t[15],14,-660478335),n=Jr(n,s,i,r,t[4],20,-405537848),r=Jr(r,n,s,i,t[9],5,568446438),i=Jr(i,r,n,s,t[14],9,-1019803690),s=Jr(s,i,r,n,t[3],14,-187363961),n=Jr(n,s,i,r,t[8],20,1163531501),r=Jr(r,n,s,i,t[13],5,-1444681467),i=Jr(i,r,n,s,t[2],9,-51403784),s=Jr(s,i,r,n,t[7],14,1735328473),n=Jr(n,s,i,r,t[12],20,-1926607734),r=Zr(r,n,s,i,t[5],4,-378558),i=Zr(i,r,n,s,t[8],11,-2022574463),s=Zr(s,i,r,n,t[11],16,1839030562),n=Zr(n,s,i,r,t[14],23,-35309556),r=Zr(r,n,s,i,t[1],4,-1530992060),i=Zr(i,r,n,s,t[4],11,1272893353),s=Zr(s,i,r,n,t[7],16,-155497632),n=Zr(n,s,i,r,t[10],23,-1094730640),r=Zr(r,n,s,i,t[13],4,681279174),i=Zr(i,r,n,s,t[0],11,-358537222),s=Zr(s,i,r,n,t[3],16,-722521979),n=Zr(n,s,i,r,t[6],23,76029189),r=Zr(r,n,s,i,t[9],4,-640364487),i=Zr(i,r,n,s,t[12],11,-421815835),s=Zr(s,i,r,n,t[15],16,530742520),n=Zr(n,s,i,r,t[2],23,-995338651),r=Xr(r,n,s,i,t[0],6,-198630844),i=Xr(i,r,n,s,t[7],10,1126891415),s=Xr(s,i,r,n,t[14],15,-1416354905),n=Xr(n,s,i,r,t[5],21,-57434055),r=Xr(r,n,s,i,t[12],6,1700485571),i=Xr(i,r,n,s,t[3],10,-1894986606),s=Xr(s,i,r,n,t[10],15,-1051523),n=Xr(n,s,i,r,t[1],21,-2054922799),r=Xr(r,n,s,i,t[8],6,1873313359),i=Xr(i,r,n,s,t[15],10,-30611744),s=Xr(s,i,r,n,t[6],15,-1560198380),n=Xr(n,s,i,r,t[13],21,1309151649),r=Xr(r,n,s,i,t[4],6,-145523070),i=Xr(i,r,n,s,t[11],10,-1120210379),s=Xr(s,i,r,n,t[2],15,718787259),n=Xr(n,s,i,r,t[9],21,-343485551),e[0]=Rs(r,e[0]),e[1]=Rs(n,e[1]),e[2]=Rs(s,e[2]),e[3]=Rs(i,e[3])}function ph(e,t,r,n,s,i){return t=Rs(Rs(t,e),Rs(n,i)),Rs(t<<s|t>>>32-s,r)}function Yr(e,t,r,n,s,i,o){return ph(t&r|~t&n,e,t,s,i,o)}function Jr(e,t,r,n,s,i,o){return ph(t&n|r&~n,e,t,s,i,o)}function Zr(e,t,r,n,s,i,o){return ph(t^r^n,e,t,s,i,o)}function Xr(e,t,r,n,s,i,o){return ph(r^(t|~n),e,t,s,i,o)}function JP(e){const t=[];let r;for(r=0;r<64;r+=4)t[r>>2]=e.charCodeAt(r)+(e.charCodeAt(r+1)<<8)+(e.charCodeAt(r+2)<<16)+(e.charCodeAt(r+3)<<24);return t}const Zg="0123456789abcdef".split("");function ZP(e){let t="",r=0;for(;r<4;r++)t+=Zg[e>>8*r+4&15]+Zg[e>>8*r&15];return t}function Rs(e,t){return e+t&4294967295}const Af=te.getWebCrypto(),Sf=te.getNodeCrypto(),XP=Sf&&Sf.getHashes();function zs(e){if(Sf&&XP.includes(e))return async function(t){const r=Sf.createHash(e);return yr(t,n=>{r.update(n)},()=>new Uint8Array(r.digest()))}}function hd(e,t){return async function(r,n=Xe){if(_r(r)&&(r=await vr(r)),!te.isStream(r)&&Af&&t&&r.length>=n.minBytesForWebCrypto)return new Uint8Array(await Af.digest(t,r));const s=e();return yr(r,i=>{s.update(i)},()=>new Uint8Array(s.digest()))}}function Xg(e,t){return async function(r,n=Xe){if(_r(r)&&(r=await vr(r)),te.isStream(r)){const s=new e;return yr(r,i=>{s.process(i)},()=>s.finish().result)}return Af&&t&&r.length>=n.minBytesForWebCrypto?new Uint8Array(await Af.digest(t,r)):e.bytes(r)}}const Ws={md5:zs("md5")||async function(e){const t=function(r){const n=r.length,s=[1732584193,-271733879,-1732584194,271733878];let i;for(i=64;i<=r.length;i+=64)o0(s,JP(r.substring(i-64,i)));r=r.substring(i-64);const o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<r.length;i++)o[i>>2]|=r.charCodeAt(i)<<(i%4<<3);if(o[i>>2]|=128<<(i%4<<3),i>55)for(o0(s,o),i=0;i<16;i++)o[i]=0;return o[14]=8*n,o0(s,o),s}(te.uint8ArrayToString(e));return te.hexToUint8Array(function(r){for(let n=0;n<r.length;n++)r[n]=ZP(r[n]);return r.join("")}(t))},sha1:zs("sha1")||Xg(ha,"SHA-1"),sha224:zs("sha224")||hd(Z8),sha256:zs("sha256")||Xg(hh,"SHA-256"),sha384:zs("sha384")||hd(tw,"SHA-384"),sha512:zs("sha512")||hd(mo,"SHA-512"),ripemd:zs("ripemd160")||hd(nw)};var Un={md5:Ws.md5,sha1:Ws.sha1,sha224:Ws.sha224,sha256:Ws.sha256,sha384:Ws.sha384,sha512:Ws.sha512,ripemd:Ws.ripemd,digest:function(e,t){switch(e){case H.hash.md5:return this.md5(t);case H.hash.sha1:return this.sha1(t);case H.hash.ripemd:return this.ripemd(t);case H.hash.sha256:return this.sha256(t);case H.hash.sha384:return this.sha384(t);case H.hash.sha512:return this.sha512(t);case H.hash.sha224:return this.sha224(t);default:throw Error("Invalid hash function.")}},getHashByteLength:function(e){switch(e){case H.hash.md5:return 16;case H.hash.sha1:case H.hash.ripemd:return 20;case H.hash.sha256:return 32;case H.hash.sha384:return 48;case H.hash.sha512:return 64;case H.hash.sha224:return 28;default:throw Error("Invalid hash algorithm.")}}};class io{static encrypt(t,r,n){return new io(r,n).encrypt(t)}static decrypt(t,r,n){return new io(r,n).decrypt(t)}constructor(t,r,n){this.aes=n||new Kl(t,r,!0,"CFB"),delete this.aes.padding}encrypt(t){return Ks(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Ks(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}function Ai(e){const t=H.read(H.symmetric,e);return ql[t]}const Qg=te.getWebCrypto(),Pf=te.getNodeCrypto(),Ys=Pf?Pf.getCiphers():[],pd={idea:Ys.includes("idea-cfb")?"idea-cfb":void 0,tripledes:Ys.includes("des-ede3-cfb")?"des-ede3-cfb":void 0,cast5:Ys.includes("cast5-cfb")?"cast5-cfb":void 0,blowfish:Ys.includes("bf-cfb")?"bf-cfb":void 0,aes128:Ys.includes("aes-128-cfb")?"aes-128-cfb":void 0,aes192:Ys.includes("aes-192-cfb")?"aes-192-cfb":void 0,aes256:Ys.includes("aes-256-cfb")?"aes-256-cfb":void 0};var QP=Object.freeze({__proto__:null,encrypt:async function(e,t,r,n,s){const i=H.read(H.symmetric,e);if(te.getNodeCrypto()&&pd[i])return function(u,p,f,h){const y=H.read(H.symmetric,u),m=new Pf.createCipheriv(pd[y],p,h);return yr(f,b=>new Uint8Array(m.update(b)))}(e,t,r,n);if(te.isAES(e))return function(u,p,f,h,y){if(te.getWebCrypto()&&p.length!==24&&!te.isStream(f)&&f.length>=3e3*y.minBytesForWebCrypto)return async function(b,v,E,_){const C="AES-CBC",k=await Qg.importKey("raw",v,{name:C},!1,["encrypt"]),{blockSize:D}=Ai(b),w=te.concatUint8Array([new Uint8Array(D),E]),S=new Uint8Array(await Qg.encrypt({name:C,iv:_},k,w)).subarray(0,E.length);return function(I,T){for(let g=0;g<I.length;g++)I[g]=I[g]^T[g]}(S,E),S}(u,p,f,h);const m=new io(p,h);return yr(f,b=>m.aes.AES_Encrypt_process(b),()=>m.aes.AES_Encrypt_finish())}(e,t,r,n,s);const o=new(Ai(e))(t),a=o.blockSize,d=n.slice();let c=new Uint8Array;const l=u=>{u&&(c=te.concatUint8Array([c,u]));const p=new Uint8Array(c.length);let f,h=0;for(;u?c.length>=a:c.length;){const y=o.encrypt(d);for(f=0;f<a;f++)d[f]=c[f]^y[f],p[h++]=d[f];c=c.subarray(a)}return p.subarray(0,h)};return yr(r,l,l)},decrypt:async function(e,t,r,n){const s=H.read(H.symmetric,e);if(te.getNodeCrypto()&&pd[s])return function(l,u,p,f){const h=H.read(H.symmetric,l),y=new Pf.createDecipheriv(pd[h],u,f);return yr(p,m=>new Uint8Array(y.update(m)))}(e,t,r,n);if(te.isAES(e))return function(l,u,p,f){if(te.isStream(p)){const h=new io(u,f);return yr(p,y=>h.aes.AES_Decrypt_process(y),()=>h.aes.AES_Decrypt_finish())}return io.decrypt(p,u,f)}(0,t,r,n);const i=new(Ai(e))(t),o=i.blockSize;let a=n,d=new Uint8Array;const c=l=>{l&&(d=te.concatUint8Array([d,l]));const u=new Uint8Array(d.length);let p,f=0;for(;l?d.length>=o:d.length;){const h=i.encrypt(a);for(a=d.subarray(0,o),p=0;p<o;p++)u[f++]=a[p]^h[p];d=d.subarray(o)}return u.subarray(0,f)};return yr(r,c,c)}});class Tf{static encrypt(t,r,n){return new Tf(r,n).encrypt(t)}static decrypt(t,r,n){return new Tf(r,n).encrypt(t)}constructor(t,r,n){this.aes=n||new Kl(t,void 0,!1,"CTR"),delete this.aes.padding,this.AES_CTR_set_options(r)}encrypt(t){return Ks(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Ks(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}AES_CTR_set_options(t,r,n){let{asm:s}=this.aes.acquire_asm();if(n!==void 0){if(n<8||n>48)throw new Ji("illegal counter size");let i=Math.pow(2,n)-1;s.set_mask(0,0,i/4294967296|0,0|i)}else n=48,s.set_mask(0,0,65535,4294967295);if(t===void 0)throw Error("nonce is required");{let i=t.length;if(!i||i>16)throw new Ji("illegal nonce size");let o=new DataView(new ArrayBuffer(16));new Uint8Array(o.buffer).set(t),s.set_nonce(o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12))}if(r!==void 0){if(r<0||r>=Math.pow(2,n))throw new Ji("illegal counter value");s.set_counter(0,0,r/4294967296|0,0|r)}}}class If{static encrypt(t,r,n=!0,s){return new If(r,s,n).encrypt(t)}static decrypt(t,r,n=!0,s){return new If(r,s,n).decrypt(t)}constructor(t,r,n=!0,s){this.aes=s||new Kl(t,r,n,"CBC")}encrypt(t){return Ks(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Ks(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}const em=te.getWebCrypto(),eT=te.getNodeCrypto(),Hi=16;function tm(e,t){const r=e.length-Hi;for(let n=0;n<Hi;n++)e[n+r]^=t[n];return e}const yd=new Uint8Array(Hi);async function tT(e){const t=await async function(s){return te.getWebCrypto()&&s.length!==24?(s=await em.importKey("raw",s,{name:"AES-CBC",length:8*s.length},!1,["encrypt"]),async function(i){const o=await em.encrypt({name:"AES-CBC",iv:yd,length:8*Hi},s,i);return new Uint8Array(o).subarray(0,o.byteLength-Hi)}):te.getNodeCrypto()?async function(i){const o=new eT.createCipheriv("aes-"+8*s.length+"-cbc",s,yd).update(i);return new Uint8Array(o)}:async function(i){return If.encrypt(i,s,!1,yd)}}(e),r=te.double(await t(yd)),n=te.double(r);return async function(s){return(await t(function(i,o,a){if(i.length&&i.length%Hi==0)return tm(i,o);const d=new Uint8Array(i.length+(Hi-i.length%Hi));return d.set(i),d[i.length]=128,tm(d,a)}(s,r,n))).subarray(-Hi)}}const rm=te.getWebCrypto(),rT=te.getNodeCrypto(),nT=te.getNodeBuffer(),rs=16,iT=rs,Fa=rs,nm=new Uint8Array(rs),my=new Uint8Array(rs);my[rs-1]=1;const by=new Uint8Array(rs);async function sT(e){const t=await tT(e);return function(r,n){return t(te.concatUint8Array([r,n]))}}async function aT(e){return te.getWebCrypto()&&e.length!==24?(e=await rm.importKey("raw",e,{name:"AES-CTR",length:8*e.length},!1,["encrypt"]),async function(t,r){const n=await rm.encrypt({name:"AES-CTR",counter:r,length:8*rs},e,t);return new Uint8Array(n)}):te.getNodeCrypto()?async function(t,r){const n=new rT.createCipheriv("aes-"+8*e.length+"-ctr",e,r),s=nT.concat([n.update(t),n.final()]);return new Uint8Array(s)}:async function(t,r){return Tf.encrypt(t,e,r)}}async function Wu(e,t){if(e!==H.symmetric.aes128&&e!==H.symmetric.aes192&&e!==H.symmetric.aes256)throw Error("EAX mode supports only AES cipher");const[r,n]=await Promise.all([sT(t),aT(t)]);return{encrypt:async function(s,i,o){const[a,d]=await Promise.all([r(nm,i),r(my,o)]),c=await n(s,a),l=await r(by,c);for(let u=0;u<Fa;u++)l[u]^=d[u]^a[u];return te.concatUint8Array([c,l])},decrypt:async function(s,i,o){if(s.length<Fa)throw Error("Invalid EAX ciphertext");const a=s.subarray(0,-Fa),d=s.subarray(-Fa),[c,l,u]=await Promise.all([r(nm,i),r(my,o),r(by,a)]),p=u;for(let f=0;f<Fa;f++)p[f]^=l[f]^c[f];if(!te.equalsUint8Array(d,p))throw Error("Authentication tag mismatch");return await n(a,c)}}}by[rs-1]=2,Wu.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[8+n]^=t[n];return r},Wu.blockLength=rs,Wu.ivLength=iT,Wu.tagLength=Fa;const un=16,iw=15,ys=16;function im(e){let t=0;for(let r=1;!(e&r);r<<=1)t++;return t}function yn(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r];return e}function gd(e,t){return yn(e.slice(),t)}const c0=new Uint8Array(un),oT=new Uint8Array([1]);async function Yu(e,t){let r,n,s,i=0;function o(a,d,c,l){const u=d.length/un|0;(function(k,D){const w=te.nbits(Math.max(k.length,D.length)/un|0)-1;for(let S=i+1;S<=w;S++)s[S]=te.double(s[S-1]);i=w})(d,l);const p=te.concatUint8Array([c0.subarray(0,iw-c.length),oT,c]),f=63&p[un-1];p[un-1]&=192;const h=r(p),y=te.concatUint8Array([h,gd(h.subarray(0,8),h.subarray(1,9))]),m=te.shiftRight(y.subarray(0+(f>>3),17+(f>>3)),8-(7&f)).subarray(1),b=new Uint8Array(un),v=new Uint8Array(d.length+ys);let E,_=0;for(E=0;E<u;E++)yn(m,s[im(E+1)]),v.set(yn(a(gd(m,d)),m),_),yn(b,a===r?d:v.subarray(_)),d=d.subarray(un),_+=un;if(d.length){yn(m,s.x);const k=r(m);v.set(gd(d,k),_);const D=new Uint8Array(un);D.set(a===r?d:v.subarray(_,-ys),0),D[d.length]=128,yn(b,D),_+=d.length}const C=yn(r(yn(yn(b,m),s.$)),function(k){if(!k.length)return c0;const D=k.length/un|0,w=new Uint8Array(un),S=new Uint8Array(un);for(let I=0;I<D;I++)yn(w,s[im(I+1)]),yn(S,r(gd(w,k))),k=k.subarray(un);if(k.length){yn(w,s.x);const I=new Uint8Array(un);I.set(k,0),I[k.length]=128,yn(I,w),yn(S,r(I))}return S}(l));return v.set(C,_),v}return function(a,d){const c=H.read(H.symmetric,a),l=new ql[c](d);r=l.encrypt.bind(l),n=l.decrypt.bind(l);const u=r(c0),p=te.double(u);s=[],s[0]=te.double(p),s.x=u,s.$=p}(e,t),{encrypt:async function(a,d,c){return o(r,a,d,c)},decrypt:async function(a,d,c){if(a.length<ys)throw Error("Invalid OCB ciphertext");const l=a.subarray(-ys);a=a.subarray(0,-ys);const u=o(n,a,d,c);if(te.equalsUint8Array(l,u.subarray(-ys)))return u.subarray(0,-ys);throw Error("Authentication tag mismatch")}}}Yu.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[7+n]^=t[n];return r},Yu.blockLength=un,Yu.ivLength=iw,Yu.tagLength=ys;const u0=68719476704;class pa{constructor(t,r,n,s=16,i){this.tagSize=s,this.gamma0=0,this.counter=1,this.aes=i||new Kl(t,void 0,!1,"CTR");let{asm:o,heap:a}=this.aes.acquire_asm();if(o.gcm_init(),this.tagSize<4||this.tagSize>16)throw new Ji("illegal tagSize value");const d=r.length||0,c=new Uint8Array(16);d!==12?(this._gcm_mac_process(r),a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=0,a[11]=d>>>29,a[12]=d>>>21&255,a[13]=d>>>13&255,a[14]=d>>>5&255,a[15]=d<<3&255,o.mac(Lt.MAC.GCM,Lt.HEAP_DATA,16),o.get_iv(Lt.HEAP_DATA),o.set_iv(0,0,0,0),c.set(a.subarray(0,16))):(c.set(r),c[15]=1);const l=new DataView(c.buffer);if(this.gamma0=l.getUint32(12),o.set_nonce(l.getUint32(0),l.getUint32(4),l.getUint32(8),0),o.set_mask(0,0,0,4294967295),n!==void 0){if(n.length>u0)throw new Ji("illegal adata length");n.length?(this.adata=n,this._gcm_mac_process(n)):this.adata=void 0}else this.adata=void 0;if(this.counter<1||this.counter>4294967295)throw new RangeError("counter must be a positive 32-bit integer");o.set_counter(0,0,0,this.gamma0+this.counter|0)}static encrypt(t,r,n,s,i){return new pa(r,n,s,i).encrypt(t)}static decrypt(t,r,n,s,i){return new pa(r,n,s,i).decrypt(t)}encrypt(t){return this.AES_GCM_encrypt(t)}decrypt(t){return this.AES_GCM_decrypt(t)}AES_GCM_Encrypt_process(t){let r=0,n=t.length||0,{asm:s,heap:i}=this.aes.acquire_asm(),o=this.counter,a=this.aes.pos,d=this.aes.len,c=0,l=d+n&-16,u=0;if((o-1<<4)+d+n>u0)throw new RangeError("counter overflow");const p=new Uint8Array(l);for(;n>0;)u=fa(i,a+d,t,r,n),d+=u,r+=u,n-=u,u=s.cipher(Lt.ENC.CTR,Lt.HEAP_DATA+a,d),u=s.mac(Lt.MAC.GCM,Lt.HEAP_DATA+a,u),u&&p.set(i.subarray(a,a+u),c),o+=u>>>4,c+=u,u<d?(a+=u,d-=u):(a=0,d=0);return this.counter=o,this.aes.pos=a,this.aes.len=d,p}AES_GCM_Encrypt_finish(){let{asm:t,heap:r}=this.aes.acquire_asm(),n=this.counter,s=this.tagSize,i=this.adata,o=this.aes.pos,a=this.aes.len;const d=new Uint8Array(a+s);t.cipher(Lt.ENC.CTR,Lt.HEAP_DATA+o,a+15&-16),a&&d.set(r.subarray(o,o+a));let c=a;for(;15&c;c++)r[o+c]=0;t.mac(Lt.MAC.GCM,Lt.HEAP_DATA+o,c);const l=i!==void 0?i.length:0,u=(n-1<<4)+a;return r[0]=0,r[1]=0,r[2]=0,r[3]=l>>>29,r[4]=l>>>21,r[5]=l>>>13&255,r[6]=l>>>5&255,r[7]=l<<3&255,r[8]=r[9]=r[10]=0,r[11]=u>>>29,r[12]=u>>>21&255,r[13]=u>>>13&255,r[14]=u>>>5&255,r[15]=u<<3&255,t.mac(Lt.MAC.GCM,Lt.HEAP_DATA,16),t.get_iv(Lt.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(Lt.ENC.CTR,Lt.HEAP_DATA,16),d.set(r.subarray(0,s),a),this.counter=1,this.aes.pos=0,this.aes.len=0,d}AES_GCM_Decrypt_process(t){let r=0,n=t.length||0,{asm:s,heap:i}=this.aes.acquire_asm(),o=this.counter,a=this.tagSize,d=this.aes.pos,c=this.aes.len,l=0,u=c+n>a?c+n-a&-16:0,p=c+n-u,f=0;if((o-1<<4)+c+n>u0)throw new RangeError("counter overflow");const h=new Uint8Array(u);for(;n>p;)f=fa(i,d+c,t,r,n-p),c+=f,r+=f,n-=f,f=s.mac(Lt.MAC.GCM,Lt.HEAP_DATA+d,f),f=s.cipher(Lt.DEC.CTR,Lt.HEAP_DATA+d,f),f&&h.set(i.subarray(d,d+f),l),o+=f>>>4,l+=f,d=0,c=0;return n>0&&(c+=fa(i,0,t,r,n)),this.counter=o,this.aes.pos=d,this.aes.len=c,h}AES_GCM_Decrypt_finish(){let{asm:t,heap:r}=this.aes.acquire_asm(),n=this.tagSize,s=this.adata,i=this.counter,o=this.aes.pos,a=this.aes.len,d=a-n;if(a<n)throw new yy("authentication tag not found");const c=new Uint8Array(d),l=new Uint8Array(r.subarray(o+d,o+a));let u=d;for(;15&u;u++)r[o+u]=0;t.mac(Lt.MAC.GCM,Lt.HEAP_DATA+o,u),t.cipher(Lt.DEC.CTR,Lt.HEAP_DATA+o,u),d&&c.set(r.subarray(o,o+d));const p=s!==void 0?s.length:0,f=(i-1<<4)+a-n;r[0]=0,r[1]=0,r[2]=0,r[3]=p>>>29,r[4]=p>>>21,r[5]=p>>>13&255,r[6]=p>>>5&255,r[7]=p<<3&255,r[8]=r[9]=r[10]=0,r[11]=f>>>29,r[12]=f>>>21&255,r[13]=f>>>13&255,r[14]=f>>>5&255,r[15]=f<<3&255,t.mac(Lt.MAC.GCM,Lt.HEAP_DATA,16),t.get_iv(Lt.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(Lt.ENC.CTR,Lt.HEAP_DATA,16);let h=0;for(let y=0;y<n;++y)h|=l[y]^r[y];if(h)throw new gy("data integrity check failed");return this.counter=1,this.aes.pos=0,this.aes.len=0,c}AES_GCM_decrypt(t){const r=this.AES_GCM_Decrypt_process(t),n=this.AES_GCM_Decrypt_finish(),s=new Uint8Array(r.length+n.length);return r.length&&s.set(r),n.length&&s.set(n,r.length),s}AES_GCM_encrypt(t){const r=this.AES_GCM_Encrypt_process(t),n=this.AES_GCM_Encrypt_finish(),s=new Uint8Array(r.length+n.length);return r.length&&s.set(r),n.length&&s.set(n,r.length),s}_gcm_mac_process(t){let{asm:r,heap:n}=this.aes.acquire_asm(),s=0,i=t.length||0,o=0;for(;i>0;){for(o=fa(n,0,t,s,i),s+=o,i-=o;15&o;)n[o++]=0;r.mac(Lt.MAC.GCM,Lt.HEAP_DATA,o)}}}const l0=te.getWebCrypto(),sm=te.getNodeCrypto(),am=te.getNodeBuffer(),Ha=16,d0="AES-GCM";async function Ya(e,t){if(e!==H.symmetric.aes128&&e!==H.symmetric.aes192&&e!==H.symmetric.aes256)throw Error("GCM mode supports only AES cipher");if(te.getNodeCrypto())return{encrypt:async function(r,n,s=new Uint8Array){const i=new sm.createCipheriv("aes-"+8*t.length+"-gcm",t,n);i.setAAD(s);const o=am.concat([i.update(r),i.final(),i.getAuthTag()]);return new Uint8Array(o)},decrypt:async function(r,n,s=new Uint8Array){const i=new sm.createDecipheriv("aes-"+8*t.length+"-gcm",t,n);i.setAAD(s),i.setAuthTag(r.slice(r.length-Ha,r.length));const o=am.concat([i.update(r.slice(0,r.length-Ha)),i.final()]);return new Uint8Array(o)}};if(te.getWebCrypto()&&t.length!==24){const r=await l0.importKey("raw",t,{name:d0},!1,["encrypt","decrypt"]);return{encrypt:async function(n,s,i=new Uint8Array){if(!n.length)return pa.encrypt(n,t,s,i);const o=await l0.encrypt({name:d0,iv:s,additionalData:i,tagLength:8*Ha},r,n);return new Uint8Array(o)},decrypt:async function(n,s,i=new Uint8Array){if(n.length===Ha)return pa.decrypt(n,t,s,i);const o=await l0.decrypt({name:d0,iv:s,additionalData:i,tagLength:8*Ha},r,n);return new Uint8Array(o)}}}return{encrypt:async function(r,n,s){return pa.encrypt(r,t,n,s)},decrypt:async function(r,n,s){return pa.decrypt(r,t,n,s)}}}Ya.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[4+n]^=t[n];return r},Ya.blockLength=16,Ya.ivLength=12,Ya.tagLength=Ha;var sw={cfb:QP,gcm:Ya,experimentalGCM:Ya,eax:Wu,ocb:Yu},Ar=Ni(function(e){(function(t){var r=function(j){var re,G=new Float64Array(16);if(j)for(re=0;re<j.length;re++)G[re]=j[re];return G},n=function(){throw Error("no PRNG")},s=new Uint8Array(32);s[0]=9;var i=r(),o=r([1]),a=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),u=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function f(j,re,G,B){return function(X,ge,_e,Se,F){var q,z=0;for(q=0;q<F;q++)z|=X[ge+q]^_e[Se+q];return(1&z-1>>>8)-1}(j,re,G,B,32)}function h(j,re){var G;for(G=0;G<16;G++)j[G]=0|re[G]}function y(j){var re,G,B=1;for(re=0;re<16;re++)G=j[re]+B+65535,B=Math.floor(G/65536),j[re]=G-65536*B;j[0]+=B-1+37*(B-1)}function m(j,re,G){for(var B,X=~(G-1),ge=0;ge<16;ge++)B=X&(j[ge]^re[ge]),j[ge]^=B,re[ge]^=B}function b(j,re){var G,B,X,ge=r(),_e=r();for(G=0;G<16;G++)_e[G]=re[G];for(y(_e),y(_e),y(_e),B=0;B<2;B++){for(ge[0]=_e[0]-65517,G=1;G<15;G++)ge[G]=_e[G]-65535-(ge[G-1]>>16&1),ge[G-1]&=65535;ge[15]=_e[15]-32767-(ge[14]>>16&1),X=ge[15]>>16&1,ge[14]&=65535,m(_e,ge,1-X)}for(G=0;G<16;G++)j[2*G]=255&_e[G],j[2*G+1]=_e[G]>>8}function v(j,re){var G=new Uint8Array(32),B=new Uint8Array(32);return b(G,j),b(B,re),f(G,0,B,0)}function E(j){var re=new Uint8Array(32);return b(re,j),1&re[0]}function _(j,re){var G;for(G=0;G<16;G++)j[G]=re[2*G]+(re[2*G+1]<<8);j[15]&=32767}function C(j,re,G){for(var B=0;B<16;B++)j[B]=re[B]+G[B]}function k(j,re,G){for(var B=0;B<16;B++)j[B]=re[B]-G[B]}function D(j,re,G){var B,X,ge=0,_e=0,Se=0,F=0,q=0,z=0,ee=0,le=0,ce=0,ne=0,je=0,De=0,Fe=0,he=0,ue=0,pe=0,de=0,fe=0,ye=0,ie=0,Q=0,qe=0,He=0,Qe=0,dt=0,rt=0,be=0,W=0,oe=0,me=0,Te=0,Pe=G[0],ke=G[1],Ne=G[2],Ue=G[3],Re=G[4],Me=G[5],et=G[6],Ee=G[7],Ce=G[8],Oe=G[9],Be=G[10],Ve=G[11],$=G[12],Y=G[13],Z=G[14],U=G[15];ge+=(B=re[0])*Pe,_e+=B*ke,Se+=B*Ne,F+=B*Ue,q+=B*Re,z+=B*Me,ee+=B*et,le+=B*Ee,ce+=B*Ce,ne+=B*Oe,je+=B*Be,De+=B*Ve,Fe+=B*$,he+=B*Y,ue+=B*Z,pe+=B*U,_e+=(B=re[1])*Pe,Se+=B*ke,F+=B*Ne,q+=B*Ue,z+=B*Re,ee+=B*Me,le+=B*et,ce+=B*Ee,ne+=B*Ce,je+=B*Oe,De+=B*Be,Fe+=B*Ve,he+=B*$,ue+=B*Y,pe+=B*Z,de+=B*U,Se+=(B=re[2])*Pe,F+=B*ke,q+=B*Ne,z+=B*Ue,ee+=B*Re,le+=B*Me,ce+=B*et,ne+=B*Ee,je+=B*Ce,De+=B*Oe,Fe+=B*Be,he+=B*Ve,ue+=B*$,pe+=B*Y,de+=B*Z,fe+=B*U,F+=(B=re[3])*Pe,q+=B*ke,z+=B*Ne,ee+=B*Ue,le+=B*Re,ce+=B*Me,ne+=B*et,je+=B*Ee,De+=B*Ce,Fe+=B*Oe,he+=B*Be,ue+=B*Ve,pe+=B*$,de+=B*Y,fe+=B*Z,ye+=B*U,q+=(B=re[4])*Pe,z+=B*ke,ee+=B*Ne,le+=B*Ue,ce+=B*Re,ne+=B*Me,je+=B*et,De+=B*Ee,Fe+=B*Ce,he+=B*Oe,ue+=B*Be,pe+=B*Ve,de+=B*$,fe+=B*Y,ye+=B*Z,ie+=B*U,z+=(B=re[5])*Pe,ee+=B*ke,le+=B*Ne,ce+=B*Ue,ne+=B*Re,je+=B*Me,De+=B*et,Fe+=B*Ee,he+=B*Ce,ue+=B*Oe,pe+=B*Be,de+=B*Ve,fe+=B*$,ye+=B*Y,ie+=B*Z,Q+=B*U,ee+=(B=re[6])*Pe,le+=B*ke,ce+=B*Ne,ne+=B*Ue,je+=B*Re,De+=B*Me,Fe+=B*et,he+=B*Ee,ue+=B*Ce,pe+=B*Oe,de+=B*Be,fe+=B*Ve,ye+=B*$,ie+=B*Y,Q+=B*Z,qe+=B*U,le+=(B=re[7])*Pe,ce+=B*ke,ne+=B*Ne,je+=B*Ue,De+=B*Re,Fe+=B*Me,he+=B*et,ue+=B*Ee,pe+=B*Ce,de+=B*Oe,fe+=B*Be,ye+=B*Ve,ie+=B*$,Q+=B*Y,qe+=B*Z,He+=B*U,ce+=(B=re[8])*Pe,ne+=B*ke,je+=B*Ne,De+=B*Ue,Fe+=B*Re,he+=B*Me,ue+=B*et,pe+=B*Ee,de+=B*Ce,fe+=B*Oe,ye+=B*Be,ie+=B*Ve,Q+=B*$,qe+=B*Y,He+=B*Z,Qe+=B*U,ne+=(B=re[9])*Pe,je+=B*ke,De+=B*Ne,Fe+=B*Ue,he+=B*Re,ue+=B*Me,pe+=B*et,de+=B*Ee,fe+=B*Ce,ye+=B*Oe,ie+=B*Be,Q+=B*Ve,qe+=B*$,He+=B*Y,Qe+=B*Z,dt+=B*U,je+=(B=re[10])*Pe,De+=B*ke,Fe+=B*Ne,he+=B*Ue,ue+=B*Re,pe+=B*Me,de+=B*et,fe+=B*Ee,ye+=B*Ce,ie+=B*Oe,Q+=B*Be,qe+=B*Ve,He+=B*$,Qe+=B*Y,dt+=B*Z,rt+=B*U,De+=(B=re[11])*Pe,Fe+=B*ke,he+=B*Ne,ue+=B*Ue,pe+=B*Re,de+=B*Me,fe+=B*et,ye+=B*Ee,ie+=B*Ce,Q+=B*Oe,qe+=B*Be,He+=B*Ve,Qe+=B*$,dt+=B*Y,rt+=B*Z,be+=B*U,Fe+=(B=re[12])*Pe,he+=B*ke,ue+=B*Ne,pe+=B*Ue,de+=B*Re,fe+=B*Me,ye+=B*et,ie+=B*Ee,Q+=B*Ce,qe+=B*Oe,He+=B*Be,Qe+=B*Ve,dt+=B*$,rt+=B*Y,be+=B*Z,W+=B*U,he+=(B=re[13])*Pe,ue+=B*ke,pe+=B*Ne,de+=B*Ue,fe+=B*Re,ye+=B*Me,ie+=B*et,Q+=B*Ee,qe+=B*Ce,He+=B*Oe,Qe+=B*Be,dt+=B*Ve,rt+=B*$,be+=B*Y,W+=B*Z,oe+=B*U,ue+=(B=re[14])*Pe,pe+=B*ke,de+=B*Ne,fe+=B*Ue,ye+=B*Re,ie+=B*Me,Q+=B*et,qe+=B*Ee,He+=B*Ce,Qe+=B*Oe,dt+=B*Be,rt+=B*Ve,be+=B*$,W+=B*Y,oe+=B*Z,me+=B*U,pe+=(B=re[15])*Pe,_e+=38*(fe+=B*Ne),Se+=38*(ye+=B*Ue),F+=38*(ie+=B*Re),q+=38*(Q+=B*Me),z+=38*(qe+=B*et),ee+=38*(He+=B*Ee),le+=38*(Qe+=B*Ce),ce+=38*(dt+=B*Oe),ne+=38*(rt+=B*Be),je+=38*(be+=B*Ve),De+=38*(W+=B*$),Fe+=38*(oe+=B*Y),he+=38*(me+=B*Z),ue+=38*(Te+=B*U),ge=(B=(ge+=38*(de+=B*ke))+(X=1)+65535)-65536*(X=Math.floor(B/65536)),_e=(B=_e+X+65535)-65536*(X=Math.floor(B/65536)),Se=(B=Se+X+65535)-65536*(X=Math.floor(B/65536)),F=(B=F+X+65535)-65536*(X=Math.floor(B/65536)),q=(B=q+X+65535)-65536*(X=Math.floor(B/65536)),z=(B=z+X+65535)-65536*(X=Math.floor(B/65536)),ee=(B=ee+X+65535)-65536*(X=Math.floor(B/65536)),le=(B=le+X+65535)-65536*(X=Math.floor(B/65536)),ce=(B=ce+X+65535)-65536*(X=Math.floor(B/65536)),ne=(B=ne+X+65535)-65536*(X=Math.floor(B/65536)),je=(B=je+X+65535)-65536*(X=Math.floor(B/65536)),De=(B=De+X+65535)-65536*(X=Math.floor(B/65536)),Fe=(B=Fe+X+65535)-65536*(X=Math.floor(B/65536)),he=(B=he+X+65535)-65536*(X=Math.floor(B/65536)),ue=(B=ue+X+65535)-65536*(X=Math.floor(B/65536)),pe=(B=pe+X+65535)-65536*(X=Math.floor(B/65536)),ge=(B=(ge+=X-1+37*(X-1))+(X=1)+65535)-65536*(X=Math.floor(B/65536)),_e=(B=_e+X+65535)-65536*(X=Math.floor(B/65536)),Se=(B=Se+X+65535)-65536*(X=Math.floor(B/65536)),F=(B=F+X+65535)-65536*(X=Math.floor(B/65536)),q=(B=q+X+65535)-65536*(X=Math.floor(B/65536)),z=(B=z+X+65535)-65536*(X=Math.floor(B/65536)),ee=(B=ee+X+65535)-65536*(X=Math.floor(B/65536)),le=(B=le+X+65535)-65536*(X=Math.floor(B/65536)),ce=(B=ce+X+65535)-65536*(X=Math.floor(B/65536)),ne=(B=ne+X+65535)-65536*(X=Math.floor(B/65536)),je=(B=je+X+65535)-65536*(X=Math.floor(B/65536)),De=(B=De+X+65535)-65536*(X=Math.floor(B/65536)),Fe=(B=Fe+X+65535)-65536*(X=Math.floor(B/65536)),he=(B=he+X+65535)-65536*(X=Math.floor(B/65536)),ue=(B=ue+X+65535)-65536*(X=Math.floor(B/65536)),pe=(B=pe+X+65535)-65536*(X=Math.floor(B/65536)),ge+=X-1+37*(X-1),j[0]=ge,j[1]=_e,j[2]=Se,j[3]=F,j[4]=q,j[5]=z,j[6]=ee,j[7]=le,j[8]=ce,j[9]=ne,j[10]=je,j[11]=De,j[12]=Fe,j[13]=he,j[14]=ue,j[15]=pe}function w(j,re){D(j,re,re)}function S(j,re){var G,B=r();for(G=0;G<16;G++)B[G]=re[G];for(G=253;G>=0;G--)w(B,B),G!==2&&G!==4&&D(B,B,re);for(G=0;G<16;G++)j[G]=B[G]}function I(j,re,G){var B,X,ge=new Uint8Array(32),_e=new Float64Array(80),Se=r(),F=r(),q=r(),z=r(),ee=r(),le=r();for(X=0;X<31;X++)ge[X]=re[X];for(ge[31]=127&re[31]|64,ge[0]&=248,_(_e,G),X=0;X<16;X++)F[X]=_e[X],z[X]=Se[X]=q[X]=0;for(Se[0]=z[0]=1,X=254;X>=0;--X)m(Se,F,B=ge[X>>>3]>>>(7&X)&1),m(q,z,B),C(ee,Se,q),k(Se,Se,q),C(q,F,z),k(F,F,z),w(z,ee),w(le,Se),D(Se,q,Se),D(q,F,ee),C(ee,Se,q),k(Se,Se,q),w(F,Se),k(q,z,le),D(Se,q,a),C(Se,Se,z),D(q,q,Se),D(Se,z,le),D(z,F,_e),w(F,ee),m(Se,F,B),m(q,z,B);for(X=0;X<16;X++)_e[X+16]=Se[X],_e[X+32]=q[X],_e[X+48]=F[X],_e[X+64]=z[X];var ce=_e.subarray(32),ne=_e.subarray(16);return S(ce,ce),D(ne,ne,ce),b(j,ne),0}function T(j,re){return I(j,re,s)}function g(j,re){var G=r(),B=r(),X=r(),ge=r(),_e=r(),Se=r(),F=r(),q=r(),z=r();k(G,j[1],j[0]),k(z,re[1],re[0]),D(G,G,z),C(B,j[0],j[1]),C(z,re[0],re[1]),D(B,B,z),D(X,j[3],re[3]),D(X,X,c),D(ge,j[2],re[2]),C(ge,ge,ge),k(_e,B,G),k(Se,ge,X),C(F,ge,X),C(q,B,G),D(j[0],_e,Se),D(j[1],q,F),D(j[2],F,Se),D(j[3],_e,q)}function A(j,re,G){var B;for(B=0;B<4;B++)m(j[B],re[B],G)}function P(j,re){var G=r(),B=r(),X=r();S(X,re[2]),D(G,re[0],X),D(B,re[1],X),b(j,B),j[31]^=E(G)<<7}function O(j,re,G){var B,X;for(h(j[0],i),h(j[1],o),h(j[2],o),h(j[3],i),X=255;X>=0;--X)A(j,re,B=G[X/8|0]>>(7&X)&1),g(re,j),g(j,j),A(j,re,B)}function N(j,re){var G=[r(),r(),r(),r()];h(G[0],l),h(G[1],u),h(G[2],o),D(G[3],l,u),O(j,G,re)}function M(j,re,G){var B,X,ge=[r(),r(),r(),r()];for(G||n(re,32),(B=t.hash(re.subarray(0,32)))[0]&=248,B[31]&=127,B[31]|=64,N(ge,B),P(j,ge),X=0;X<32;X++)re[X+32]=j[X];return 0}var L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function x(j,re){var G,B,X,ge;for(B=63;B>=32;--B){for(G=0,X=B-32,ge=B-12;X<ge;++X)re[X]+=G-16*re[B]*L[X-(B-32)],G=Math.floor((re[X]+128)/256),re[X]-=256*G;re[X]+=G,re[B]=0}for(G=0,X=0;X<32;X++)re[X]+=G-(re[31]>>4)*L[X],G=re[X]>>8,re[X]&=255;for(X=0;X<32;X++)re[X]-=G*L[X];for(B=0;B<32;B++)re[B+1]+=re[B]>>8,j[B]=255&re[B]}function R(j){var re,G=new Float64Array(64);for(re=0;re<64;re++)G[re]=j[re];for(re=0;re<64;re++)j[re]=0;x(j,G)}function K(j,re){var G=r(),B=r(),X=r(),ge=r(),_e=r(),Se=r(),F=r();return h(j[2],o),_(j[1],re),w(X,j[1]),D(ge,X,d),k(X,X,j[2]),C(ge,j[2],ge),w(_e,ge),w(Se,_e),D(F,Se,_e),D(G,F,X),D(G,G,ge),function(q,z){var ee,le=r();for(ee=0;ee<16;ee++)le[ee]=z[ee];for(ee=250;ee>=0;ee--)w(le,le),ee!==1&&D(le,le,z);for(ee=0;ee<16;ee++)q[ee]=le[ee]}(G,G),D(G,G,X),D(G,G,ge),D(G,G,ge),D(j[0],G,ge),w(B,j[0]),D(B,B,ge),v(B,X)&&D(j[0],j[0],p),w(B,j[0]),D(B,B,ge),v(B,X)?-1:(E(j[0])===re[31]>>7&&k(j[0],i,j[0]),D(j[3],j[0],j[1]),0)}var V=64;function J(){for(var j=0;j<arguments.length;j++)if(!(arguments[j]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function se(j){for(var re=0;re<j.length;re++)j[re]=0}t.scalarMult=function(j,re){if(J(j,re),j.length!==32)throw Error("bad n size");if(re.length!==32)throw Error("bad p size");var G=new Uint8Array(32);return I(G,j,re),G},t.box={},t.box.keyPair=function(){var j,re,G=new Uint8Array(32),B=new Uint8Array(32);return j=G,n(re=B,32),T(j,re),{publicKey:G,secretKey:B}},t.box.keyPair.fromSecretKey=function(j){if(J(j),j.length!==32)throw Error("bad secret key size");var re=new Uint8Array(32);return T(re,j),{publicKey:re,secretKey:new Uint8Array(j)}},t.sign=function(j,re){if(J(j,re),re.length!==64)throw Error("bad secret key size");var G=new Uint8Array(V+j.length);return function(B,X,ge,_e){var Se,F,q,z,ee,le=new Float64Array(64),ce=[r(),r(),r(),r()];(Se=t.hash(_e.subarray(0,32)))[0]&=248,Se[31]&=127,Se[31]|=64;var ne=ge+64;for(z=0;z<ge;z++)B[64+z]=X[z];for(z=0;z<32;z++)B[32+z]=Se[32+z];for(R(q=t.hash(B.subarray(32,ne))),N(ce,q),P(B,ce),z=32;z<64;z++)B[z]=_e[z];for(R(F=t.hash(B.subarray(0,ne))),z=0;z<64;z++)le[z]=0;for(z=0;z<32;z++)le[z]=q[z];for(z=0;z<32;z++)for(ee=0;ee<32;ee++)le[z+ee]+=F[z]*Se[ee];x(B.subarray(32),le)}(G,j,j.length,re),G},t.sign.detached=function(j,re){for(var G=t.sign(j,re),B=new Uint8Array(V),X=0;X<B.length;X++)B[X]=G[X];return B},t.sign.detached.verify=function(j,re,G){if(J(j,re,G),re.length!==V)throw Error("bad signature size");if(G.length!==32)throw Error("bad public key size");var B,X=new Uint8Array(V+j.length),ge=new Uint8Array(V+j.length);for(B=0;B<V;B++)X[B]=re[B];for(B=0;B<j.length;B++)X[B+V]=j[B];return function(_e,Se,F,q){var z,ee,le=new Uint8Array(32),ce=[r(),r(),r(),r()],ne=[r(),r(),r(),r()];if(F<64||K(ne,q))return-1;for(z=0;z<F;z++)_e[z]=Se[z];for(z=0;z<32;z++)_e[z+32]=q[z];if(R(ee=t.hash(_e.subarray(0,F))),O(ce,ne,ee),N(ne,Se.subarray(32)),g(ce,ne),P(le,ce),F-=64,f(Se,0,le,0)){for(z=0;z<F;z++)_e[z]=0;return-1}for(z=0;z<F;z++)_e[z]=Se[z+64];return F}(ge,X,X.length,G)>=0},t.sign.keyPair=function(){var j=new Uint8Array(32),re=new Uint8Array(64);return M(j,re),{publicKey:j,secretKey:re}},t.sign.keyPair.fromSecretKey=function(j){if(J(j),j.length!==64)throw Error("bad secret key size");for(var re=new Uint8Array(32),G=0;G<re.length;G++)re[G]=j[32+G];return{publicKey:re,secretKey:new Uint8Array(j)}},t.sign.keyPair.fromSeed=function(j){if(J(j),j.length!==32)throw Error("bad seed size");for(var re=new Uint8Array(32),G=new Uint8Array(64),B=0;B<32;B++)G[B]=j[B];return M(re,G,!0),{publicKey:re,secretKey:G}},t.setPRNG=function(j){n=j},function(){var j=typeof self<"u"?self.crypto||self.msCrypto:null;j&&j.getRandomValues?t.setPRNG(function(re,G){var B,X=new Uint8Array(G);for(B=0;B<G;B+=65536)j.getRandomValues(X.subarray(B,B+Math.min(G-B,65536)));for(B=0;B<G;B++)re[B]=X[B];se(X)}):uP!==void 0&&(j=void 0)&&j.randomBytes&&t.setPRNG(function(re,G){var B,X=j.randomBytes(G);for(B=0;B<G;B++)re[B]=X[B];se(X)})}()})(e.exports?e.exports:self.nacl=self.nacl||{})});const om=te.getNodeCrypto();function Cn(e){const t=new Uint8Array(e);if(om){const r=om.randomBytes(t.length);t.set(r)}else{if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("No secure random number generator available.");crypto.getRandomValues(t)}return t}async function ns(e,t){const r=await te.getBigInteger();if(t.lt(e))throw Error("Illegal parameter value: max <= min");const n=t.sub(e),s=n.byteLength();return new r(await Cn(s+8)).mod(n).add(e)}var cT=Object.freeze({__proto__:null,getRandomBytes:Cn,getRandomBigInteger:ns});async function cm(e,t,r){const n=await te.getBigInteger(),s=new n(1),i=s.leftShift(new n(e-1)),o=new n(30),a=[1,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2],d=await ns(i,i.leftShift(s));let c=d.mod(o).toNumber();do d.iadd(new n(a[c])),c=(c+a[c])%a.length,d.bitLength()>e&&(d.imod(i.leftShift(s)).iadd(i),c=d.mod(o).toNumber());while(!await aw(d,t,r));return d}async function aw(e,t,r){return!(t&&!e.dec().gcd(t).isOne())&&!!await async function(n){const s=await te.getBigInteger();return uT.every(i=>n.mod(new s(i))!==0)}(e)&&!!await async function(n,s){const i=await te.getBigInteger();return s=s||new i(2),s.modExp(n.dec(),n).isOne()}(e)&&!!await async function(n,s,i){const o=await te.getBigInteger(),a=n.bitLength();s||(s=Math.max(1,a/48|0));const d=n.dec();let c=0;for(;!d.getBit(c);)c++;const l=n.rightShift(new o(c));for(;s>0;s--){let u,p=(i?i():await ns(new o(2),d)).modExp(l,n);if(!p.isOne()&&!p.equal(d)){for(u=1;u<c;u++){if(p=p.mul(p).mod(n),p.isOne())return!1;if(p.equal(d))break}if(u===c)return!1}}return!0}(e,r)}const uT=[7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999],di=[];function h2(e,t){const r=e.length;if(r>t-11)throw Error("Message too long");const n=function(i){const o=new Uint8Array(i);let a=0;for(;a<i;){const d=Cn(i-a);for(let c=0;c<d.length;c++)d[c]!==0&&(o[a++]=d[c])}return o}(t-r-3),s=new Uint8Array(t);return s[1]=2,s.set(n,2),s.set(e,t-r),s}function p2(e,t){let r=2,n=1;for(let a=r;a<e.length;a++)n&=e[a]!==0,r+=n;const s=r-2,i=e.subarray(r+1),o=e[0]===0&e[1]===2&s>=8&!n;if(t)return te.selectUint8Array(o,i,t);if(o)return i;throw Error("Decryption error")}async function vy(e,t,r){let n;if(t.length!==Un.getHashByteLength(e))throw Error("Invalid hash length");const s=new Uint8Array(di[e].length);for(n=0;n<di[e].length;n++)s[n]=di[e][n];const i=s.length+t.length;if(r<i+11)throw Error("Intended encoded message length too short");const o=new Uint8Array(r-i-3).fill(255),a=new Uint8Array(r);return a[1]=1,a.set(o,2),a.set(s,r-i),a.set(t,r-t.length),a}di[1]=[48,32,48,12,6,8,42,134,72,134,247,13,2,5,5,0,4,16],di[2]=[48,33,48,9,6,5,43,14,3,2,26,5,0,4,20],di[3]=[48,33,48,9,6,5,43,36,3,2,1,5,0,4,20],di[8]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32],di[9]=[48,65,48,13,6,9,96,134,72,1,101,3,4,2,2,5,0,4,48],di[10]=[48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64],di[11]=[48,45,48,13,6,9,96,134,72,1,101,3,4,2,4,5,0,4,28];var lT=Object.freeze({__proto__:null,emeEncode:h2,emeDecode:p2,emsaEncode:vy});const Ua=te.getWebCrypto(),en=te.getNodeCrypto(),ow=void 0,Ba=en?ow.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}):void 0,md=en?ow.define("RSAPubliceKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}):void 0;var dT=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i,o,a,d){if(t&&!te.isStream(t)){if(te.getWebCrypto())try{return await async function(c,l,u,p,f,h,y,m){const b=await async function(_,C,k,D,w,S){const I=await te.getBigInteger(),T=new I(D),g=new I(w),A=new I(k);let P=A.mod(g.dec()),O=A.mod(T.dec());return O=O.toUint8Array(),P=P.toUint8Array(),{kty:"RSA",n:Tn(_,!0),e:Tn(C,!0),d:Tn(k,!0),p:Tn(w,!0),q:Tn(D,!0),dp:Tn(P,!0),dq:Tn(O,!0),qi:Tn(S,!0),ext:!0}}(u,p,f,h,y,m),v={name:"RSASSA-PKCS1-v1_5",hash:{name:c}},E=await Ua.importKey("jwk",b,v,!1,["sign"]);return new Uint8Array(await Ua.sign("RSASSA-PKCS1-v1_5",E,l))}(H.read(H.webHash,e),t,r,n,s,i,o,a)}catch(c){te.printDebugError(c)}else if(te.getNodeCrypto())return async function(c,l,u,p,f,h,y,m){const{default:b}=await Promise.resolve().then(function(){return rl}),v=new b(h),E=new b(y),_=new b(f),C=_.mod(E.subn(1)),k=_.mod(v.subn(1)),D=en.createSign(H.read(H.hash,c));D.write(l),D.end();const w={version:0,modulus:new b(u),publicExponent:new b(p),privateExponent:new b(f),prime1:new b(y),prime2:new b(h),exponent1:C,exponent2:k,coefficient:new b(m)};if(en.createPrivateKey!==void 0){const I=Ba.encode(w,"der");return new Uint8Array(D.sign({key:I,format:"der",type:"pkcs1"}))}const S=Ba.encode(w,"pem",{label:"RSA PRIVATE KEY"});return new Uint8Array(D.sign(S))}(e,t,r,n,s,i,o,a)}return async function(c,l,u,p){const f=await te.getBigInteger();l=new f(l);const h=new f(await vy(c,p,l.byteLength()));if(u=new f(u),h.gte(l))throw Error("Message size cannot exceed modulus size");return h.modExp(u,l).toUint8Array("be",l.byteLength())}(e,r,s,d)},verify:async function(e,t,r,n,s,i){if(t&&!te.isStream(t)){if(te.getWebCrypto())try{return await async function(o,a,d,c,l){const u=function(f,h){return{kty:"RSA",n:Tn(f,!0),e:Tn(h,!0),ext:!0}}(c,l),p=await Ua.importKey("jwk",u,{name:"RSASSA-PKCS1-v1_5",hash:{name:o}},!1,["verify"]);return Ua.verify("RSASSA-PKCS1-v1_5",p,d,a)}(H.read(H.webHash,e),t,r,n,s)}catch(o){te.printDebugError(o)}else if(te.getNodeCrypto())return async function(o,a,d,c,l){const{default:u}=await Promise.resolve().then(function(){return rl}),p=en.createVerify(H.read(H.hash,o));p.write(a),p.end();const f={modulus:new u(c),publicExponent:new u(l)};let h;en.createPrivateKey!==void 0?h={key:md.encode(f,"der"),format:"der",type:"pkcs1"}:h=md.encode(f,"pem",{label:"RSA PUBLIC KEY"});try{return await p.verify(h,d)}catch{return!1}}(e,t,r,n,s)}return async function(o,a,d,c,l){const u=await te.getBigInteger();if(d=new u(d),a=new u(a),c=new u(c),a.gte(d))throw Error("Signature size cannot exceed modulus size");const p=a.modExp(c,d).toUint8Array("be",d.byteLength()),f=await vy(o,l,d.byteLength());return te.equalsUint8Array(p,f)}(e,r,n,s,i)},encrypt:async function(e,t,r){return te.getNodeCrypto()?async function(n,s,i){const{default:o}=await Promise.resolve().then(function(){return rl}),a={modulus:new o(s),publicExponent:new o(i)};let d;return en.createPrivateKey!==void 0?d={key:md.encode(a,"der"),format:"der",type:"pkcs1",padding:en.constants.RSA_PKCS1_PADDING}:d={key:md.encode(a,"pem",{label:"RSA PUBLIC KEY"}),padding:en.constants.RSA_PKCS1_PADDING},new Uint8Array(en.publicEncrypt(d,n))}(e,t,r):async function(n,s,i){const o=await te.getBigInteger();if(s=new o(s),n=new o(h2(n,s.byteLength())),i=new o(i),n.gte(s))throw Error("Message size cannot exceed modulus size");return n.modExp(i,s).toUint8Array("be",s.byteLength())}(e,t,r)},decrypt:async function(e,t,r,n,s,i,o,a){if(te.getNodeCrypto()&&!a)try{return await async function(d,c,l,u,p,f,h){const{default:y}=await Promise.resolve().then(function(){return rl}),m=new y(p),b=new y(f),v=new y(u),E=v.mod(b.subn(1)),_=v.mod(m.subn(1)),C={version:0,modulus:new y(c),publicExponent:new y(l),privateExponent:new y(u),prime1:new y(f),prime2:new y(p),exponent1:E,exponent2:_,coefficient:new y(h)};let k;en.createPrivateKey!==void 0?k={key:Ba.encode(C,"der"),format:"der",type:"pkcs1",padding:en.constants.RSA_PKCS1_PADDING}:k={key:Ba.encode(C,"pem",{label:"RSA PRIVATE KEY"}),padding:en.constants.RSA_PKCS1_PADDING};try{return new Uint8Array(en.privateDecrypt(k,d))}catch{throw Error("Decryption error")}}(e,t,r,n,s,i,o)}catch(d){te.printDebugError(d)}return async function(d,c,l,u,p,f,h,y){const m=await te.getBigInteger();if(d=new m(d),c=new m(c),l=new m(l),u=new m(u),p=new m(p),f=new m(f),h=new m(h),d.gte(c))throw Error("Data too large.");const b=u.mod(f.dec()),v=u.mod(p.dec()),E=(await ns(new m(2),c)).mod(c),_=E.modInv(c).modExp(l,c);d=d.mul(_).mod(c);const C=d.modExp(v,p),k=d.modExp(b,f);let w=h.mul(k.sub(C)).mod(f).mul(p).add(C);return w=w.mul(E).mod(c),p2(w.toUint8Array("be",c.byteLength()),y)}(e,t,r,n,s,i,o,a)},generate:async function(e,t){if(t=new(await te.getBigInteger())(t),te.getWebCrypto()){const o={name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:t.toUint8Array(),hash:{name:"SHA-1"}},a=await Ua.generateKey(o,!0,["sign","verify"]),d=await Ua.exportKey("jwk",a.privateKey);return{n:zi(d.n),e:t.toUint8Array(),d:zi(d.d),p:zi(d.q),q:zi(d.p),u:zi(d.qi)}}if(te.getNodeCrypto()&&en.generateKeyPair&&Ba){const o={modulusLength:e,publicExponent:t.toNumber(),publicKeyEncoding:{type:"pkcs1",format:"der"},privateKeyEncoding:{type:"pkcs1",format:"der"}},a=await new Promise((d,c)=>{en.generateKeyPair("rsa",o,(l,u,p)=>{l?c(l):d(Ba.decode(p,"der"))})});return{n:a.modulus.toArrayLike(Uint8Array),e:a.publicExponent.toArrayLike(Uint8Array),d:a.privateExponent.toArrayLike(Uint8Array),p:a.prime2.toArrayLike(Uint8Array),q:a.prime1.toArrayLike(Uint8Array),u:a.coefficient.toArrayLike(Uint8Array)}}let r,n,s;do n=await cm(e-(e>>1),t,40),r=await cm(e>>1,t,40),s=r.mul(n);while(s.bitLength()!==e);const i=r.dec().imul(n.dec());return n.lt(r)&&([r,n]=[n,r]),{n:s.toUint8Array(),e:t.toUint8Array(),d:t.modInv(i).toUint8Array(),p:r.toUint8Array(),q:n.toUint8Array(),u:r.modInv(n).toUint8Array()}},validateParams:async function(e,t,r,n,s,i){const o=await te.getBigInteger();if(e=new o(e),n=new o(n),s=new o(s),!n.mul(s).equal(e))return!1;const a=new o(2);if(i=new o(i),!n.mul(i).mod(s).isOne())return!1;t=new o(t),r=new o(r);const d=new o(Math.floor(e.bitLength()/3)),c=await ns(a,a.leftShift(d)),l=c.mul(r).mul(t);return!(!l.mod(n.dec()).equal(c)||!l.mod(s.dec()).equal(c))}}),fT=Object.freeze({__proto__:null,encrypt:async function(e,t,r,n){const s=await te.getBigInteger();t=new s(t),r=new s(r),n=new s(n);const i=new s(h2(e,t.byteLength())),o=await ns(new s(1),t.dec());return{c1:r.modExp(o,t).toUint8Array(),c2:n.modExp(o,t).imul(i).imod(t).toUint8Array()}},decrypt:async function(e,t,r,n,s){const i=await te.getBigInteger();return e=new i(e),t=new i(t),r=new i(r),n=new i(n),p2(e.modExp(n,r).modInv(r).imul(t).imod(r).toUint8Array("be",r.byteLength()),s)},validateParams:async function(e,t,r,n){const s=await te.getBigInteger();e=new s(e),t=new s(t),r=new s(r);const i=new s(1);if(t.lte(i)||t.gte(e))return!1;const o=new s(e.bitLength()),a=new s(1023);if(o.lt(a)||!t.modExp(e.dec(),e).isOne())return!1;let d=t;const c=new s(1),l=new s(2).leftShift(new s(17));for(;c.lt(l);){if(d=d.mul(t).imod(e),d.isOne())return!1;c.iinc()}n=new s(n);const u=new s(2),p=await ns(u.leftShift(o.dec()),u.leftShift(o)),f=e.dec().imul(p).iadd(n);return!!r.equal(t.modExp(f,e))}});class pi{constructor(t){if(t instanceof pi)this.oid=t.oid;else if(te.isArray(t)||te.isUint8Array(t)){if((t=new Uint8Array(t))[0]===6){if(t[1]!==t.length-2)throw Error("Length mismatch in DER encoded oid");t=t.subarray(2)}this.oid=t}else this.oid=""}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.oid=t.subarray(1,1+r),1+this.oid.length}throw Error("Invalid oid")}write(){return te.concatUint8Array([new Uint8Array([this.oid.length]),this.oid])}toHex(){return te.uint8ArrayToHex(this.oid)}getName(){const t=this.toHex();if(H.curve[t])return H.write(H.curve,t);throw Error("Unknown curve object identifier.")}}function yh(e,t){return e.keyPair({priv:t})}function gh(e,t){const r=e.keyPair({pub:t});if(r.validate().result!==!0)throw Error("Invalid elliptic public key");return r}async function bo(e){if(!Xe.useIndutnyElliptic)throw Error("This curve is only supported in the full build of OpenPGP.js");const{default:t}=await Promise.resolve().then(function(){return ZC});return new t.ec(e)}function cw(e){let t,r=0;const n=e[0];return n<192?([r]=e,t=1):n<255?(r=(e[0]-192<<8)+e[1]+192,t=2):n===255&&(r=te.readNumber(e.subarray(1,5)),t=5),{len:r,offset:t}}function $l(e){return e<192?new Uint8Array([e]):e>191&&e<8384?new Uint8Array([192+(e-192>>8),e-192&255]):te.concatUint8Array([new Uint8Array([255]),te.writeNumber(e,4)])}function hT(e){if(e<0||e>30)throw Error("Partial Length power must be between 1 and 30");return new Uint8Array([224+e])}function uw(e){return new Uint8Array([192|e])}function um(e,t){return te.concatUint8Array([uw(e),$l(t)])}function sf(e){return[H.packet.literalData,H.packet.compressedData,H.packet.symmetricallyEncryptedData,H.packet.symEncryptedIntegrityProtectedData,H.packet.aeadEncryptedData].includes(e)}async function pT(e,t){const r=Mi(e);let n,s;try{const i=await r.peekBytes(2);if(!i||i.length<2||!(128&i[0]))throw Error("Error during parsing. This message / key probably does not conform to a valid OpenPGP format.");const o=await r.readByte();let a,d,c=-1,l=-1;l=0,64&o&&(l=1),l?c=63&o:(c=(63&o)>>2,d=3&o);const u=sf(c);let p,f=null;if(u){if(te.isStream(e)==="array"){const y=new bi;n=vn(y),f=y}else{const y=new lo;n=vn(y.writable),f=y.readable}s=t({tag:c,packet:f})}else f=[];do{if(l){const y=await r.readByte();if(p=!1,y<192)a=y;else if(y>=192&&y<224)a=(y-192<<8)+await r.readByte()+192;else if(y>223&&y<255){if(a=1<<(31&y),p=!0,!u)throw new TypeError("This packet type does not support partial lengths.")}else a=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte()}else switch(d){case 0:a=await r.readByte();break;case 1:a=await r.readByte()<<8|await r.readByte();break;case 2:a=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte();break;default:a=1/0}if(a>0){let y=0;for(;;){n&&await n.ready;const{done:m,value:b}=await r.read();if(m){if(a===1/0)break;throw Error("Unexpected end of packet")}const v=a===1/0?b:b.subarray(0,a-y);if(n?await n.write(v):f.push(v),y+=b.length,y>=a){r.unshift(b.subarray(a-y+b.length));break}}}}while(p);const h=await r.peekBytes(u?1/0:2);return n?(await n.ready,await n.close()):(f=te.concatUint8Array(f),await t({tag:c,packet:f})),!h||!h.length}catch(i){if(n)return await n.abort(i),!0;throw i}finally{n&&await s,r.releaseLock()}}let hr=class lw extends Error{constructor(...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,lw),this.name="UnsupportedError"}};class Cf{constructor(t,r){this.tag=t,this.rawContent=r}write(){return this.rawContent}}const f0=te.getWebCrypto(),Rf=te.getNodeCrypto(),Si={p256:"P-256",p384:"P-384",p521:"P-521"},Ui=Rf?Rf.getCurves():[],gs=Rf?{secp256k1:Ui.includes("secp256k1")?"secp256k1":void 0,p256:Ui.includes("prime256v1")?"prime256v1":void 0,p384:Ui.includes("secp384r1")?"secp384r1":void 0,p521:Ui.includes("secp521r1")?"secp521r1":void 0,ed25519:Ui.includes("ED25519")?"ED25519":void 0,curve25519:Ui.includes("X25519")?"X25519":void 0,brainpoolP256r1:Ui.includes("brainpoolP256r1")?"brainpoolP256r1":void 0,brainpoolP384r1:Ui.includes("brainpoolP384r1")?"brainpoolP384r1":void 0,brainpoolP512r1:Ui.includes("brainpoolP512r1")?"brainpoolP512r1":void 0}:{},af={p256:{oid:[6,8,42,134,72,206,61,3,1,7],keyType:H.publicKey.ecdsa,hash:H.hash.sha256,cipher:H.symmetric.aes128,node:gs.p256,web:Si.p256,payloadSize:32,sharedSize:256},p384:{oid:[6,5,43,129,4,0,34],keyType:H.publicKey.ecdsa,hash:H.hash.sha384,cipher:H.symmetric.aes192,node:gs.p384,web:Si.p384,payloadSize:48,sharedSize:384},p521:{oid:[6,5,43,129,4,0,35],keyType:H.publicKey.ecdsa,hash:H.hash.sha512,cipher:H.symmetric.aes256,node:gs.p521,web:Si.p521,payloadSize:66,sharedSize:528},secp256k1:{oid:[6,5,43,129,4,0,10],keyType:H.publicKey.ecdsa,hash:H.hash.sha256,cipher:H.symmetric.aes128,node:gs.secp256k1,payloadSize:32},ed25519:{oid:[6,9,43,6,1,4,1,218,71,15,1],keyType:H.publicKey.eddsaLegacy,hash:H.hash.sha512,node:!1,payloadSize:32},curve25519:{oid:[6,10,43,6,1,4,1,151,85,1,5,1],keyType:H.publicKey.ecdh,hash:H.hash.sha256,cipher:H.symmetric.aes128,node:!1,payloadSize:32},brainpoolP256r1:{oid:[6,9,43,36,3,3,2,8,1,1,7],keyType:H.publicKey.ecdsa,hash:H.hash.sha256,cipher:H.symmetric.aes128,node:gs.brainpoolP256r1,payloadSize:32},brainpoolP384r1:{oid:[6,9,43,36,3,3,2,8,1,1,11],keyType:H.publicKey.ecdsa,hash:H.hash.sha384,cipher:H.symmetric.aes192,node:gs.brainpoolP384r1,payloadSize:48},brainpoolP512r1:{oid:[6,9,43,36,3,3,2,8,1,1,13],keyType:H.publicKey.ecdsa,hash:H.hash.sha512,cipher:H.symmetric.aes256,node:gs.brainpoolP512r1,payloadSize:64}};class is{constructor(t,r){try{(te.isArray(t)||te.isUint8Array(t))&&(t=new pi(t)),t instanceof pi&&(t=t.getName()),this.name=H.write(H.curve,t)}catch{throw new hr("Unknown curve")}r=r||af[this.name],this.keyType=r.keyType,this.oid=r.oid,this.hash=r.hash,this.cipher=r.cipher,this.node=r.node&&af[this.name],this.web=r.web&&af[this.name],this.payloadSize=r.payloadSize,this.web&&te.getWebCrypto()?this.type="web":this.node&&te.getNodeCrypto()?this.type="node":this.name==="curve25519"?this.type="curve25519":this.name==="ed25519"&&(this.type="ed25519")}async genKeyPair(){let t;switch(this.type){case"web":try{return await async function(n){const s=await f0.generateKey({name:"ECDSA",namedCurve:Si[n]},!0,["sign","verify"]),i=await f0.exportKey("jwk",s.privateKey),o=await f0.exportKey("jwk",s.publicKey);return{publicKey:fw(o),privateKey:zi(i.d)}}(this.name)}catch(n){te.printDebugError("Browser did not support generating ec key "+n.message);break}case"node":return async function(n){const s=Rf.createECDH(gs[n]);return await s.generateKeys(),{publicKey:new Uint8Array(s.getPublicKey()),privateKey:new Uint8Array(s.getPrivateKey())}}(this.name);case"curve25519":{const n=Cn(32);n[0]=127&n[0]|64,n[31]&=248;const s=n.slice().reverse();return t=Ar.box.keyPair.fromSecretKey(s),{publicKey:te.concatUint8Array([new Uint8Array([64]),t.publicKey]),privateKey:n}}case"ed25519":{const n=Cn(32),s=Ar.sign.keyPair.fromSeed(n);return{publicKey:te.concatUint8Array([new Uint8Array([64]),s.publicKey]),privateKey:n}}}return t=await(await bo(this.name)).genKeyPair({entropy:te.uint8ArrayToString(Cn(32))}),{publicKey:new Uint8Array(t.getPublic("array",!1)),privateKey:t.getPrivate().toArrayLike(Uint8Array)}}}async function dw(e,t,r,n){const s={p256:!0,p384:!0,p521:!0,secp256k1:!0,curve25519:e===H.publicKey.ecdh,brainpoolP256r1:!0,brainpoolP384r1:!0,brainpoolP512r1:!0},i=t.getName();if(!s[i])return!1;if(i==="curve25519"){n=n.slice().reverse();const{publicKey:a}=Ar.box.keyPair.fromSecretKey(n);r=new Uint8Array(r);const d=new Uint8Array([64,...a]);return!!te.equalsUint8Array(d,r)}const o=await bo(i);try{r=gh(o,r).getPublic()}catch{return!1}return!!yh(o,n).getPublic().eq(r)}function fw(e){const t=zi(e.x),r=zi(e.y),n=new Uint8Array(t.length+r.length+1);return n[0]=4,n.set(t,1),n.set(r,t.length+1),n}function mh(e,t,r){const n=e,s=r.slice(1,n+1),i=r.slice(n+1,2*n+1);return{kty:"EC",crv:t,x:Tn(s,!0),y:Tn(i,!0),ext:!0}}function hw(e,t,r,n){const s=mh(e,t,r);return s.d=Tn(n,!0),s}const kf=te.getWebCrypto(),vo=te.getNodeCrypto();async function lm(e,t,r,n,s,i){const o=new is(e);if(r&&!te.isStream(r)){const a={publicKey:n,privateKey:s};switch(o.type){case"web":try{return await async function(d,c,l,u){const p=d.payloadSize,f=hw(d.payloadSize,Si[d.name],u.publicKey,u.privateKey),h=await kf.importKey("jwk",f,{name:"ECDSA",namedCurve:Si[d.name],hash:{name:H.read(H.webHash,d.hash)}},!1,["sign"]),y=new Uint8Array(await kf.sign({name:"ECDSA",namedCurve:Si[d.name],hash:{name:H.read(H.webHash,c)}},h,l));return{r:y.slice(0,p),s:y.slice(p,p<<1)}}(o,t,r,a)}catch(d){if(o.name!=="p521"&&(d.name==="DataError"||d.name==="OperationError"))throw d;te.printDebugError("Browser did not support signing: "+d.message)}break;case"node":{const d=await async function(c,l,u,p){const f=vo.createSign(H.read(H.hash,l));f.write(u),f.end();const h=yT.encode({version:1,parameters:c.oid,privateKey:Array.from(p.privateKey),publicKey:{unused:0,data:Array.from(p.publicKey)}},"pem",{label:"EC PRIVATE KEY"});return pw.decode(f.sign(h),"der")}(o,t,r,a);return{r:d.r.toArrayLike(Uint8Array),s:d.s.toArrayLike(Uint8Array)}}}}return async function(a,d,c){const l=await bo(a.name),u=yh(l,c),p=u.sign(d);return{r:p.r.toArrayLike(Uint8Array),s:p.s.toArrayLike(Uint8Array)}}(o,i,s)}async function dm(e,t,r,n,s,i){const o=new is(e);if(n&&!te.isStream(n))switch(o.type){case"web":try{return await async function(a,d,{r:c,s:l},u,p){const f=mh(a.payloadSize,Si[a.name],p),h=await kf.importKey("jwk",f,{name:"ECDSA",namedCurve:Si[a.name],hash:{name:H.read(H.webHash,a.hash)}},!1,["verify"]),y=te.concatUint8Array([c,l]).buffer;return kf.verify({name:"ECDSA",namedCurve:Si[a.name],hash:{name:H.read(H.webHash,d)}},h,y,u)}(o,t,r,n,s)}catch(a){if(o.name!=="p521"&&(a.name==="DataError"||a.name==="OperationError"))throw a;te.printDebugError("Browser did not support verifying: "+a.message)}break;case"node":return async function(a,d,{r:c,s:l},u,p){const{default:f}=await Promise.resolve().then(function(){return rl}),h=vo.createVerify(H.read(H.hash,d));h.write(u),h.end();const y=mT.encode({algorithm:{algorithm:[1,2,840,10045,2,1],parameters:a.oid},subjectPublicKey:{unused:0,data:Array.from(p)}},"pem",{label:"PUBLIC KEY"}),m=pw.encode({r:new f(c),s:new f(l)},"der");try{return h.verify(y,m)}catch{return!1}}(o,t,r,n,s)}return async function(a,d,c,l){const u=await bo(a.name);return gh(u,l).verify(c,d)}(o,r,t===void 0?n:i,s)}const bh=void 0,pw=vo?bh.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}):void 0,yT=vo?bh.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}):void 0,gT=vo?bh.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}):void 0,mT=vo?bh.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(gT),this.key("subjectPublicKey").bitstr())}):void 0;var bT=Object.freeze({__proto__:null,sign:lm,verify:dm,validateParams:async function(e,t,r){const n=new is(e);if(n.keyType!==H.publicKey.ecdsa)return!1;switch(n.type){case"web":case"node":{const s=Cn(8),i=H.hash.sha256,o=await Un.digest(i,s);try{const a=await lm(e,i,s,t,r,o);return await dm(e,i,a,s,t,o)}catch{return!1}}default:return dw(H.publicKey.ecdsa,e,t,r)}}});Ar.hash=e=>new Uint8Array(mo().update(e).digest());var vT=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i){if(Un.getHashByteLength(t)<Un.getHashByteLength(H.hash.sha256))throw Error("Hash algorithm too weak for EdDSA.");const o=te.concatUint8Array([s,n.subarray(1)]),a=Ar.sign.detached(i,o);return{r:a.subarray(0,32),s:a.subarray(32)}},verify:async function(e,t,{r,s:n},s,i,o){if(Un.getHashByteLength(t)<Un.getHashByteLength(H.hash.sha256))throw Error("Hash algorithm too weak for EdDSA.");const a=te.concatUint8Array([r,n]);return Ar.sign.detached.verify(o,a,i.subarray(1))},validateParams:async function(e,t,r){if(e.getName()!=="ed25519")return!1;const{publicKey:n}=Ar.sign.keyPair.fromSeed(r),s=new Uint8Array([64,...n]);return te.equalsUint8Array(t,s)}});function h0(e){if(e===H.publicKey.ed25519)return H.hash.sha256;throw Error("Unknown EdDSA algo")}Ar.hash=e=>new Uint8Array(mo().update(e).digest());var _T=Object.freeze({__proto__:null,generate:async function(e){if(e===H.publicKey.ed25519){const t=Cn(32),{publicKey:r}=Ar.sign.keyPair.fromSeed(t);return{A:r,seed:t}}throw Error("Unsupported EdDSA algorithm")},sign:async function(e,t,r,n,s,i){if(Un.getHashByteLength(t)<Un.getHashByteLength(h0(e)))throw Error("Hash algorithm too weak for EdDSA.");switch(e){case H.publicKey.ed25519:{const o=te.concatUint8Array([s,n]);return{RS:Ar.sign.detached(i,o)}}case H.publicKey.ed448:default:throw Error("Unsupported EdDSA algorithm")}},verify:async function(e,t,{RS:r},n,s,i){if(Un.getHashByteLength(t)<Un.getHashByteLength(h0(e)))throw Error("Hash algorithm too weak for EdDSA.");switch(e){case H.publicKey.ed25519:return Ar.sign.detached.verify(i,r,s);case H.publicKey.ed448:default:throw Error("Unsupported EdDSA algorithm")}},validateParams:async function(e,t,r){switch(e){case H.publicKey.ed25519:{const{publicKey:n}=Ar.sign.keyPair.fromSeed(r);return te.equalsUint8Array(t,n)}case H.publicKey.ed448:default:return!1}},getPreferredHashAlgo:h0});function y2(e,t){const r=new ql["aes"+8*e.length](e),n=new Uint32Array([2795939494,2795939494]),s=Mf(t);let i=n;const o=s,a=s.length/2,d=new Uint32Array([0,0]);let c=new Uint32Array(4);for(let l=0;l<=5;++l)for(let u=0;u<a;++u)d[1]=a*l+(1+u),c[0]=i[0],c[1]=i[1],c[2]=o[2*u],c[3]=o[2*u+1],c=Mf(r.encrypt(Of(c))),i=c.subarray(0,2),i[0]^=d[0],i[1]^=d[1],o[2*u]=c[2],o[2*u+1]=c[3];return Of(i,o)}function g2(e,t){const r=new ql["aes"+8*e.length](e),n=new Uint32Array([2795939494,2795939494]),s=Mf(t);let i=s.subarray(0,2);const o=s.subarray(2),a=s.length/2-1,d=new Uint32Array([0,0]);let c=new Uint32Array(4);for(let l=5;l>=0;--l)for(let u=a-1;u>=0;--u)d[1]=a*l+(u+1),c[0]=i[0]^d[0],c[1]=i[1]^d[1],c[2]=o[2*u],c[3]=o[2*u+1],c=Mf(r.decrypt(Of(c))),i=c.subarray(0,2),o[2*u]=c[2],o[2*u+1]=c[3];if(i[0]===n[0]&&i[1]===n[1])return Of(o);throw Error("Key Data Integrity failed")}function Mf(e){const{length:t}=e,r=function(i){if(te.isString(i)){const{length:o}=i,a=new ArrayBuffer(o),d=new Uint8Array(a);for(let c=0;c<o;++c)d[c]=i.charCodeAt(c);return a}return new Uint8Array(i).buffer}(e),n=new DataView(r),s=new Uint32Array(t/4);for(let i=0;i<t/4;++i)s[i]=n.getUint32(4*i);return s}function Of(){let e=0;for(let s=0;s<arguments.length;++s)e+=4*arguments[s].length;const t=new ArrayBuffer(e),r=new DataView(t);let n=0;for(let s=0;s<arguments.length;++s){for(let i=0;i<arguments[s].length;++i)r.setUint32(n+4*i,arguments[s][i]);n+=4*arguments[s].length}return new Uint8Array(t)}var wT=Object.freeze({__proto__:null,wrap:y2,unwrap:g2});function yw(e){const t=8-e.length%8,r=new Uint8Array(e.length+t).fill(t);return r.set(e),r}function gw(e){const t=e.length;if(t>0){const r=e[t-1];if(r>=1){const n=e.subarray(t-r),s=new Uint8Array(r).fill(r);if(te.equalsUint8Array(n,s))return e.subarray(0,t-r)}}throw Error("Invalid padding")}var ET=Object.freeze({__proto__:null,encode:yw,decode:gw});const ks=te.getWebCrypto(),mw=te.getNodeCrypto();function fm(e,t,r,n){return te.concatUint8Array([t.write(),new Uint8Array([e]),r.write(),te.stringToUint8Array("Anonymous Sender "),n.subarray(0,20)])}async function hm(e,t,r,n,s=!1,i=!1){let o;if(s){for(o=0;o<t.length&&t[o]===0;o++);t=t.subarray(o)}if(i){for(o=t.length-1;o>=0&&t[o]===0;o--);t=t.subarray(0,o+1)}return(await Un.digest(e,te.concatUint8Array([new Uint8Array([0,0,0,1]),t,n]))).subarray(0,r)}async function AT(e,t){switch(e.type){case"curve25519":{const r=Cn(32),{secretKey:n,sharedKey:s}=await bw(e,t,null,r);let{publicKey:i}=Ar.box.keyPair.fromSecretKey(n);return i=te.concatUint8Array([new Uint8Array([64]),i]),{publicKey:i,sharedKey:s}}case"web":if(e.web&&te.getWebCrypto())try{return await async function(r,n){const s=mh(r.payloadSize,r.web.web,n);let i=ks.generateKey({name:"ECDH",namedCurve:r.web.web},!0,["deriveKey","deriveBits"]),o=ks.importKey("jwk",s,{name:"ECDH",namedCurve:r.web.web},!1,[]);[i,o]=await Promise.all([i,o]);let a=ks.deriveBits({name:"ECDH",namedCurve:r.web.web,public:o},i.privateKey,r.web.sharedSize),d=ks.exportKey("jwk",i.publicKey);[a,d]=await Promise.all([a,d]);const c=new Uint8Array(a);return{publicKey:new Uint8Array(fw(d)),sharedKey:c}}(e,t)}catch(r){te.printDebugError(r)}break;case"node":return async function(r,n){const s=mw.createECDH(r.node.node);s.generateKeys();const i=new Uint8Array(s.computeSecret(n));return{publicKey:new Uint8Array(s.getPublicKey()),sharedKey:i}}(e,t)}return async function(r,n){const s=await bo(r.name),i=await r.genKeyPair();n=gh(s,n);const o=yh(s,i.privateKey),a=i.publicKey,d=o.derive(n.getPublic()),c=s.curve.p.byteLength(),l=d.toArrayLike(Uint8Array,"be",c);return{publicKey:a,sharedKey:l}}(e,t)}async function bw(e,t,r,n){if(n.length!==e.payloadSize){const s=new Uint8Array(e.payloadSize);s.set(n,e.payloadSize-n.length),n=s}switch(e.type){case"curve25519":{const s=n.slice().reverse();return{secretKey:s,sharedKey:Ar.scalarMult(s,t.subarray(1))}}case"web":if(e.web&&te.getWebCrypto())try{return await async function(s,i,o,a){const d=hw(s.payloadSize,s.web.web,o,a);let c=ks.importKey("jwk",d,{name:"ECDH",namedCurve:s.web.web},!0,["deriveKey","deriveBits"]);const l=mh(s.payloadSize,s.web.web,i);let u=ks.importKey("jwk",l,{name:"ECDH",namedCurve:s.web.web},!0,[]);[c,u]=await Promise.all([c,u]);let p=ks.deriveBits({name:"ECDH",namedCurve:s.web.web,public:u},c,s.web.sharedSize),f=ks.exportKey("jwk",c);[p,f]=await Promise.all([p,f]);const h=new Uint8Array(p);return{secretKey:zi(f.d),sharedKey:h}}(e,t,r,n)}catch(s){te.printDebugError(s)}break;case"node":return async function(s,i,o){const a=mw.createECDH(s.node.node);a.setPrivateKey(o);const d=new Uint8Array(a.computeSecret(i));return{secretKey:new Uint8Array(a.getPrivateKey()),sharedKey:d}}(e,t,n)}return async function(s,i,o){const a=await bo(s.name);i=gh(a,i),o=yh(a,o);const d=new Uint8Array(o.getPrivate()),c=o.derive(i.getPublic()),l=a.curve.p.byteLength(),u=c.toArrayLike(Uint8Array,"be",l);return{secretKey:d,sharedKey:u}}(e,t,n)}var ST=Object.freeze({__proto__:null,validateParams:async function(e,t,r){return dw(H.publicKey.ecdh,e,t,r)},encrypt:async function(e,t,r,n,s){const i=yw(r),o=new is(e),{publicKey:a,sharedKey:d}=await AT(o,n),c=fm(H.publicKey.ecdh,e,t,s),{keySize:l}=Ai(t.cipher);return{publicKey:a,wrappedKey:y2(await hm(t.hash,d,l,c),i)}},decrypt:async function(e,t,r,n,s,i,o){const a=new is(e),{sharedKey:d}=await bw(a,r,s,i),c=fm(H.publicKey.ecdh,e,t,o),{keySize:l}=Ai(t.cipher);let u;for(let p=0;p<3;p++)try{return gw(g2(await hm(t.hash,d,l,c,p===1,p===2),n))}catch(f){u=f}throw u}});const pm=te.getWebCrypto(),ll=te.getNodeCrypto(),ym=ll&&ll.webcrypto&&ll.webcrypto.subtle;async function gm(e,t,r,n,s){const i=H.read(H.webHash,e);if(!i)throw Error("Hash algo not supported with HKDF");if(pm||ym){const o=pm||ym,a=await o.importKey("raw",t,"HKDF",!1,["deriveBits"]),d=await o.deriveBits({name:"HKDF",hash:i,salt:r,info:n},a,8*s);return new Uint8Array(d)}if(ll){const o=H.read(H.hash,e),a=(f,h)=>ll.createHmac(o,f).update(h).digest(),d=a(r,t),c=d.length,l=Math.ceil(s/c),u=new Uint8Array(l*c),p=new Uint8Array(c+n.length+1);p.set(n,c);for(let f=0;f<l;f++){p[p.length-1]=f+1;const h=a(d,f>0?p:p.subarray(c));p.set(h,0),u.set(h,f*c)}return u.subarray(0,s)}throw Error("No HKDF implementation available")}const mm={x25519:te.encodeUTF8("OpenPGP X25519")};var PT=Object.freeze({__proto__:null,generate:async function(e){if(e===H.publicKey.x25519){const t=Cn(32),{publicKey:r}=Ar.box.keyPair.fromSecretKey(t);return{A:r,k:t}}throw Error("Unsupported ECDH algorithm")},validateParams:async function(e,t,r){if(e===H.publicKey.x25519){const{publicKey:n}=Ar.box.keyPair.fromSecretKey(r);return te.equalsUint8Array(t,n)}return!1},encrypt:async function(e,t,r){if(e===H.publicKey.x25519){const n=Cn(32),s=Ar.scalarMult(n,r),{publicKey:i}=Ar.box.keyPair.fromSecretKey(n),o=te.concatUint8Array([i,r,s]),{keySize:a}=Ai(H.symmetric.aes128);return{ephemeralPublicKey:i,wrappedKey:y2(await gm(H.hash.sha256,o,new Uint8Array,mm.x25519,a),t)}}throw Error("Unsupported ECDH algorithm")},decrypt:async function(e,t,r,n,s){if(e===H.publicKey.x25519){const i=Ar.scalarMult(s,t),o=te.concatUint8Array([t,n,i]),{keySize:a}=Ai(H.symmetric.aes128);return g2(await gm(H.hash.sha256,o,new Uint8Array,mm.x25519,a),r)}throw Error("Unsupported ECDH algorithm")}}),TT=Object.freeze({__proto__:null,CurveWithOID:is,ecdh:ST,ecdhX:PT,ecdsa:bT,eddsaLegacy:vT,eddsa:_T,generate:async function(e){const t=await te.getBigInteger();e=new is(e);const r=await e.genKeyPair(),n=new t(r.publicKey).toUint8Array(),s=new t(r.privateKey).toUint8Array("be",e.payloadSize);return{oid:e.oid,Q:n,secret:s,hash:e.hash,cipher:e.cipher}},getPreferredHashAlgo:function(e){return af[H.write(H.curve,e.toHex())].hash}}),IT=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i){const o=await te.getBigInteger(),a=new o(1);let d,c,l,u;n=new o(n),s=new o(s),r=new o(r),i=new o(i),r=r.mod(n),i=i.mod(s);const p=new o(t.subarray(0,s.byteLength())).mod(s);for(;;){if(d=await ns(a,s),c=r.modExp(d,n).imod(s),c.isZero())continue;const f=i.mul(c).imod(s);if(u=p.add(f).imod(s),l=d.modInv(s).imul(u).imod(s),!l.isZero())break}return{r:c.toUint8Array("be",s.byteLength()),s:l.toUint8Array("be",s.byteLength())}},verify:async function(e,t,r,n,s,i,o,a){const d=await te.getBigInteger(),c=new d(0);if(t=new d(t),r=new d(r),i=new d(i),o=new d(o),s=new d(s),a=new d(a),t.lte(c)||t.gte(o)||r.lte(c)||r.gte(o))return te.printDebug("invalid DSA Signature"),!1;const l=new d(n.subarray(0,o.byteLength())).imod(o),u=r.modInv(o);if(u.isZero())return te.printDebug("invalid DSA Signature"),!1;s=s.mod(i),a=a.mod(i);const p=l.mul(u).imod(o),f=t.mul(u).imod(o),h=s.modExp(p,i),y=a.modExp(f,i);return h.mul(y).imod(i).imod(o).equal(t)},validateParams:async function(e,t,r,n,s){const i=await te.getBigInteger();e=new i(e),t=new i(t),r=new i(r),n=new i(n);const o=new i(1);if(r.lte(o)||r.gte(e)||!e.dec().mod(t).isZero()||!r.modExp(t,e).isOne())return!1;const a=new i(t.bitLength()),d=new i(150);if(a.lt(d)||!await aw(t,null,32))return!1;s=new i(s);const c=new i(2),l=await ns(c.leftShift(a.dec()),c.leftShift(a)),u=t.mul(l).add(s);return!!n.equal(r.modExp(u,e))}}),$t={rsa:dT,elgamal:fT,elliptic:TT,dsa:IT,nacl:Ar},CT=Object.freeze({__proto__:null,parseSignatureParams:function(e,t){let r=0;switch(e){case H.publicKey.rsaEncryptSign:case H.publicKey.rsaEncrypt:case H.publicKey.rsaSign:return{s:te.readMPI(t.subarray(r))};case H.publicKey.dsa:case H.publicKey.ecdsa:{const n=te.readMPI(t.subarray(r));return r+=n.length+2,{r:n,s:te.readMPI(t.subarray(r))}}case H.publicKey.eddsaLegacy:{let n=te.readMPI(t.subarray(r));r+=n.length+2,n=te.leftPad(n,32);let s=te.readMPI(t.subarray(r));return s=te.leftPad(s,32),{r:n,s}}case H.publicKey.ed25519:{const n=t.subarray(r,r+64);return r+=n.length,{RS:n}}default:throw new hr("Unknown signature algorithm.")}},verify:async function(e,t,r,n,s,i){switch(e){case H.publicKey.rsaEncryptSign:case H.publicKey.rsaEncrypt:case H.publicKey.rsaSign:{const{n:o,e:a}=n,d=te.leftPad(r.s,o.length);return $t.rsa.verify(t,s,d,o,a,i)}case H.publicKey.dsa:{const{g:o,p:a,q:d,y:c}=n,{r:l,s:u}=r;return $t.dsa.verify(t,l,u,i,o,a,d,c)}case H.publicKey.ecdsa:{const{oid:o,Q:a}=n,d=new $t.elliptic.CurveWithOID(o).payloadSize,c=te.leftPad(r.r,d),l=te.leftPad(r.s,d);return $t.elliptic.ecdsa.verify(o,t,{r:c,s:l},s,a,i)}case H.publicKey.eddsaLegacy:{const{oid:o,Q:a}=n;return $t.elliptic.eddsaLegacy.verify(o,t,r,s,a,i)}case H.publicKey.ed25519:{const{A:o}=n;return $t.elliptic.eddsa.verify(e,t,r,s,o,i)}default:throw Error("Unknown signature algorithm.")}},sign:async function(e,t,r,n,s,i){if(!r||!n)throw Error("Missing key parameters");switch(e){case H.publicKey.rsaEncryptSign:case H.publicKey.rsaEncrypt:case H.publicKey.rsaSign:{const{n:o,e:a}=r,{d,p:c,q:l,u}=n;return{s:await $t.rsa.sign(t,s,o,a,d,c,l,u,i)}}case H.publicKey.dsa:{const{g:o,p:a,q:d}=r,{x:c}=n;return $t.dsa.sign(t,i,o,a,d,c)}case H.publicKey.elgamal:throw Error("Signing with Elgamal is not defined in the OpenPGP standard.");case H.publicKey.ecdsa:{const{oid:o,Q:a}=r,{d}=n;return $t.elliptic.ecdsa.sign(o,t,s,a,d,i)}case H.publicKey.eddsaLegacy:{const{oid:o,Q:a}=r,{seed:d}=n;return $t.elliptic.eddsaLegacy.sign(o,t,s,a,d,i)}case H.publicKey.ed25519:{const{A:o}=r,{seed:a}=n;return $t.elliptic.eddsa.sign(e,t,s,o,a,i)}default:throw Error("Unknown signature algorithm.")}}});class bm{constructor(t){t&&(this.data=t)}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.data=t.subarray(1,1+r),1+this.data.length}throw Error("Invalid symmetric key")}write(){return te.concatUint8Array([new Uint8Array([this.data.length]),this.data])}}class vm{constructor(t){if(t){const{hash:r,cipher:n}=t;this.hash=r,this.cipher=n}else this.hash=null,this.cipher=null}read(t){if(t.length<4||t[0]!==3||t[1]!==1)throw new hr("Cannot read KDFParams");return this.hash=t[2],this.cipher=t[3],4}write(){return new Uint8Array([3,1,this.hash,this.cipher])}}class Nf{static fromObject({wrappedKey:t,algorithm:r}){const n=new Nf;return n.wrappedKey=t,n.algorithm=r,n}read(t){let r=0,n=t[r++];this.algorithm=n%2?t[r++]:null,n-=n%2,this.wrappedKey=t.subarray(r,r+n),r+=n}write(){return te.concatUint8Array([this.algorithm?new Uint8Array([this.wrappedKey.length+1,this.algorithm]):new Uint8Array([this.wrappedKey.length]),this.wrappedKey])}}function p0(e){try{e.getName()}catch{throw new hr("Unknown curve OID")}}var RT=Object.freeze({__proto__:null,publicKeyEncrypt:async function(e,t,r,n,s){switch(e){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:{const{n:i,e:o}=r;return{c:await $t.rsa.encrypt(n,i,o)}}case H.publicKey.elgamal:{const{p:i,g:o,y:a}=r;return $t.elgamal.encrypt(n,i,o,a)}case H.publicKey.ecdh:{const{oid:i,Q:o,kdfParams:a}=r,{publicKey:d,wrappedKey:c}=await $t.elliptic.ecdh.encrypt(i,a,n,o,s);return{V:d,C:new bm(c)}}case H.publicKey.x25519:{if(!te.isAES(t))throw Error("X25519 keys can only encrypt AES session keys");const{A:i}=r,{ephemeralPublicKey:o,wrappedKey:a}=await $t.elliptic.ecdhX.encrypt(e,n,i);return{ephemeralPublicKey:o,C:Nf.fromObject({algorithm:t,wrappedKey:a})}}default:return[]}},publicKeyDecrypt:async function(e,t,r,n,s,i){switch(e){case H.publicKey.rsaEncryptSign:case H.publicKey.rsaEncrypt:{const{c:o}=n,{n:a,e:d}=t,{d:c,p:l,q:u,u:p}=r;return $t.rsa.decrypt(o,a,d,c,l,u,p,i)}case H.publicKey.elgamal:{const{c1:o,c2:a}=n,d=t.p,c=r.x;return $t.elgamal.decrypt(o,a,d,c,i)}case H.publicKey.ecdh:{const{oid:o,Q:a,kdfParams:d}=t,{d:c}=r,{V:l,C:u}=n;return $t.elliptic.ecdh.decrypt(o,d,l,u.data,a,c,s)}case H.publicKey.x25519:{const{A:o}=t,{k:a}=r,{ephemeralPublicKey:d,C:c}=n;if(!te.isAES(c.algorithm))throw Error("AES session key expected");return $t.elliptic.ecdhX.decrypt(e,d,c.wrappedKey,o,a)}default:throw Error("Unknown public key encryption algorithm.")}},parsePublicKeyParams:function(e,t){let r=0;switch(e){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:case H.publicKey.rsaSign:{const n=te.readMPI(t.subarray(r));r+=n.length+2;const s=te.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{n,e:s}}}case H.publicKey.dsa:{const n=te.readMPI(t.subarray(r));r+=n.length+2;const s=te.readMPI(t.subarray(r));r+=s.length+2;const i=te.readMPI(t.subarray(r));r+=i.length+2;const o=te.readMPI(t.subarray(r));return r+=o.length+2,{read:r,publicParams:{p:n,q:s,g:i,y:o}}}case H.publicKey.elgamal:{const n=te.readMPI(t.subarray(r));r+=n.length+2;const s=te.readMPI(t.subarray(r));r+=s.length+2;const i=te.readMPI(t.subarray(r));return r+=i.length+2,{read:r,publicParams:{p:n,g:s,y:i}}}case H.publicKey.ecdsa:{const n=new pi;r+=n.read(t),p0(n);const s=te.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{oid:n,Q:s}}}case H.publicKey.eddsaLegacy:{const n=new pi;r+=n.read(t),p0(n);let s=te.readMPI(t.subarray(r));return r+=s.length+2,s=te.leftPad(s,33),{read:r,publicParams:{oid:n,Q:s}}}case H.publicKey.ecdh:{const n=new pi;r+=n.read(t),p0(n);const s=te.readMPI(t.subarray(r));r+=s.length+2;const i=new vm;return r+=i.read(t.subarray(r)),{read:r,publicParams:{oid:n,Q:s,kdfParams:i}}}case H.publicKey.ed25519:case H.publicKey.x25519:{const n=t.subarray(r,r+32);return r+=n.length,{read:r,publicParams:{A:n}}}default:throw new hr("Unknown public key encryption algorithm.")}},parsePrivateKeyParams:function(e,t,r){let n=0;switch(e){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:case H.publicKey.rsaSign:{const s=te.readMPI(t.subarray(n));n+=s.length+2;const i=te.readMPI(t.subarray(n));n+=i.length+2;const o=te.readMPI(t.subarray(n));n+=o.length+2;const a=te.readMPI(t.subarray(n));return n+=a.length+2,{read:n,privateParams:{d:s,p:i,q:o,u:a}}}case H.publicKey.dsa:case H.publicKey.elgamal:{const s=te.readMPI(t.subarray(n));return n+=s.length+2,{read:n,privateParams:{x:s}}}case H.publicKey.ecdsa:case H.publicKey.ecdh:{const s=new is(r.oid);let i=te.readMPI(t.subarray(n));return n+=i.length+2,i=te.leftPad(i,s.payloadSize),{read:n,privateParams:{d:i}}}case H.publicKey.eddsaLegacy:{const s=new is(r.oid);let i=te.readMPI(t.subarray(n));return n+=i.length+2,i=te.leftPad(i,s.payloadSize),{read:n,privateParams:{seed:i}}}case H.publicKey.ed25519:{const s=t.subarray(n,n+32);return n+=s.length,{read:n,privateParams:{seed:s}}}case H.publicKey.x25519:{const s=t.subarray(n,n+32);return n+=s.length,{read:n,privateParams:{k:s}}}default:throw new hr("Unknown public key encryption algorithm.")}},parseEncSessionKeyParams:function(e,t){let r=0;switch(e){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:return{c:te.readMPI(t.subarray(r))};case H.publicKey.elgamal:{const n=te.readMPI(t.subarray(r));return r+=n.length+2,{c1:n,c2:te.readMPI(t.subarray(r))}}case H.publicKey.ecdh:{const n=te.readMPI(t.subarray(r));r+=n.length+2;const s=new bm;return s.read(t.subarray(r)),{V:n,C:s}}case H.publicKey.x25519:{const n=t.subarray(r,r+32);r+=n.length;const s=new Nf;return s.read(t.subarray(r)),{ephemeralPublicKey:n,C:s}}default:throw new hr("Unknown public key encryption algorithm.")}},serializeParams:function(e,t){const r=new Set([H.publicKey.ed25519,H.publicKey.x25519]),n=Object.keys(t).map(s=>{const i=t[s];return te.isUint8Array(i)?r.has(e)?i:te.uint8ArrayToMPI(i):i.write()});return te.concatUint8Array(n)},generateParams:function(e,t,r){switch(e){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:case H.publicKey.rsaSign:return $t.rsa.generate(t,65537).then(({n,e:s,d:i,p:o,q:a,u:d})=>({privateParams:{d:i,p:o,q:a,u:d},publicParams:{n,e:s}}));case H.publicKey.ecdsa:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i})=>({privateParams:{d:i},publicParams:{oid:new pi(n),Q:s}}));case H.publicKey.eddsaLegacy:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i})=>({privateParams:{seed:i},publicParams:{oid:new pi(n),Q:s}}));case H.publicKey.ecdh:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i,hash:o,cipher:a})=>({privateParams:{d:i},publicParams:{oid:new pi(n),Q:s,kdfParams:new vm({hash:o,cipher:a})}}));case H.publicKey.ed25519:return $t.elliptic.eddsa.generate(e).then(({A:n,seed:s})=>({privateParams:{seed:s},publicParams:{A:n}}));case H.publicKey.x25519:return $t.elliptic.ecdhX.generate(e).then(({A:n,k:s})=>({privateParams:{k:s},publicParams:{A:n}}));case H.publicKey.dsa:case H.publicKey.elgamal:throw Error("Unsupported algorithm for key generation.");default:throw Error("Unknown public key algorithm.")}},validateParams:async function(e,t,r){if(!t||!r)throw Error("Missing key parameters");switch(e){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:case H.publicKey.rsaSign:{const{n,e:s}=t,{d:i,p:o,q:a,u:d}=r;return $t.rsa.validateParams(n,s,i,o,a,d)}case H.publicKey.dsa:{const{p:n,q:s,g:i,y:o}=t,{x:a}=r;return $t.dsa.validateParams(n,s,i,o,a)}case H.publicKey.elgamal:{const{p:n,g:s,y:i}=t,{x:o}=r;return $t.elgamal.validateParams(n,s,i,o)}case H.publicKey.ecdsa:case H.publicKey.ecdh:{const n=$t.elliptic[H.read(H.publicKey,e)],{oid:s,Q:i}=t,{d:o}=r;return n.validateParams(s,i,o)}case H.publicKey.eddsaLegacy:{const{Q:n,oid:s}=t,{seed:i}=r;return $t.elliptic.eddsaLegacy.validateParams(s,n,i)}case H.publicKey.ed25519:{const{A:n}=t,{seed:s}=r;return $t.elliptic.eddsa.validateParams(e,n,s)}case H.publicKey.x25519:{const{A:n}=t,{k:s}=r;return $t.elliptic.ecdhX.validateParams(e,n,s)}default:throw Error("Unknown public key algorithm.")}},getPrefixRandom:async function(e){const{blockSize:t}=Ai(e),r=await Cn(t),n=new Uint8Array([r[r.length-2],r[r.length-1]]);return te.concat([r,n])},generateSessionKey:function(e){const{keySize:t}=Ai(e);return Cn(t)},getAEADMode:function(e){const t=H.read(H.aead,e);return sw[t]},getCipher:Ai,getPreferredCurveHashAlgo:function(e,t){switch(e){case H.publicKey.ecdsa:case H.publicKey.eddsaLegacy:return $t.elliptic.getPreferredHashAlgo(t);case H.publicKey.ed25519:return $t.elliptic.eddsa.getPreferredHashAlgo(e);default:throw Error("Unknown elliptic signing algo")}}});const yt={cipher:ql,hash:Un,mode:sw,publicKey:$t,signature:CT,random:cT,pkcs1:lT,pkcs5:ET,aesKW:wT};Object.assign(yt,RT);var Vl=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function vw(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)}const _w={arraySet:function(e,t,r,n,s){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),s);else for(let i=0;i<n;i++)e[s+i]=t[r+i]},flattenChunks:function(e){let t,r,n,s,i;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;const o=new Uint8Array(n);for(s=0,t=0,r=e.length;t<r;t++)i=e[t],o.set(i,s),s+=i.length;return o}},ww={arraySet:function(e,t,r,n,s){for(let i=0;i<n;i++)e[s+i]=t[r+i]},flattenChunks:function(e){return[].concat.apply([],e)}};let vi=Vl?Uint8Array:Array,xn=Vl?Uint16Array:Array,Df=Vl?Int32Array:Array,Ew=Vl?_w.flattenChunks:ww.flattenChunks,Pi=Vl?_w.arraySet:ww.arraySet;const Ti=0,kT=1,El=2,MT=3,Dr=4,_y=5,bd=6,er=0,Zi=1,Aw=2,Er=-2,m2=-3,dl=-5,_m=-1,OT=1,vd=2,NT=3,Sw=4,wm=0,Em=1,Pw=2,fo=8;function _o(e){let t=e.length;for(;--t>=0;)e[t]=0}const DT=0,Tw=1,xT=2,b2=29,Fl=256,Al=Fl+1+b2,so=30,v2=19,Am=2*Al+1,ya=15,y0=16,UT=7,_2=256,Iw=16,Cw=17,Rw=18,wy=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],of=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],BT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Sm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Gi=Array(2*(Al+2));_o(Gi);const fl=Array(2*so);_o(fl);const Sl=Array(512);_o(Sl);const Pl=Array(256);_o(Pl);const w2=Array(b2);_o(w2);const xf=Array(so);function g0(e,t,r,n,s){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=s,this.has_stree=e&&e.length}let Pm,Tm,Im;function m0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function kw(e){return e<256?Sl[e]:Sl[256+(e>>>7)]}function Tl(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function mn(e,t,r){e.bi_valid>y0-r?(e.bi_buf|=t<<e.bi_valid&65535,Tl(e,e.bi_buf),e.bi_buf=t>>y0-e.bi_valid,e.bi_valid+=r-y0):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function gi(e,t,r){mn(e,r[2*t],r[2*t+1])}function Mw(e,t){let r=0;do r|=1&e,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Ow(e,t,r){const n=Array(ya+1);let s,i,o=0;for(s=1;s<=ya;s++)n[s]=o=o+r[s-1]<<1;for(i=0;i<=t;i++){const a=e[2*i+1];a!==0&&(e[2*i]=Mw(n[a]++,a))}}function Nw(e){let t;for(t=0;t<Al;t++)e.dyn_ltree[2*t]=0;for(t=0;t<so;t++)e.dyn_dtree[2*t]=0;for(t=0;t<v2;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*_2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Dw(e){e.bi_valid>8?Tl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Cm(e,t,r,n){const s=2*t,i=2*r;return e[s]<e[i]||e[s]===e[i]&&n[t]<=n[r]}function b0(e,t,r){const n=e.heap[r];let s=r<<1;for(;s<=e.heap_len&&(s<e.heap_len&&Cm(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!Cm(t,n,e.heap[s],e.depth));)e.heap[r]=e.heap[s],r=s,s<<=1;e.heap[r]=n}function Rm(e,t,r){let n,s,i,o,a=0;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],s=e.pending_buf[e.l_buf+a],a++,n===0?gi(e,s,t):(i=Pl[s],gi(e,i+Fl+1,t),o=wy[i],o!==0&&(s-=w2[i],mn(e,s,o)),n--,i=kw(n),gi(e,i,r),o=of[i],o!==0&&(n-=xf[i],mn(e,n,o)));while(a<e.last_lit);gi(e,_2,t)}function v0(e,t){const r=t.dyn_tree,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,i=t.stat_desc.elems;let o,a,d,c=-1;for(e.heap_len=0,e.heap_max=Am,o=0;o<i;o++)r[2*o]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):r[2*o+1]=0;for(;e.heap_len<2;)d=e.heap[++e.heap_len]=c<2?++c:0,r[2*d]=1,e.depth[d]=0,e.opt_len--,s&&(e.static_len-=n[2*d+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)b0(e,r,o);d=i;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],b0(e,r,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,r[2*d]=r[2*o]+r[2*a],e.depth[d]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,r[2*o+1]=r[2*a+1]=d,e.heap[1]=d++,b0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(l,u){const p=u.dyn_tree,f=u.max_code,h=u.stat_desc.static_tree,y=u.stat_desc.has_stree,m=u.stat_desc.extra_bits,b=u.stat_desc.extra_base,v=u.stat_desc.max_length;let E,_,C,k,D,w,S=0;for(k=0;k<=ya;k++)l.bl_count[k]=0;for(p[2*l.heap[l.heap_max]+1]=0,E=l.heap_max+1;E<Am;E++)_=l.heap[E],k=p[2*p[2*_+1]+1]+1,k>v&&(k=v,S++),p[2*_+1]=k,_>f||(l.bl_count[k]++,D=0,_>=b&&(D=m[_-b]),w=p[2*_],l.opt_len+=w*(k+D),y&&(l.static_len+=w*(h[2*_+1]+D)));if(S!==0){do{for(k=v-1;l.bl_count[k]===0;)k--;l.bl_count[k]--,l.bl_count[k+1]+=2,l.bl_count[v]--,S-=2}while(S>0);for(k=v;k!==0;k--)for(_=l.bl_count[k];_!==0;)C=l.heap[--E],C>f||(p[2*C+1]!==k&&(l.opt_len+=(k-p[2*C+1])*p[2*C],p[2*C+1]=k),_--)}}(e,t),Ow(r,c,e.bl_count)}function km(e,t,r){let n,s,i=-1,o=t[1],a=0,d=7,c=4;for(o===0&&(d=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)s=o,o=t[2*(n+1)+1],++a<d&&s===o||(a<c?e.bl_tree[2*s]+=a:s!==0?(s!==i&&e.bl_tree[2*s]++,e.bl_tree[2*Iw]++):a<=10?e.bl_tree[2*Cw]++:e.bl_tree[2*Rw]++,a=0,i=s,o===0?(d=138,c=3):s===o?(d=6,c=3):(d=7,c=4))}function Mm(e,t,r){let n,s,i=-1,o=t[1],a=0,d=7,c=4;for(o===0&&(d=138,c=3),n=0;n<=r;n++)if(s=o,o=t[2*(n+1)+1],!(++a<d&&s===o)){if(a<c)do gi(e,s,e.bl_tree);while(--a!=0);else s!==0?(s!==i&&(gi(e,s,e.bl_tree),a--),gi(e,Iw,e.bl_tree),mn(e,a-3,2)):a<=10?(gi(e,Cw,e.bl_tree),mn(e,a-3,3)):(gi(e,Rw,e.bl_tree),mn(e,a-11,7));a=0,i=s,o===0?(d=138,c=3):s===o?(d=6,c=3):(d=7,c=4)}}_o(xf);let Om=!1;function LT(e){Om||(function(){let t,r,n,s,i;const o=Array(ya+1);for(n=0,s=0;s<b2-1;s++)for(w2[s]=n,t=0;t<1<<wy[s];t++)Pl[n++]=s;for(Pl[n-1]=s,i=0,s=0;s<16;s++)for(xf[s]=i,t=0;t<1<<of[s];t++)Sl[i++]=s;for(i>>=7;s<so;s++)for(xf[s]=i<<7,t=0;t<1<<of[s]-7;t++)Sl[256+i++]=s;for(r=0;r<=ya;r++)o[r]=0;for(t=0;t<=143;)Gi[2*t+1]=8,t++,o[8]++;for(;t<=255;)Gi[2*t+1]=9,t++,o[9]++;for(;t<=279;)Gi[2*t+1]=7,t++,o[7]++;for(;t<=287;)Gi[2*t+1]=8,t++,o[8]++;for(Ow(Gi,Al+1,o),t=0;t<so;t++)fl[2*t+1]=5,fl[2*t]=Mw(t,5);Pm=new g0(Gi,wy,Fl+1,Al,ya),Tm=new g0(fl,of,0,so,ya),Im=new g0([],BT,0,v2,UT)}(),Om=!0),e.l_desc=new m0(e.dyn_ltree,Pm),e.d_desc=new m0(e.dyn_dtree,Tm),e.bl_desc=new m0(e.bl_tree,Im),e.bi_buf=0,e.bi_valid=0,Nw(e)}function xw(e,t,r,n){mn(e,(DT<<1)+(n?1:0),3),function(s,i,o,a){Dw(s),a&&(Tl(s,o),Tl(s,~o)),Pi(s.pending_buf,s.window,i,o,s.pending),s.pending+=o}(e,t,r,!0)}function KT(e){mn(e,Tw<<1,3),gi(e,_2,Gi),function(t){t.bi_valid===16?(Tl(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(e)}function qT(e,t,r,n){let s,i,o=0;e.level>0?(e.strm.data_type===Pw&&(e.strm.data_type=function(a){let d,c=4093624447;for(d=0;d<=31;d++,c>>>=1)if(1&c&&a.dyn_ltree[2*d]!==0)return wm;if(a.dyn_ltree[18]!==0||a.dyn_ltree[20]!==0||a.dyn_ltree[26]!==0)return Em;for(d=32;d<Fl;d++)if(a.dyn_ltree[2*d]!==0)return Em;return wm}(e)),v0(e,e.l_desc),v0(e,e.d_desc),o=function(a){let d;for(km(a,a.dyn_ltree,a.l_desc.max_code),km(a,a.dyn_dtree,a.d_desc.max_code),v0(a,a.bl_desc),d=v2-1;d>=3&&a.bl_tree[2*Sm[d]+1]===0;d--);return a.opt_len+=3*(d+1)+5+5+4,d}(e),s=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=s&&(s=i)):s=i=r+5,r+4<=s&&t!==-1?xw(e,t,r,n):e.strategy===Sw||i===s?(mn(e,(Tw<<1)+(n?1:0),3),Rm(e,Gi,fl)):(mn(e,(xT<<1)+(n?1:0),3),function(a,d,c,l){let u;for(mn(a,d-257,5),mn(a,c-1,5),mn(a,l-4,4),u=0;u<l;u++)mn(a,a.bl_tree[2*Sm[u]+1],3);Mm(a,a.dyn_ltree,d-1),Mm(a,a.dyn_dtree,c-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Rm(e,e.dyn_ltree,e.dyn_dtree)),Nw(e),n&&Dw(e)}function xs(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,t===0?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(Pl[r]+Fl+1)]++,e.dyn_dtree[2*kw(t)]++),e.last_lit===e.lit_bufsize-1}function Il(e,t,r,n){let s=65535&e|0,i=e>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do s=s+t[n++]|0,i=i+s|0;while(--o);s%=65521,i%=65521}return s|i<<16|0}const jT=function(){let e;const t=[];for(let r=0;r<256;r++){e=r;for(let n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();function kr(e,t,r,n){const s=jT,i=n+r;e^=-1;for(let o=n;o<i;o++)e=e>>>8^s[255&(e^t[o])];return-1^e}var Cl={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};const $T=9,Vt=3,Ms=258,ei=Ms+Vt+1,VT=32,Uf=42,Ey=69,cf=73,uf=91,lf=103,ga=113,Ju=666,Or=1,hl=2,ma=3,ao=4,FT=3;function Os(e,t){return e.msg=Cl[t],t}function Nm(e){return(e<<1)-(e>4?9:0)}function Is(e){let t=e.length;for(;--t>=0;)e[t]=0}function ms(e){const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(Pi(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function $r(e,t){qT(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ms(e.strm)}function Jt(e,t){e.pending_buf[e.pending++]=t}function qo(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function HT(e,t,r,n){let s=e.avail_in;return s>n&&(s=n),s===0?0:(e.avail_in-=s,Pi(t,e.input,e.next_in,s,r),e.state.wrap===1?e.adler=Il(e.adler,t,s,r):e.state.wrap===2&&(e.adler=kr(e.adler,t,s,r)),e.next_in+=s,e.total_in+=s,s)}function Uw(e,t){let r,n,s=e.max_chain_length,i=e.strstart,o=e.prev_length,a=e.nice_match;const d=e.strstart>e.w_size-ei?e.strstart-(e.w_size-ei):0,c=e.window,l=e.w_mask,u=e.prev,p=e.strstart+Ms;let f=c[i+o-1],h=c[i+o];e.prev_length>=e.good_match&&(s>>=2),a>e.lookahead&&(a=e.lookahead);do if(r=t,c[r+o]===h&&c[r+o-1]===f&&c[r]===c[i]&&c[++r]===c[i+1]){i+=2,r++;do;while(c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&i<p);if(n=Ms-(p-i),i=p-Ms,n>o){if(e.match_start=t,o=n,n>=a)break;f=c[i+o-1],h=c[i+o]}}while((t=u[t&l])>d&&--s!=0);return o<=e.lookahead?o:e.lookahead}function Ta(e){const t=e.w_size;let r,n,s,i,o;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ei)){Pi(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do s=e.head[--r],e.head[r]=s>=t?s-t:0;while(--n);n=t,r=n;do s=e.prev[--r],e.prev[r]=s>=t?s-t:0;while(--n);i+=t}if(e.strm.avail_in===0)break;if(n=HT(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=Vt)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+Vt-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<Vt)););}while(e.lookahead<ei&&e.strm.avail_in!==0)}function _0(e,t){let r,n;for(;;){if(e.lookahead<ei){if(Ta(e),e.lookahead<ei&&t===Ti)return Or;if(e.lookahead===0)break}if(r=0,e.lookahead>=Vt&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-ei&&(e.match_length=Uw(e,r)),e.match_length>=Vt)if(n=xs(e,e.strstart-e.match_start,e.match_length-Vt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Vt){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=xs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&($r(e,!1),e.strm.avail_out===0))return Or}return e.insert=e.strstart<Vt-1?e.strstart:Vt-1,t===Dr?($r(e,!0),e.strm.avail_out===0?ma:ao):e.last_lit&&($r(e,!1),e.strm.avail_out===0)?Or:hl}function La(e,t){let r,n,s;for(;;){if(e.lookahead<ei){if(Ta(e),e.lookahead<ei&&t===Ti)return Or;if(e.lookahead===0)break}if(r=0,e.lookahead>=Vt&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Vt-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-ei&&(e.match_length=Uw(e,r),e.match_length<=5&&(e.strategy===OT||e.match_length===Vt&&e.strstart-e.match_start>4096)&&(e.match_length=Vt-1)),e.prev_length>=Vt&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-Vt,n=xs(e,e.strstart-1-e.prev_match,e.prev_length-Vt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=Vt-1,e.strstart++,n&&($r(e,!1),e.strm.avail_out===0))return Or}else if(e.match_available){if(n=xs(e,0,e.window[e.strstart-1]),n&&$r(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Or}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=xs(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Vt-1?e.strstart:Vt-1,t===Dr?($r(e,!0),e.strm.avail_out===0?ma:ao):e.last_lit&&($r(e,!1),e.strm.avail_out===0)?Or:hl}class oi{constructor(t,r,n,s,i){this.good_length=t,this.max_lazy=r,this.nice_length=n,this.max_chain=s,this.func=i}}const Zu=[new oi(0,0,0,0,function(e,t){let r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Ta(e),e.lookahead===0&&t===Ti)return Or;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;const n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,$r(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-ei&&($r(e,!1),e.strm.avail_out===0))return Or}return e.insert=0,t===Dr?($r(e,!0),e.strm.avail_out===0?ma:ao):(e.strstart>e.block_start&&($r(e,!1),e.strm.avail_out),Or)}),new oi(4,4,8,4,_0),new oi(4,5,16,8,_0),new oi(4,6,32,32,_0),new oi(4,4,16,16,La),new oi(8,16,32,32,La),new oi(8,16,128,128,La),new oi(8,32,128,256,La),new oi(32,128,258,1024,La),new oi(32,258,258,4096,La)];class GT{constructor(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=fo,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new xn(1146),this.dyn_dtree=new xn(122),this.bl_tree=new xn(78),Is(this.dyn_ltree),Is(this.dyn_dtree),Is(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xn(16),this.heap=new xn(573),Is(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xn(573),Is(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}}function zT(e){const t=function(r){let n;return r&&r.state?(r.total_in=r.total_out=0,r.data_type=Pw,n=r.state,n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap?Uf:ga,r.adler=n.wrap===2?0:1,n.last_flush=Ti,LT(n),er):Os(r,Er)}(e);return t===er&&function(r){r.window_size=2*r.w_size,Is(r.head),r.max_lazy_match=Zu[r.level].max_lazy,r.good_match=Zu[r.level].good_length,r.nice_match=Zu[r.level].nice_length,r.max_chain_length=Zu[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=Vt-1,r.match_available=0,r.ins_h=0}(e.state),t}function WT(e,t){let r,n,s,i;if(!e||!e.state||t>_y||t<0)return e?Os(e,Er):Er;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Ju&&t!==Dr)return Os(e,e.avail_out===0?dl:Er);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Uf)if(n.wrap===2)e.adler=0,Jt(n,31),Jt(n,139),Jt(n,8),n.gzhead?(Jt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Jt(n,255&n.gzhead.time),Jt(n,n.gzhead.time>>8&255),Jt(n,n.gzhead.time>>16&255),Jt(n,n.gzhead.time>>24&255),Jt(n,n.level===9?2:n.strategy>=vd||n.level<2?4:0),Jt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Jt(n,255&n.gzhead.extra.length),Jt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=kr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Ey):(Jt(n,0),Jt(n,0),Jt(n,0),Jt(n,0),Jt(n,0),Jt(n,n.level===9?2:n.strategy>=vd||n.level<2?4:0),Jt(n,FT),n.status=ga);else{let a=fo+(n.w_bits-8<<4)<<8,d=-1;d=n.strategy>=vd||n.level<2?0:n.level<6?1:n.level===6?2:3,a|=d<<6,n.strstart!==0&&(a|=VT),a+=31-a%31,n.status=ga,qo(n,a),n.strstart!==0&&(qo(n,e.adler>>>16),qo(n,65535&e.adler)),e.adler=1}if(n.status===Ey)if(n.gzhead.extra){for(s=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>s&&(e.adler=kr(e.adler,n.pending_buf,n.pending-s,s)),ms(e),s=n.pending,n.pending!==n.pending_buf_size));)Jt(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>s&&(e.adler=kr(e.adler,n.pending_buf,n.pending-s,s)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=cf)}else n.status=cf;if(n.status===cf)if(n.gzhead.name){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=kr(e.adler,n.pending_buf,n.pending-s,s)),ms(e),s=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Jt(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>s&&(e.adler=kr(e.adler,n.pending_buf,n.pending-s,s)),i===0&&(n.gzindex=0,n.status=uf)}else n.status=uf;if(n.status===uf)if(n.gzhead.comment){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=kr(e.adler,n.pending_buf,n.pending-s,s)),ms(e),s=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Jt(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>s&&(e.adler=kr(e.adler,n.pending_buf,n.pending-s,s)),i===0&&(n.status=lf)}else n.status=lf;if(n.status===lf&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&ms(e),n.pending+2<=n.pending_buf_size&&(Jt(n,255&e.adler),Jt(n,e.adler>>8&255),e.adler=0,n.status=ga)):n.status=ga),n.pending!==0){if(ms(e),e.avail_out===0)return n.last_flush=-1,er}else if(e.avail_in===0&&Nm(t)<=Nm(r)&&t!==Dr)return Os(e,dl);if(n.status===Ju&&e.avail_in!==0)return Os(e,dl);if(e.avail_in!==0||n.lookahead!==0||t!==Ti&&n.status!==Ju){var o=n.strategy===vd?function(a,d){let c;for(;;){if(a.lookahead===0&&(Ta(a),a.lookahead===0)){if(d===Ti)return Or;break}if(a.match_length=0,c=xs(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&($r(a,!1),a.strm.avail_out===0))return Or}return a.insert=0,d===Dr?($r(a,!0),a.strm.avail_out===0?ma:ao):a.last_lit&&($r(a,!1),a.strm.avail_out===0)?Or:hl}(n,t):n.strategy===NT?function(a,d){let c,l,u,p;const f=a.window;for(;;){if(a.lookahead<=Ms){if(Ta(a),a.lookahead<=Ms&&d===Ti)return Or;if(a.lookahead===0)break}if(a.match_length=0,a.lookahead>=Vt&&a.strstart>0&&(u=a.strstart-1,l=f[u],l===f[++u]&&l===f[++u]&&l===f[++u])){p=a.strstart+Ms;do;while(l===f[++u]&&l===f[++u]&&l===f[++u]&&l===f[++u]&&l===f[++u]&&l===f[++u]&&l===f[++u]&&l===f[++u]&&u<p);a.match_length=Ms-(p-u),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=Vt?(c=xs(a,1,a.match_length-Vt),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=xs(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&($r(a,!1),a.strm.avail_out===0))return Or}return a.insert=0,d===Dr?($r(a,!0),a.strm.avail_out===0?ma:ao):a.last_lit&&($r(a,!1),a.strm.avail_out===0)?Or:hl}(n,t):Zu[n.level].func(n,t);if(o!==ma&&o!==ao||(n.status=Ju),o===Or||o===ma)return e.avail_out===0&&(n.last_flush=-1),er;if(o===hl&&(t===kT?KT(n):t!==_y&&(xw(n,0,0,!1),t===MT&&(Is(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),ms(e),e.avail_out===0))return n.last_flush=-1,er}return t!==Dr?er:n.wrap<=0?Zi:(n.wrap===2?(Jt(n,255&e.adler),Jt(n,e.adler>>8&255),Jt(n,e.adler>>16&255),Jt(n,e.adler>>24&255),Jt(n,255&e.total_in),Jt(n,e.total_in>>8&255),Jt(n,e.total_in>>16&255),Jt(n,e.total_in>>24&255)):(qo(n,e.adler>>>16),qo(n,65535&e.adler)),ms(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?er:Zi)}try{String.fromCharCode.call(null,0)}catch{}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{}const Ay=new vi(256);for(let e=0;e<256;e++)Ay[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;function Sy(e){let t,r,n,s,i=0;const o=e.length;for(n=0;n<o;n++)t=e.charCodeAt(n),(64512&t)==55296&&n+1<o&&(r=e.charCodeAt(n+1),(64512&r)==56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),i+=t<128?1:t<2048?2:t<65536?3:4;const a=new vi(i);for(s=0,n=0;s<i;n++)t=e.charCodeAt(n),(64512&t)==55296&&n+1<o&&(r=e.charCodeAt(n+1),(64512&r)==56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?a[s++]=t:t<2048?(a[s++]=192|t>>>6,a[s++]=128|63&t):t<65536?(a[s++]=224|t>>>12,a[s++]=128|t>>>6&63,a[s++]=128|63&t):(a[s++]=240|t>>>18,a[s++]=128|t>>>12&63,a[s++]=128|t>>>6&63,a[s++]=128|63&t);return a}Ay[254]=Ay[254]=1;class Bw{constructor(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}class Py{constructor(t){this.options={level:_m,method:fo,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,...t||{}};const r=this.options;r.raw&&r.windowBits>0?r.windowBits=-r.windowBits:r.gzip&&r.windowBits>0&&r.windowBits<16&&(r.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Bw,this.strm.avail_out=0;var n,s,i=function(o,a,d,c,l,u){if(!o)return Er;let p=1;if(a===_m&&(a=6),c<0?(p=0,c=-c):c>15&&(p=2,c-=16),l<1||l>$T||d!==fo||c<8||c>15||a<0||a>9||u<0||u>Sw)return Os(o,Er);c===8&&(c=9);const f=new GT;return o.state=f,f.strm=o,f.wrap=p,f.gzhead=null,f.w_bits=c,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=l+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+Vt-1)/Vt),f.window=new vi(2*f.w_size),f.head=new xn(f.hash_size),f.prev=new xn(f.w_size),f.lit_bufsize=1<<l+6,f.pending_buf_size=4*f.lit_bufsize,f.pending_buf=new vi(f.pending_buf_size),f.d_buf=1*f.lit_bufsize,f.l_buf=3*f.lit_bufsize,f.level=a,f.strategy=u,f.method=d,zT(o)}(this.strm,r.level,r.method,r.windowBits,r.memLevel,r.strategy);if(i!==er)throw Error(Cl[i]);if(r.header&&(n=this.strm,s=r.header,n&&n.state&&(n.state.wrap!==2||(n.state.gzhead=s))),r.dictionary){let o;if(o=typeof r.dictionary=="string"?Sy(r.dictionary):r.dictionary instanceof ArrayBuffer?new Uint8Array(r.dictionary):r.dictionary,i=function(a,d){let c,l,u,p,f,h,y,m,b=d.length;if(!a||!a.state||(c=a.state,p=c.wrap,p===2||p===1&&c.status!==Uf||c.lookahead))return Er;for(p===1&&(a.adler=Il(a.adler,d,b,0)),c.wrap=0,b>=c.w_size&&(p===0&&(Is(c.head),c.strstart=0,c.block_start=0,c.insert=0),m=new vi(c.w_size),Pi(m,d,b-c.w_size,c.w_size,0),d=m,b=c.w_size),f=a.avail_in,h=a.next_in,y=a.input,a.avail_in=b,a.next_in=0,a.input=d,Ta(c);c.lookahead>=Vt;){l=c.strstart,u=c.lookahead-(Vt-1);do c.ins_h=(c.ins_h<<c.hash_shift^c.window[l+Vt-1])&c.hash_mask,c.prev[l&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=l,l++;while(--u);c.strstart=l,c.lookahead=Vt-1,Ta(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=Vt-1,c.match_available=0,a.next_in=h,a.input=y,a.avail_in=f,c.wrap=p,er}(this.strm,o),i!==er)throw Error(Cl[i]);this._dict_set=!0}}push(t,r){const{strm:n,options:{chunkSize:s}}=this;var i,o;if(this.ended)return!1;o=r===~~r?r:r===!0?Dr:Ti,typeof t=="string"?n.input=Sy(t):t instanceof ArrayBuffer?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new vi(s),n.next_out=0,n.avail_out=s),(i=WT(n,o))!==Zi&&i!==er)return this.onEnd(i),this.ended=!0,!1;n.avail_out!==0&&(n.avail_in!==0||o!==Dr&&o!==El)||this.onData(vw(n.output,n.next_out))}while((n.avail_in>0||n.avail_out===0)&&i!==Zi);return o===Dr?(i=function(a){let d;return a&&a.state?(d=a.state.status,d!==Uf&&d!==Ey&&d!==cf&&d!==uf&&d!==lf&&d!==ga&&d!==Ju?Os(a,Er):(a.state=null,d===ga?Os(a,m2):er)):Er}(this.strm),this.onEnd(i),this.ended=!0,i===er):o!==El||(this.onEnd(er),n.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===er&&(this.result=Ew(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}const _d=30,YT=12;function JT(e,t){let r,n,s,i,o,a,d,c,l,u;const p=e.state;r=e.next_in;const f=e.input,h=r+(e.avail_in-5);n=e.next_out;const y=e.output,m=n-(t-e.avail_out),b=n+(e.avail_out-257),v=p.dmax,E=p.wsize,_=p.whave,C=p.wnext,k=p.window;s=p.hold,i=p.bits;const D=p.lencode,w=p.distcode,S=(1<<p.lenbits)-1,I=(1<<p.distbits)-1;e:do{i<15&&(s+=f[r++]<<i,i+=8,s+=f[r++]<<i,i+=8),o=D[s&S];t:for(;;){if(a=o>>>24,s>>>=a,i-=a,a=o>>>16&255,a===0)y[n++]=65535&o;else{if(!(16&a)){if(!(64&a)){o=D[(65535&o)+(s&(1<<a)-1)];continue t}if(32&a){p.mode=YT;break e}e.msg="invalid literal/length code",p.mode=_d;break e}d=65535&o,a&=15,a&&(i<a&&(s+=f[r++]<<i,i+=8),d+=s&(1<<a)-1,s>>>=a,i-=a),i<15&&(s+=f[r++]<<i,i+=8,s+=f[r++]<<i,i+=8),o=w[s&I];r:for(;;){if(a=o>>>24,s>>>=a,i-=a,a=o>>>16&255,!(16&a)){if(!(64&a)){o=w[(65535&o)+(s&(1<<a)-1)];continue r}e.msg="invalid distance code",p.mode=_d;break e}if(c=65535&o,a&=15,i<a&&(s+=f[r++]<<i,i+=8,i<a&&(s+=f[r++]<<i,i+=8)),c+=s&(1<<a)-1,c>v){e.msg="invalid distance too far back",p.mode=_d;break e}if(s>>>=a,i-=a,a=n-m,c>a){if(a=c-a,a>_&&p.sane){e.msg="invalid distance too far back",p.mode=_d;break e}if(l=0,u=k,C===0){if(l+=E-a,a<d){d-=a;do y[n++]=k[l++];while(--a);l=n-c,u=y}}else if(C<a){if(l+=E+C-a,a-=C,a<d){d-=a;do y[n++]=k[l++];while(--a);if(l=0,C<d){a=C,d-=a;do y[n++]=k[l++];while(--a);l=n-c,u=y}}}else if(l+=C-a,a<d){d-=a;do y[n++]=k[l++];while(--a);l=n-c,u=y}for(;d>2;)y[n++]=u[l++],y[n++]=u[l++],y[n++]=u[l++],d-=3;d&&(y[n++]=u[l++],d>1&&(y[n++]=u[l++]))}else{l=n-c;do y[n++]=y[l++],y[n++]=y[l++],y[n++]=y[l++],d-=3;while(d>2);d&&(y[n++]=y[l++],d>1&&(y[n++]=y[l++]))}break}}break}}while(r<h&&n<b);d=i>>3,r-=d,i-=d<<3,s&=(1<<i)-1,e.next_in=r,e.next_out=n,e.avail_in=r<h?h-r+5:5-(r-h),e.avail_out=n<b?b-n+257:257-(n-b),p.hold=s,p.bits=i}const Ka=15,Dm=852,xm=592,Um=0,w0=1,Bm=2,ZT=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],XT=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],QT=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],eI=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function pl(e,t,r,n,s,i,o,a){const d=a.bits;let c,l,u,p,f,h=0,y=0,m=0,b=0,v=0,E=0,_=0,C=0,k=0,D=0,w=null,S=0;const I=new xn(Ka+1),T=new xn(Ka+1);let g,A,P,O=null,N=0;for(h=0;h<=Ka;h++)I[h]=0;for(y=0;y<n;y++)I[t[r+y]]++;for(v=d,b=Ka;b>=1&&I[b]===0;b--);if(v>b&&(v=b),b===0)return s[i++]=20971520,s[i++]=20971520,a.bits=1,0;for(m=1;m<b&&I[m]===0;m++);for(v<m&&(v=m),C=1,h=1;h<=Ka;h++)if(C<<=1,C-=I[h],C<0)return-1;if(C>0&&(e===Um||b!==1))return-1;for(T[1]=0,h=1;h<Ka;h++)T[h+1]=T[h]+I[h];for(y=0;y<n;y++)t[r+y]!==0&&(o[T[t[r+y]]++]=y);e===Um?(w=O=o,f=19):e===w0?(w=ZT,S-=257,O=XT,N-=257,f=256):(w=QT,O=eI,f=-1),D=0,y=0,h=m,p=i,E=v,_=0,u=-1,k=1<<v;const M=k-1;if(e===w0&&k>Dm||e===Bm&&k>xm)return 1;for(;;){g=h-_,o[y]<f?(A=0,P=o[y]):o[y]>f?(A=O[N+o[y]],P=w[S+o[y]]):(A=96,P=0),c=1<<h-_,l=1<<E,m=l;do l-=c,s[p+(D>>_)+l]=g<<24|A<<16|P|0;while(l!==0);for(c=1<<h-1;D&c;)c>>=1;if(c!==0?(D&=c-1,D+=c):D=0,y++,--I[h]==0){if(h===b)break;h=t[r+o[y]]}if(h>v&&(D&M)!==u){for(_===0&&(_=v),p+=m,E=h-_,C=1<<E;E+_<b&&(C-=I[E+_],!(C<=0));)E++,C<<=1;if(k+=1<<E,e===w0&&k>Dm||e===Bm&&k>xm)return 1;u=D&M,s[u]=v<<24|E<<16|p-i|0}}return D!==0&&(s[p+D]=h-_<<24|64<<16|0),a.bits=v,0}const tI=0,Lw=1,Kw=2,qw=1,Lm=2,Km=3,qm=4,jm=5,$m=6,Vm=7,Fm=8,Hm=9,Gm=10,Bf=11,Bi=12,E0=13,zm=14,A0=15,Wm=16,Ym=17,Jm=18,Zm=19,wd=20,Ed=21,Xm=22,Qm=23,e3=24,t3=25,r3=26,S0=27,n3=28,i3=29,lr=30,rI=852,nI=592;function s3(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}class iI{constructor(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new xn(320),this.work=new xn(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}}function sI(e){let t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,function(r){let n;return r&&r.state?(n=r.state,r.total_in=r.total_out=n.total=0,r.msg="",n.wrap&&(r.adler=1&n.wrap),n.mode=qw,n.last=0,n.havedict=0,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Df(rI),n.distcode=n.distdyn=new Df(nI),n.sane=1,n.back=-1,er):Er}(e)):Er}function aI(e,t){let r,n;return e?(n=new iI,e.state=n,n.window=null,r=function(s,i){let o,a;return s&&s.state?(a=s.state,i<0?(o=0,i=-i):(o=1+(i>>4),i<48&&(i&=15)),i&&(i<8||i>15)?Er:(a.window!==null&&a.wbits!==i&&(a.window=null),a.wrap=o,a.wbits=i,sI(s))):Er}(e,t),r!==er&&(e.state=null),r):Er}let P0,T0,a3=!0;function oI(e){if(a3){let t;for(P0=new Df(512),T0=new Df(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(pl(Lw,e.lens,0,288,P0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pl(Kw,e.lens,0,32,T0,0,e.work,{bits:5}),a3=!1}e.lencode=P0,e.lenbits=9,e.distcode=T0,e.distbits=5}function jw(e,t,r,n){let s;const i=e.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new vi(i.wsize)),n>=i.wsize?(Pi(i.window,t,r-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),Pi(i.window,t,r-n,s,i.wnext),(n-=s)?(Pi(i.window,t,r-n,n,0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=s))),0}function cI(e,t){let r,n,s,i,o,a,d,c,l,u,p,f,h,y,m,b,v,E,_,C,k,D,w,S,I=0,T=new vi(4);const g=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Er;r=e.state,r.mode===Bi&&(r.mode=E0),o=e.next_out,s=e.output,d=e.avail_out,i=e.next_in,n=e.input,a=e.avail_in,c=r.hold,l=r.bits,u=a,p=d,D=er;e:for(;;)switch(r.mode){case qw:if(r.wrap===0){r.mode=E0;break}for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(2&r.wrap&&c===35615){r.check=0,T[0]=255&c,T[1]=c>>>8&255,r.check=kr(r.check,T,2,0),c=0,l=0,r.mode=Lm;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=lr;break}if((15&c)!==fo){e.msg="unknown compression method",r.mode=lr;break}if(c>>>=4,l-=4,k=8+(15&c),r.wbits===0)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=lr;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=512&c?Gm:Bi,c=0,l=0;break;case Lm:for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(r.flags=c,(255&r.flags)!==fo){e.msg="unknown compression method",r.mode=lr;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=lr;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(T[0]=255&c,T[1]=c>>>8&255,r.check=kr(r.check,T,2,0)),c=0,l=0,r.mode=Km;case Km:for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.head&&(r.head.time=c),512&r.flags&&(T[0]=255&c,T[1]=c>>>8&255,T[2]=c>>>16&255,T[3]=c>>>24&255,r.check=kr(r.check,T,4,0)),c=0,l=0,r.mode=qm;case qm:for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(T[0]=255&c,T[1]=c>>>8&255,r.check=kr(r.check,T,2,0)),c=0,l=0,r.mode=jm;case jm:if(1024&r.flags){for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(T[0]=255&c,T[1]=c>>>8&255,r.check=kr(r.check,T,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=$m;case $m:if(1024&r.flags&&(f=r.length,f>a&&(f=a),f&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=Array(r.head.extra_len)),Pi(r.head.extra,n,i,f,k)),512&r.flags&&(r.check=kr(r.check,n,f,i)),a-=f,i+=f,r.length-=f),r.length))break e;r.length=0,r.mode=Vm;case Vm:if(2048&r.flags){if(a===0)break e;f=0;do k=n[i+f++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k));while(k&&f<a);if(512&r.flags&&(r.check=kr(r.check,n,f,i)),a-=f,i+=f,k)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Fm;case Fm:if(4096&r.flags){if(a===0)break e;f=0;do k=n[i+f++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k));while(k&&f<a);if(512&r.flags&&(r.check=kr(r.check,n,f,i)),a-=f,i+=f,k)break e}else r.head&&(r.head.comment=null);r.mode=Hm;case Hm:if(512&r.flags){for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=lr;break}c=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Bi;break;case Gm:for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}e.adler=r.check=s3(c),c=0,l=0,r.mode=Bf;case Bf:if(r.havedict===0)return e.next_out=o,e.avail_out=d,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,Aw;e.adler=r.check=1,r.mode=Bi;case Bi:if(t===_y||t===bd)break e;case E0:if(r.last){c>>>=7&l,l-=7&l,r.mode=S0;break}for(;l<3;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}switch(r.last=1&c,c>>>=1,l-=1,3&c){case 0:r.mode=zm;break;case 1:if(oI(r),r.mode=wd,t===bd){c>>>=2,l-=2;break e}break;case 2:r.mode=Ym;break;case 3:e.msg="invalid block type",r.mode=lr}c>>>=2,l-=2;break;case zm:for(c>>>=7&l,l-=7&l;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=lr;break}if(r.length=65535&c,c=0,l=0,r.mode=A0,t===bd)break e;case A0:r.mode=Wm;case Wm:if(f=r.length,f){if(f>a&&(f=a),f>d&&(f=d),f===0)break e;Pi(s,n,i,f,o),a-=f,i+=f,d-=f,o+=f,r.length-=f;break}r.mode=Bi;break;case Ym:for(;l<14;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(r.nlen=257+(31&c),c>>>=5,l-=5,r.ndist=1+(31&c),c>>>=5,l-=5,r.ncode=4+(15&c),c>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=lr;break}r.have=0,r.mode=Jm;case Jm:for(;r.have<r.ncode;){for(;l<3;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.lens[g[r.have++]]=7&c,c>>>=3,l-=3}for(;r.have<19;)r.lens[g[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,w={bits:r.lenbits},D=pl(tI,r.lens,0,19,r.lencode,0,r.work,w),r.lenbits=w.bits,D){e.msg="invalid code lengths set",r.mode=lr;break}r.have=0,r.mode=Zm;case Zm:for(;r.have<r.nlen+r.ndist;){for(;I=r.lencode[c&(1<<r.lenbits)-1],m=I>>>24,b=I>>>16&255,v=65535&I,!(m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(v<16)c>>>=m,l-=m,r.lens[r.have++]=v;else{if(v===16){for(S=m+2;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c>>>=m,l-=m,r.have===0){e.msg="invalid bit length repeat",r.mode=lr;break}k=r.lens[r.have-1],f=3+(3&c),c>>>=2,l-=2}else if(v===17){for(S=m+3;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=m,l-=m,k=0,f=3+(7&c),c>>>=3,l-=3}else{for(S=m+7;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=m,l-=m,k=0,f=11+(127&c),c>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=lr;break}for(;f--;)r.lens[r.have++]=k}}if(r.mode===lr)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=lr;break}if(r.lenbits=9,w={bits:r.lenbits},D=pl(Lw,r.lens,0,r.nlen,r.lencode,0,r.work,w),r.lenbits=w.bits,D){e.msg="invalid literal/lengths set",r.mode=lr;break}if(r.distbits=6,r.distcode=r.distdyn,w={bits:r.distbits},D=pl(Kw,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,w),r.distbits=w.bits,D){e.msg="invalid distances set",r.mode=lr;break}if(r.mode=wd,t===bd)break e;case wd:r.mode=Ed;case Ed:if(a>=6&&d>=258){e.next_out=o,e.avail_out=d,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,JT(e,p),o=e.next_out,s=e.output,d=e.avail_out,i=e.next_in,n=e.input,a=e.avail_in,c=r.hold,l=r.bits,r.mode===Bi&&(r.back=-1);break}for(r.back=0;I=r.lencode[c&(1<<r.lenbits)-1],m=I>>>24,b=I>>>16&255,v=65535&I,!(m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(b&&!(240&b)){for(E=m,_=b,C=v;I=r.lencode[C+((c&(1<<E+_)-1)>>E)],m=I>>>24,b=I>>>16&255,v=65535&I,!(E+m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=E,l-=E,r.back+=E}if(c>>>=m,l-=m,r.back+=m,r.length=v,b===0){r.mode=r3;break}if(32&b){r.back=-1,r.mode=Bi;break}if(64&b){e.msg="invalid literal/length code",r.mode=lr;break}r.extra=15&b,r.mode=Xm;case Xm:if(r.extra){for(S=r.extra;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Qm;case Qm:for(;I=r.distcode[c&(1<<r.distbits)-1],m=I>>>24,b=I>>>16&255,v=65535&I,!(m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(!(240&b)){for(E=m,_=b,C=v;I=r.distcode[C+((c&(1<<E+_)-1)>>E)],m=I>>>24,b=I>>>16&255,v=65535&I,!(E+m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=E,l-=E,r.back+=E}if(c>>>=m,l-=m,r.back+=m,64&b){e.msg="invalid distance code",r.mode=lr;break}r.offset=v,r.extra=15&b,r.mode=e3;case e3:if(r.extra){for(S=r.extra;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=lr;break}r.mode=t3;case t3:if(d===0)break e;if(f=p-d,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=lr;break}f>r.wnext?(f-=r.wnext,h=r.wsize-f):h=r.wnext-f,f>r.length&&(f=r.length),y=r.window}else y=s,h=o-r.offset,f=r.length;f>d&&(f=d),d-=f,r.length-=f;do s[o++]=y[h++];while(--f);r.length===0&&(r.mode=Ed);break;case r3:if(d===0)break e;s[o++]=r.length,d--,r.mode=Ed;break;case S0:if(r.wrap){for(;l<32;){if(a===0)break e;a--,c|=n[i++]<<l,l+=8}if(p-=d,e.total_out+=p,r.total+=p,p&&(e.adler=r.check=r.flags?kr(r.check,s,p,o-p):Il(r.check,s,p,o-p)),p=d,(r.flags?c:s3(c))!==r.check){e.msg="incorrect data check",r.mode=lr;break}c=0,l=0}r.mode=n3;case n3:if(r.wrap&&r.flags){for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=lr;break}c=0,l=0}r.mode=i3;case i3:D=Zi;break e;case lr:D=m2;break e;default:return Er}return e.next_out=o,e.avail_out=d,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,(r.wsize||p!==e.avail_out&&r.mode<lr&&(r.mode<S0||t!==Dr))&&jw(e,e.output,e.next_out,p-e.avail_out),u-=e.avail_in,p-=e.avail_out,e.total_in+=u,e.total_out+=p,r.total+=p,r.wrap&&p&&(e.adler=r.check=r.flags?kr(r.check,s,p,e.next_out-p):Il(r.check,s,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Bi?128:0)+(r.mode===wd||r.mode===A0?256:0),(u===0&&p===0||t===Dr)&&D===er&&(D=dl),D}function o3(e,t){const r=t.length;let n,s;return e&&e.state?(n=e.state,n.wrap!==0&&n.mode!==Bf?Er:n.mode===Bf&&(s=1,s=Il(s,t,r,0),s!==n.check)?m2:(jw(e,t,r,r),n.havedict=1,er)):Er}class uI{constructor(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}}class c3{constructor(t){this.options={chunkSize:16384,windowBits:0,...t||{}};const r=this.options;r.raw&&r.windowBits>=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),!(r.windowBits>=0&&r.windowBits<16)||t&&t.windowBits||(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&!(15&r.windowBits)&&(r.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Bw,this.strm.avail_out=0;let n=aI(this.strm,r.windowBits);if(n!==er||(this.header=new uI,function(s,i){let o;s&&s.state&&(o=s.state,!(2&o.wrap)||(o.head=i,i.done=!1))}(this.strm,this.header),r.dictionary&&(typeof r.dictionary=="string"?r.dictionary=Sy(r.dictionary):r.dictionary instanceof ArrayBuffer&&(r.dictionary=new Uint8Array(r.dictionary)),r.raw&&(n=o3(this.strm,r.dictionary),n!==er))))throw Error(Cl[n])}push(t,r){const{strm:n,options:{chunkSize:s,dictionary:i}}=this;let o,a,d=!1;if(this.ended)return!1;a=r===~~r?r:r===!0?Dr:Ti,typeof t=="string"?n.input=function(c){const l=new vi(c.length);for(let u=0,p=l.length;u<p;u++)l[u]=c.charCodeAt(u);return l}(t):t instanceof ArrayBuffer?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new vi(s),n.next_out=0,n.avail_out=s),o=cI(n,Ti),o===Aw&&i&&(o=o3(this.strm,i)),o===dl&&d===!0&&(o=er,d=!1),o!==Zi&&o!==er)return this.onEnd(o),this.ended=!0,!1;n.next_out&&(n.avail_out!==0&&o!==Zi&&(n.avail_in!==0||a!==Dr&&a!==El)||this.onData(vw(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(d=!0)}while((n.avail_in>0||n.avail_out===0)&&o!==Zi);return o===Zi&&(a=Dr),a===Dr?(o=function(c){if(!c||!c.state)return Er;const l=c.state;return l.window&&(l.window=null),c.state=null,er}(this.strm),this.onEnd(o),this.ended=!0,o===er):a!==El||(this.onEnd(er),n.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===er&&(this.result=Ew(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}var u3=[0,1,3,7,15,31,63,127,255],Xu=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};Xu.prototype._ensureByte=function(){this.hasByte||(this.curByte=this.stream.readByte(),this.hasByte=!0)},Xu.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=u3[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var n=r-e;t|=(this.curByte&u3[e]<<n)>>n,this.bitOffset+=e,e=0}}return t},Xu.prototype.seek=function(e){var t=e%8,r=(e-t)/8;this.bitOffset=t,this.stream.seek(r),this.hasByte=!1},Xu.prototype.pi=function(){var e,t=new Uint8Array(6);for(e=0;e<t.length;e++)t[e]=this.read(8);return function(r){return Array.prototype.map.call(r,n=>("00"+n.toString(16)).slice(-2)).join("")}(t)};var lI=Xu,ca=function(){};ca.prototype.readByte=function(){throw Error("abstract method readByte() not implemented")},ca.prototype.read=function(e,t,r){for(var n=0;n<r;){var s=this.readByte();if(s<0)return n===0?-1:n;e[t++]=s,n++}return n},ca.prototype.seek=function(e){throw Error("abstract method seek() not implemented")},ca.prototype.writeByte=function(e){throw Error("abstract method readByte() not implemented")},ca.prototype.write=function(e,t,r){var n;for(n=0;n<r;n++)this.writeByte(e[t++]);return r},ca.prototype.flush=function(){};var I0,$w=ca,dI=(I0=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]),function(){var e=4294967295;this.getCRC=function(){return~e>>>0},this.updateCRC=function(t){e=e<<8^I0[255&(e>>>24^t)]},this.updateCRCRun=function(t,r){for(;r-- >0;)e=e<<8^I0[255&(e>>>24^t)]}}),l3=function(e,t){var r,n=e[t];for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},fr={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},bs={};bs[fr.LAST_BLOCK]="Bad file checksum",bs[fr.NOT_BZIP_DATA]="Not bzip data",bs[fr.UNEXPECTED_INPUT_EOF]="Unexpected input EOF",bs[fr.UNEXPECTED_OUTPUT_EOF]="Unexpected output EOF",bs[fr.DATA_ERROR]="Data error",bs[fr.OUT_OF_MEMORY]="Out of memory",bs[fr.OBSOLETE_INPUT]="Obsolete (pre 0.9.5) bzip format not supported.";var qr=function(e,t){var r=bs[e]||"unknown error";t&&(r+=": "+t);var n=new TypeError(r);throw n.errorCode=e,n},Qu=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};Qu.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new dI,!0):(this.writeCount=-1,!1)},Qu.prototype._start_bunzip=function(e,t){var r=new Uint8Array(4);e.read(r,0,4)===4&&String.fromCharCode(r[0],r[1],r[2])==="BZh"||qr(fr.NOT_BZIP_DATA,"bad magic");var n=r[3]-48;(n<1||n>9)&&qr(fr.NOT_BZIP_DATA,"level out of range"),this.reader=new lI(e),this.dbufSize=1e5*n,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},Qu.prototype._get_next_block=function(){var e,t,r,n=this.reader,s=n.pi();if(s==="177245385090")return!1;s!=="314159265359"&&qr(fr.NOT_BZIP_DATA),this.targetBlockCRC=n.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,n.read(1)&&qr(fr.OBSOLETE_INPUT);var i=n.read(24);i>this.dbufSize&&qr(fr.DATA_ERROR,"initial position out of bounds");var o=n.read(16),a=new Uint8Array(256),d=0;for(e=0;e<16;e++)if(o&1<<15-e){var c=16*e;for(r=n.read(16),t=0;t<16;t++)r&1<<15-t&&(a[d++]=c+t)}var l=n.read(3);(l<2||l>6)&&qr(fr.DATA_ERROR);var u=n.read(15);u===0&&qr(fr.DATA_ERROR);var p=new Uint8Array(256);for(e=0;e<l;e++)p[e]=e;var f=new Uint8Array(u);for(e=0;e<u;e++){for(t=0;n.read(1);t++)t>=l&&qr(fr.DATA_ERROR);f[e]=l3(p,t)}var h,y=d+2,m=[];for(t=0;t<l;t++){var b,v,E=new Uint8Array(y),_=new Uint16Array(21);for(o=n.read(5),e=0;e<y;e++){for(;(o<1||o>20)&&qr(fr.DATA_ERROR),n.read(1);)n.read(1)?o--:o++;E[e]=o}for(b=v=E[0],e=1;e<y;e++)E[e]>v?v=E[e]:E[e]<b&&(b=E[e]);h={},m.push(h),h.permute=new Uint16Array(258),h.limit=new Uint32Array(22),h.base=new Uint32Array(21),h.minLen=b,h.maxLen=v;var C=0;for(e=b;e<=v;e++)for(_[e]=h.limit[e]=0,o=0;o<y;o++)E[o]===e&&(h.permute[C++]=o);for(e=0;e<y;e++)_[E[e]]++;for(C=o=0,e=b;e<v;e++)C+=_[e],h.limit[e]=C-1,C<<=1,o+=_[e],h.base[e+1]=C-o;h.limit[v+1]=Number.MAX_VALUE,h.limit[v]=C+_[v]-1,h.base[b]=0}var k=new Uint32Array(256);for(e=0;e<256;e++)p[e]=e;var D,w=0,S=0,I=0,T=this.dbuf=new Uint32Array(this.dbufSize);for(y=0;;){for(y--||(y=49,I>=u&&qr(fr.DATA_ERROR),h=m[f[I++]]),e=h.minLen,t=n.read(e);e>h.maxLen&&qr(fr.DATA_ERROR),!(t<=h.limit[e]);e++)t=t<<1|n.read(1);((t-=h.base[e])<0||t>=258)&&qr(fr.DATA_ERROR);var g=h.permute[t];if(g!==0&&g!==1){if(w)for(w=0,S+o>this.dbufSize&&qr(fr.DATA_ERROR),k[D=a[p[0]]]+=o;o--;)T[S++]=D;if(g>d)break;S>=this.dbufSize&&qr(fr.DATA_ERROR),k[D=a[D=l3(p,e=g-1)]]++,T[S++]=D}else w||(w=1,o=0),o+=g===0?w:2*w,w<<=1}for((i<0||i>=S)&&qr(fr.DATA_ERROR),t=0,e=0;e<256;e++)r=t+k[e],k[e]=t,t=r;for(e=0;e<S;e++)T[k[D=255&T[e]]]|=e<<8,k[D]++;var A=0,P=0,O=0;return S&&(P=255&(A=T[i]),A>>=8,O=-1),this.writePos=A,this.writeCurrent=P,this.writeCount=S,this.writeRun=O,!0},Qu.prototype._read_bunzip=function(e,t){var r,n,s;if(this.writeCount<0)return 0;var i=this.dbuf,o=this.writePos,a=this.writeCurrent,d=this.writeCount;this.outputsize;for(var c=this.writeRun;d;){for(d--,n=a,a=255&(o=i[o]),o>>=8,c++==3?(r=a,s=n,a=-1):(r=1,s=a),this.blockCRC.updateCRCRun(s,r);r--;)this.outputStream.writeByte(s),this.nextoutput++;a!=n&&(c=0)}return this.writeCount=d,this.blockCRC.getCRC()!==this.targetBlockCRC&&qr(fr.DATA_ERROR,"Bad block CRC (got "+this.blockCRC.getCRC().toString(16)+" expected "+this.targetBlockCRC.toString(16)+")"),this.nextoutput};var fI=function(e){if("readByte"in e)return e;var t=new $w;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(r){this.pos=r},t.eof=function(){return this.pos>=e.length},t},hI=function(e){var t=new $w,r=!0;if(e)if(typeof e=="number")t.buffer=new Uint8Array(e),r=!1;else{if("writeByte"in e)return e;t.buffer=e,r=!1}else t.buffer=new Uint8Array(16384);return t.pos=0,t.writeByte=function(n){if(r&&this.pos>=this.buffer.length){var s=new Uint8Array(2*this.buffer.length);s.set(this.buffer),this.buffer=s}this.buffer[this.pos++]=n},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!r)throw new TypeError("outputsize does not match decoded input");var n=new Uint8Array(this.pos);n.set(this.buffer.subarray(0,this.pos)),this.buffer=n}return this.buffer},t._coerced=!0,t},d3=function(e,t,r){for(var n=fI(e),s=hI(t),i=new Qu(n,s);!("eof"in n)||!n.eof();)if(i._init_block())i._read_bunzip();else{var o=i.reader.read(32)>>>0;if(o!==i.streamCRC&&qr(fr.DATA_ERROR,"Bad stream CRC (got "+i.streamCRC.toString(16)+" expected "+o.toString(16)+")"),!r||!("eof"in n)||n.eof())break;i._start_bunzip(n,s)}if("getBuffer"in s)return s.getBuffer()};class ss{static get tag(){return H.packet.literalData}constructor(t=new Date){this.format=H.literal.utf8,this.date=te.normalizeDate(t),this.text=null,this.data=null,this.filename=""}setText(t,r=H.literal.utf8){this.format=r,this.text=t,this.data=null}getText(t=!1){return(this.text===null||te.isStream(this.text))&&(this.text=te.decodeUTF8(te.nativeEOL(this.getBytes(t)))),this.text}setBytes(t,r){this.format=r,this.data=t,this.text=null}getBytes(t=!1){return this.data===null&&(this.data=te.canonicalizeEOL(te.encodeUTF8(this.text))),t?no(this.data):this.data}setFilename(t){this.filename=t}getFilename(){return this.filename}async read(t){await fh(t,async r=>{const n=await r.readByte(),s=await r.readByte();this.filename=te.decodeUTF8(await r.readBytes(s)),this.date=te.readDate(await r.readBytes(4));let i=r.remainder();_r(i)&&(i=await vr(i)),this.setBytes(i,n)})}writeHeader(){const t=te.encodeUTF8(this.filename),r=new Uint8Array([t.length]),n=new Uint8Array([this.format]),s=te.writeDate(this.date);return te.concatUint8Array([n,r,t,s])}write(){const t=this.writeHeader(),r=this.getBytes();return te.concat([t,r])}}const jo=Symbol("verified"),pI=new Set([H.signatureSubpacket.issuer,H.signatureSubpacket.issuerFingerprint,H.signatureSubpacket.embeddedSignature]);class xr{static get tag(){return H.packet.signature}constructor(){this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.signatureData=null,this.unhashedSubpackets=[],this.signedHashValue=null,this.created=null,this.signatureExpirationTime=null,this.signatureNeverExpires=!0,this.exportable=null,this.trustLevel=null,this.trustAmount=null,this.regularExpression=null,this.revocable=null,this.keyExpirationTime=null,this.keyNeverExpires=null,this.preferredSymmetricAlgorithms=null,this.revocationKeyClass=null,this.revocationKeyAlgorithm=null,this.revocationKeyFingerprint=null,this.issuerKeyID=new Ls,this.rawNotations=[],this.notations={},this.preferredHashAlgorithms=null,this.preferredCompressionAlgorithms=null,this.keyServerPreferences=null,this.preferredKeyServer=null,this.isPrimaryUserID=null,this.policyURI=null,this.keyFlags=null,this.signersUserID=null,this.reasonForRevocationFlag=null,this.reasonForRevocationString=null,this.features=null,this.signatureTargetPublicKeyAlgorithm=null,this.signatureTargetHashAlgorithm=null,this.signatureTargetHash=null,this.embeddedSignature=null,this.issuerKeyVersion=null,this.issuerFingerprint=null,this.preferredAEADAlgorithms=null,this.revoked=null,this[jo]=null}read(t){let r=0;if(this.version=t[r++],this.version!==4&&this.version!==5)throw new hr(`Version ${this.version} of the signature packet is unsupported.`);if(this.signatureType=t[r++],this.publicKeyAlgorithm=t[r++],this.hashAlgorithm=t[r++],r+=this.readSubPackets(t.subarray(r,t.length),!0),!this.created)throw Error("Missing signature creation time subpacket.");this.signatureData=t.subarray(0,r),r+=this.readSubPackets(t.subarray(r,t.length),!1),this.signedHashValue=t.subarray(r,r+2),r+=2,this.params=yt.signature.parseSignatureParams(this.publicKeyAlgorithm,t.subarray(r,t.length))}writeParams(){return this.params instanceof Promise?cs(async()=>yt.serializeParams(this.publicKeyAlgorithm,await this.params)):yt.serializeParams(this.publicKeyAlgorithm,this.params)}write(){const t=[];return t.push(this.signatureData),t.push(this.writeUnhashedSubPackets()),t.push(this.signedHashValue),t.push(this.writeParams()),te.concat(t)}async sign(t,r,n=new Date,s=!1){t.version===5?this.version=5:this.version=4;const i=[new Uint8Array([this.version,this.signatureType,this.publicKeyAlgorithm,this.hashAlgorithm])];this.created=te.normalizeDate(n),this.issuerKeyVersion=t.version,this.issuerFingerprint=t.getFingerprintBytes(),this.issuerKeyID=t.getKeyID(),i.push(this.writeHashedSubPackets()),this.unhashedSubpackets=[],this.signatureData=te.concat(i);const o=this.toHash(this.signatureType,r,s),a=await this.hash(this.signatureType,r,o,s);this.signedHashValue=Vr(Pa(a),0,2);const d=async()=>yt.signature.sign(this.publicKeyAlgorithm,this.hashAlgorithm,t.publicParams,t.privateParams,o,await vr(a));te.isStream(a)?this.params=d():(this.params=await d(),this[jo]=!0)}writeHashedSubPackets(){const t=H.signatureSubpacket,r=[];let n;if(this.created===null)throw Error("Missing signature creation time");r.push(sr(t.signatureCreationTime,!0,te.writeDate(this.created))),this.signatureExpirationTime!==null&&r.push(sr(t.signatureExpirationTime,!0,te.writeNumber(this.signatureExpirationTime,4))),this.exportable!==null&&r.push(sr(t.exportableCertification,!0,new Uint8Array([this.exportable?1:0]))),this.trustLevel!==null&&(n=new Uint8Array([this.trustLevel,this.trustAmount]),r.push(sr(t.trustSignature,!0,n))),this.regularExpression!==null&&r.push(sr(t.regularExpression,!0,this.regularExpression)),this.revocable!==null&&r.push(sr(t.revocable,!0,new Uint8Array([this.revocable?1:0]))),this.keyExpirationTime!==null&&r.push(sr(t.keyExpirationTime,!0,te.writeNumber(this.keyExpirationTime,4))),this.preferredSymmetricAlgorithms!==null&&(n=te.stringToUint8Array(te.uint8ArrayToString(this.preferredSymmetricAlgorithms)),r.push(sr(t.preferredSymmetricAlgorithms,!1,n))),this.revocationKeyClass!==null&&(n=new Uint8Array([this.revocationKeyClass,this.revocationKeyAlgorithm]),n=te.concat([n,this.revocationKeyFingerprint]),r.push(sr(t.revocationKey,!1,n))),this.issuerKeyID.isNull()||this.issuerKeyVersion===5||r.push(sr(t.issuer,!0,this.issuerKeyID.write())),this.rawNotations.forEach(({name:o,value:a,humanReadable:d,critical:c})=>{n=[new Uint8Array([d?128:0,0,0,0])];const l=te.encodeUTF8(o);n.push(te.writeNumber(l.length,2)),n.push(te.writeNumber(a.length,2)),n.push(l),n.push(a),n=te.concat(n),r.push(sr(t.notationData,c,n))}),this.preferredHashAlgorithms!==null&&(n=te.stringToUint8Array(te.uint8ArrayToString(this.preferredHashAlgorithms)),r.push(sr(t.preferredHashAlgorithms,!1,n))),this.preferredCompressionAlgorithms!==null&&(n=te.stringToUint8Array(te.uint8ArrayToString(this.preferredCompressionAlgorithms)),r.push(sr(t.preferredCompressionAlgorithms,!1,n))),this.keyServerPreferences!==null&&(n=te.stringToUint8Array(te.uint8ArrayToString(this.keyServerPreferences)),r.push(sr(t.keyServerPreferences,!1,n))),this.preferredKeyServer!==null&&r.push(sr(t.preferredKeyServer,!1,te.encodeUTF8(this.preferredKeyServer))),this.isPrimaryUserID!==null&&r.push(sr(t.primaryUserID,!1,new Uint8Array([this.isPrimaryUserID?1:0]))),this.policyURI!==null&&r.push(sr(t.policyURI,!1,te.encodeUTF8(this.policyURI))),this.keyFlags!==null&&(n=te.stringToUint8Array(te.uint8ArrayToString(this.keyFlags)),r.push(sr(t.keyFlags,!0,n))),this.signersUserID!==null&&r.push(sr(t.signersUserID,!1,te.encodeUTF8(this.signersUserID))),this.reasonForRevocationFlag!==null&&(n=te.stringToUint8Array(String.fromCharCode(this.reasonForRevocationFlag)+this.reasonForRevocationString),r.push(sr(t.reasonForRevocation,!0,n))),this.features!==null&&(n=te.stringToUint8Array(te.uint8ArrayToString(this.features)),r.push(sr(t.features,!1,n))),this.signatureTargetPublicKeyAlgorithm!==null&&(n=[new Uint8Array([this.signatureTargetPublicKeyAlgorithm,this.signatureTargetHashAlgorithm])],n.push(te.stringToUint8Array(this.signatureTargetHash)),n=te.concat(n),r.push(sr(t.signatureTarget,!0,n))),this.embeddedSignature!==null&&r.push(sr(t.embeddedSignature,!0,this.embeddedSignature.write())),this.issuerFingerprint!==null&&(n=[new Uint8Array([this.issuerKeyVersion]),this.issuerFingerprint],n=te.concat(n),r.push(sr(t.issuerFingerprint,this.version===5,n))),this.preferredAEADAlgorithms!==null&&(n=te.stringToUint8Array(te.uint8ArrayToString(this.preferredAEADAlgorithms)),r.push(sr(t.preferredAEADAlgorithms,!1,n)));const s=te.concat(r),i=te.writeNumber(s.length,2);return te.concat([i,s])}writeUnhashedSubPackets(){const t=[];this.unhashedSubpackets.forEach(s=>{t.push($l(s.length)),t.push(s)});const r=te.concat(t),n=te.writeNumber(r.length,2);return te.concat([n,r])}readSubPacket(t,r=!0){let n=0;const s=!!(128&t[n]),i=127&t[n];if(r||(this.unhashedSubpackets.push(t.subarray(n,t.length)),pI.has(i)))switch(n++,i){case H.signatureSubpacket.signatureCreationTime:this.created=te.readDate(t.subarray(n,t.length));break;case H.signatureSubpacket.signatureExpirationTime:{const o=te.readNumber(t.subarray(n,t.length));this.signatureNeverExpires=o===0,this.signatureExpirationTime=o;break}case H.signatureSubpacket.exportableCertification:this.exportable=t[n++]===1;break;case H.signatureSubpacket.trustSignature:this.trustLevel=t[n++],this.trustAmount=t[n++];break;case H.signatureSubpacket.regularExpression:this.regularExpression=t[n];break;case H.signatureSubpacket.revocable:this.revocable=t[n++]===1;break;case H.signatureSubpacket.keyExpirationTime:{const o=te.readNumber(t.subarray(n,t.length));this.keyExpirationTime=o,this.keyNeverExpires=o===0;break}case H.signatureSubpacket.preferredSymmetricAlgorithms:this.preferredSymmetricAlgorithms=[...t.subarray(n,t.length)];break;case H.signatureSubpacket.revocationKey:this.revocationKeyClass=t[n++],this.revocationKeyAlgorithm=t[n++],this.revocationKeyFingerprint=t.subarray(n,n+20);break;case H.signatureSubpacket.issuer:this.issuerKeyID.read(t.subarray(n,t.length));break;case H.signatureSubpacket.notationData:{const o=!!(128&t[n]);n+=4;const a=te.readNumber(t.subarray(n,n+2));n+=2;const d=te.readNumber(t.subarray(n,n+2));n+=2;const c=te.decodeUTF8(t.subarray(n,n+a)),l=t.subarray(n+a,n+a+d);this.rawNotations.push({name:c,humanReadable:o,value:l,critical:s}),o&&(this.notations[c]=te.decodeUTF8(l));break}case H.signatureSubpacket.preferredHashAlgorithms:this.preferredHashAlgorithms=[...t.subarray(n,t.length)];break;case H.signatureSubpacket.preferredCompressionAlgorithms:this.preferredCompressionAlgorithms=[...t.subarray(n,t.length)];break;case H.signatureSubpacket.keyServerPreferences:this.keyServerPreferences=[...t.subarray(n,t.length)];break;case H.signatureSubpacket.preferredKeyServer:this.preferredKeyServer=te.decodeUTF8(t.subarray(n,t.length));break;case H.signatureSubpacket.primaryUserID:this.isPrimaryUserID=t[n++]!==0;break;case H.signatureSubpacket.policyURI:this.policyURI=te.decodeUTF8(t.subarray(n,t.length));break;case H.signatureSubpacket.keyFlags:this.keyFlags=[...t.subarray(n,t.length)];break;case H.signatureSubpacket.signersUserID:this.signersUserID=te.decodeUTF8(t.subarray(n,t.length));break;case H.signatureSubpacket.reasonForRevocation:this.reasonForRevocationFlag=t[n++],this.reasonForRevocationString=te.decodeUTF8(t.subarray(n,t.length));break;case H.signatureSubpacket.features:this.features=[...t.subarray(n,t.length)];break;case H.signatureSubpacket.signatureTarget:{this.signatureTargetPublicKeyAlgorithm=t[n++],this.signatureTargetHashAlgorithm=t[n++];const o=yt.getHashByteLength(this.signatureTargetHashAlgorithm);this.signatureTargetHash=te.uint8ArrayToString(t.subarray(n,n+o));break}case H.signatureSubpacket.embeddedSignature:this.embeddedSignature=new xr,this.embeddedSignature.read(t.subarray(n,t.length));break;case H.signatureSubpacket.issuerFingerprint:this.issuerKeyVersion=t[n++],this.issuerFingerprint=t.subarray(n,t.length),this.issuerKeyVersion===5?this.issuerKeyID.read(this.issuerFingerprint):this.issuerKeyID.read(this.issuerFingerprint.subarray(-8));break;case H.signatureSubpacket.preferredAEADAlgorithms:this.preferredAEADAlgorithms=[...t.subarray(n,t.length)];break;default:{const o=Error("Unknown signature subpacket type "+i);if(s)throw o;te.printDebug(o)}}}readSubPackets(t,r=!0,n){const s=te.readNumber(t.subarray(0,2));let i=2;for(;i<2+s;){const o=cw(t.subarray(i,t.length));i+=o.offset,this.readSubPacket(t.subarray(i,i+o.len),r,n),i+=o.len}return i}toSign(t,r){const n=H.signature;switch(t){case n.binary:return r.text!==null?te.encodeUTF8(r.getText(!0)):r.getBytes(!0);case n.text:{const s=r.getBytes(!0);return te.canonicalizeEOL(s)}case n.standalone:return new Uint8Array(0);case n.certGeneric:case n.certPersona:case n.certCasual:case n.certPositive:case n.certRevocation:{let s,i;if(r.userID)i=180,s=r.userID;else{if(!r.userAttribute)throw Error("Either a userID or userAttribute packet needs to be supplied for certification.");i=209,s=r.userAttribute}const o=s.write();return te.concat([this.toSign(n.key,r),new Uint8Array([i]),te.writeNumber(o.length,4),o])}case n.subkeyBinding:case n.subkeyRevocation:case n.keyBinding:return te.concat([this.toSign(n.key,r),this.toSign(n.key,{key:r.bind})]);case n.key:if(r.key===void 0)throw Error("Key packet is required for this signature.");return r.key.writeForHash(this.version);case n.keyRevocation:return this.toSign(n.key,r);case n.timestamp:return new Uint8Array(0);case n.thirdParty:throw Error("Not implemented");default:throw Error("Unknown signature type.")}}calculateTrailer(t,r){let n=0;return yr(Pa(this.signatureData),s=>{n+=s.length},()=>{const s=[];return this.version!==5||this.signatureType!==H.signature.binary&&this.signatureType!==H.signature.text||(r?s.push(new Uint8Array(6)):s.push(t.writeHeader())),s.push(new Uint8Array([this.version,255])),this.version===5&&s.push(new Uint8Array(4)),s.push(te.writeNumber(n,4)),te.concat(s)})}toHash(t,r,n=!1){const s=this.toSign(t,r);return te.concat([s,this.signatureData,this.calculateTrailer(r,n)])}async hash(t,r,n,s=!1){return n||(n=this.toHash(t,r,s)),yt.hash.digest(this.hashAlgorithm,n)}async verify(t,r,n,s=new Date,i=!1,o=Xe){if(!this.issuerKeyID.equals(t.getKeyID()))throw Error("Signature was not issued by the given public key");if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Public key algorithm used to sign signature does not match issuer key algorithm.");const a=r===H.signature.binary||r===H.signature.text;if(!(this[jo]&&!a)){let c,l;if(this.hashed?l=await this.hashed:(c=this.toHash(r,n,i),l=await this.hash(r,n,c)),l=await vr(l),this.signedHashValue[0]!==l[0]||this.signedHashValue[1]!==l[1])throw Error("Signed digest did not match");if(this.params=await this.params,this[jo]=await yt.signature.verify(this.publicKeyAlgorithm,this.hashAlgorithm,this.params,t.publicParams,c,l),!this[jo])throw Error("Signature verification failed")}const d=te.normalizeDate(s);if(d&&this.created>d)throw Error("Signature creation time is in the future");if(d&&d>=this.getExpirationTime())throw Error("Signature is expired");if(o.rejectHashAlgorithms.has(this.hashAlgorithm))throw Error("Insecure hash algorithm: "+H.read(H.hash,this.hashAlgorithm).toUpperCase());if(o.rejectMessageHashAlgorithms.has(this.hashAlgorithm)&&[H.signature.binary,H.signature.text].includes(this.signatureType))throw Error("Insecure message hash algorithm: "+H.read(H.hash,this.hashAlgorithm).toUpperCase());if(this.rawNotations.forEach(({name:c,critical:l})=>{if(l&&o.knownNotations.indexOf(c)<0)throw Error("Unknown critical notation: "+c)}),this.revocationKeyClass!==null)throw Error("This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.")}isExpired(t=new Date){const r=te.normalizeDate(t);return r!==null&&!(this.created<=r&&r<this.getExpirationTime())}getExpirationTime(){return this.signatureNeverExpires?1/0:new Date(this.created.getTime()+1e3*this.signatureExpirationTime)}}function sr(e,t,r){const n=[];return n.push($l(r.length+1)),n.push(new Uint8Array([(t?128:0)|e])),n.push(r),te.concat(n)}class Bn{static get tag(){return H.packet.onePassSignature}constructor(){this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.issuerKeyID=null,this.flags=null}read(t){let r=0;if(this.version=t[r++],this.version!==3)throw new hr(`Version ${this.version} of the one-pass signature packet is unsupported.`);return this.signatureType=t[r++],this.hashAlgorithm=t[r++],this.publicKeyAlgorithm=t[r++],this.issuerKeyID=new Ls,this.issuerKeyID.read(t.subarray(r,r+8)),r+=8,this.flags=t[r++],this}write(){const t=new Uint8Array([3,this.signatureType,this.hashAlgorithm,this.publicKeyAlgorithm]),r=new Uint8Array([this.flags]);return te.concatUint8Array([t,this.issuerKeyID.write(),r])}calculateTrailer(...t){return cs(async()=>xr.prototype.calculateTrailer.apply(await this.correspondingSig,t))}async verify(){const t=await this.correspondingSig;if(!t||t.constructor.tag!==H.packet.signature)throw Error("Corresponding signature packet missing");if(t.signatureType!==this.signatureType||t.hashAlgorithm!==this.hashAlgorithm||t.publicKeyAlgorithm!==this.publicKeyAlgorithm||!t.issuerKeyID.equals(this.issuerKeyID))throw Error("Corresponding signature packet does not match one-pass signature packet");return t.hashed=this.hashed,t.verify.apply(t,arguments)}}function yI(e,t){if(!t[e]){let r;try{r=H.read(H.packet,e)}catch{throw new hr("Unknown packet type with tag: "+e)}throw Error("Packet not allowed in this context: "+r)}return new t[e]}Bn.prototype.hash=xr.prototype.hash,Bn.prototype.toHash=xr.prototype.toHash,Bn.prototype.toSign=xr.prototype.toSign;class Ft extends Array{static async fromBinary(t,r,n=Xe){const s=new Ft;return await s.read(t,r,n),s}async read(t,r,n=Xe){n.additionalAllowedPackets.length&&(r={...r,...te.constructAllowedPackets(n.additionalAllowedPackets)}),this.stream=Ii(t,async(i,o)=>{const a=vn(o);try{for(;;)if(await a.ready,await pT(i,async d=>{try{if(d.tag===H.packet.marker||d.tag===H.packet.trust)return;const c=yI(d.tag,r);c.packets=new Ft,c.fromStream=te.isStream(d.packet),await c.read(d.packet,n),await a.write(c)}catch(c){const l=!n.ignoreUnsupportedPackets&&c instanceof hr,u=!(n.ignoreMalformedPackets||c instanceof hr);if(l||u||sf(d.tag))await a.abort(c);else{const p=new Cf(d.tag,d.packet);await a.write(p)}te.printDebugError(c)}}))return await a.ready,void await a.close()}catch(d){await a.abort(d)}});const s=Mi(this.stream);for(;;){const{done:i,value:o}=await s.read();if(i?this.stream=null:this.push(o),i||sf(o.constructor.tag))break}s.releaseLock()}write(){const t=[];for(let r=0;r<this.length;r++){const n=this[r]instanceof Cf?this[r].tag:this[r].constructor.tag,s=this[r].write();if(te.isStream(s)&&sf(this[r].constructor.tag)){let i=[],o=0;const a=512;t.push(uw(n)),t.push(yr(s,d=>{if(i.push(d),o+=d.length,o>=a){const c=Math.min(Math.log(o)/Math.LN2|0,30),l=2**c,u=te.concat([hT(c)].concat(i));return i=[u.subarray(1+l)],o=i[0].length,u.subarray(0,1+l)}},()=>te.concat([$l(o)].concat(i))))}else{if(te.isStream(s)){let i=0;t.push(yr(Pa(s),o=>{i+=o.length},()=>um(n,i)))}else t.push(um(n,s.length));t.push(s)}}return te.concat(t)}filterByTag(...t){const r=new Ft,n=s=>i=>s===i;for(let s=0;s<this.length;s++)t.some(n(this[s].constructor.tag))&&r.push(this[s]);return r}findPacket(t){return this.find(r=>r.constructor.tag===t)}indexOfTag(...t){const r=[],n=this,s=i=>o=>i===o;for(let i=0;i<this.length;i++)t.some(s(n[i].constructor.tag))&&r.push(i);return r}}const gI=te.constructAllowedPackets([ss,Bn,xr]);class wo{static get tag(){return H.packet.compressedData}constructor(t=Xe){this.packets=null,this.algorithm=t.preferredCompressionAlgorithm,this.compressed=null,this.deflateLevel=t.deflateLevel}async read(t,r=Xe){await fh(t,async n=>{this.algorithm=await n.readByte(),this.compressed=n.remainder(),await this.decompress(r)})}write(){return this.compressed===null&&this.compress(),te.concat([new Uint8Array([this.algorithm]),this.compressed])}async decompress(t=Xe){const r=H.read(H.compression,this.algorithm),n=bI[r];if(!n)throw Error(r+" decompression not supported");this.packets=await Ft.fromBinary(n(this.compressed),gI,t)}compress(){const t=H.read(H.compression,this.algorithm),r=mI[t];if(!r)throw Error(t+" compression not supported");this.compressed=r(this.packets.write(),this.deflateLevel)}}const mi=te.getNodeZlib();function f3(e){return e}function Lf(e,t,r={}){return function(n){return!te.isStream(n)||_r(n)?cs(()=>vr(n).then(s=>new Promise((i,o)=>{e(s,r,(a,d)=>{if(a)return o(a);i(d)})}))):dh(u2(n).pipe(t(r)))}}function Kf(e,t={}){return function(r){const n=new e(t);return yr(r,s=>{if(s.length)return n.push(s,El),n.result},()=>{if(e===Py)return n.push([],Dr),n.result})}}function h3(e){return function(t){return cs(async()=>e(await vr(t)))}}const mI=mi?{zip:(e,t)=>Lf(mi.deflateRaw,mi.createDeflateRaw,{level:t})(e),zlib:(e,t)=>Lf(mi.deflate,mi.createDeflate,{level:t})(e)}:{zip:(e,t)=>Kf(Py,{raw:!0,level:t})(e),zlib:(e,t)=>Kf(Py,{level:t})(e)},bI=mi?{uncompressed:f3,zip:Lf(mi.inflateRaw,mi.createInflateRaw),zlib:Lf(mi.inflate,mi.createInflate),bzip2:h3(d3)}:{uncompressed:f3,zip:Kf(c3,{raw:!0}),zlib:Kf(c3),bzip2:h3(d3)},vI=te.constructAllowedPackets([ss,wo,Bn,xr]);class E2{static get tag(){return H.packet.symEncryptedIntegrityProtectedData}constructor(){this.version=1,this.encrypted=null,this.packets=null}async read(t){await fh(t,async r=>{const n=await r.readByte();if(n!==1)throw new hr(`Version ${n} of the SEIP packet is unsupported.`);this.encrypted=r.remainder()})}write(){return te.concat([new Uint8Array([1]),this.encrypted])}async encrypt(t,r,n=Xe){const{blockSize:s}=yt.getCipher(t);let i=this.packets.write();_r(i)&&(i=await vr(i));const o=await yt.getPrefixRandom(t),a=new Uint8Array([211,20]),d=te.concat([o,i,a]),c=await yt.hash.sha1(no(d)),l=te.concat([d,c]);return this.encrypted=await yt.mode.cfb.encrypt(t,r,l,new Uint8Array(s),n),!0}async decrypt(t,r,n=Xe){const{blockSize:s}=yt.getCipher(t);let i=Pa(this.encrypted);_r(i)&&(i=await vr(i));const o=await yt.mode.cfb.decrypt(t,r,i,new Uint8Array(s)),a=Vr(no(o),-20),d=Vr(o,0,-20),c=Promise.all([vr(await yt.hash.sha1(no(d))),vr(a)]).then(([p,f])=>{if(!te.equalsUint8Array(p,f))throw Error("Modification detected.");return new Uint8Array}),l=Vr(d,s+2);let u=Vr(l,0,-2);return u=ln([u,cs(()=>c)]),te.isStream(i)&&n.allowUnauthenticatedStream||(u=await vr(u)),this.packets=await Ft.fromBinary(u,vI,n),!0}}const _I=te.constructAllowedPackets([ss,wo,Bn,xr]);class Hl{static get tag(){return H.packet.aeadEncryptedData}constructor(){this.version=1,this.cipherAlgorithm=null,this.aeadAlgorithm=H.aead.eax,this.chunkSizeByte=null,this.iv=null,this.encrypted=null,this.packets=null}async read(t){await fh(t,async r=>{const n=await r.readByte();if(n!==1)throw new hr(`Version ${n} of the AEAD-encrypted data packet is not supported.`);this.cipherAlgorithm=await r.readByte(),this.aeadAlgorithm=await r.readByte(),this.chunkSizeByte=await r.readByte();const s=yt.getAEADMode(this.aeadAlgorithm);this.iv=await r.readBytes(s.ivLength),this.encrypted=r.remainder()})}write(){return te.concat([new Uint8Array([this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte]),this.iv,this.encrypted])}async decrypt(t,r,n=Xe){this.packets=await Ft.fromBinary(await this.crypt("decrypt",r,Pa(this.encrypted)),_I,n)}async encrypt(t,r,n=Xe){this.cipherAlgorithm=t;const{ivLength:s}=yt.getAEADMode(this.aeadAlgorithm);this.iv=yt.random.getRandomBytes(s),this.chunkSizeByte=n.aeadChunkSizeByte;const i=this.packets.write();this.encrypted=await this.crypt("encrypt",r,i)}async crypt(t,r,n){const s=yt.getAEADMode(this.aeadAlgorithm),i=await s(this.cipherAlgorithm,r),o=t==="decrypt"?s.tagLength:0,a=t==="encrypt"?s.tagLength:0,d=2**(this.chunkSizeByte+6)+o,c=new ArrayBuffer(21),l=new Uint8Array(c,0,13),u=new Uint8Array(c),p=new DataView(c),f=new Uint8Array(c,5,8);l.set([192|Hl.tag,this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte],0);let h=0,y=Promise.resolve(),m=0,b=0;const v=this.iv;return Ii(n,async(E,_)=>{if(te.isStream(E)!=="array"){const D=new lo({},{highWaterMark:te.getHardwareConcurrency()*2**(this.chunkSizeByte+6),size:w=>w.length});ts(D.readable,_),_=D.writable}const C=Mi(E),k=vn(_);try{for(;;){let D=await C.readBytes(d+o)||new Uint8Array;const w=D.subarray(D.length-o);let S,I;if(D=D.subarray(0,D.length-o),!h||D.length?(C.unshift(w),S=i[t](D,s.getNonce(v,f),l),b+=D.length-o+a):(p.setInt32(17,m),S=i[t](w,s.getNonce(v,f),u),b+=a,I=!0),m+=D.length-o,y=y.then(()=>S).then(async T=>{await k.ready,await k.write(T),b-=T.length}).catch(T=>k.abort(T)),(I||b>k.desiredSize)&&await y,I){await k.close();break}p.setInt32(9,++h)}}catch(D){await k.abort(D)}})}}class qf{static get tag(){return H.packet.publicKeyEncryptedSessionKey}constructor(){this.version=3,this.publicKeyID=new Ls,this.publicKeyAlgorithm=null,this.sessionKey=null,this.sessionKeyAlgorithm=null,this.encrypted={}}read(t){let r=0;if(this.version=t[r++],this.version!==3)throw new hr(`Version ${this.version} of the PKESK packet is unsupported.`);r+=this.publicKeyID.read(t.subarray(r)),this.publicKeyAlgorithm=t[r++],this.encrypted=yt.parseEncSessionKeyParams(this.publicKeyAlgorithm,t.subarray(r),this.version),this.publicKeyAlgorithm===H.publicKey.x25519&&(this.sessionKeyAlgorithm=H.write(H.symmetric,this.encrypted.C.algorithm))}write(){const t=[new Uint8Array([this.version]),this.publicKeyID.write(),new Uint8Array([this.publicKeyAlgorithm]),yt.serializeParams(this.publicKeyAlgorithm,this.encrypted)];return te.concatUint8Array(t)}async encrypt(t){const r=H.write(H.publicKey,this.publicKeyAlgorithm),n=p3(this.version,r,this.sessionKeyAlgorithm,this.sessionKey);this.encrypted=await yt.publicKeyEncrypt(r,this.sessionKeyAlgorithm,t.publicParams,n,t.getFingerprintBytes())}async decrypt(t,r){if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Decryption error");const n=r?p3(this.version,this.publicKeyAlgorithm,r.sessionKeyAlgorithm,r.sessionKey):null,s=await yt.publicKeyDecrypt(this.publicKeyAlgorithm,t.publicParams,t.privateParams,this.encrypted,t.getFingerprintBytes(),n),{sessionKey:i,sessionKeyAlgorithm:o}=function(a,d,c,l){switch(d){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:case H.publicKey.elgamal:case H.publicKey.ecdh:{const u=c.subarray(0,c.length-2),p=c.subarray(c.length-2),f=te.writeChecksum(u.subarray(u.length%8)),h=f[0]===p[0]&f[1]===p[1],y={sessionKeyAlgorithm:u[0],sessionKey:u.subarray(1)};if(l){const m=h&y.sessionKeyAlgorithm===l.sessionKeyAlgorithm&y.sessionKey.length===l.sessionKey.length;return{sessionKey:te.selectUint8Array(m,y.sessionKey,l.sessionKey),sessionKeyAlgorithm:te.selectUint8(m,y.sessionKeyAlgorithm,l.sessionKeyAlgorithm)}}if(h&&H.read(H.symmetric,y.sessionKeyAlgorithm))return y;throw Error("Decryption error")}case H.publicKey.x25519:return{sessionKey:c};default:throw Error("Unsupported public key algorithm")}}(this.version,this.publicKeyAlgorithm,s,r);this.publicKeyAlgorithm!==H.publicKey.x25519&&(this.sessionKeyAlgorithm=o),this.sessionKey=i}}function p3(e,t,r,n){switch(t){case H.publicKey.rsaEncrypt:case H.publicKey.rsaEncryptSign:case H.publicKey.elgamal:case H.publicKey.ecdh:return te.concatUint8Array([new Uint8Array([r]),n,te.writeChecksum(n.subarray(n.length%8))]);case H.publicKey.x25519:return n;default:throw Error("Unsupported public key algorithm")}}class yl{constructor(t=Xe){this.algorithm=H.hash.sha256,this.type="iterated",this.c=t.s2kIterationCountByte,this.salt=null}getCount(){return 16+(15&this.c)<<6+(this.c>>4)}read(t){let r=0;try{this.type=H.read(H.s2k,t[r++])}catch{throw new hr("Unknown S2K type.")}switch(this.algorithm=t[r++],this.type){case"simple":break;case"salted":this.salt=t.subarray(r,r+8),r+=8;break;case"iterated":this.salt=t.subarray(r,r+8),r+=8,this.c=t[r++];break;case"gnu":if(te.uint8ArrayToString(t.subarray(r,r+3))!=="GNU")throw new hr("Unknown s2k type.");if(r+=3,1e3+t[r++]!==1001)throw new hr("Unknown s2k gnu protection mode.");this.type="gnu-dummy";break;default:throw new hr("Unknown s2k type.")}return r}write(){if(this.type==="gnu-dummy")return new Uint8Array([101,0,...te.stringToUint8Array("GNU"),1]);const t=[new Uint8Array([H.write(H.s2k,this.type),this.algorithm])];switch(this.type){case"simple":break;case"salted":t.push(this.salt);break;case"iterated":t.push(this.salt),t.push(new Uint8Array([this.c]));break;case"gnu":throw Error("GNU s2k type not supported.");default:throw Error("Unknown s2k type.")}return te.concatUint8Array(t)}async produceKey(t,r){t=te.encodeUTF8(t);const n=[];let s=0,i=0;for(;s<r;){let o;switch(this.type){case"simple":o=te.concatUint8Array([new Uint8Array(i),t]);break;case"salted":o=te.concatUint8Array([new Uint8Array(i),this.salt,t]);break;case"iterated":{const d=te.concatUint8Array([this.salt,t]);let c=d.length;const l=Math.max(this.getCount(),c);o=new Uint8Array(i+l),o.set(d,i);for(let u=i+c;u<l;u+=c,c*=2)o.copyWithin(u,i,u);break}case"gnu":throw Error("GNU s2k type not supported.");default:throw Error("Unknown s2k type.")}const a=await yt.hash.digest(this.algorithm,o);n.push(a),s+=a.length,i++}return te.concatUint8Array(n).subarray(0,r)}}class Ia{static get tag(){return H.packet.symEncryptedSessionKey}constructor(t=Xe){this.version=t.aeadProtect?5:4,this.sessionKey=null,this.sessionKeyEncryptionAlgorithm=null,this.sessionKeyAlgorithm=H.symmetric.aes256,this.aeadAlgorithm=H.write(H.aead,t.preferredAEADAlgorithm),this.encrypted=null,this.s2k=null,this.iv=null}read(t){let r=0;if(this.version=t[r++],this.version!==4&&this.version!==5)throw new hr(`Version ${this.version} of the SKESK packet is unsupported.`);const n=t[r++];if(this.version===5&&(this.aeadAlgorithm=t[r++]),this.s2k=new yl,r+=this.s2k.read(t.subarray(r,t.length)),this.version===5){const s=yt.getAEADMode(this.aeadAlgorithm);this.iv=t.subarray(r,r+=s.ivLength)}this.version===5||r<t.length?(this.encrypted=t.subarray(r,t.length),this.sessionKeyEncryptionAlgorithm=n):this.sessionKeyAlgorithm=n}write(){const t=this.encrypted===null?this.sessionKeyAlgorithm:this.sessionKeyEncryptionAlgorithm;let r;return this.version===5?r=te.concatUint8Array([new Uint8Array([this.version,t,this.aeadAlgorithm]),this.s2k.write(),this.iv,this.encrypted]):(r=te.concatUint8Array([new Uint8Array([this.version,t]),this.s2k.write()]),this.encrypted!==null&&(r=te.concatUint8Array([r,this.encrypted]))),r}async decrypt(t){const r=this.sessionKeyEncryptionAlgorithm!==null?this.sessionKeyEncryptionAlgorithm:this.sessionKeyAlgorithm,{blockSize:n,keySize:s}=yt.getCipher(r),i=await this.s2k.produceKey(t,s);if(this.version===5){const o=yt.getAEADMode(this.aeadAlgorithm),a=new Uint8Array([192|Ia.tag,this.version,this.sessionKeyEncryptionAlgorithm,this.aeadAlgorithm]),d=await o(r,i);this.sessionKey=await d.decrypt(this.encrypted,this.iv,a)}else if(this.encrypted!==null){const o=await yt.mode.cfb.decrypt(r,i,this.encrypted,new Uint8Array(n));this.sessionKeyAlgorithm=H.write(H.symmetric,o[0]),this.sessionKey=o.subarray(1,o.length)}else this.sessionKey=i}async encrypt(t,r=Xe){const n=this.sessionKeyEncryptionAlgorithm!==null?this.sessionKeyEncryptionAlgorithm:this.sessionKeyAlgorithm;this.sessionKeyEncryptionAlgorithm=n,this.s2k=new yl(r),this.s2k.salt=yt.random.getRandomBytes(8);const{blockSize:s,keySize:i}=yt.getCipher(n),o=await this.s2k.produceKey(t,i);if(this.sessionKey===null&&(this.sessionKey=yt.generateSessionKey(this.sessionKeyAlgorithm)),this.version===5){const a=yt.getAEADMode(this.aeadAlgorithm);this.iv=yt.random.getRandomBytes(a.ivLength);const d=new Uint8Array([192|Ia.tag,this.version,this.sessionKeyEncryptionAlgorithm,this.aeadAlgorithm]),c=await a(n,o);this.encrypted=await c.encrypt(this.sessionKey,this.iv,d)}else{const a=te.concatUint8Array([new Uint8Array([this.sessionKeyAlgorithm]),this.sessionKey]);this.encrypted=await yt.mode.cfb.encrypt(n,o,a,new Uint8Array(s),r)}}}class Xn{static get tag(){return H.packet.publicKey}constructor(t=new Date,r=Xe){this.version=r.v5Keys?5:4,this.created=te.normalizeDate(t),this.algorithm=null,this.publicParams=null,this.expirationTimeV3=0,this.fingerprint=null,this.keyID=null}static fromSecretKeyPacket(t){const r=new Xn,{version:n,created:s,algorithm:i,publicParams:o,keyID:a,fingerprint:d}=t;return r.version=n,r.created=s,r.algorithm=i,r.publicParams=o,r.keyID=a,r.fingerprint=d,r}async read(t){let r=0;if(this.version=t[r++],this.version===4||this.version===5){this.created=te.readDate(t.subarray(r,r+4)),r+=4,this.algorithm=t[r++],this.version===5&&(r+=4);const{read:n,publicParams:s}=yt.parsePublicKeyParams(this.algorithm,t.subarray(r));return this.publicParams=s,r+=n,await this.computeFingerprintAndKeyID(),r}throw new hr(`Version ${this.version} of the key packet is unsupported.`)}write(){const t=[];t.push(new Uint8Array([this.version])),t.push(te.writeDate(this.created)),t.push(new Uint8Array([this.algorithm]));const r=yt.serializeParams(this.algorithm,this.publicParams);return this.version===5&&t.push(te.writeNumber(r.length,4)),t.push(r),te.concatUint8Array(t)}writeForHash(t){const r=this.writePublicKey();return t===5?te.concatUint8Array([new Uint8Array([154]),te.writeNumber(r.length,4),r]):te.concatUint8Array([new Uint8Array([153]),te.writeNumber(r.length,2),r])}isDecrypted(){return null}getCreationTime(){return this.created}getKeyID(){return this.keyID}async computeFingerprintAndKeyID(){if(await this.computeFingerprint(),this.keyID=new Ls,this.version===5)this.keyID.read(this.fingerprint.subarray(0,8));else{if(this.version!==4)throw Error("Unsupported key version");this.keyID.read(this.fingerprint.subarray(12,20))}}async computeFingerprint(){const t=this.writeForHash(this.version);if(this.version===5)this.fingerprint=await yt.hash.sha256(t);else{if(this.version!==4)throw Error("Unsupported key version");this.fingerprint=await yt.hash.sha1(t)}}getFingerprintBytes(){return this.fingerprint}getFingerprint(){return te.uint8ArrayToHex(this.getFingerprintBytes())}hasSameFingerprintAs(t){return this.version===t.version&&te.equalsUint8Array(this.writePublicKey(),t.writePublicKey())}getAlgorithmInfo(){const t={};t.algorithm=H.read(H.publicKey,this.algorithm);const r=this.publicParams.n||this.publicParams.p;return r?t.bits=te.uint8ArrayBitLength(r):this.publicParams.oid&&(t.curve=this.publicParams.oid.getName()),t}}Xn.prototype.readPublicKey=Xn.prototype.read,Xn.prototype.writePublicKey=Xn.prototype.write;const wI=te.constructAllowedPackets([ss,wo,Bn,xr]);class Vw{static get tag(){return H.packet.symmetricallyEncryptedData}constructor(){this.encrypted=null,this.packets=null}read(t){this.encrypted=t}write(){return this.encrypted}async decrypt(t,r,n=Xe){if(!n.allowUnauthenticatedMessages)throw Error("Message is not authenticated.");const{blockSize:s}=yt.getCipher(t),i=await vr(Pa(this.encrypted)),o=await yt.mode.cfb.decrypt(t,r,i.subarray(s+2),i.subarray(2,s+2));this.packets=await Ft.fromBinary(o,wI,n)}async encrypt(t,r,n=Xe){const s=this.packets.write(),{blockSize:i}=yt.getCipher(t),o=await yt.getPrefixRandom(t),a=await yt.mode.cfb.encrypt(t,r,o,new Uint8Array(i),n),d=await yt.mode.cfb.encrypt(t,r,s,a.subarray(2),n);this.encrypted=te.concat([a,d])}}class EI{static get tag(){return H.packet.marker}read(t){return t[0]===80&&t[1]===71&&t[2]===80}write(){return new Uint8Array([80,71,80])}}class Gl extends Xn{static get tag(){return H.packet.publicSubkey}constructor(t,r){super(t,r)}static fromSecretSubkeyPacket(t){const r=new Gl,{version:n,created:s,algorithm:i,publicParams:o,keyID:a,fingerprint:d}=t;return r.version=n,r.created=s,r.algorithm=i,r.publicParams=o,r.keyID=a,r.fingerprint=d,r}}class vh{static get tag(){return H.packet.userAttribute}constructor(){this.attributes=[]}read(t){let r=0;for(;r<t.length;){const n=cw(t.subarray(r,t.length));r+=n.offset,this.attributes.push(te.uint8ArrayToString(t.subarray(r,r+n.len))),r+=n.len}}write(){const t=[];for(let r=0;r<this.attributes.length;r++)t.push($l(this.attributes[r].length)),t.push(te.stringToUint8Array(this.attributes[r]));return te.concatUint8Array(t)}equals(t){return!!(t&&t instanceof vh)&&this.attributes.every(function(r,n){return r===t.attributes[n]})}}class _h extends Xn{static get tag(){return H.packet.secretKey}constructor(t=new Date,r=Xe){super(t,r),this.keyMaterial=null,this.isEncrypted=null,this.s2kUsage=0,this.s2k=null,this.symmetric=null,this.aead=null,this.privateParams=null}async read(t){let r=await this.readPublicKey(t);const n=r;this.s2kUsage=t[r++],this.version===5&&r++;try{if(this.s2kUsage===255||this.s2kUsage===254||this.s2kUsage===253){if(this.symmetric=t[r++],this.s2kUsage===253&&(this.aead=t[r++]),this.s2k=new yl,r+=this.s2k.read(t.subarray(r,t.length)),this.s2k.type==="gnu-dummy")return}else this.s2kUsage&&(this.symmetric=this.s2kUsage);this.s2kUsage&&(this.iv=t.subarray(r,r+yt.getCipher(this.symmetric).blockSize),r+=this.iv.length)}catch(s){if(!this.s2kUsage)throw s;this.unparseableKeyMaterial=t.subarray(n),this.isEncrypted=!0}if(this.version===5&&(r+=4),this.keyMaterial=t.subarray(r),this.isEncrypted=!!this.s2kUsage,!this.isEncrypted){const s=this.keyMaterial.subarray(0,-2);if(!te.equalsUint8Array(te.writeChecksum(s),this.keyMaterial.subarray(-2)))throw Error("Key checksum mismatch");try{const{privateParams:i}=yt.parsePrivateKeyParams(this.algorithm,s,this.publicParams);this.privateParams=i}catch(i){throw i instanceof hr?i:Error("Error reading MPIs")}}}write(){const t=this.writePublicKey();if(this.unparseableKeyMaterial)return te.concatUint8Array([t,this.unparseableKeyMaterial]);const r=[t];r.push(new Uint8Array([this.s2kUsage]));const n=[];return this.s2kUsage!==255&&this.s2kUsage!==254&&this.s2kUsage!==253||(n.push(this.symmetric),this.s2kUsage===253&&n.push(this.aead),n.push(...this.s2k.write())),this.s2kUsage&&this.s2k.type!=="gnu-dummy"&&n.push(...this.iv),this.version===5&&r.push(new Uint8Array([n.length])),r.push(new Uint8Array(n)),this.isDummy()||(this.s2kUsage||(this.keyMaterial=yt.serializeParams(this.algorithm,this.privateParams)),this.version===5&&r.push(te.writeNumber(this.keyMaterial.length,4)),r.push(this.keyMaterial),this.s2kUsage||r.push(te.writeChecksum(this.keyMaterial))),te.concatUint8Array(r)}isDecrypted(){return this.isEncrypted===!1}isMissingSecretKeyMaterial(){return this.unparseableKeyMaterial!==void 0||this.isDummy()}isDummy(){return!(!this.s2k||this.s2k.type!=="gnu-dummy")}makeDummy(t=Xe){this.isDummy()||(this.isDecrypted()&&this.clearPrivateParams(),delete this.unparseableKeyMaterial,this.isEncrypted=null,this.keyMaterial=null,this.s2k=new yl(t),this.s2k.algorithm=0,this.s2k.c=0,this.s2k.type="gnu-dummy",this.s2kUsage=254,this.symmetric=H.symmetric.aes256)}async encrypt(t,r=Xe){if(this.isDummy())return;if(!this.isDecrypted())throw Error("Key packet is already encrypted");if(!t)throw Error("A non-empty passphrase is required for key encryption.");this.s2k=new yl(r),this.s2k.salt=yt.random.getRandomBytes(8);const n=yt.serializeParams(this.algorithm,this.privateParams);this.symmetric=H.symmetric.aes256;const s=await y3(this.s2k,t,this.symmetric),{blockSize:i}=yt.getCipher(this.symmetric);if(this.iv=yt.random.getRandomBytes(i),r.aeadProtect){this.s2kUsage=253,this.aead=H.aead.eax;const o=yt.getAEADMode(this.aead),a=await o(this.symmetric,s);this.keyMaterial=await a.encrypt(n,this.iv.subarray(0,o.ivLength),new Uint8Array)}else this.s2kUsage=254,this.keyMaterial=await yt.mode.cfb.encrypt(this.symmetric,s,te.concatUint8Array([n,await yt.hash.sha1(n,r)]),this.iv,r)}async decrypt(t){if(this.isDummy())return!1;if(this.unparseableKeyMaterial)throw Error("Key packet cannot be decrypted: unsupported S2K or cipher algo");if(this.isDecrypted())throw Error("Key packet is already decrypted.");let r,n;if(this.s2kUsage!==254&&this.s2kUsage!==253)throw this.s2kUsage===255?Error("Encrypted private key is authenticated using an insecure two-byte hash"):Error("Private key is encrypted using an insecure S2K function: unsalted MD5");if(r=await y3(this.s2k,t,this.symmetric),this.s2kUsage===253){const s=yt.getAEADMode(this.aead),i=await s(this.symmetric,r);try{n=await i.decrypt(this.keyMaterial,this.iv.subarray(0,s.ivLength),new Uint8Array)}catch(o){throw o.message==="Authentication tag mismatch"?Error("Incorrect key passphrase: "+o.message):o}}else{const s=await yt.mode.cfb.decrypt(this.symmetric,r,this.keyMaterial,this.iv);n=s.subarray(0,-20);const i=await yt.hash.sha1(n);if(!te.equalsUint8Array(i,s.subarray(-20)))throw Error("Incorrect key passphrase")}try{const{privateParams:s}=yt.parsePrivateKeyParams(this.algorithm,n,this.publicParams);this.privateParams=s}catch{throw Error("Error reading MPIs")}this.isEncrypted=!1,this.keyMaterial=null,this.s2kUsage=0}async validate(){if(this.isDummy())return;if(!this.isDecrypted())throw Error("Key is not decrypted");let t;try{t=await yt.validateParams(this.algorithm,this.publicParams,this.privateParams)}catch{t=!1}if(!t)throw Error("Key is invalid")}async generate(t,r){const{privateParams:n,publicParams:s}=await yt.generateParams(this.algorithm,t,r);this.privateParams=n,this.publicParams=s,this.isEncrypted=!1}clearPrivateParams(){this.isMissingSecretKeyMaterial()||(Object.keys(this.privateParams).forEach(t=>{this.privateParams[t].fill(0),delete this.privateParams[t]}),this.privateParams=null,this.isEncrypted=!0)}}async function y3(e,t,r){const{keySize:n}=yt.getCipher(r);return e.produceKey(t,n)}var AI=Ni(function(e){(function(t){function r(s){function i(){return Ue<Re}function o(){return Ue}function a(Ee){Ue=Ee}function d(){Ue=0,Re=Ne.length}function c(Ee,Ce){return{name:Ee,tokens:Ce||"",semantic:Ce||"",children:[]}}function l(Ee,Ce){var Oe;return Ce===null?null:((Oe=c(Ee)).tokens=Ce.tokens,Oe.semantic=Ce.semantic,Oe.children.push(Ce),Oe)}function u(Ee,Ce){return Ce!==null&&(Ee.tokens+=Ce.tokens,Ee.semantic+=Ce.semantic),Ee.children.push(Ce),Ee}function p(Ee){var Ce;return i()&&Ee(Ce=Ne[Ue])?(Ue+=1,c("token",Ce)):null}function f(Ee){return function(){return l("literal",p(function(Ce){return Ce===Ee}))}}function h(){var Ee=arguments;return function(){var Ce,Oe,Be,Ve;for(Ve=o(),Oe=c("and"),Ce=0;Ce<Ee.length;Ce+=1){if((Be=Ee[Ce]())===null)return a(Ve),null;u(Oe,Be)}return Oe}}function y(){var Ee=arguments;return function(){var Ce,Oe,Be;for(Be=o(),Ce=0;Ce<Ee.length;Ce+=1){if((Oe=Ee[Ce]())!==null)return Oe;a(Be)}return null}}function m(Ee){return function(){var Ce,Oe;return Oe=o(),(Ce=Ee())!==null?Ce:(a(Oe),c("opt"))}}function b(Ee){return function(){var Ce=Ee();return Ce!==null&&(Ce.semantic=""),Ce}}function v(Ee){return function(){var Ce=Ee();return Ce!==null&&Ce.semantic.length>0&&(Ce.semantic=" "),Ce}}function E(Ee,Ce){return function(){var Oe,Be,Ve,$,Y;for($=o(),Oe=c("star"),Ve=0,Y=Ce===void 0?0:Ce;(Be=Ee())!==null;)Ve+=1,u(Oe,Be);return Ve>=Y?Oe:(a($),null)}}function _(Ee){return Ee.charCodeAt(0)>=128}function C(){return l("cr",f("\r")())}function k(){return l("crlf",h(C,S)())}function D(){return l("dquote",f('"')())}function w(){return l("htab",f(" ")())}function S(){return l("lf",f(`
|
|
37
|
-
`)())}function I(){return l("sp",f(" ")())}function T(){return l("vchar",p(function(Ee){var Ce=Ee.charCodeAt(0),Oe=33<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||_(Ee)),Oe}))}function g(){return l("wsp",y(I,w)())}function A(){var Ee=l("quoted-pair",y(h(f("\\"),y(T,g)),ue)());return Ee===null?null:(Ee.semantic=Ee.semantic[1],Ee)}function P(){return l("fws",y(de,h(m(h(E(g),b(k))),E(g,1)))())}function O(){return l("ctext",y(function(){return p(function(Ee){var Ce=Ee.charCodeAt(0),Oe=33<=Ce&&Ce<=39||42<=Ce&&Ce<=91||93<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||_(Ee)),Oe})},Fe)())}function N(){return l("ccontent",y(O,A,M)())}function M(){return l("comment",h(f("("),E(h(m(P),N)),m(P),f(")"))())}function L(){return l("cfws",y(h(E(h(m(P),M),1),m(P)),P)())}function x(){return l("atext",p(function(Ee){var Ce="a"<=Ee&&Ee<="z"||"A"<=Ee&&Ee<="Z"||"0"<=Ee&&Ee<="9"||["!","#","$","%","&","'","*","+","-","/","=","?","^","_","`","{","|","}","~"].indexOf(Ee)>=0;return s.rfc6532&&(Ce=Ce||_(Ee)),Ce}))}function R(){return l("atom",h(v(m(L)),E(x,1),v(m(L)))())}function K(){var Ee,Ce;return(Ee=l("dot-atom-text",E(x,1)()))===null||(Ce=E(h(f("."),E(x,1)))())!==null&&u(Ee,Ce),Ee}function V(){return l("dot-atom",h(b(m(L)),K,b(m(L)))())}function J(){return l("qtext",y(function(){return p(function(Ee){var Ce=Ee.charCodeAt(0),Oe=Ce===33||35<=Ce&&Ce<=91||93<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||_(Ee)),Oe})},he)())}function se(){return l("qcontent",y(J,A)())}function j(){return l("quoted-string",h(b(m(L)),b(D),E(h(m(v(P)),se)),m(b(P)),b(D),b(m(L)))())}function re(){return l("word",y(R,j)())}function G(){return l("address",y(B,_e)())}function B(){return l("mailbox",y(X,je)())}function X(){return l("name-addr",h(m(Se),ge)())}function ge(){return l("angle-addr",y(h(b(m(L)),f("<"),je,f(">"),b(m(L))),fe)())}function _e(){return l("group",h(Se,f(":"),m(z),f(";"),b(m(L)))())}function Se(){return l("display-name",((Ee=l("phrase",y(pe,E(re,1))()))!==null&&(Ee.semantic=function(Ce){return Ce.replace(/([ \t]|\r\n)+/g," ").replace(/^\s*/,"").replace(/\s*$/,"")}(Ee.semantic)),Ee));var Ee}function F(){return l("mailbox-list",y(h(B,E(h(f(","),B))),Q)())}function q(){return l("address-list",y(h(G,E(h(f(","),G))),qe)())}function z(){return l("group-list",y(F,b(L),He)())}function ee(){return l("local-part",y(Qe,V,j)())}function le(){return l("dtext",y(function(){return p(function(Ee){var Ce=Ee.charCodeAt(0),Oe=33<=Ce&&Ce<=90||94<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||_(Ee)),Oe})},rt)())}function ce(){return l("domain-literal",h(b(m(L)),f("["),E(h(m(P),le)),m(P),f("]"),b(m(L)))())}function ne(){return l("domain",(Ee=y(dt,V,ce)(),s.rejectTLD&&Ee&&Ee.semantic&&Ee.semantic.indexOf(".")<0?null:(Ee&&(Ee.semantic=Ee.semantic.replace(/\s+/g,"")),Ee)));var Ee}function je(){return l("addr-spec",h(ee,f("@"),ne)())}function De(){return s.strict?null:l("obs-NO-WS-CTL",p(function(Ee){var Ce=Ee.charCodeAt(0);return 1<=Ce&&Ce<=8||Ce===11||Ce===12||14<=Ce&&Ce<=31||Ce===127}))}function Fe(){return s.strict?null:l("obs-ctext",De())}function he(){return s.strict?null:l("obs-qtext",De())}function ue(){return s.strict?null:l("obs-qp",h(f("\\"),y(f("\0"),De,S,C))())}function pe(){return s.strict?null:s.atInDisplayName?l("obs-phrase",h(re,E(y(re,f("."),f("@"),v(L))))()):l("obs-phrase",h(re,E(y(re,f("."),v(L))))())}function de(){return s.strict?null:l("obs-FWS",E(h(b(m(k)),g),1)())}function fe(){return s.strict?null:l("obs-angle-addr",h(b(m(L)),f("<"),ye,je,f(">"),b(m(L)))())}function ye(){return s.strict?null:l("obs-route",h(ie,f(":"))())}function ie(){return s.strict?null:l("obs-domain-list",h(E(y(b(L),f(","))),f("@"),ne,E(h(f(","),b(m(L)),m(h(f("@"),ne)))))())}function Q(){return s.strict?null:l("obs-mbox-list",h(E(h(b(m(L)),f(","))),B,E(h(f(","),m(h(B,b(L))))))())}function qe(){return s.strict?null:l("obs-addr-list",h(E(h(b(m(L)),f(","))),G,E(h(f(","),m(h(G,b(L))))))())}function He(){return s.strict?null:l("obs-group-list",h(E(h(b(m(L)),f(",")),1),b(m(L)))())}function Qe(){return s.strict?null:l("obs-local-part",h(re,E(h(f("."),re)))())}function dt(){return s.strict?null:l("obs-domain",h(R,E(h(f("."),R)))())}function rt(){return s.strict?null:l("obs-dtext",y(De,A)())}function be(Ee,Ce){var Oe,Be,Ve;if(Ce==null)return null;for(Be=[Ce];Be.length>0;){if((Ve=Be.pop()).name===Ee)return Ve;for(Oe=Ve.children.length-1;Oe>=0;Oe-=1)Be.push(Ve.children[Oe])}return null}function W(Ee,Ce){var Oe,Be,Ve,$,Y;if(Ce==null)return null;for(Be=[Ce],$=[],Y={},Oe=0;Oe<Ee.length;Oe+=1)Y[Ee[Oe]]=!0;for(;Be.length>0;)if((Ve=Be.pop()).name in Y)$.push(Ve);else for(Oe=Ve.children.length-1;Oe>=0;Oe-=1)Be.push(Ve.children[Oe]);return $}function oe(Ee){var Ce,Oe,Be,Ve,$;if(Ee===null)return null;for(Ce=[],Oe=W(["group","mailbox"],Ee),Be=0;Be<Oe.length;Be+=1)(Ve=Oe[Be]).name==="group"?Ce.push(me(Ve)):Ve.name==="mailbox"&&Ce.push(Te(Ve));return $={ast:Ee,addresses:Ce},s.simple&&($=function(Y){var Z;if(Y&&Y.addresses)for(Z=0;Z<Y.addresses.length;Z+=1)delete Y.addresses[Z].node;return Y}($)),s.oneResult?function(Y){return!Y||!s.partial&&Y.addresses.length>1?null:Y.addresses&&Y.addresses[0]}($):s.simple?$&&$.addresses:$}function me(Ee){var Ce,Oe=be("display-name",Ee),Be=[],Ve=W(["mailbox"],Ee);for(Ce=0;Ce<Ve.length;Ce+=1)Be.push(Te(Ve[Ce]));return{node:Ee,parts:{name:Oe},type:Ee.name,name:Pe(Oe),addresses:Be}}function Te(Ee){var Ce=be("display-name",Ee),Oe=be("addr-spec",Ee),Be=function(Z,U){var ae,Ae,Ie,xe;if(U==null)return null;for(Ae=[U],xe=[];Ae.length>0;)for((Ie=Ae.pop()).name===Z&&xe.push(Ie),ae=Ie.children.length-1;ae>=0;ae-=1)Ae.push(Ie.children[ae]);return xe}("cfws",Ee),Ve=W(["comment"],Ee),$=be("local-part",Oe),Y=be("domain",Oe);return{node:Ee,parts:{name:Ce,address:Oe,local:$,domain:Y,comments:Be},type:Ee.name,name:Pe(Ce),address:Pe(Oe),local:Pe($),domain:Pe(Y),comments:ke(Ve),groupName:Pe(Ee.groupName)}}function Pe(Ee){return Ee!=null?Ee.semantic:null}function ke(Ee){var Ce="";if(Ee)for(var Oe=0;Oe<Ee.length;Oe+=1)Ce+=Pe(Ee[Oe]);return Ce}var Ne,Ue,Re,Me,et;if((s=n(s,{}))===null)return null;if(Ne=s.input,et={address:G,"address-list":q,"angle-addr":ge,from:function(){return l("from",y(F,q)())},group:_e,mailbox:B,"mailbox-list":F,"reply-to":function(){return l("reply-to",q())},sender:function(){return l("sender",y(B,G)())}}[s.startAt]||q,!s.strict){if(d(),s.strict=!0,Me=et(Ne),s.partial||!i())return oe(Me);s.strict=!1}return d(),Me=et(Ne),!s.partial&&i()?null:oe(Me)}function n(s,i){function o(l){return Object.prototype.toString.call(l)==="[object String]"}function a(l){return l==null}var d,c;if(o(s))s={input:s};else if(!function(l){return l===Object(l)}(s))return null;if(!o(s.input)||!i)return null;for(c in d={oneResult:!1,partial:!1,rejectTLD:!1,rfc6532:!1,simple:!1,startAt:"address-list",strict:!1,atInDisplayName:!1})a(s[c])&&(s[c]=a(i[c])?d[c]:i[c]);return s}r.parseOneAddress=function(s){return r(n(s,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"address-list"}))},r.parseAddressList=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"address-list"}))},r.parseFrom=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"from"}))},r.parseSender=function(s){return r(n(s,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"sender"}))},r.parseReplyTo=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"reply-to"}))},e.exports=r})()});class zl{static get tag(){return H.packet.userID}constructor(){this.userID="",this.name="",this.email="",this.comment=""}static fromObject(t){if(te.isString(t)||t.name&&!te.isString(t.name)||t.email&&!te.isEmailAddress(t.email)||t.comment&&!te.isString(t.comment))throw Error("Invalid user ID format");const r=new zl;Object.assign(r,t);const n=[];return r.name&&n.push(r.name),r.comment&&n.push(`(${r.comment})`),r.email&&n.push(`<${r.email}>`),r.userID=n.join(" "),r}read(t,r=Xe){const n=te.decodeUTF8(t);if(n.length>r.maxUserIDLength)throw Error("User ID string is too long");try{const{name:s,address:i,comments:o}=AI.parseOneAddress({input:n,atInDisplayName:!0});this.comment=o.replace(/^\(|\)$/g,""),this.name=s,this.email=i}catch{}this.userID=n}write(){return te.encodeUTF8(this.userID)}equals(t){return t&&t.userID===this.userID}}class A2 extends _h{static get tag(){return H.packet.secretSubkey}constructor(t=new Date,r=Xe){super(t,r)}}class SI{static get tag(){return H.packet.trust}read(){throw new hr("Trust packets are not supported")}write(){throw new hr("Trust packets are not supported")}}const PI=te.constructAllowedPackets([xr]);class Us{constructor(t){this.packets=t||new Ft}write(){return this.packets.write()}armor(t=Xe){return ka(H.armor.signature,this.write(),void 0,void 0,void 0,t)}getSigningKeyIDs(){return this.packets.map(t=>t.issuerKeyID)}}async function TI({armoredSignature:e,binarySignature:t,config:r,...n}){r={...Xe,...r};let s=e||t;if(!s)throw Error("readSignature: must pass options object containing `armoredSignature` or `binarySignature`");if(e&&!te.isString(e))throw Error("readSignature: options.armoredSignature must be a string");if(t&&!te.isUint8Array(t))throw Error("readSignature: options.binarySignature must be a Uint8Array");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));if(e){const{type:a,data:d}=await Oi(s,r);if(a!==H.armor.signature)throw Error("Armored text not of type signature");s=d}const o=await Ft.fromBinary(s,PI,r);return new Us(o)}async function Fw(e,t){const r=new A2(e.date,t);return r.packets=null,r.algorithm=H.write(H.publicKey,e.algorithm),await r.generate(e.rsaBits,e.curve),await r.computeFingerprintAndKeyID(),r}async function II(e,t){const r=new _h(e.date,t);return r.packets=null,r.algorithm=H.write(H.publicKey,e.algorithm),await r.generate(e.rsaBits,e.curve,e.config),await r.computeFingerprintAndKeyID(),r}async function Zn(e,t,r,n,s=new Date,i){let o,a;for(let d=e.length-1;d>=0;d--)try{(!o||e[d].created>=o.created)&&(await e[d].verify(t,r,n,s,void 0,i),o=e[d])}catch(c){a=c}if(!o)throw te.wrapError(`Could not find valid ${H.read(H.signature,r)} signature in key ${t.getKeyID().toHex()}`.replace("certGeneric ","self-").replace(/([a-z])([A-Z])/g,(d,c,l)=>c+" "+l.toLowerCase()),a);return o}function Ty(e,t,r=new Date){const n=te.normalizeDate(r);if(n!==null){const s=jf(e,t);return!(e.created<=n&&n<s)}return!1}async function Hw(e,t,r,n){const s={};s.key=t,s.bind=e;const i={signatureType:H.signature.subkeyBinding};return r.sign?(i.keyFlags=[H.keyFlags.signData],i.embeddedSignature=await as(s,null,e,{signatureType:H.signature.keyBinding},r.date,void 0,void 0,void 0,n)):i.keyFlags=[H.keyFlags.encryptCommunication|H.keyFlags.encryptStorage],r.keyExpirationTime>0&&(i.keyExpirationTime=r.keyExpirationTime,i.keyNeverExpires=!1),await as(s,null,t,i,r.date,void 0,void 0,void 0,n)}async function Gw(e,t,r=new Date,n={},s){let i=s.preferredHashAlgorithm,o=i;if(e){const a=await e.getPrimaryUser(r,n,s);a.selfCertification.preferredHashAlgorithms&&([o]=a.selfCertification.preferredHashAlgorithms,i=yt.hash.getHashByteLength(i)<=yt.hash.getHashByteLength(o)?o:i)}switch(t.algorithm){case H.publicKey.ecdsa:case H.publicKey.eddsaLegacy:case H.publicKey.ed25519:o=yt.getPreferredCurveHashAlgo(t.algorithm,t.publicParams.oid)}return yt.hash.getHashByteLength(i)<=yt.hash.getHashByteLength(o)?o:i}async function Iy(e,t=[],r=new Date,n=[],s=Xe){const i={symmetric:H.symmetric.aes128,aead:H.aead.eax,compression:H.compression.uncompressed}[e],o={symmetric:s.preferredSymmetricAlgorithm,aead:s.preferredAEADAlgorithm,compression:s.preferredCompressionAlgorithm}[e],a={symmetric:"preferredSymmetricAlgorithms",aead:"preferredAEADAlgorithms",compression:"preferredCompressionAlgorithms"}[e];return(await Promise.all(t.map(async function(c,l){const u=(await c.getPrimaryUser(r,n[l],s)).selfCertification[a];return!!u&&u.indexOf(o)>=0}))).every(Boolean)?o:i}async function as(e,t,r,n,s,i,o=[],a=!1,d){if(r.isDummy())throw Error("Cannot sign with a gnu-dummy key.");if(!r.isDecrypted())throw Error("Signing key is not decrypted.");const c=new xr;return Object.assign(c,n),c.publicKeyAlgorithm=r.algorithm,c.hashAlgorithm=await Gw(t,r,s,i,d),c.rawNotations=o,await c.sign(r,e,s,a),c}async function _a(e,t,r,n=new Date,s){(e=e[r])&&(t[r].length?await Promise.all(e.map(async function(i){i.isExpired(n)||s&&!await s(i)||t[r].some(function(o){return te.equalsUint8Array(o.writeParams(),i.writeParams())})||t[r].push(i)})):t[r]=e)}async function ho(e,t,r,n,s,i,o=new Date,a){i=i||e;const d=[];return await Promise.all(n.map(async function(c){try{s&&!c.issuerKeyID.equals(s.issuerKeyID)||(await c.verify(i,t,r,a.revocationsExpire?o:null,!1,a),d.push(c.issuerKeyID))}catch{}})),s?(s.revoked=!!d.some(c=>c.equals(s.issuerKeyID))||s.revoked||!1,s.revoked):d.length>0}function jf(e,t){let r;return t.keyNeverExpires===!1&&(r=e.created.getTime()+1e3*t.keyExpirationTime),r?new Date(r):1/0}function Cy(e,t={}){switch(e.type=e.type||t.type,e.curve=e.curve||t.curve,e.rsaBits=e.rsaBits||t.rsaBits,e.keyExpirationTime=e.keyExpirationTime!==void 0?e.keyExpirationTime:t.keyExpirationTime,e.passphrase=te.isString(e.passphrase)?e.passphrase:t.passphrase,e.date=e.date||t.date,e.sign=e.sign||!1,e.type){case"ecc":try{e.curve=H.write(H.curve,e.curve)}catch{throw Error("Unknown curve")}e.curve!==H.curve.ed25519Legacy&&e.curve!==H.curve.curve25519Legacy||(e.curve=e.sign?H.curve.ed25519Legacy:H.curve.curve25519Legacy),e.sign?e.algorithm=e.curve===H.curve.ed25519Legacy?H.publicKey.eddsaLegacy:H.publicKey.ecdsa:e.algorithm=H.publicKey.ecdh;break;case"rsa":e.algorithm=H.publicKey.rsaEncryptSign;break;default:throw Error("Unsupported key type "+e.type)}return e}function g3(e,t){const r=e.algorithm;return r!==H.publicKey.rsaEncrypt&&r!==H.publicKey.elgamal&&r!==H.publicKey.ecdh&&r!==H.publicKey.x25519&&(!t.keyFlags||(t.keyFlags[0]&H.keyFlags.signData)!=0)}function m3(e,t){const r=e.algorithm;return r!==H.publicKey.dsa&&r!==H.publicKey.rsaSign&&r!==H.publicKey.ecdsa&&r!==H.publicKey.eddsaLegacy&&r!==H.publicKey.ed25519&&(!t.keyFlags||(t.keyFlags[0]&H.keyFlags.encryptCommunication)!=0||(t.keyFlags[0]&H.keyFlags.encryptStorage)!=0)}function b3(e,t){return!!t.allowInsecureDecryptionWithSigningKeys||!e.keyFlags||(e.keyFlags[0]&H.keyFlags.encryptCommunication)!=0||(e.keyFlags[0]&H.keyFlags.encryptStorage)!=0}function Ja(e,t){const r=H.write(H.publicKey,e.algorithm),n=e.getAlgorithmInfo();if(t.rejectPublicKeyAlgorithms.has(r))throw Error(n.algorithm+" keys are considered too weak.");switch(r){case H.publicKey.rsaEncryptSign:case H.publicKey.rsaSign:case H.publicKey.rsaEncrypt:if(n.bits<t.minRSABits)throw Error(`RSA keys shorter than ${t.minRSABits} bits are considered too weak.`);break;case H.publicKey.ecdsa:case H.publicKey.eddsaLegacy:case H.publicKey.ecdh:if(t.rejectCurves.has(n.curve))throw Error(`Support for ${n.algorithm} keys using curve ${n.curve} is disabled.`)}}class gl{constructor(t,r){this.userID=t.constructor.tag===H.packet.userID?t:null,this.userAttribute=t.constructor.tag===H.packet.userAttribute?t:null,this.selfCertifications=[],this.otherCertifications=[],this.revocationSignatures=[],this.mainKey=r}toPacketList(){const t=new Ft;return t.push(this.userID||this.userAttribute),t.push(...this.revocationSignatures),t.push(...this.selfCertifications),t.push(...this.otherCertifications),t}clone(){const t=new gl(this.userID||this.userAttribute,this.mainKey);return t.selfCertifications=[...this.selfCertifications],t.otherCertifications=[...this.otherCertifications],t.revocationSignatures=[...this.revocationSignatures],t}async certify(t,r,n){const s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s},o=new gl(i.userID||i.userAttribute,this.mainKey);return o.otherCertifications=await Promise.all(t.map(async function(a){if(!a.isPrivate())throw Error("Need private key for signing");if(a.hasSameFingerprintAs(s))throw Error("The user's own key can only be used for self-certifications");const d=await a.getSigningKey(void 0,r,void 0,n);return as(i,a,d.keyPacket,{signatureType:H.signature.certGeneric,keyFlags:[H.keyFlags.certifyKeys|H.keyFlags.signData]},r,void 0,void 0,void 0,n)})),await o.update(this,r,n),o}async isRevoked(t,r,n=new Date,s=Xe){const i=this.mainKey.keyPacket;return ho(i,H.signature.certRevocation,{key:i,userID:this.userID,userAttribute:this.userAttribute},this.revocationSignatures,t,r,n,s)}async verifyCertificate(t,r,n=new Date,s){const i=this,o=this.mainKey.keyPacket,a={userID:this.userID,userAttribute:this.userAttribute,key:o},{issuerKeyID:d}=t,c=r.filter(l=>l.getKeys(d).length>0);return c.length===0?null:(await Promise.all(c.map(async l=>{const u=await l.getSigningKey(d,t.created,void 0,s);if(t.revoked||await i.isRevoked(t,u.keyPacket,n,s))throw Error("User certificate is revoked");try{await t.verify(u.keyPacket,H.signature.certGeneric,a,n,void 0,s)}catch(p){throw te.wrapError("User certificate is invalid",p)}})),!0)}async verifyAllCertifications(t,r=new Date,n){const s=this,i=this.selfCertifications.concat(this.otherCertifications);return Promise.all(i.map(async o=>({keyID:o.issuerKeyID,valid:await s.verifyCertificate(o,t,r,n).catch(()=>!1)})))}async verify(t=new Date,r){if(!this.selfCertifications.length)throw Error("No self-certifications found");const n=this,s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s};let o;for(let a=this.selfCertifications.length-1;a>=0;a--)try{const d=this.selfCertifications[a];if(d.revoked||await n.isRevoked(d,void 0,t,r))throw Error("Self-certification is revoked");try{await d.verify(s,H.signature.certGeneric,i,t,void 0,r)}catch(c){throw te.wrapError("Self-certification is invalid",c)}return!0}catch(d){o=d}throw o}async update(t,r,n){const s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s};await _a(t,this,"selfCertifications",r,async function(o){try{return await o.verify(s,H.signature.certGeneric,i,r,!1,n),!0}catch{return!1}}),await _a(t,this,"otherCertifications",r),await _a(t,this,"revocationSignatures",r,function(o){return ho(s,H.signature.certRevocation,i,[o],void 0,void 0,r,n)})}async revoke(t,{flag:r=H.reasonForRevocation.noReason,string:n=""}={},s=new Date,i=Xe){const o={userID:this.userID,userAttribute:this.userAttribute,key:t},a=new gl(o.userID||o.userAttribute,this.mainKey);return a.revocationSignatures.push(await as(o,null,t,{signatureType:H.signature.certRevocation,reasonForRevocationFlag:H.write(H.reasonForRevocation,r),reasonForRevocationString:n},s,void 0,void 0,!1,i)),await a.update(this),a}}class Ca{constructor(t,r){this.keyPacket=t,this.bindingSignatures=[],this.revocationSignatures=[],this.mainKey=r}toPacketList(){const t=new Ft;return t.push(this.keyPacket),t.push(...this.revocationSignatures),t.push(...this.bindingSignatures),t}clone(){const t=new Ca(this.keyPacket,this.mainKey);return t.bindingSignatures=[...this.bindingSignatures],t.revocationSignatures=[...this.revocationSignatures],t}async isRevoked(t,r,n=new Date,s=Xe){const i=this.mainKey.keyPacket;return ho(i,H.signature.subkeyRevocation,{key:i,bind:this.keyPacket},this.revocationSignatures,t,r,n,s)}async verify(t=new Date,r=Xe){const n=this.mainKey.keyPacket,s={key:n,bind:this.keyPacket},i=await Zn(this.bindingSignatures,n,H.signature.subkeyBinding,s,t,r);if(i.revoked||await this.isRevoked(i,null,t,r))throw Error("Subkey is revoked");if(Ty(this.keyPacket,i,t))throw Error("Subkey is expired");return i}async getExpirationTime(t=new Date,r=Xe){const n=this.mainKey.keyPacket,s={key:n,bind:this.keyPacket};let i;try{i=await Zn(this.bindingSignatures,n,H.signature.subkeyBinding,s,t,r)}catch{return null}const o=jf(this.keyPacket,i),a=i.getExpirationTime();return o<a?o:a}async update(t,r=new Date,n=Xe){const s=this.mainKey.keyPacket;if(!this.hasSameFingerprintAs(t))throw Error("Subkey update method: fingerprints of subkeys not equal");this.keyPacket.constructor.tag===H.packet.publicSubkey&&t.keyPacket.constructor.tag===H.packet.secretSubkey&&(this.keyPacket=t.keyPacket);const i=this,o={key:s,bind:i.keyPacket};await _a(t,this,"bindingSignatures",r,async function(a){for(let d=0;d<i.bindingSignatures.length;d++)if(i.bindingSignatures[d].issuerKeyID.equals(a.issuerKeyID))return a.created>i.bindingSignatures[d].created&&(i.bindingSignatures[d]=a),!1;try{return await a.verify(s,H.signature.subkeyBinding,o,r,void 0,n),!0}catch{return!1}}),await _a(t,this,"revocationSignatures",r,function(a){return ho(s,H.signature.subkeyRevocation,o,[a],void 0,void 0,r,n)})}async revoke(t,{flag:r=H.reasonForRevocation.noReason,string:n=""}={},s=new Date,i=Xe){const o={key:t,bind:this.keyPacket},a=new Ca(this.keyPacket,this.mainKey);return a.revocationSignatures.push(await as(o,null,t,{signatureType:H.signature.subkeyRevocation,reasonForRevocationFlag:H.write(H.reasonForRevocation,r),reasonForRevocationString:n},s,void 0,void 0,!1,i)),await a.update(this),a}hasSameFingerprintAs(t){return this.keyPacket.hasSameFingerprintAs(t.keyPacket||t)}}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted"].forEach(e=>{Ca.prototype[e]=function(){return this.keyPacket[e]()}});const CI=te.constructAllowedPackets([xr]),v3=new Set([H.packet.publicKey,H.packet.privateKey]),_3=new Set([H.packet.publicKey,H.packet.privateKey,H.packet.publicSubkey,H.packet.privateSubkey]);class zw{packetListToStructure(t,r=new Set){let n,s,i,o;for(const a of t){if(a instanceof Cf){_3.has(a.tag)&&!o&&(o=v3.has(a.tag)?v3:_3);continue}const d=a.constructor.tag;if(o){if(!o.has(d))continue;o=null}if(r.has(d))throw Error("Unexpected packet type: "+d);switch(d){case H.packet.publicKey:case H.packet.secretKey:if(this.keyPacket)throw Error("Key block contains multiple keys");if(this.keyPacket=a,s=this.getKeyID(),!s)throw Error("Missing Key ID");break;case H.packet.userID:case H.packet.userAttribute:n=new gl(a,this),this.users.push(n);break;case H.packet.publicSubkey:case H.packet.secretSubkey:n=null,i=new Ca(a,this),this.subkeys.push(i);break;case H.packet.signature:switch(a.signatureType){case H.signature.certGeneric:case H.signature.certPersona:case H.signature.certCasual:case H.signature.certPositive:if(!n){te.printDebug("Dropping certification signatures without preceding user packet");continue}a.issuerKeyID.equals(s)?n.selfCertifications.push(a):n.otherCertifications.push(a);break;case H.signature.certRevocation:n?n.revocationSignatures.push(a):this.directSignatures.push(a);break;case H.signature.key:this.directSignatures.push(a);break;case H.signature.subkeyBinding:if(!i){te.printDebug("Dropping subkey binding signature without preceding subkey packet");continue}i.bindingSignatures.push(a);break;case H.signature.keyRevocation:this.revocationSignatures.push(a);break;case H.signature.subkeyRevocation:if(!i){te.printDebug("Dropping subkey revocation signature without preceding subkey packet");continue}i.revocationSignatures.push(a)}}}}toPacketList(){const t=new Ft;return t.push(this.keyPacket),t.push(...this.revocationSignatures),t.push(...this.directSignatures),this.users.map(r=>t.push(...r.toPacketList())),this.subkeys.map(r=>t.push(...r.toPacketList())),t}clone(t=!1){const r=new this.constructor(this.toPacketList());return t&&r.getKeys().forEach(n=>{if(n.keyPacket=Object.create(Object.getPrototypeOf(n.keyPacket),Object.getOwnPropertyDescriptors(n.keyPacket)),!n.keyPacket.isDecrypted())return;const s={};Object.keys(n.keyPacket.privateParams).forEach(i=>{s[i]=new Uint8Array(n.keyPacket.privateParams[i])}),n.keyPacket.privateParams=s}),r}getSubkeys(t=null){return this.subkeys.filter(r=>!t||r.getKeyID().equals(t,!0))}getKeys(t=null){const r=[];return t&&!this.getKeyID().equals(t,!0)||r.push(this),r.concat(this.getSubkeys(t))}getKeyIDs(){return this.getKeys().map(t=>t.getKeyID())}getUserIDs(){return this.users.map(t=>t.userID?t.userID.userID:null).filter(t=>t!==null)}write(){return this.toPacketList().write()}async getSigningKey(t=null,r=new Date,n={},s=Xe){await this.verifyPrimaryKey(r,n,s);const i=this.keyPacket,o=this.subkeys.slice().sort((d,c)=>c.keyPacket.created-d.keyPacket.created);let a;for(const d of o)if(!t||d.getKeyID().equals(t))try{await d.verify(r,s);const c={key:i,bind:d.keyPacket},l=await Zn(d.bindingSignatures,i,H.signature.subkeyBinding,c,r,s);if(!g3(d.keyPacket,l))continue;if(!l.embeddedSignature)throw Error("Missing embedded signature");return await Zn([l.embeddedSignature],d.keyPacket,H.signature.keyBinding,c,r,s),Ja(d.keyPacket,s),d}catch(c){a=c}try{const d=await this.getPrimaryUser(r,n,s);if((!t||i.getKeyID().equals(t))&&g3(i,d.selfCertification))return Ja(i,s),this}catch(d){a=d}throw te.wrapError("Could not find valid signing key packet in key "+this.getKeyID().toHex(),a)}async getEncryptionKey(t,r=new Date,n={},s=Xe){await this.verifyPrimaryKey(r,n,s);const i=this.keyPacket,o=this.subkeys.slice().sort((d,c)=>c.keyPacket.created-d.keyPacket.created);let a;for(const d of o)if(!t||d.getKeyID().equals(t))try{await d.verify(r,s);const c={key:i,bind:d.keyPacket},l=await Zn(d.bindingSignatures,i,H.signature.subkeyBinding,c,r,s);if(m3(d.keyPacket,l))return Ja(d.keyPacket,s),d}catch(c){a=c}try{const d=await this.getPrimaryUser(r,n,s);if((!t||i.getKeyID().equals(t))&&m3(i,d.selfCertification))return Ja(i,s),this}catch(d){a=d}throw te.wrapError("Could not find valid encryption key packet in key "+this.getKeyID().toHex(),a)}async isRevoked(t,r,n=new Date,s=Xe){return ho(this.keyPacket,H.signature.keyRevocation,{key:this.keyPacket},this.revocationSignatures,t,r,n,s)}async verifyPrimaryKey(t=new Date,r={},n=Xe){const s=this.keyPacket;if(await this.isRevoked(null,null,t,n))throw Error("Primary key is revoked");const{selfCertification:i}=await this.getPrimaryUser(t,r,n);if(Ty(s,i,t))throw Error("Primary key is expired");const o=await Zn(this.directSignatures,s,H.signature.key,{key:s},t,n).catch(()=>{});if(o&&Ty(s,o,t))throw Error("Primary key is expired")}async getExpirationTime(t,r=Xe){let n;try{const{selfCertification:s}=await this.getPrimaryUser(null,t,r),i=jf(this.keyPacket,s),o=s.getExpirationTime(),a=await Zn(this.directSignatures,this.keyPacket,H.signature.key,{key:this.keyPacket},null,r).catch(()=>{});if(a){const d=jf(this.keyPacket,a);n=Math.min(i,o,d)}else n=i<o?i:o}catch{n=null}return te.normalizeDate(n)}async getPrimaryUser(t=new Date,r={},n=Xe){const s=this.keyPacket,i=[];let o;for(let l=0;l<this.users.length;l++)try{const u=this.users[l];if(!u.userID)continue;if(r.name!==void 0&&u.userID.name!==r.name||r.email!==void 0&&u.userID.email!==r.email||r.comment!==void 0&&u.userID.comment!==r.comment)throw Error("Could not find user that matches that user ID");const p={userID:u.userID,key:s},f=await Zn(u.selfCertifications,s,H.signature.certGeneric,p,t,n);i.push({index:l,user:u,selfCertification:f})}catch(u){o=u}if(!i.length)throw o||Error("Could not find primary user");await Promise.all(i.map(async function(l){return l.selfCertification.revoked||l.user.isRevoked(l.selfCertification,null,t,n)}));const a=i.sort(function(l,u){const p=l.selfCertification,f=u.selfCertification;return f.revoked-p.revoked||p.isPrimaryUserID-f.isPrimaryUserID||p.created-f.created}).pop(),{user:d,selfCertification:c}=a;if(c.revoked||await d.isRevoked(c,null,t,n))throw Error("Primary user is revoked");return a}async update(t,r=new Date,n=Xe){if(!this.hasSameFingerprintAs(t))throw Error("Primary key fingerprints must be equal to update the key");if(!this.isPrivate()&&t.isPrivate()){if(!(this.subkeys.length===t.subkeys.length&&this.subkeys.every(i=>t.subkeys.some(o=>i.hasSameFingerprintAs(o)))))throw Error("Cannot update public key with private key if subkeys mismatch");return t.update(this,n)}const s=this.clone();return await _a(t,s,"revocationSignatures",r,i=>ho(s.keyPacket,H.signature.keyRevocation,s,[i],null,t.keyPacket,r,n)),await _a(t,s,"directSignatures",r),await Promise.all(t.users.map(async i=>{const o=s.users.filter(a=>i.userID&&i.userID.equals(a.userID)||i.userAttribute&&i.userAttribute.equals(a.userAttribute));if(o.length>0)await Promise.all(o.map(a=>a.update(i,r,n)));else{const a=i.clone();a.mainKey=s,s.users.push(a)}})),await Promise.all(t.subkeys.map(async i=>{const o=s.subkeys.filter(a=>a.hasSameFingerprintAs(i));if(o.length>0)await Promise.all(o.map(a=>a.update(i,r,n)));else{const a=i.clone();a.mainKey=s,s.subkeys.push(a)}})),s}async getRevocationCertificate(t=new Date,r=Xe){const n={key:this.keyPacket},s=await Zn(this.revocationSignatures,this.keyPacket,H.signature.keyRevocation,n,t,r),i=new Ft;return i.push(s),ka(H.armor.publicKey,i.write(),null,null,"This is a revocation certificate")}async applyRevocationCertificate(t,r=new Date,n=Xe){const s=await Oi(t,n),i=(await Ft.fromBinary(s.data,CI,n)).findPacket(H.packet.signature);if(!i||i.signatureType!==H.signature.keyRevocation)throw Error("Could not find revocation signature packet");if(!i.issuerKeyID.equals(this.getKeyID()))throw Error("Revocation signature does not match key");try{await i.verify(this.keyPacket,H.signature.keyRevocation,{key:this.keyPacket},r,void 0,n)}catch(a){throw te.wrapError("Could not verify revocation signature",a)}const o=this.clone();return o.revocationSignatures.push(i),o}async signPrimaryUser(t,r,n,s=Xe){const{index:i,user:o}=await this.getPrimaryUser(r,n,s),a=await o.certify(t,r,s),d=this.clone();return d.users[i]=a,d}async signAllUsers(t,r=new Date,n=Xe){const s=this.clone();return s.users=await Promise.all(this.users.map(function(i){return i.certify(t,r,n)})),s}async verifyPrimaryUser(t,r=new Date,n,s=Xe){const i=this.keyPacket,{user:o}=await this.getPrimaryUser(r,n,s);return t?await o.verifyAllCertifications(t,r,s):[{keyID:i.getKeyID(),valid:await o.verify(r,s).catch(()=>!1)}]}async verifyAllUsers(t,r=new Date,n=Xe){const s=this.keyPacket,i=[];return await Promise.all(this.users.map(async o=>{const a=t?await o.verifyAllCertifications(t,r,n):[{keyID:s.getKeyID(),valid:await o.verify(r,n).catch(()=>!1)}];i.push(...a.map(d=>({userID:o.userID?o.userID.userID:null,userAttribute:o.userAttribute,keyID:d.keyID,valid:d.valid})))})),i}}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","hasSameFingerprintAs"].forEach(e=>{zw.prototype[e]=Ca.prototype[e]});class $f extends zw{constructor(t){if(super(),this.keyPacket=null,this.revocationSignatures=[],this.directSignatures=[],this.users=[],this.subkeys=[],t&&(this.packetListToStructure(t,new Set([H.packet.secretKey,H.packet.secretSubkey])),!this.keyPacket))throw Error("Invalid key: missing public-key packet")}isPrivate(){return!1}toPublic(){return this}armor(t=Xe){return ka(H.armor.publicKey,this.toPacketList().write(),void 0,void 0,void 0,t)}}class Oa extends $f{constructor(t){if(super(),this.packetListToStructure(t,new Set([H.packet.publicKey,H.packet.publicSubkey])),!this.keyPacket)throw Error("Invalid key: missing private-key packet")}isPrivate(){return!0}toPublic(){const t=new Ft,r=this.toPacketList();for(const n of r)switch(n.constructor.tag){case H.packet.secretKey:{const s=Xn.fromSecretKeyPacket(n);t.push(s);break}case H.packet.secretSubkey:{const s=Gl.fromSecretSubkeyPacket(n);t.push(s);break}default:t.push(n)}return new $f(t)}armor(t=Xe){return ka(H.armor.privateKey,this.toPacketList().write(),void 0,void 0,void 0,t)}async getDecryptionKeys(t,r=new Date,n={},s=Xe){const i=this.keyPacket,o=[];for(let d=0;d<this.subkeys.length;d++)if(!t||this.subkeys[d].getKeyID().equals(t,!0))try{const c={key:i,bind:this.subkeys[d].keyPacket};b3(await Zn(this.subkeys[d].bindingSignatures,i,H.signature.subkeyBinding,c,r,s),s)&&o.push(this.subkeys[d])}catch{}const a=await this.getPrimaryUser(r,n,s);return t&&!i.getKeyID().equals(t,!0)||!b3(a.selfCertification,s)||o.push(this),o}isDecrypted(){return this.getKeys().some(({keyPacket:t})=>t.isDecrypted())}async validate(t=Xe){if(!this.isPrivate())throw Error("Cannot validate a public key");let r;if(this.keyPacket.isDummy()){const n=await this.getSigningKey(null,null,void 0,{...t,rejectPublicKeyAlgorithms:new Set,minRSABits:0});n&&!n.keyPacket.isDummy()&&(r=n.keyPacket)}else r=this.keyPacket;if(r)return r.validate();{const n=this.getKeys();if(n.map(i=>i.keyPacket.isDummy()).every(Boolean))throw Error("Cannot validate an all-gnu-dummy key");return Promise.all(n.map(async i=>i.keyPacket.validate()))}}clearPrivateParams(){this.getKeys().forEach(({keyPacket:t})=>{t.isDecrypted()&&t.clearPrivateParams()})}async revoke({flag:t=H.reasonForRevocation.noReason,string:r=""}={},n=new Date,s=Xe){if(!this.isPrivate())throw Error("Need private key for revoking");const i={key:this.keyPacket},o=this.clone();return o.revocationSignatures.push(await as(i,null,this.keyPacket,{signatureType:H.signature.keyRevocation,reasonForRevocationFlag:H.write(H.reasonForRevocation,t),reasonForRevocationString:r},n,void 0,void 0,void 0,s)),o}async addSubkey(t={}){const r={...Xe,...t.config};if(t.passphrase)throw Error("Subkey could not be encrypted here, please encrypt whole key");if(t.rsaBits<r.minRSABits)throw Error(`rsaBits should be at least ${r.minRSABits}, got: ${t.rsaBits}`);const n=this.keyPacket;if(n.isDummy())throw Error("Cannot add subkey to gnu-dummy primary key");if(!n.isDecrypted())throw Error("Key is not decrypted");const s=n.getAlgorithmInfo();s.type=s.curve?"ecc":"rsa",s.rsaBits=s.bits||4096,s.curve=s.curve||"curve25519",t=Cy(t,s);const i=await Fw(t);Ja(i,r);const o=await Hw(i,n,t,r),a=this.toPacketList();return a.push(i,o),new Oa(a)}}const wh=te.constructAllowedPackets([Xn,Gl,_h,A2,zl,vh,xr]);function Ww(e){for(const t of e)switch(t.constructor.tag){case H.packet.secretKey:return new Oa(e);case H.packet.publicKey:return new $f(e)}throw Error("No key packet found")}async function Yw(e,t,r,n){r.passphrase&&await e.encrypt(r.passphrase,n),await Promise.all(t.map(async function(o,a){const d=r.subkeys[a].passphrase;d&&await o.encrypt(d,n)}));const s=new Ft;s.push(e),await Promise.all(r.userIDs.map(async function(o,a){function d(p,f){return[f,...p.filter(h=>h!==f)]}const c=zl.fromObject(o),l={};l.userID=c,l.key=e;const u={};return u.signatureType=H.signature.certGeneric,u.keyFlags=[H.keyFlags.certifyKeys|H.keyFlags.signData],u.preferredSymmetricAlgorithms=d([H.symmetric.aes256,H.symmetric.aes128,H.symmetric.aes192],n.preferredSymmetricAlgorithm),n.aeadProtect&&(u.preferredAEADAlgorithms=d([H.aead.eax,H.aead.ocb],n.preferredAEADAlgorithm)),u.preferredHashAlgorithms=d([H.hash.sha256,H.hash.sha512],n.preferredHashAlgorithm),u.preferredCompressionAlgorithms=d([H.compression.zlib,H.compression.zip,H.compression.uncompressed],n.preferredCompressionAlgorithm),a===0&&(u.isPrimaryUserID=!0),u.features=[0],u.features[0]|=H.features.modificationDetection,n.aeadProtect&&(u.features[0]|=H.features.aead),n.v5Keys&&(u.features[0]|=H.features.v5Keys),r.keyExpirationTime>0&&(u.keyExpirationTime=r.keyExpirationTime,u.keyNeverExpires=!1),{userIDPacket:c,signaturePacket:await as(l,null,e,u,r.date,void 0,void 0,void 0,n)}})).then(o=>{o.forEach(({userIDPacket:a,signaturePacket:d})=>{s.push(a),s.push(d)})}),await Promise.all(t.map(async function(o,a){const d=r.subkeys[a];return{secretSubkeyPacket:o,subkeySignaturePacket:await Hw(o,e,d,n)}})).then(o=>{o.forEach(({secretSubkeyPacket:a,subkeySignaturePacket:d})=>{s.push(a),s.push(d)})});const i={key:e};return s.push(await as(i,null,e,{signatureType:H.signature.keyRevocation,reasonForRevocationFlag:H.reasonForRevocation.noReason,reasonForRevocationString:""},r.date,void 0,void 0,void 0,n)),r.passphrase&&e.clearPrivateParams(),await Promise.all(t.map(async function(o,a){r.subkeys[a].passphrase&&o.clearPrivateParams()})),new Oa(s)}async function RI({armoredKey:e,binaryKey:t,config:r,...n}){if(r={...Xe,...r},!e&&!t)throw Error("readKey: must pass options object containing `armoredKey` or `binaryKey`");if(e&&!te.isString(e))throw Error("readKey: options.armoredKey must be a string");if(t&&!te.isUint8Array(t))throw Error("readKey: options.binaryKey must be a Uint8Array");const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));let i;if(e){const{type:o,data:a}=await Oi(e,r);if(o!==H.armor.publicKey&&o!==H.armor.privateKey)throw Error("Armored text not of type key");i=a}else i=t;return Ww(await Ft.fromBinary(i,wh,r))}async function kI({armoredKey:e,binaryKey:t,config:r,...n}){if(r={...Xe,...r},!e&&!t)throw Error("readPrivateKey: must pass options object containing `armoredKey` or `binaryKey`");if(e&&!te.isString(e))throw Error("readPrivateKey: options.armoredKey must be a string");if(t&&!te.isUint8Array(t))throw Error("readPrivateKey: options.binaryKey must be a Uint8Array");const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));let i;if(e){const{type:a,data:d}=await Oi(e,r);if(a!==H.armor.privateKey)throw Error("Armored text not of type private key");i=d}else i=t;const o=await Ft.fromBinary(i,wh,r);return new Oa(o)}async function MI({armoredKeys:e,binaryKeys:t,config:r,...n}){r={...Xe,...r};let s=e||t;if(!s)throw Error("readKeys: must pass options object containing `armoredKeys` or `binaryKeys`");if(e&&!te.isString(e))throw Error("readKeys: options.armoredKeys must be a string");if(t&&!te.isUint8Array(t))throw Error("readKeys: options.binaryKeys must be a Uint8Array");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));if(e){const{type:c,data:l}=await Oi(e,r);if(c!==H.armor.publicKey&&c!==H.armor.privateKey)throw Error("Armored text not of type key");s=l}const o=[],a=await Ft.fromBinary(s,wh,r),d=a.indexOfTag(H.packet.publicKey,H.packet.secretKey);if(d.length===0)throw Error("No key packet found");for(let c=0;c<d.length;c++){const l=Ww(a.slice(d[c],d[c+1]));o.push(l)}return o}async function OI({armoredKeys:e,binaryKeys:t,config:r}){r={...Xe,...r};let n=e||t;if(!n)throw Error("readPrivateKeys: must pass options object containing `armoredKeys` or `binaryKeys`");if(e&&!te.isString(e))throw Error("readPrivateKeys: options.armoredKeys must be a string");if(t&&!te.isUint8Array(t))throw Error("readPrivateKeys: options.binaryKeys must be a Uint8Array");if(e){const{type:a,data:d}=await Oi(e,r);if(a!==H.armor.privateKey)throw Error("Armored text not of type private key");n=d}const s=[],i=await Ft.fromBinary(n,wh,r),o=i.indexOfTag(H.packet.secretKey);if(o.length===0)throw Error("No secret key packet found");for(let a=0;a<o.length;a++){const d=i.slice(o[a],o[a+1]),c=new Oa(d);s.push(c)}return s}const NI=te.constructAllowedPackets([ss,wo,Hl,E2,Vw,qf,Ia,Bn,xr]),DI=te.constructAllowedPackets([Ia]),xI=te.constructAllowedPackets([xr]);class rn{constructor(t){this.packets=t||new Ft}getEncryptionKeyIDs(){const t=[];return this.packets.filterByTag(H.packet.publicKeyEncryptedSessionKey).forEach(function(r){t.push(r.publicKeyID)}),t}getSigningKeyIDs(){const t=this.unwrapCompressed(),r=t.packets.filterByTag(H.packet.onePassSignature);return r.length>0?r.map(n=>n.issuerKeyID):t.packets.filterByTag(H.packet.signature).map(n=>n.issuerKeyID)}async decrypt(t,r,n,s=new Date,i=Xe){const o=n||await this.decryptSessionKeys(t,r,s,i),a=this.packets.filterByTag(H.packet.symmetricallyEncryptedData,H.packet.symEncryptedIntegrityProtectedData,H.packet.aeadEncryptedData);if(a.length===0)throw Error("No encrypted data found");const d=a[0];let c=null;const l=Promise.all(o.map(async({algorithm:p,data:f})=>{if(!te.isUint8Array(f)||!te.isString(p))throw Error("Invalid session key for decryption.");try{const h=H.write(H.symmetric,p);await d.decrypt(h,f,i)}catch(h){te.printDebugError(h),c=h}}));if(py(d.encrypted),d.encrypted=null,await l,!d.packets||!d.packets.length)throw c||Error("Decryption failed.");const u=new rn(d.packets);return d.packets=new Ft,u}async decryptSessionKeys(t,r,n=new Date,s=Xe){let i,o=[];if(r){const a=this.packets.filterByTag(H.packet.symEncryptedSessionKey);if(a.length===0)throw Error("No symmetrically encrypted session key packet found.");await Promise.all(r.map(async function(d,c){let l;l=c?await Ft.fromBinary(a.write(),DI,s):a,await Promise.all(l.map(async function(u){try{await u.decrypt(d),o.push(u)}catch(p){te.printDebugError(p)}}))}))}else{if(!t)throw Error("No key or password specified.");{const a=this.packets.filterByTag(H.packet.publicKeyEncryptedSessionKey);if(a.length===0)throw Error("No public key encrypted session key packet found.");await Promise.all(a.map(async function(d){await Promise.all(t.map(async function(c){let l=[H.symmetric.aes256,H.symmetric.aes128,H.symmetric.tripledes,H.symmetric.cast5];try{const p=await c.getPrimaryUser(n,void 0,s);p.selfCertification.preferredSymmetricAlgorithms&&(l=l.concat(p.selfCertification.preferredSymmetricAlgorithms))}catch{}const u=(await c.getDecryptionKeys(d.publicKeyID,null,void 0,s)).map(p=>p.keyPacket);await Promise.all(u.map(async function(p){if(!(!p||p.isDummy())){if(!p.isDecrypted())throw Error("Decryption key is not decrypted.");if(s.constantTimePKCS1Decryption&&(d.publicKeyAlgorithm===H.publicKey.rsaEncrypt||d.publicKeyAlgorithm===H.publicKey.rsaEncryptSign||d.publicKeyAlgorithm===H.publicKey.rsaSign||d.publicKeyAlgorithm===H.publicKey.elgamal)){const f=d.write();await Promise.all(Array.from(s.constantTimePKCS1DecryptionSupportedSymmetricAlgorithms).map(async h=>{const y=new qf;y.read(f);const m={sessionKeyAlgorithm:h,sessionKey:yt.generateSessionKey(h)};try{await y.decrypt(p,m),o.push(y)}catch(b){te.printDebugError(b),i=b}}))}else try{if(await d.decrypt(p),!l.includes(H.write(H.symmetric,d.sessionKeyAlgorithm)))throw Error("A non-preferred symmetric algorithm was used.");o.push(d)}catch(f){te.printDebugError(f),i=f}}}))})),py(d.encrypted),d.encrypted=null}))}}if(o.length>0){if(o.length>1){const a=new Set;o=o.filter(d=>{const c=d.sessionKeyAlgorithm+te.uint8ArrayToString(d.sessionKey);return!a.has(c)&&(a.add(c),!0)})}return o.map(a=>({data:a.sessionKey,algorithm:H.read(H.symmetric,a.sessionKeyAlgorithm)}))}throw i||Error("Session key decryption failed.")}getLiteralData(){const t=this.unwrapCompressed().packets.findPacket(H.packet.literalData);return t&&t.getBytes()||null}getFilename(){const t=this.unwrapCompressed().packets.findPacket(H.packet.literalData);return t&&t.getFilename()||null}getText(){const t=this.unwrapCompressed().packets.findPacket(H.packet.literalData);return t?t.getText():null}static async generateSessionKey(t=[],r=new Date,n=[],s=Xe){const i=await Iy("symmetric",t,r,n,s),o=H.read(H.symmetric,i),a=s.aeadProtect&&await async function(d,c=new Date,l=[],u=Xe){let p=!0;return await Promise.all(d.map(async function(f,h){const y=await f.getPrimaryUser(c,l[h],u);y.selfCertification.features&&y.selfCertification.features[0]&H.features.aead||(p=!1)})),p}(t,r,n,s)?H.read(H.aead,await Iy("aead",t,r,n,s)):void 0;return await Promise.all(t.map(d=>d.getEncryptionKey().catch(()=>null).then(c=>{if(c&&c.keyPacket.algorithm===H.publicKey.x25519&&!te.isAES(i))throw Error("Could not generate a session key compatible with the given `encryptionKeys`: X22519 keys can only be used to encrypt AES session keys; change `config.preferredSymmetricAlgorithm` accordingly.")}))),{data:yt.generateSessionKey(i),algorithm:o,aeadAlgorithm:a}}async encrypt(t,r,n,s=!1,i=[],o=new Date,a=[],d=Xe){if(n){if(!te.isUint8Array(n.data)||!te.isString(n.algorithm))throw Error("Invalid session key for encryption.")}else if(t&&t.length)n=await rn.generateSessionKey(t,o,a,d);else{if(!r||!r.length)throw Error("No keys, passwords, or session key provided.");n=await rn.generateSessionKey(void 0,void 0,void 0,d)}const{data:c,algorithm:l,aeadAlgorithm:u}=n,p=await rn.encryptSessionKey(c,l,u,t,r,s,i,o,a,d);let f;u?(f=new Hl,f.aeadAlgorithm=H.write(H.aead,u)):f=new E2,f.packets=this.packets;const h=H.write(H.symmetric,l);return await f.encrypt(h,c,d),p.packets.push(f),f.packets=new Ft,p}static async encryptSessionKey(t,r,n,s,i,o=!1,a=[],d=new Date,c=[],l=Xe){const u=new Ft,p=H.write(H.symmetric,r),f=n&&H.write(H.aead,n);if(s){const h=await Promise.all(s.map(async function(y,m){const b=await y.getEncryptionKey(a[m],d,c,l),v=new qf;return v.publicKeyID=o?Ls.wildcard():b.getKeyID(),v.publicKeyAlgorithm=b.keyPacket.algorithm,v.sessionKey=t,v.sessionKeyAlgorithm=p,await v.encrypt(b.keyPacket),delete v.sessionKey,v}));u.push(...h)}if(i){const h=async function(v,E){try{return await v.decrypt(E),1}catch{return 0}},y=(v,E)=>v+E,m=async function(v,E,_,C){const k=new Ia(l);return k.sessionKey=v,k.sessionKeyAlgorithm=E,_&&(k.aeadAlgorithm=_),await k.encrypt(C,l),l.passwordCollisionCheck&&(await Promise.all(i.map(D=>h(k,D)))).reduce(y)!==1?m(v,E,C):(delete k.sessionKey,k)},b=await Promise.all(i.map(v=>m(t,p,f,v)));u.push(...b)}return new rn(u)}async sign(t=[],r=null,n=[],s=new Date,i=[],o=[],a=Xe){const d=new Ft,c=this.packets.findPacket(H.packet.literalData);if(!c)throw Error("No literal data packet to sign.");let l,u;const p=c.text===null?H.signature.binary:H.signature.text;if(r)for(u=r.packets.filterByTag(H.packet.signature),l=u.length-1;l>=0;l--){const f=u[l],h=new Bn;h.signatureType=f.signatureType,h.hashAlgorithm=f.hashAlgorithm,h.publicKeyAlgorithm=f.publicKeyAlgorithm,h.issuerKeyID=f.issuerKeyID,t.length||l!==0||(h.flags=1),d.push(h)}return await Promise.all(Array.from(t).reverse().map(async function(f,h){if(!f.isPrivate())throw Error("Need private key for signing");const y=n[t.length-1-h],m=await f.getSigningKey(y,s,i,a),b=new Bn;return b.signatureType=p,b.hashAlgorithm=await Gw(f,m.keyPacket,s,i,a),b.publicKeyAlgorithm=m.keyPacket.algorithm,b.issuerKeyID=m.getKeyID(),h===t.length-1&&(b.flags=1),b})).then(f=>{f.forEach(h=>d.push(h))}),d.push(c),d.push(...await Ry(c,t,r,n,s,i,o,!1,a)),new rn(d)}compress(t,r=Xe){if(t===H.compression.uncompressed)return this;const n=new wo(r);n.algorithm=t,n.packets=this.packets;const s=new Ft;return s.push(n),new rn(s)}async signDetached(t=[],r=null,n=[],s=new Date,i=[],o=[],a=Xe){const d=this.packets.findPacket(H.packet.literalData);if(!d)throw Error("No literal data packet to sign.");return new Us(await Ry(d,t,r,n,s,i,o,!0,a))}async verify(t,r=new Date,n=Xe){const s=this.unwrapCompressed(),i=s.packets.filterByTag(H.packet.literalData);if(i.length!==1)throw Error("Can only verify message with one literal data packet.");let o=s.packets;_r(o.stream)&&(o=o.concat(await vr(o.stream,c=>c||[])));const a=o.filterByTag(H.packet.onePassSignature).reverse(),d=o.filterByTag(H.packet.signature);return a.length&&!d.length&&te.isStream(o.stream)&&!_r(o.stream)?(await Promise.all(a.map(async c=>{c.correspondingSig=new Promise((l,u)=>{c.correspondingSigResolve=l,c.correspondingSigReject=u}),c.signatureData=cs(async()=>(await c.correspondingSig).signatureData),c.hashed=vr(await c.hash(c.signatureType,i[0],void 0,!1)),c.hashed.catch(()=>{})})),o.stream=Ii(o.stream,async(c,l)=>{const u=Mi(c),p=vn(l);try{for(let f=0;f<a.length;f++){const{value:h}=await u.read();a[f].correspondingSigResolve(h)}await u.readToEnd(),await p.ready,await p.close()}catch(f){a.forEach(h=>{h.correspondingSigReject(f)}),await p.abort(f)}}),df(a,i,t,r,!1,n)):df(d,i,t,r,!1,n)}verifyDetached(t,r,n=new Date,s=Xe){const i=this.unwrapCompressed().packets.filterByTag(H.packet.literalData);if(i.length!==1)throw Error("Can only verify message with one literal data packet.");return df(t.packets.filterByTag(H.packet.signature),i,r,n,!0,s)}unwrapCompressed(){const t=this.packets.filterByTag(H.packet.compressedData);return t.length?new rn(t[0].packets):this}async appendSignature(t,r=Xe){await this.packets.read(te.isUint8Array(t)?t:(await Oi(t)).data,xI,r)}write(){return this.packets.write()}armor(t=Xe){return ka(H.armor.message,this.write(),null,null,null,t)}}async function Ry(e,t,r=null,n=[],s=new Date,i=[],o=[],a=!1,d=Xe){const c=new Ft,l=e.text===null?H.signature.binary:H.signature.text;if(await Promise.all(t.map(async(u,p)=>{const f=i[p];if(!u.isPrivate())throw Error("Need private key for signing");const h=await u.getSigningKey(n[p],s,f,d);return as(e,u,h.keyPacket,{signatureType:l},s,f,o,a,d)})).then(u=>{c.push(...u)}),r){const u=r.packets.filterByTag(H.packet.signature);c.push(...u)}return c}async function df(e,t,r,n=new Date,s=!1,i=Xe){return Promise.all(e.filter(function(o){return["text","binary"].includes(H.read(H.signature,o.signatureType))}).map(async function(o){return async function(a,d,c,l=new Date,u=!1,p=Xe){let f,h;for(const b of c){const v=b.getKeys(a.issuerKeyID);if(v.length>0){f=b,h=v[0];break}}const y=a instanceof Bn?a.correspondingSig:a,m={keyID:a.issuerKeyID,verified:(async()=>{if(!h)throw Error("Could not find signing key with key ID "+a.issuerKeyID.toHex());await a.verify(h.keyPacket,a.signatureType,d[0],l,u,p);const b=await y;if(h.getCreationTime()>b.created)throw Error("Key is newer than the signature");try{await f.getSigningKey(h.getKeyID(),b.created,void 0,p)}catch(v){if(!p.allowInsecureVerificationWithReformattedKeys||!v.message.match(/Signature creation time is in the future/))throw v;await f.getSigningKey(h.getKeyID(),l,void 0,p)}return!0})(),signature:(async()=>{const b=await y,v=new Ft;return b&&v.push(b),new Us(v)})()};return m.signature.catch(()=>{}),m.verified.catch(()=>{}),m}(o,t,r,n,s,i)}))}async function UI({armoredMessage:e,binaryMessage:t,config:r,...n}){r={...Xe,...r};let s=e||t;if(!s)throw Error("readMessage: must pass options object containing `armoredMessage` or `binaryMessage`");if(e&&!te.isString(e)&&!te.isStream(e))throw Error("readMessage: options.armoredMessage must be a string or stream");if(t&&!te.isUint8Array(t)&&!te.isStream(t))throw Error("readMessage: options.binaryMessage must be a Uint8Array or stream");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));const o=te.isStream(s);if(o&&(await x8(),s=Ll(s)),e){const{type:c,data:l}=await Oi(s,r);if(c!==H.armor.message)throw Error("Armored text not of type message");s=l}const a=await Ft.fromBinary(s,NI,r),d=new rn(a);return d.fromStream=o,d}async function BI({text:e,binary:t,filename:r,date:n=new Date,format:s=e!==void 0?"utf8":"binary",...i}){let o=e!==void 0?e:t;if(o===void 0)throw Error("createMessage: must pass options object containing `text` or `binary`");if(e&&!te.isString(e)&&!te.isStream(e))throw Error("createMessage: options.text must be a string or stream");if(t&&!te.isUint8Array(t)&&!te.isStream(t))throw Error("createMessage: options.binary must be a Uint8Array or stream");const a=Object.keys(i);if(a.length>0)throw Error("Unknown option: "+a.join(", "));const d=te.isStream(o);d&&(await x8(),o=Ll(o));const c=new ss(n);e!==void 0?c.setText(o,H.write(H.literal,s)):c.setBytes(o,H.write(H.literal,s)),r!==void 0&&c.setFilename(r);const l=new Ft;l.push(c);const u=new rn(l);return u.fromStream=d,u}const LI=te.constructAllowedPackets([xr]);class Ci{constructor(t,r){if(this.text=te.removeTrailingSpaces(t).replace(/\r?\n/g,`\r
|
|
38
|
-
`),r&&!(r instanceof Us))throw Error("Invalid signature input");this.signature=r||new Us(new Ft)}getSigningKeyIDs(){const t=[];return this.signature.packets.forEach(function(r){t.push(r.issuerKeyID)}),t}async sign(t,r=null,n=[],s=new Date,i=[],o=[],a=Xe){const d=new ss;d.setText(this.text);const c=new Us(await Ry(d,t,r,n,s,i,o,!0,a));return new Ci(this.text,c)}verify(t,r=new Date,n=Xe){const s=this.signature.packets.filterByTag(H.packet.signature),i=new ss;return i.setText(this.text),df(s,[i],t,r,!0,n)}getText(){return this.text.replace(/\r\n/g,`
|
|
39
|
-
`)}armor(t=Xe){let r=this.signature.packets.map(function(s){return H.read(H.hash,s.hashAlgorithm).toUpperCase()});r=r.filter(function(s,i,o){return o.indexOf(s)===i});const n={hash:r.join(),text:this.text,data:this.signature.packets.write()};return ka(H.armor.signed,n,void 0,void 0,void 0,t)}}async function KI({cleartextMessage:e,config:t,...r}){if(t={...Xe,...t},!e)throw Error("readCleartextMessage: must pass options object containing `cleartextMessage`");if(!te.isString(e))throw Error("readCleartextMessage: options.cleartextMessage must be a string");const n=Object.keys(r);if(n.length>0)throw Error("Unknown option: "+n.join(", "));const s=await Oi(e);if(s.type!==H.armor.signed)throw Error("No cleartext signed message.");const i=await Ft.fromBinary(s.data,LI,t);(function(a,d){const c=function(p){const f=h=>y=>h.hashAlgorithm===y;for(let h=0;h<d.length;h++)if(d[h].constructor.tag===H.packet.signature&&!p.some(f(d[h])))return!1;return!0};let l=null,u=[];if(a.forEach(function(p){if(l=p.match(/^Hash: (.+)$/),!l)throw Error('Only "Hash" header allowed in cleartext signed message');l=l[1].replace(/\s/g,""),l=l.split(","),l=l.map(function(f){f=f.toLowerCase();try{return H.write(H.hash,f)}catch{throw Error("Unknown hash algorithm in armor header: "+f)}}),u=u.concat(l)}),!u.length&&!c([H.hash.md5]))throw Error('If no "Hash" header in cleartext signed message, then only MD5 signatures allowed');if(u.length&&!c(u))throw Error("Hash algorithm mismatch in armor header and signature")})(s.headers,i);const o=new Us(i);return new Ci(s.text,o)}async function qI({text:e,...t}){if(!e)throw Error("createCleartextMessage: must pass options object containing `text`");if(!te.isString(e))throw Error("createCleartextMessage: options.text must be a string");const r=Object.keys(t);if(r.length>0)throw Error("Unknown option: "+r.join(", "));return new Ci(e)}async function jI({userIDs:e=[],passphrase:t,type:r="ecc",rsaBits:n=4096,curve:s="curve25519",keyExpirationTime:i=0,date:o=new Date,subkeys:a=[{}],format:d="armored",config:c,...l}){qn(c={...Xe,...c}),e=rr(e);const u=Object.keys(l);if(u.length>0)throw Error("Unknown option: "+u.join(", "));if(e.length===0)throw Error("UserIDs are required for key generation");if(r==="rsa"&&n<c.minRSABits)throw Error(`rsaBits should be at least ${c.minRSABits}, got: ${n}`);const p={userIDs:e,passphrase:t,type:r,rsaBits:n,curve:s,keyExpirationTime:i,date:o,subkeys:a};try{const{key:f,revocationCertificate:h}=await async function(y,m){y.sign=!0,(y=Cy(y)).subkeys=y.subkeys.map((C,k)=>Cy(y.subkeys[k],y));let b=[II(y,m)];b=b.concat(y.subkeys.map(C=>Fw(C,m)));const v=await Promise.all(b),E=await Yw(v[0],v.slice(1),y,m),_=await E.getRevocationCertificate(y.date,m);return E.revocationSignatures=[],{key:E,revocationCertificate:_}}(p,c);return f.getKeys().forEach(({keyPacket:y})=>Ja(y,c)),{privateKey:Bs(f,d,c),publicKey:Bs(f.toPublic(),d,c),revocationCertificate:h}}catch(f){throw te.wrapError("Error generating keypair",f)}}async function $I({privateKey:e,userIDs:t=[],passphrase:r,keyExpirationTime:n=0,date:s,format:i="armored",config:o,...a}){qn(o={...Xe,...o}),t=rr(t);const d=Object.keys(a);if(d.length>0)throw Error("Unknown option: "+d.join(", "));if(t.length===0)throw Error("UserIDs are required for key reformat");const c={privateKey:e,userIDs:t,passphrase:r,keyExpirationTime:n,date:s};try{const{key:l,revocationCertificate:u}=await async function(p,f){p=E(p);const{privateKey:h}=p;if(!h.isPrivate())throw Error("Cannot reformat a public key");if(h.keyPacket.isDummy())throw Error("Cannot reformat a gnu-dummy primary key");if(!h.getKeys().every(({keyPacket:_})=>_.isDecrypted()))throw Error("Key is not decrypted");const y=h.keyPacket;p.subkeys||(p.subkeys=await Promise.all(h.subkeys.map(async _=>{const C=_.keyPacket,k={key:y,bind:C},D=await Zn(_.bindingSignatures,y,H.signature.subkeyBinding,k,null,f).catch(()=>({}));return{sign:D.keyFlags&&D.keyFlags[0]&H.keyFlags.signData}})));const m=h.subkeys.map(_=>_.keyPacket);if(p.subkeys.length!==m.length)throw Error("Number of subkey options does not match number of subkeys");p.subkeys=p.subkeys.map(_=>E(_,p));const b=await Yw(y,m,p,f),v=await b.getRevocationCertificate(p.date,f);return b.revocationSignatures=[],{key:b,revocationCertificate:v};function E(_,C={}){return _.keyExpirationTime=_.keyExpirationTime||C.keyExpirationTime,_.passphrase=te.isString(_.passphrase)?_.passphrase:C.passphrase,_.date=_.date||C.date,_}}(c,o);return{privateKey:Bs(l,i,o),publicKey:Bs(l.toPublic(),i,o),revocationCertificate:u}}catch(l){throw te.wrapError("Error reformatting keypair",l)}}async function VI({key:e,revocationCertificate:t,reasonForRevocation:r,date:n=new Date,format:s="armored",config:i,...o}){qn(i={...Xe,...i});const a=Object.keys(o);if(a.length>0)throw Error("Unknown option: "+a.join(", "));try{const d=t?await e.applyRevocationCertificate(t,n,i):await e.revoke(r,n,i);return d.isPrivate()?{privateKey:Bs(d,s,i),publicKey:Bs(d.toPublic(),s,i)}:{privateKey:null,publicKey:Bs(d,s,i)}}catch(d){throw te.wrapError("Error revoking key",d)}}async function FI({privateKey:e,passphrase:t,config:r,...n}){qn(r={...Xe,...r});const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));if(!e.isPrivate())throw Error("Cannot decrypt a public key");const i=e.clone(!0),o=te.isArray(t)?t:[t];try{return await Promise.all(i.getKeys().map(a=>te.anyPromise(o.map(d=>a.keyPacket.decrypt(d))))),await i.validate(r),i}catch(a){throw i.clearPrivateParams(),te.wrapError("Error decrypting private key",a)}}async function HI({privateKey:e,passphrase:t,config:r,...n}){qn(r={...Xe,...r});const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));if(!e.isPrivate())throw Error("Cannot encrypt a public key");const i=e.clone(!0),o=i.getKeys(),a=te.isArray(t)?t:Array(o.length).fill(t);if(a.length!==o.length)throw Error("Invalid number of passphrases given for key encryption");try{return await Promise.all(o.map(async(d,c)=>{const{keyPacket:l}=d;await l.encrypt(a[c],r),l.clearPrivateParams()})),i}catch(d){throw i.clearPrivateParams(),te.wrapError("Error encrypting private key",d)}}async function GI({message:e,encryptionKeys:t,signingKeys:r,passwords:n,sessionKey:s,format:i="armored",signature:o=null,wildcard:a=!1,signingKeyIDs:d=[],encryptionKeyIDs:c=[],date:l=new Date,signingUserIDs:u=[],encryptionUserIDs:p=[],signatureNotations:f=[],config:h,...y}){if(qn(h={...Xe,...h}),S2(e),P2(i),t=rr(t),r=rr(r),n=rr(n),d=rr(d),c=rr(c),u=rr(u),p=rr(p),f=rr(f),y.detached)throw Error("The `detached` option has been removed from openpgp.encrypt, separately call openpgp.sign instead. Don't forget to remove the `privateKeys` option as well.");if(y.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.encrypt, pass `encryptionKeys` instead");if(y.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.encrypt, pass `signingKeys` instead");if(y.armor!==void 0)throw Error("The `armor` option has been removed from openpgp.encrypt, pass `format` instead.");const m=Object.keys(y);if(m.length>0)throw Error("Unknown option: "+m.join(", "));r||(r=[]);const b=e.fromStream;try{if((r.length||o)&&(e=await e.sign(r,o,d,l,u,f,h)),e=e.compress(await Iy("compression",t,l,p,h),h),e=await e.encrypt(t,n,s,a,c,l,p,h),i==="object")return e;const v=i==="armored";return Eh(v?e.armor(h):e.write(),b,v?"utf8":"binary")}catch(v){throw te.wrapError("Error encrypting message",v)}}async function zI({message:e,decryptionKeys:t,passwords:r,sessionKeys:n,verificationKeys:s,expectSigned:i=!1,format:o="utf8",signature:a=null,date:d=new Date,config:c,...l}){if(qn(c={...Xe,...c}),S2(e),s=rr(s),t=rr(t),r=rr(r),n=rr(n),l.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.decrypt, pass `decryptionKeys` instead");if(l.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.decrypt, pass `verificationKeys` instead");const u=Object.keys(l);if(u.length>0)throw Error("Unknown option: "+u.join(", "));try{const p=await e.decrypt(t,r,n,d,c);s||(s=[]);const f={};if(f.signatures=a?await p.verifyDetached(a,s,d,c):await p.verify(s,d,c),f.data=o==="binary"?p.getLiteralData():p.getText(),f.filename=p.getFilename(),Zw(f,e),i){if(s.length===0)throw Error("Verification keys are required to verify message signatures");if(f.signatures.length===0)throw Error("Message is not signed");f.data=ln([f.data,cs(async()=>{await te.anyPromise(f.signatures.map(h=>h.verified))})])}return f.data=await Eh(f.data,e.fromStream,o),f}catch(p){throw te.wrapError("Error decrypting message",p)}}async function WI({message:e,signingKeys:t,format:r="armored",detached:n=!1,signingKeyIDs:s=[],date:i=new Date,signingUserIDs:o=[],signatureNotations:a=[],config:d,...c}){if(qn(d={...Xe,...d}),Jw(e),P2(r),t=rr(t),s=rr(s),o=rr(o),a=rr(a),c.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.sign, pass `signingKeys` instead");if(c.armor!==void 0)throw Error("The `armor` option has been removed from openpgp.sign, pass `format` instead.");const l=Object.keys(c);if(l.length>0)throw Error("Unknown option: "+l.join(", "));if(e instanceof Ci&&r==="binary")throw Error("Cannot return signed cleartext message in binary format");if(e instanceof Ci&&n)throw Error("Cannot detach-sign a cleartext message");if(!t||t.length===0)throw Error("No signing keys provided");try{let u;if(u=n?await e.signDetached(t,void 0,s,i,o,a,d):await e.sign(t,void 0,s,i,o,a,d),r==="object")return u;const p=r==="armored";return u=p?u.armor(d):u.write(),n&&(u=Ii(e.packets.write(),async(f,h)=>{await Promise.all([ts(u,h),vr(f).catch(()=>{})])})),Eh(u,e.fromStream,p?"utf8":"binary")}catch(u){throw te.wrapError("Error signing message",u)}}async function YI({message:e,verificationKeys:t,expectSigned:r=!1,format:n="utf8",signature:s=null,date:i=new Date,config:o,...a}){if(qn(o={...Xe,...o}),Jw(e),t=rr(t),a.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.verify, pass `verificationKeys` instead");const d=Object.keys(a);if(d.length>0)throw Error("Unknown option: "+d.join(", "));if(e instanceof Ci&&n==="binary")throw Error("Can't return cleartext message data as binary");if(e instanceof Ci&&s)throw Error("Can't verify detached cleartext signature");try{const c={};if(c.signatures=s?await e.verifyDetached(s,t,i,o):await e.verify(t,i,o),c.data=n==="binary"?e.getLiteralData():e.getText(),e.fromStream&&!s&&Zw(c,e),r){if(c.signatures.length===0)throw Error("Message is not signed");c.data=ln([c.data,cs(async()=>{await te.anyPromise(c.signatures.map(l=>l.verified))})])}return c.data=await Eh(c.data,e.fromStream,n),c}catch(c){throw te.wrapError("Error verifying signed message",c)}}async function JI({encryptionKeys:e,date:t=new Date,encryptionUserIDs:r=[],config:n,...s}){if(qn(n={...Xe,...n}),e=rr(e),r=rr(r),s.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.generateSessionKey, pass `encryptionKeys` instead");const i=Object.keys(s);if(i.length>0)throw Error("Unknown option: "+i.join(", "));try{return await rn.generateSessionKey(e,t,r,n)}catch(o){throw te.wrapError("Error generating session key",o)}}async function ZI({data:e,algorithm:t,aeadAlgorithm:r,encryptionKeys:n,passwords:s,format:i="armored",wildcard:o=!1,encryptionKeyIDs:a=[],date:d=new Date,encryptionUserIDs:c=[],config:l,...u}){if(qn(l={...Xe,...l}),function(f,h){if(!te.isUint8Array(f))throw Error("Parameter ["+(h||"data")+"] must be of type Uint8Array")}(e),function(f,h){if(!te.isString(f))throw Error("Parameter ["+(h||"data")+"] must be of type String")}(t,"algorithm"),P2(i),n=rr(n),s=rr(s),a=rr(a),c=rr(c),u.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.encryptSessionKey, pass `encryptionKeys` instead");const p=Object.keys(u);if(p.length>0)throw Error("Unknown option: "+p.join(", "));if(!(n&&n.length!==0||s&&s.length!==0))throw Error("No encryption keys or passwords provided.");try{return Bs(await rn.encryptSessionKey(e,t,r,n,s,o,a,d,c,l),i,l)}catch(f){throw te.wrapError("Error encrypting session key",f)}}async function XI({message:e,decryptionKeys:t,passwords:r,date:n=new Date,config:s,...i}){if(qn(s={...Xe,...s}),S2(e),t=rr(t),r=rr(r),i.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.decryptSessionKeys, pass `decryptionKeys` instead");const o=Object.keys(i);if(o.length>0)throw Error("Unknown option: "+o.join(", "));try{return await e.decryptSessionKeys(t,r,n,s)}catch(a){throw te.wrapError("Error decrypting session keys",a)}}function S2(e){if(!(e instanceof rn))throw Error("Parameter [message] needs to be of type Message")}function Jw(e){if(!(e instanceof Ci||e instanceof rn))throw Error("Parameter [message] needs to be of type Message or CleartextMessage")}function P2(e){if(e!=="armored"&&e!=="binary"&&e!=="object")throw Error("Unsupported format "+e)}const QI=Object.keys(Xe).length;function qn(e){const t=Object.keys(e);if(t.length!==QI){for(const r of t)if(Xe[r]===void 0)throw Error("Unknown config property: "+r)}}function rr(e){return e&&!te.isArray(e)&&(e=[e]),e}async function Eh(e,t,r="utf8"){const n=te.isStream(e);return n==="array"?vr(e):t==="node"?(e=u2(e),r!=="binary"&&e.setEncoding(r),e):t==="web"&&n==="ponyfill"?N8(e):e}function Zw(e,t){e.data=Ii(t.packets.stream,async(r,n)=>{await ts(e.data,n,{preventClose:!0});const s=vn(n);try{await vr(r,i=>i),await s.close()}catch(i){await s.abort(i)}})}function Bs(e,t,r){switch(t){case"object":return e;case"armored":return e.armor(r);case"binary":return e.write();default:throw Error("Unsupported format "+t)}}const Ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:e=>`Symbol(${e})`;function T2(){}const w3=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:void 0;function _n(e){return typeof e=="object"&&e!==null||typeof e=="function"}const Xw=T2,I2=Promise,eC=Promise.prototype.then,tC=Promise.resolve.bind(I2),rC=Promise.reject.bind(I2);function fn(e){return new I2(e)}function cr(e){return tC(e)}function kt(e){return rC(e)}function Xi(e,t,r){return eC.call(e,t,r)}function ti(e,t,r){Xi(Xi(e,t,r),void 0,Xw)}function C0(e,t){ti(e,t)}function Qw(e,t){ti(e,void 0,t)}function wa(e,t,r){return Xi(e,t,r)}function Wl(e){Xi(e,void 0,Xw)}const e7=(()=>{const e=w3&&w3.queueMicrotask;if(typeof e=="function")return e;const t=cr(void 0);return r=>Xi(t,r)})();function Ah(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function Na(e,t,r){try{return cr(Ah(e,t,r))}catch(n){return kt(n)}}class Ri{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){const r=this._back;let n=r;r._elements.length===16383&&(n={_elements:[],_next:void 0}),r._elements.push(t),n!==r&&(this._back=n,r._next=n),++this._size}shift(){const t=this._front;let r=t;const n=this._cursor;let s=n+1;const i=t._elements,o=i[n];return s===16384&&(r=t._next,s=0),--this._size,this._cursor=s,t!==r&&(this._front=r),i[n]=void 0,o}forEach(t){let r=this._cursor,n=this._front,s=n._elements;for(;!(r===s.length&&n._next===void 0||r===s.length&&(n=n._next,s=n._elements,r=0,s.length===0));)t(s[r]),++r}peek(){const t=this._front,r=this._cursor;return t._elements[r]}}function t7(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?ky(e):t._state==="closed"?function(r){ky(r),n7(r)}(e):r7(e,t._storedError)}function C2(e,t){return Ea(e._ownerReadableStream,t)}function ba(e){e._ownerReadableStream._state==="readable"?R2(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(t,r){r7(t,r)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function po(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function ky(e){e._closedPromise=fn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function r7(e,t){ky(e),R2(e,t)}function R2(e,t){e._closedPromise_reject!==void 0&&(Wl(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function n7(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const i7=Ht("[[AbortSteps]]"),s7=Ht("[[ErrorSteps]]"),k2=Ht("[[CancelSteps]]"),M2=Ht("[[PullSteps]]"),E3=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},nC=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Qi(e,t){if(e!==void 0&&typeof(r=e)!="object"&&typeof r!="function")throw new TypeError(t+" is not an object.");var r}function ni(e,t){if(typeof e!="function")throw new TypeError(t+" is not a function.")}function a7(e,t){if(!function(r){return typeof r=="object"&&r!==null||typeof r=="function"}(e))throw new TypeError(t+" is not an object.")}function os(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function My(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function O2(e){return Number(e)}function A3(e){return e===0?0:e}function o7(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=A3(n),!E3(n))throw new TypeError(t+" is not a finite number");if(n=function(s){return A3(nC(s))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return E3(n)&&n!==0?n:0}function N2(e,t){if(!vs(e))throw new TypeError(t+" is not a ReadableStream.")}function ff(e){return new Vf(e)}function c7(e,t){e._reader._readRequests.push(t)}function D2(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Sh(e){return e._reader._readRequests.length}function u7(e){const t=e._reader;return t!==void 0&&!!va(t)}class Vf{constructor(t){if(os(t,1,"ReadableStreamDefaultReader"),N2(t,"First parameter"),Ns(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");t7(this,t),this._readRequests=new Ri}get closed(){return va(this)?this._closedPromise:kt(Ad("closed"))}cancel(t=void 0){return va(this)?this._ownerReadableStream===void 0?kt(po("cancel")):C2(this,t):kt(Ad("cancel"))}read(){if(!va(this))return kt(Ad("read"));if(this._ownerReadableStream===void 0)return kt(po("read from"));let t,r;const n=fn((s,i)=>{t=s,r=i});return Ph(this,{_chunkSteps:s=>t({value:s,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:s=>r(s)}),n}releaseLock(){if(!va(this))throw Ad("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ba(this)}}}function va(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function Ph(e,t){const r=e._ownerReadableStream;r._disturbed=!0,r._state==="closed"?t._closeSteps():r._state==="errored"?t._errorSteps(r._storedError):r._readableStreamController[M2](t)}function Ad(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}let Ff;Object.defineProperties(Vf.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Vf.prototype,Ht.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),typeof Ht.asyncIterator=="symbol"&&(Ff={[Ht.asyncIterator](){return this}},Object.defineProperty(Ff,Ht.asyncIterator,{enumerable:!1}));class iC{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){const t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?wa(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){const r=()=>this._returnSteps(t);return this._ongoingPromise?wa(this._ongoingPromise,r,r):r()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const t=this._reader;if(t._ownerReadableStream===void 0)return kt(po("iterate"));let r,n;const s=fn((i,o)=>{r=i,n=o});return Ph(t,{_chunkSteps:i=>{this._ongoingPromise=void 0,e7(()=>r({value:i,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,ba(t),r({value:void 0,done:!0})},_errorSteps:i=>{this._ongoingPromise=void 0,this._isFinished=!0,ba(t),n(i)}}),s}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;const r=this._reader;if(r._ownerReadableStream===void 0)return kt(po("finish iterating"));if(!this._preventCancel){const n=C2(r,t);return ba(r),wa(n,()=>({value:t,done:!0}))}return ba(r),cr({value:t,done:!0})}}const l7={next(){return S3(this)?this._asyncIteratorImpl.next():kt(P3("next"))},return(e){return S3(this)?this._asyncIteratorImpl.return(e):kt(P3("return"))}};function S3(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl")}function P3(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Ff!==void 0&&Object.setPrototypeOf(l7,Ff);const d7=Number.isNaN||function(e){return e!=e};function f7(e){return!!function(t){return!(typeof t!="number"||d7(t)||t<0)}(e)&&e!==1/0}function Oy(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function x2(e,t,r){if(!f7(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Vs(e){e._queue=new Ri,e._queueTotalSize=0}function R0(e){return e.slice()}class Hf{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!k0(this))throw M0("view");return this._view}respond(t){if(!k0(this))throw M0("respond");if(os(t,1,"respond"),t=o7(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(r,n){if(n=Number(n),!f7(n))throw new RangeError("bytesWritten must be a finite");T3(r,n)}(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!k0(this))throw M0("respondWithNewView");if(os(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");(function(r,n){const s=r._pendingPullIntos.peek();if(s.byteOffset+s.bytesFilled!==n.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(s.byteLength!==n.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");s.buffer=n.buffer,T3(r,n.byteLength)})(this._associatedReadableByteStreamController,t)}}Object.defineProperties(Hf.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Hf.prototype,Ht.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Gf{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Ga(this))throw $o("byobRequest");if(this._byobRequest===null&&this._pendingPullIntos.length>0){const t=this._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(Hf.prototype);(function(s,i,o){s._associatedReadableByteStreamController=i,s._view=o})(n,this,r),this._byobRequest=n}return this._byobRequest}get desiredSize(){if(!Ga(this))throw $o("desiredSize");return b7(this)}close(){if(!Ga(this))throw $o("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);(function(r){const n=r._controlledReadableByteStream;if(!(r._closeRequested||n._state!=="readable")){if(r._queueTotalSize>0)return void(r._closeRequested=!0);if(r._pendingPullIntos.length>0&&r._pendingPullIntos.peek().bytesFilled>0){const s=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Rl(r,s),s}zf(r),Yl(n)}})(this)}enqueue(t){if(!Ga(this))throw $o("enqueue");if(os(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);(function(n,s){const i=n._controlledReadableByteStream;if(n._closeRequested||i._state!=="readable")return;const o=s.buffer,a=s.byteOffset,d=s.byteLength,c=o;u7(i)?Sh(i)===0?hf(n,c,a,d):D2(i,new Uint8Array(c,a,d),!1):B2(i)?(hf(n,c,a,d),m7(n)):hf(n,c,a,d),Ra(n)})(this,t)}error(t=void 0){if(!Ga(this))throw $o("error");Rl(this,t)}[k2](t){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0),Vs(this);const r=this._cancelAlgorithm(t);return zf(this),r}[M2](t){const r=this._controlledReadableByteStream;if(this._queueTotalSize>0){const s=this._queue.shift();this._queueTotalSize-=s.byteLength,g7(this);const i=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return void t._chunkSteps(i)}const n=this._autoAllocateChunkSize;if(n!==void 0){let s;try{s=new ArrayBuffer(n)}catch(o){return void t._errorSteps(o)}const i={buffer:s,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(i)}c7(r,t),Ra(this)}}function Ga(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function k0(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function Ra(e){if(function(r){const n=r._controlledReadableByteStream;return n._state!=="readable"||r._closeRequested||!r._started?!1:!!(u7(n)&&Sh(n)>0||B2(n)&&v7(n)>0||b7(r)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,ti(e._pullAlgorithm(),()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Ra(e))},r=>{Rl(e,r)})}}function Ny(e,t){let r=!1;e._state==="closed"&&(r=!0);const n=h7(t);t.readerType==="default"?D2(e,n,r):function(s,i,o){const a=s._reader,d=a._readIntoRequests.shift();o?d._closeSteps(i):d._chunkSteps(i)}(e,n,r)}function h7(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function hf(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function p7(e,t){const r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,s=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),i=t.bytesFilled+s,o=i-i%r;let a=s,d=!1;o>n&&(a=o-t.bytesFilled,d=!0);const c=e._queue;for(;a>0;){const y=c.peek(),m=Math.min(a,y.byteLength),b=t.byteOffset+t.bytesFilled;l=t.buffer,u=b,p=y.buffer,f=y.byteOffset,h=m,new Uint8Array(l).set(new Uint8Array(p,f,h),u),y.byteLength===m?c.shift():(y.byteOffset+=m,y.byteLength-=m),e._queueTotalSize-=m,y7(e,m,t),a-=m}var l,u,p,f,h;return d}function y7(e,t,r){U2(e),r.bytesFilled+=t}function g7(e){e._queueTotalSize===0&&e._closeRequested?(zf(e),Yl(e._controlledReadableByteStream)):Ra(e)}function U2(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function m7(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;const t=e._pendingPullIntos.peek();p7(e,t)&&(Dy(e),Ny(e._controlledReadableByteStream,t))}}function T3(e,t){const r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");(function(n,s){s.buffer=s.buffer;const i=n._controlledReadableByteStream;if(B2(i))for(;v7(i)>0;)Ny(i,Dy(n))})(e,r)}else(function(n,s,i){if(i.bytesFilled+s>i.byteLength)throw new RangeError("bytesWritten out of range");if(y7(n,s,i),i.bytesFilled<i.elementSize)return;Dy(n);const o=i.bytesFilled%i.elementSize;if(o>0){const a=i.byteOffset+i.bytesFilled,d=i.buffer.slice(a-o,a);hf(n,d,0,d.byteLength)}i.buffer=i.buffer,i.bytesFilled-=o,Ny(n._controlledReadableByteStream,i),m7(n)})(e,t,r);Ra(e)}function Dy(e){const t=e._pendingPullIntos.shift();return U2(e),t}function zf(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Rl(e,t){const r=e._controlledReadableByteStream;r._state==="readable"&&(function(n){U2(n),n._pendingPullIntos=new Ri}(e),Vs(e),zf(e),L7(r,t))}function b7(e){const t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function sC(e,t,r){const n=Object.create(Gf.prototype);let s=()=>{},i=()=>cr(void 0),o=()=>cr(void 0);t.start!==void 0&&(s=()=>t.start(n)),t.pull!==void 0&&(i=()=>t.pull(n)),t.cancel!==void 0&&(o=d=>t.cancel(d));const a=t.autoAllocateChunkSize;if(a===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");(function(d,c,l,u,p,f,h){c._controlledReadableByteStream=d,c._pullAgain=!1,c._pulling=!1,c._byobRequest=null,c._queue=c._queueTotalSize=void 0,Vs(c),c._closeRequested=!1,c._started=!1,c._strategyHWM=f,c._pullAlgorithm=u,c._cancelAlgorithm=p,c._autoAllocateChunkSize=h,c._pendingPullIntos=new Ri,d._readableStreamController=c,ti(cr(l()),()=>{c._started=!0,Ra(c)},y=>{Rl(c,y)})})(e,n,s,i,o,r,a)}function M0(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function $o(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function I3(e,t){e._reader._readIntoRequests.push(t)}function v7(e){return e._reader._readIntoRequests.length}function B2(e){const t=e._reader;return t!==void 0&&!!el(t)}Object.defineProperties(Gf.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Gf.prototype,Ht.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Wf{constructor(t){if(os(t,1,"ReadableStreamBYOBReader"),N2(t,"First parameter"),Ns(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Ga(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");t7(this,t),this._readIntoRequests=new Ri}get closed(){return el(this)?this._closedPromise:kt(Sd("closed"))}cancel(t=void 0){return el(this)?this._ownerReadableStream===void 0?kt(po("cancel")):C2(this,t):kt(Sd("cancel"))}read(t){if(!el(this))return kt(Sd("read"));if(!ArrayBuffer.isView(t))return kt(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return kt(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return kt(new TypeError("view's buffer must have non-zero byteLength"));if(this._ownerReadableStream===void 0)return kt(po("read from"));let r,n;const s=fn((i,o)=>{r=i,n=o});return function(i,o,a){const d=i._ownerReadableStream;d._disturbed=!0,d._state==="errored"?a._errorSteps(d._storedError):function(c,l,u){const p=c._controlledReadableByteStream;let f=1;l.constructor!==DataView&&(f=l.constructor.BYTES_PER_ELEMENT);const h=l.constructor,y={buffer:l.buffer,byteOffset:l.byteOffset,byteLength:l.byteLength,bytesFilled:0,elementSize:f,viewConstructor:h,readerType:"byob"};if(c._pendingPullIntos.length>0)return c._pendingPullIntos.push(y),void I3(p,u);if(p._state!=="closed"){if(c._queueTotalSize>0){if(p7(c,y)){const m=h7(y);return g7(c),void u._chunkSteps(m)}if(c._closeRequested){const m=new TypeError("Insufficient bytes to fill elements in the given buffer");return Rl(c,m),void u._errorSteps(m)}}c._pendingPullIntos.push(y),I3(p,u),Ra(c)}else{const m=new h(y.buffer,y.byteOffset,0);u._closeSteps(m)}}(d._readableStreamController,o,a)}(this,t,{_chunkSteps:i=>r({value:i,done:!1}),_closeSteps:i=>r({value:i,done:!0}),_errorSteps:i=>n(i)}),s}releaseLock(){if(!el(this))throw Sd("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ba(this)}}}function el(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Sd(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function kl(e,t){const{highWaterMark:r}=e;if(r===void 0)return t;if(d7(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Yf(e){const{size:t}=e;return t||(()=>1)}function Jf(e,t){Qi(e,t);const r=e==null?void 0:e.highWaterMark,n=e==null?void 0:e.size;return{highWaterMark:r===void 0?void 0:O2(r),size:n===void 0?void 0:aC(n,t+" has member 'size' that")}}function aC(e,t){return ni(e,t),r=>O2(e(r))}function oC(e,t,r){return ni(e,r),n=>Na(e,t,[n])}function cC(e,t,r){return ni(e,r),()=>Na(e,t,[])}function uC(e,t,r){return ni(e,r),n=>Ah(e,t,[n])}function lC(e,t,r){return ni(e,r),(n,s)=>Na(e,t,[n,s])}function _7(e,t){if(!Za(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(Wf.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Wf.prototype,Ht.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});class Zf{constructor(t={},r={}){t===void 0?t=null:a7(t,"First parameter");const n=Jf(r,"Second parameter"),s=function(o,a){Qi(o,a);const d=o==null?void 0:o.abort,c=o==null?void 0:o.close,l=o==null?void 0:o.start,u=o==null?void 0:o.type,p=o==null?void 0:o.write;return{abort:d===void 0?void 0:oC(d,o,a+" has member 'abort' that"),close:c===void 0?void 0:cC(c,o,a+" has member 'close' that"),start:l===void 0?void 0:uC(l,o,a+" has member 'start' that"),write:p===void 0?void 0:lC(p,o,a+" has member 'write' that"),type:u}}(t,"First parameter");if(E7(this),s.type!==void 0)throw new RangeError("Invalid type is specified");const i=Yf(n);(function(o,a,d,c){const l=Object.create(Ml.prototype);let u=()=>{},p=()=>cr(void 0),f=()=>cr(void 0),h=()=>cr(void 0);a.start!==void 0&&(u=()=>a.start(l)),a.write!==void 0&&(p=y=>a.write(y,l)),a.close!==void 0&&(f=()=>a.close()),a.abort!==void 0&&(h=y=>a.abort(y)),R7(o,l,u,p,f,h,d,c)})(this,s,kl(n,1),i)}get locked(){if(!Za(this))throw Td("locked");return oo(this)}abort(t=void 0){return Za(this)?oo(this)?kt(new TypeError("Cannot abort a stream that already has a writer")):Xf(this,t):kt(Td("abort"))}close(){return Za(this)?oo(this)?kt(new TypeError("Cannot close a stream that already has a writer")):_i(this)?kt(new TypeError("Cannot close an already-closing stream")):A7(this):kt(Td("close"))}getWriter(){if(!Za(this))throw Td("getWriter");return w7(this)}}function w7(e){return new Qf(e)}function E7(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new Ri,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Za(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function oo(e){return e._writer!==void 0}function Xf(e,t){const r=e._state;if(r==="closed"||r==="errored")return cr(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let n=!1;r==="erroring"&&(n=!0,t=void 0);const s=fn((i,o)=>{e._pendingAbortRequest={_promise:void 0,_resolve:i,_reject:o,_reason:t,_wasAlreadyErroring:n}});return e._pendingAbortRequest._promise=s,n||L2(e,t),s}function A7(e){const t=e._state;if(t==="closed"||t==="errored")return kt(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=fn((i,o)=>{const a={_resolve:i,_reject:o};e._closeRequest=a}),n=e._writer;var s;return n!==void 0&&e._backpressure&&t==="writable"&&V2(n),x2(s=e._writableStreamController,C7,0),Th(s),r}function xy(e,t){e._state!=="writable"?K2(e):L2(e,t)}function L2(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;n!==void 0&&P7(n,t),!function(s){return!(s._inFlightWriteRequest===void 0&&s._inFlightCloseRequest===void 0)}(e)&&r._started&&K2(e)}function K2(e){e._state="errored",e._writableStreamController[s7]();const t=e._storedError;if(e._writeRequests.forEach(n=>{n._reject(t)}),e._writeRequests=new Ri,e._pendingAbortRequest===void 0)return void Pd(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Pd(e);ti(e._writableStreamController[i7](r._reason),()=>{r._resolve(),Pd(e)},n=>{r._reject(n),Pd(e)})}function _i(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function Pd(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;t!==void 0&&$2(t,e._storedError)}function q2(e,t){const r=e._writer;r!==void 0&&t!==e._backpressure&&(t?function(n){Ih(n)}(r):V2(r)),e._backpressure=t}Object.defineProperties(Zf.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Zf.prototype,Ht.toStringTag,{value:"WritableStream",configurable:!0});class Qf{constructor(t){if(os(t,1,"WritableStreamDefaultWriter"),_7(t,"First parameter"),oo(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;const r=t._state;if(r==="writable")!_i(t)&&t._backpressure?Ih(this):C3(this),pf(this);else if(r==="erroring")By(this,t._storedError),pf(this);else if(r==="closed")C3(this),pf(n=this),N7(n);else{const s=t._storedError;By(this,s),O7(this,s)}var n}get closed(){return Js(this)?this._closedPromise:kt(Zs("closed"))}get desiredSize(){if(!Js(this))throw Zs("desiredSize");if(this._ownerWritableStream===void 0)throw tl("desiredSize");return function(t){const r=t._ownerWritableStream,n=r._state;return n==="errored"||n==="erroring"?null:n==="closed"?0:k7(r._writableStreamController)}(this)}get ready(){return Js(this)?this._readyPromise:kt(Zs("ready"))}abort(t=void 0){return Js(this)?this._ownerWritableStream===void 0?kt(tl("abort")):function(r,n){const s=r._ownerWritableStream;return Xf(s,n)}(this,t):kt(Zs("abort"))}close(){if(!Js(this))return kt(Zs("close"));const t=this._ownerWritableStream;return t===void 0?kt(tl("close")):_i(t)?kt(new TypeError("Cannot close an already-closing stream")):S7(this)}releaseLock(){if(!Js(this))throw Zs("releaseLock");this._ownerWritableStream!==void 0&&T7(this)}write(t=void 0){return Js(this)?this._ownerWritableStream===void 0?kt(tl("write to")):I7(this,t):kt(Zs("write"))}}function Js(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function S7(e){return A7(e._ownerWritableStream)}function dC(e,t){e._closedPromiseState==="pending"?$2(e,t):function(r,n){O7(r,n)}(e,t)}function P7(e,t){e._readyPromiseState==="pending"?D7(e,t):function(r,n){By(r,n)}(e,t)}function T7(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");P7(e,r),dC(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function I7(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,s=function(a,d){try{return a._strategySizeAlgorithm(d)}catch(c){return Uy(a,c),1}}(n,t);if(r!==e._ownerWritableStream)return kt(tl("write to"));const i=r._state;if(i==="errored")return kt(r._storedError);if(_i(r)||i==="closed")return kt(new TypeError("The stream is closing or closed and cannot be written to"));if(i==="erroring")return kt(r._storedError);const o=function(a){return fn((d,c)=>{const l={_resolve:d,_reject:c};a._writeRequests.push(l)})}(r);return function(a,d,c){try{x2(a,d,c)}catch(u){return void Uy(a,u)}const l=a._controlledWritableStream;!_i(l)&&l._state==="writable"&&q2(l,j2(a)),Th(a)}(n,t,s),o}Object.defineProperties(Qf.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Qf.prototype,Ht.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const C7={};class Ml{constructor(){throw new TypeError("Illegal constructor")}error(t=void 0){if(!function(r){return!(!_n(r)||!Object.prototype.hasOwnProperty.call(r,"_controlledWritableStream"))}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");this._controlledWritableStream._state==="writable"&&M7(this,t)}[i7](t){const r=this._abortAlgorithm(t);return eh(this),r}[s7](){Vs(this)}}function R7(e,t,r,n,s,i,o,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Vs(t),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=s,t._abortAlgorithm=i;const d=j2(t);q2(e,d),ti(cr(r()),()=>{t._started=!0,Th(t)},c=>{t._started=!0,xy(e,c)})}function eh(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function k7(e){return e._strategyHWM-e._queueTotalSize}function Th(e){const t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring")return void K2(t);if(e._queue.length===0)return;const r=e._queue.peek().value;r===C7?function(n){const s=n._controlledWritableStream;(function(o){o._inFlightCloseRequest=o._closeRequest,o._closeRequest=void 0})(s),Oy(n);const i=n._closeAlgorithm();eh(n),ti(i,()=>{(function(o){o._inFlightCloseRequest._resolve(void 0),o._inFlightCloseRequest=void 0,o._state==="erroring"&&(o._storedError=void 0,o._pendingAbortRequest!==void 0&&(o._pendingAbortRequest._resolve(),o._pendingAbortRequest=void 0)),o._state="closed";const a=o._writer;a!==void 0&&N7(a)})(s)},o=>{(function(a,d){a._inFlightCloseRequest._reject(d),a._inFlightCloseRequest=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._reject(d),a._pendingAbortRequest=void 0),xy(a,d)})(s,o)})}(e):function(n,s){const i=n._controlledWritableStream;(function(a){a._inFlightWriteRequest=a._writeRequests.shift()})(i);const o=n._writeAlgorithm(s);ti(o,()=>{(function(d){d._inFlightWriteRequest._resolve(void 0),d._inFlightWriteRequest=void 0})(i);const a=i._state;if(Oy(n),!_i(i)&&a==="writable"){const d=j2(n);q2(i,d)}Th(n)},a=>{i._state==="writable"&&eh(n),function(d,c){d._inFlightWriteRequest._reject(c),d._inFlightWriteRequest=void 0,xy(d,c)}(i,a)})}(e,r)}function Uy(e,t){e._controlledWritableStream._state==="writable"&&M7(e,t)}function j2(e){return k7(e)<=0}function M7(e,t){const r=e._controlledWritableStream;eh(e),L2(r,t)}function Td(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Zs(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function tl(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function pf(e){e._closedPromise=fn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function O7(e,t){pf(e),$2(e,t)}function $2(e,t){e._closedPromise_reject!==void 0&&(Wl(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function N7(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Ih(e){e._readyPromise=fn((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function By(e,t){Ih(e),D7(e,t)}function C3(e){Ih(e),V2(e)}function D7(e,t){e._readyPromise_reject!==void 0&&(Wl(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function V2(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(Ml.prototype,{error:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Ml.prototype,Ht.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const R3=typeof DOMException<"u"?DOMException:void 0,fC=function(e){if(typeof e!="function"&&typeof e!="object")return!1;try{return new e,!0}catch{return!1}}(R3)?R3:function(){const e=function(t,r){this.message=t||"",this.name=r||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return Object.defineProperty(e.prototype=Object.create(Error.prototype),"constructor",{value:e,writable:!0,configurable:!0}),e}();function k3(e,t,r,n,s,i){const o=ff(e),a=w7(t);e._disturbed=!0;let d=!1,c=cr(void 0);return fn((l,u)=>{let p;if(i!==void 0){if(p=()=>{const v=new fC("Aborted","AbortError"),E=[];n||E.push(()=>t._state==="writable"?Xf(t,v):cr(void 0)),s||E.push(()=>e._state==="readable"?Ea(e,v):cr(void 0)),y(()=>Promise.all(E.map(_=>_())),!0,v)},i.aborted)return void p();i.addEventListener("abort",p)}if(h(e,o._closedPromise,v=>{n?m(!0,v):y(()=>Xf(t,v),!0,v)}),h(t,a._closedPromise,v=>{s?m(!0,v):y(()=>Ea(e,v),!0,v)}),function(v,E,_){v._state==="closed"?_():C0(E,_)}(e,o._closedPromise,()=>{r?m():y(()=>function(v){const E=v._ownerWritableStream,_=E._state;return _i(E)||_==="closed"?cr(void 0):_==="errored"?kt(E._storedError):S7(v)}(a))}),_i(t)||t._state==="closed"){const v=new TypeError("the destination writable stream closed before all data could be piped to it");s?m(!0,v):y(()=>Ea(e,v),!0,v)}function f(){const v=c;return Xi(c,()=>v!==c?f():void 0)}function h(v,E,_){v._state==="errored"?_(v._storedError):Qw(E,_)}function y(v,E,_){function C(){ti(v(),()=>b(E,_),k=>b(!0,k))}d||(d=!0,t._state!=="writable"||_i(t)?C():C0(f(),C))}function m(v,E){d||(d=!0,t._state!=="writable"||_i(t)?b(v,E):C0(f(),()=>b(v,E)))}function b(v,E){T7(a),ba(o),i!==void 0&&i.removeEventListener("abort",p),v?u(E):l(void 0)}Wl(fn((v,E)=>{(function _(C){C?v():Xi(d?cr(!0):Xi(a._readyPromise,()=>fn((k,D)=>{Ph(o,{_chunkSteps:w=>{c=Xi(I7(a,w),void 0,T2),k(!1)},_closeSteps:()=>k(!0),_errorSteps:D})})),_,E)})(!1)}))})}class Ol{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Id(this))throw Cd("desiredSize");return F2(this)}close(){if(!Id(this))throw Cd("close");if(!yo(this))throw new TypeError("The stream is not in a state that permits close");Dl(this)}enqueue(t=void 0){if(!Id(this))throw Cd("enqueue");if(!yo(this))throw new TypeError("The stream is not in a state that permits enqueue");return rh(this,t)}error(t=void 0){if(!Id(this))throw Cd("error");qs(this,t)}[k2](t){Vs(this);const r=this._cancelAlgorithm(t);return th(this),r}[M2](t){const r=this._controlledReadableStream;if(this._queue.length>0){const n=Oy(this);this._closeRequested&&this._queue.length===0?(th(this),Yl(r)):Nl(this),t._chunkSteps(n)}else c7(r,t),Nl(this)}}function Id(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function Nl(e){if(x7(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,ti(e._pullAlgorithm(),()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Nl(e))},t=>{qs(e,t)})}}function x7(e){const t=e._controlledReadableStream;return!yo(e)||!e._started?!1:Ns(t)&&Sh(t)>0?!0:F2(e)>0}function th(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Dl(e){if(!yo(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(th(e),Yl(t))}function rh(e,t){if(!yo(e))return;const r=e._controlledReadableStream;if(Ns(r)&&Sh(r)>0)D2(r,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(s){throw qs(e,s),s}try{x2(e,t,n)}catch(s){throw qs(e,s),s}}Nl(e)}function qs(e,t){const r=e._controlledReadableStream;r._state==="readable"&&(Vs(e),th(e),L7(r,t))}function F2(e){const t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function yo(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function U7(e,t,r,n,s,i,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Vs(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=s,e._readableStreamController=t,ti(cr(r()),()=>{t._started=!0,Nl(t)},a=>{qs(t,a)})}function Cd(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function hC(e,t,r){return ni(e,r),n=>Na(e,t,[n])}function pC(e,t,r){return ni(e,r),n=>Na(e,t,[n])}function yC(e,t,r){return ni(e,r),n=>Ah(e,t,[n])}function gC(e,t){if((e=""+e)!="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function mC(e,t){if((e=""+e)!="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function M3(e,t){Qi(e,t);const r=e==null?void 0:e.preventAbort,n=e==null?void 0:e.preventCancel,s=e==null?void 0:e.preventClose,i=e==null?void 0:e.signal;return i!==void 0&&function(o,a){if(!function(d){if(typeof d!="object"||d===null)return!1;try{return typeof d.aborted=="boolean"}catch{return!1}}(o))throw new TypeError(a+" is not an AbortSignal.")}(i,t+" has member 'signal' that"),{preventAbort:!!r,preventCancel:!!n,preventClose:!!s,signal:i}}Object.defineProperties(Ol.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Ol.prototype,Ht.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class Xa{constructor(t={},r={}){t===void 0?t=null:a7(t,"First parameter");const n=Jf(r,"Second parameter"),s=function(i,o){Qi(i,o);const a=i,d=a==null?void 0:a.autoAllocateChunkSize,c=a==null?void 0:a.cancel,l=a==null?void 0:a.pull,u=a==null?void 0:a.start,p=a==null?void 0:a.type;return{autoAllocateChunkSize:d===void 0?void 0:o7(d,o+" has member 'autoAllocateChunkSize' that"),cancel:c===void 0?void 0:hC(c,a,o+" has member 'cancel' that"),pull:l===void 0?void 0:pC(l,a,o+" has member 'pull' that"),start:u===void 0?void 0:yC(u,a,o+" has member 'start' that"),type:p===void 0?void 0:gC(p,o+" has member 'type' that")}}(t,"First parameter");if(B7(this),s.type==="bytes"){if(n.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");sC(this,s,kl(n,0))}else{const i=Yf(n);(function(o,a,d,c){const l=Object.create(Ol.prototype);let u=()=>{},p=()=>cr(void 0),f=()=>cr(void 0);a.start!==void 0&&(u=()=>a.start(l)),a.pull!==void 0&&(p=()=>a.pull(l)),a.cancel!==void 0&&(f=h=>a.cancel(h)),U7(o,l,u,p,f,d,c)})(this,s,kl(n,1),i)}}get locked(){if(!vs(this))throw Xs("locked");return Ns(this)}cancel(t=void 0){return vs(this)?Ns(this)?kt(new TypeError("Cannot cancel a stream that already has a reader")):Ea(this,t):kt(Xs("cancel"))}getReader(t=void 0){if(!vs(this))throw Xs("getReader");return function(n,s){Qi(n,s);const i=n==null?void 0:n.mode;return{mode:i===void 0?void 0:mC(i,s+" has member 'mode' that")}}(t,"First parameter").mode===void 0?ff(this):function(n){return new Wf(n)}(this)}pipeThrough(t,r={}){if(!vs(this))throw Xs("pipeThrough");os(t,1,"pipeThrough");const n=function(i,o){Qi(i,o);const a=i==null?void 0:i.readable;My(a,"readable","ReadableWritablePair"),N2(a,o+" has member 'readable' that");const d=i==null?void 0:i.writable;return My(d,"writable","ReadableWritablePair"),_7(d,o+" has member 'writable' that"),{readable:a,writable:d}}(t,"First parameter"),s=M3(r,"Second parameter");if(Ns(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(oo(n.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return Wl(k3(this,n.writable,s.preventClose,s.preventAbort,s.preventCancel,s.signal)),n.readable}pipeTo(t,r={}){if(!vs(this))return kt(Xs("pipeTo"));if(t===void 0)return kt("Parameter 1 is required in 'pipeTo'.");if(!Za(t))return kt(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let n;try{n=M3(r,"Second parameter")}catch(s){return kt(s)}return Ns(this)?kt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):oo(t)?kt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):k3(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!vs(this))throw Xs("tee");const t=function(r,n){const s=ff(r);let i,o,a,d,c,l=!1,u=!1,p=!1;const f=fn(m=>{c=m});function h(){return l||(l=!0,Ph(s,{_chunkSteps:m=>{e7(()=>{l=!1;const b=m,v=m;u||rh(a._readableStreamController,b),p||rh(d._readableStreamController,v)})},_closeSteps:()=>{l=!1,u||Dl(a._readableStreamController),p||Dl(d._readableStreamController),u&&p||c(void 0)},_errorSteps:()=>{l=!1}})),cr(void 0)}function y(){}return a=Ly(y,h,function(m){if(u=!0,i=m,p){const b=R0([i,o]),v=Ea(r,b);c(v)}return f}),d=Ly(y,h,function(m){if(p=!0,o=m,u){const b=R0([i,o]),v=Ea(r,b);c(v)}return f}),Qw(s._closedPromise,m=>{qs(a._readableStreamController,m),qs(d._readableStreamController,m),u&&p||c(void 0)}),[a,d]}(this);return R0(t)}values(t=void 0){if(!vs(this))throw Xs("values");return function(r,n){const s=ff(r),i=new iC(s,n),o=Object.create(l7);return o._asyncIteratorImpl=i,o}(this,function(r,n){return Qi(r,n),{preventCancel:!!(r!=null&&r.preventCancel)}}(t,"First parameter").preventCancel)}}function Ly(e,t,r,n=1,s=()=>1){const i=Object.create(Xa.prototype);return B7(i),U7(i,Object.create(Ol.prototype),e,t,r,n,s),i}function B7(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function vs(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function Ns(e){return e._reader!==void 0}function Ea(e,t){return e._disturbed=!0,e._state==="closed"?cr(void 0):e._state==="errored"?kt(e._storedError):(Yl(e),wa(e._readableStreamController[k2](t),T2))}function Yl(e){e._state="closed";const t=e._reader;t!==void 0&&(n7(t),va(t)&&(t._readRequests.forEach(r=>{r._closeSteps()}),t._readRequests=new Ri))}function L7(e,t){e._state="errored",e._storedError=t;const r=e._reader;r!==void 0&&(R2(r,t),va(r)?(r._readRequests.forEach(n=>{n._errorSteps(t)}),r._readRequests=new Ri):(r._readIntoRequests.forEach(n=>{n._errorSteps(t)}),r._readIntoRequests=new Ri))}function Xs(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function K7(e,t){Qi(e,t);const r=e==null?void 0:e.highWaterMark;return My(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:O2(r)}}Object.defineProperties(Xa.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Xa.prototype,Ht.toStringTag,{value:"ReadableStream",configurable:!0}),typeof Ht.asyncIterator=="symbol"&&Object.defineProperty(Xa.prototype,Ht.asyncIterator,{value:Xa.prototype.values,writable:!0,configurable:!0});const bC=function(e){return e.byteLength};class Ky{constructor(t){os(t,1,"ByteLengthQueuingStrategy"),t=K7(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!N3(this))throw O3("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!N3(this))throw O3("size");return bC}}function O3(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function N3(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")}Object.defineProperties(Ky.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Ky.prototype,Ht.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const vC=function(){return 1};class qy{constructor(t){os(t,1,"CountQueuingStrategy"),t=K7(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!x3(this))throw D3("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!x3(this))throw D3("size");return vC}}function D3(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function x3(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")}function _C(e,t,r){return ni(e,r),n=>Na(e,t,[n])}function wC(e,t,r){return ni(e,r),n=>Ah(e,t,[n])}function EC(e,t,r){return ni(e,r),(n,s)=>Na(e,t,[n,s])}Object.defineProperties(qy.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(qy.prototype,Ht.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class jy{constructor(t={},r={},n={}){t===void 0&&(t=null);const s=Jf(r,"Second parameter"),i=Jf(n,"Third parameter"),o=function(p,f){Qi(p,f);const h=p==null?void 0:p.flush,y=p==null?void 0:p.readableType,m=p==null?void 0:p.start,b=p==null?void 0:p.transform,v=p==null?void 0:p.writableType;return{flush:h===void 0?void 0:_C(h,p,f+" has member 'flush' that"),readableType:y,start:m===void 0?void 0:wC(m,p,f+" has member 'start' that"),transform:b===void 0?void 0:EC(b,p,f+" has member 'transform' that"),writableType:v}}(t,"First parameter");if(o.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(o.writableType!==void 0)throw new RangeError("Invalid writableType specified");const a=kl(i,0),d=Yf(i),c=kl(s,1),l=Yf(s);let u;(function(p,f,h,y,m,b){function v(){return f}function E(w){return function(S,I){const T=S._transformStreamController;return S._backpressure?wa(S._backpressureChangePromise,()=>{const g=S._writable;if(g._state==="erroring")throw g._storedError;return B3(T,I)}):B3(T,I)}(p,w)}function _(w){return function(S,I){return nh(S,I),cr(void 0)}(p,w)}function C(){return function(w){const S=w._readable,I=w._transformStreamController,T=I._flushAlgorithm();return q7(I),wa(T,()=>{if(S._state==="errored")throw S._storedError;Dl(S._readableStreamController)},g=>{throw nh(w,g),S._storedError})}(p)}function k(){return function(w){return ih(w,!1),w._backpressureChangePromise}(p)}function D(w){return Ch(p,w),cr(void 0)}p._writable=function(w,S,I,T,g=1,A=()=>1){const P=Object.create(Zf.prototype);return E7(P),R7(P,Object.create(Ml.prototype),w,S,I,T,g,A),P}(v,E,C,_,h,y),p._readable=Ly(v,k,D,m,b),p._backpressure=void 0,p._backpressureChangePromise=void 0,p._backpressureChangePromise_resolve=void 0,ih(p,!0),p._transformStreamController=void 0})(this,fn(p=>{u=p}),c,l,a,d),function(p,f){const h=Object.create(sh.prototype);let y=b=>{try{return j7(h,b),cr(void 0)}catch(v){return kt(v)}},m=()=>cr(void 0);f.transform!==void 0&&(y=b=>f.transform(b,h)),f.flush!==void 0&&(m=()=>f.flush(h)),function(b,v,E,_){v._controlledTransformStream=b,b._transformStreamController=v,v._transformAlgorithm=E,v._flushAlgorithm=_}(p,h,y,m)}(this,o),o.start!==void 0?u(o.start(this._transformStreamController)):u(void 0)}get readable(){if(!U3(this))throw L3("readable");return this._readable}get writable(){if(!U3(this))throw L3("writable");return this._writable}}function U3(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function nh(e,t){qs(e._readable._readableStreamController,t),Ch(e,t)}function Ch(e,t){q7(e._transformStreamController),Uy(e._writable._writableStreamController,t),e._backpressure&&ih(e,!1)}function ih(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=fn(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}Object.defineProperties(jy.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(jy.prototype,Ht.toStringTag,{value:"TransformStream",configurable:!0});class sh{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Rd(this))throw kd("desiredSize");return F2(this._controlledTransformStream._readable._readableStreamController)}enqueue(t=void 0){if(!Rd(this))throw kd("enqueue");j7(this,t)}error(t=void 0){if(!Rd(this))throw kd("error");var r;r=t,nh(this._controlledTransformStream,r)}terminate(){if(!Rd(this))throw kd("terminate");(function(t){const r=t._controlledTransformStream,n=r._readable._readableStreamController;Dl(n),Ch(r,new TypeError("TransformStream terminated"))})(this)}}function Rd(e){return!!_n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function q7(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function j7(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!yo(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{rh(n,t)}catch(i){throw Ch(r,i),r._readable._storedError}(function(i){return!x7(i)})(n)!==r._backpressure&&ih(r,!0)}function B3(e,t){return wa(e._transformAlgorithm(t),void 0,r=>{throw nh(e._controlledTransformStream,r),r})}function kd(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function L3(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(sh.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(sh.prototype,Ht.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var AC=Object.freeze({__proto__:null,ByteLengthQueuingStrategy:Ky,CountQueuingStrategy:qy,ReadableByteStreamController:Gf,ReadableStream:Xa,ReadableStreamBYOBReader:Wf,ReadableStreamBYOBRequest:Hf,ReadableStreamDefaultController:Ol,ReadableStreamDefaultReader:Vf,TransformStream:jy,TransformStreamDefaultController:sh,WritableStream:Zf,WritableStreamDefaultController:Ml,WritableStreamDefaultWriter:Qf}),$y=function(e,t){return $y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},$y(e,t)};/*! *****************************************************************************
|
|
40
|
-
Copyright (c) Microsoft Corporation.
|
|
41
|
-
|
|
42
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
43
|
-
purpose with or without fee is hereby granted.
|
|
44
|
-
|
|
45
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
46
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
47
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
48
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
49
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
50
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
51
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
52
|
-
***************************************************************************** */function $7(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}$y(e,t),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Rn(e){if(!e)throw new TypeError("Assertion failed")}function ml(){}function H2(e){return typeof e=="object"&&e!==null||typeof e=="function"}function O0(e){if(typeof e!="function")return!1;var t=!1;try{new e({start:function(){t=!0}})}catch{}return t}function G2(e){return!!H2(e)&&typeof e.getReader=="function"}function z2(e){return!!H2(e)&&typeof e.getWriter=="function"}function V7(e){return!!H2(e)&&!!G2(e.readable)&&!!z2(e.writable)}function F7(e){try{return e.getReader({mode:"byob"}).releaseLock(),!0}catch{return!1}}function N0(e,t){var r=(t===void 0?{}:t).type;return Rn(G2(e)),Rn(e.locked===!1),(r=H7(r))==="bytes"?new PC(e):new SC(e)}function H7(e){var t=e+"";if(t==="bytes")return t;if(e===void 0)return e;throw new RangeError("Invalid type is specified")}var G7=function(){function e(t){this._underlyingReader=void 0,this._readerMode=void 0,this._readableStreamController=void 0,this._pendingRead=void 0,this._underlyingStream=t,this._attachDefaultReader()}return e.prototype.start=function(t){this._readableStreamController=t},e.prototype.cancel=function(t){return Rn(this._underlyingReader!==void 0),this._underlyingReader.cancel(t)},e.prototype._attachDefaultReader=function(){if(this._readerMode!=="default"){this._detachReader();var t=this._underlyingStream.getReader();this._readerMode="default",this._attachReader(t)}},e.prototype._attachReader=function(t){var r=this;Rn(this._underlyingReader===void 0),this._underlyingReader=t;var n=this._underlyingReader.closed;n&&n.then(function(){return r._finishPendingRead()}).then(function(){t===r._underlyingReader&&r._readableStreamController.close()},function(s){t===r._underlyingReader&&r._readableStreamController.error(s)}).catch(ml)},e.prototype._detachReader=function(){this._underlyingReader!==void 0&&(this._underlyingReader.releaseLock(),this._underlyingReader=void 0,this._readerMode=void 0)},e.prototype._pullWithDefaultReader=function(){var t=this;this._attachDefaultReader();var r=this._underlyingReader.read().then(function(n){var s=t._readableStreamController;n.done?t._tryClose():s.enqueue(n.value)});return this._setPendingRead(r),r},e.prototype._tryClose=function(){try{this._readableStreamController.close()}catch{}},e.prototype._setPendingRead=function(t){var r,n=this,s=function(){n._pendingRead===r&&(n._pendingRead=void 0)};this._pendingRead=r=t.then(s,s)},e.prototype._finishPendingRead=function(){var t=this;if(this._pendingRead){var r=function(){return t._finishPendingRead()};return this._pendingRead.then(r,r)}},e}(),SC=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return $7(t,e),t.prototype.pull=function(){return this._pullWithDefaultReader()},t}(G7);function K3(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var PC=function(e){function t(r){var n=this,s=F7(r);return(n=e.call(this,r)||this)._supportsByob=s,n}return $7(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return"bytes"},enumerable:!1,configurable:!0}),t.prototype._attachByobReader=function(){if(this._readerMode!=="byob"){Rn(this._supportsByob),this._detachReader();var r=this._underlyingStream.getReader({mode:"byob"});this._readerMode="byob",this._attachReader(r)}},t.prototype.pull=function(){if(this._supportsByob){var r=this._readableStreamController.byobRequest;if(r)return this._pullWithByobRequest(r)}return this._pullWithDefaultReader()},t.prototype._pullWithByobRequest=function(r){var n=this;this._attachByobReader();var s=new Uint8Array(r.view.byteLength),i=this._underlyingReader.read(s).then(function(o){var a,d,c;n._readableStreamController,o.done?(n._tryClose(),r.respond(0)):(a=o.value,d=r.view,c=K3(a),K3(d).set(c,0),r.respond(o.value.byteLength))});return this._setPendingRead(i),i},t}(G7);function q3(e){Rn(z2(e)),Rn(e.locked===!1);var t=e.getWriter();return new TC(t)}var TC=function(){function e(t){var r=this;this._writableStreamController=void 0,this._pendingWrite=void 0,this._state="writable",this._storedError=void 0,this._underlyingWriter=t,this._errorPromise=new Promise(function(n,s){r._errorPromiseReject=s}),this._errorPromise.catch(ml)}return e.prototype.start=function(t){var r=this;this._writableStreamController=t,this._underlyingWriter.closed.then(function(){r._state="closed"}).catch(function(n){return r._finishErroring(n)})},e.prototype.write=function(t){var r=this,n=this._underlyingWriter;if(n.desiredSize===null)return n.ready;var s=n.write(t);s.catch(function(o){return r._finishErroring(o)}),n.ready.catch(function(o){return r._startErroring(o)});var i=Promise.race([s,this._errorPromise]);return this._setPendingWrite(i),i},e.prototype.close=function(){var t=this;return this._pendingWrite===void 0?this._underlyingWriter.close():this._finishPendingWrite().then(function(){return t.close()})},e.prototype.abort=function(t){if(this._state!=="errored")return this._underlyingWriter.abort(t)},e.prototype._setPendingWrite=function(t){var r,n=this,s=function(){n._pendingWrite===r&&(n._pendingWrite=void 0)};this._pendingWrite=r=t.then(s,s)},e.prototype._finishPendingWrite=function(){var t=this;if(this._pendingWrite===void 0)return Promise.resolve();var r=function(){return t._finishPendingWrite()};return this._pendingWrite.then(r,r)},e.prototype._startErroring=function(t){var r=this;if(this._state==="writable"){this._state="erroring",this._storedError=t;var n=function(){return r._finishErroring(t)};this._pendingWrite===void 0?n():this._finishPendingWrite().then(n,n),this._writableStreamController.error(t)}},e.prototype._finishErroring=function(t){this._state==="writable"&&this._startErroring(t),this._state==="erroring"&&(this._state="errored",this._errorPromiseReject(this._storedError))},e}();function j3(e){Rn(V7(e));var t=e.readable,r=e.writable;Rn(t.locked===!1),Rn(r.locked===!1);var n,s=t.getReader();try{n=r.getWriter()}catch(i){throw s.releaseLock(),i}return new IC(s,n)}var IC=function(){function e(t,r){var n=this;this._transformStreamController=void 0,this._onRead=function(s){if(!s.done)return n._transformStreamController.enqueue(s.value),n._reader.read().then(n._onRead)},this._onError=function(s){n._flushReject(s),n._transformStreamController.error(s),n._reader.cancel(s).catch(ml),n._writer.abort(s).catch(ml)},this._onTerminate=function(){n._flushResolve(),n._transformStreamController.terminate();var s=new TypeError("TransformStream terminated");n._writer.abort(s).catch(ml)},this._reader=t,this._writer=r,this._flushPromise=new Promise(function(s,i){n._flushResolve=s,n._flushReject=i})}return e.prototype.start=function(t){this._transformStreamController=t,this._reader.read().then(this._onRead).then(this._onTerminate,this._onError);var r=this._reader.closed;r&&r.then(this._onTerminate,this._onError)},e.prototype.transform=function(t){return this._writer.write(t)},e.prototype.flush=function(){var t=this;return this._writer.close().then(function(){return t._flushPromise})},e}(),CC=Object.freeze({__proto__:null,createReadableStreamWrapper:function(e){Rn(function(r){return!!O0(r)&&!!G2(new r)}(e));var t=function(r){try{return new r({type:"bytes"}),!0}catch{return!1}}(e);return function(r,n){var s=(n===void 0?{}:n).type;if((s=H7(s))!=="bytes"||t||(s=void 0),r.constructor===e&&(s!=="bytes"||F7(r)))return r;if(s==="bytes"){var i=N0(r,{type:s});return new e(i)}return i=N0(r),new e(i)}},createTransformStreamWrapper:function(e){return Rn(function(t){return!!O0(t)&&!!V7(new t)}(e)),function(t){if(t.constructor===e)return t;var r=j3(t);return new e(r)}},createWrappingReadableSource:N0,createWrappingTransformer:j3,createWrappingWritableSink:q3,createWritableStreamWrapper:function(e){return Rn(function(t){return!!O0(t)&&!!z2(new t)}(e)),function(t){if(t.constructor===e)return t;var r=q3(t);return new e(r)}}}),pt=Ni(function(e){(function(t,r){function n(w,S){if(!w)throw Error(S||"Assertion failed")}function s(w,S){w.super_=S;var I=function(){};I.prototype=S.prototype,w.prototype=new I,w.prototype.constructor=w}function i(w,S,I){if(i.isBN(w))return w;this.negative=0,this.words=null,this.length=0,this.red=null,w!==null&&(S!=="le"&&S!=="be"||(I=S,S=10),this._init(w||0,S||10,I||"be"))}var o;typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;try{o=void 0}catch{}function a(w,S,I){for(var T=0,g=Math.min(w.length,I),A=S;A<g;A++){var P=w.charCodeAt(A)-48;T<<=4,T|=P>=49&&P<=54?P-49+10:P>=17&&P<=22?P-17+10:15&P}return T}function d(w,S,I,T){for(var g=0,A=Math.min(w.length,I),P=S;P<A;P++){var O=w.charCodeAt(P)-48;g*=T,g+=O>=49?O-49+10:O>=17?O-17+10:O}return g}i.isBN=function(w){return w instanceof i||w!==null&&typeof w=="object"&&w.constructor.wordSize===i.wordSize&&Array.isArray(w.words)},i.max=function(w,S){return w.cmp(S)>0?w:S},i.min=function(w,S){return w.cmp(S)<0?w:S},i.prototype._init=function(w,S,I){if(typeof w=="number")return this._initNumber(w,S,I);if(typeof w=="object")return this._initArray(w,S,I);S==="hex"&&(S=16),n(S===(0|S)&&S>=2&&S<=36);var T=0;(w=w.toString().replace(/\s+/g,""))[0]==="-"&&T++,S===16?this._parseHex(w,T):this._parseBase(w,S,T),w[0]==="-"&&(this.negative=1),this.strip(),I==="le"&&this._initArray(this.toArray(),S,I)},i.prototype._initNumber=function(w,S,I){w<0&&(this.negative=1,w=-w),w<67108864?(this.words=[67108863&w],this.length=1):w<4503599627370496?(this.words=[67108863&w,w/67108864&67108863],this.length=2):(n(w<9007199254740992),this.words=[67108863&w,w/67108864&67108863,1],this.length=3),I==="le"&&this._initArray(this.toArray(),S,I)},i.prototype._initArray=function(w,S,I){if(n(typeof w.length=="number"),w.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(w.length/3),this.words=Array(this.length);for(var T=0;T<this.length;T++)this.words[T]=0;var g,A,P=0;if(I==="be")for(T=w.length-1,g=0;T>=0;T-=3)A=w[T]|w[T-1]<<8|w[T-2]<<16,this.words[g]|=A<<P&67108863,this.words[g+1]=A>>>26-P&67108863,(P+=24)>=26&&(P-=26,g++);else if(I==="le")for(T=0,g=0;T<w.length;T+=3)A=w[T]|w[T+1]<<8|w[T+2]<<16,this.words[g]|=A<<P&67108863,this.words[g+1]=A>>>26-P&67108863,(P+=24)>=26&&(P-=26,g++);return this.strip()},i.prototype._parseHex=function(w,S){this.length=Math.ceil((w.length-S)/6),this.words=Array(this.length);for(var I=0;I<this.length;I++)this.words[I]=0;var T,g,A=0;for(I=w.length-6,T=0;I>=S;I-=6)g=a(w,I,I+6),this.words[T]|=g<<A&67108863,this.words[T+1]|=g>>>26-A&4194303,(A+=24)>=26&&(A-=26,T++);I+6!==S&&(g=a(w,S,I+6),this.words[T]|=g<<A&67108863,this.words[T+1]|=g>>>26-A&4194303),this.strip()},i.prototype._parseBase=function(w,S,I){this.words=[0],this.length=1;for(var T=0,g=1;g<=67108863;g*=S)T++;T--,g=g/S|0;for(var A=w.length-I,P=A%T,O=Math.min(A,A-P)+I,N=0,M=I;M<O;M+=T)N=d(w,M,M+T,S),this.imuln(g),this.words[0]+N<67108864?this.words[0]+=N:this._iaddn(N);if(P!==0){var L=1;for(N=d(w,M,w.length,S),M=0;M<P;M++)L*=S;this.imuln(L),this.words[0]+N<67108864?this.words[0]+=N:this._iaddn(N)}},i.prototype.copy=function(w){w.words=Array(this.length);for(var S=0;S<this.length;S++)w.words[S]=this.words[S];w.length=this.length,w.negative=this.negative,w.red=this.red},i.prototype.clone=function(){var w=new i(null);return this.copy(w),w},i.prototype._expand=function(w){for(;this.length<w;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],u=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(w,S,I){I.negative=S.negative^w.negative;var T=w.length+S.length|0;I.length=T,T=T-1|0;var g=0|w.words[0],A=0|S.words[0],P=g*A,O=67108863&P,N=P/67108864|0;I.words[0]=O;for(var M=1;M<T;M++){for(var L=N>>>26,x=67108863&N,R=Math.min(M,S.length-1),K=Math.max(0,M-w.length+1);K<=R;K++){var V=M-K|0;L+=(P=(g=0|w.words[V])*(A=0|S.words[K])+x)/67108864|0,x=67108863&P}I.words[M]=0|x,N=0|L}return N!==0?I.words[M]=0|N:I.length--,I.strip()}i.prototype.toString=function(w,S){var I;if(S=0|S||1,(w=w||10)===16||w==="hex"){I="";for(var T=0,g=0,A=0;A<this.length;A++){var P=this.words[A],O=(16777215&(P<<T|g)).toString(16);I=(g=P>>>24-T&16777215)!==0||A!==this.length-1?c[6-O.length]+O+I:O+I,(T+=2)>=26&&(T-=26,A--)}for(g!==0&&(I=g.toString(16)+I);I.length%S!=0;)I="0"+I;return this.negative!==0&&(I="-"+I),I}if(w===(0|w)&&w>=2&&w<=36){var N=l[w],M=u[w];I="";var L=this.clone();for(L.negative=0;!L.isZero();){var x=L.modn(M).toString(w);I=(L=L.idivn(M)).isZero()?x+I:c[N-x.length]+x+I}for(this.isZero()&&(I="0"+I);I.length%S!=0;)I="0"+I;return this.negative!==0&&(I="-"+I),I}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var w=this.words[0];return this.length===2?w+=67108864*this.words[1]:this.length===3&&this.words[2]===1?w+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-w:w},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(w,S){return n(o!==void 0),this.toArrayLike(o,w,S)},i.prototype.toArray=function(w,S){return this.toArrayLike(Array,w,S)},i.prototype.toArrayLike=function(w,S,I){var T=this.byteLength(),g=I||Math.max(1,T);n(T<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A,P,O=S==="le",N=new w(g),M=this.clone();if(O){for(P=0;!M.isZero();P++)A=M.andln(255),M.iushrn(8),N[P]=A;for(;P<g;P++)N[P]=0}else{for(P=0;P<g-T;P++)N[P]=0;for(P=0;!M.isZero();P++)A=M.andln(255),M.iushrn(8),N[g-P-1]=A}return N},i.prototype._countBits=Math.clz32?function(w){return 32-Math.clz32(w)}:function(w){var S=w,I=0;return S>=4096&&(I+=13,S>>>=13),S>=64&&(I+=7,S>>>=7),S>=8&&(I+=4,S>>>=4),S>=2&&(I+=2,S>>>=2),I+S},i.prototype._zeroBits=function(w){if(w===0)return 26;var S=w,I=0;return!(8191&S)&&(I+=13,S>>>=13),!(127&S)&&(I+=7,S>>>=7),!(15&S)&&(I+=4,S>>>=4),!(3&S)&&(I+=2,S>>>=2),!(1&S)&&I++,I},i.prototype.bitLength=function(){var w=this.words[this.length-1],S=this._countBits(w);return 26*(this.length-1)+S},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var w=0,S=0;S<this.length;S++){var I=this._zeroBits(this.words[S]);if(w+=I,I!==26)break}return w},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(w){return this.negative!==0?this.abs().inotn(w).iaddn(1):this.clone()},i.prototype.fromTwos=function(w){return this.testn(w-1)?this.notn(w).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(w){for(;this.length<w.length;)this.words[this.length++]=0;for(var S=0;S<w.length;S++)this.words[S]=this.words[S]|w.words[S];return this.strip()},i.prototype.ior=function(w){return n((this.negative|w.negative)==0),this.iuor(w)},i.prototype.or=function(w){return this.length>w.length?this.clone().ior(w):w.clone().ior(this)},i.prototype.uor=function(w){return this.length>w.length?this.clone().iuor(w):w.clone().iuor(this)},i.prototype.iuand=function(w){var S;S=this.length>w.length?w:this;for(var I=0;I<S.length;I++)this.words[I]=this.words[I]&w.words[I];return this.length=S.length,this.strip()},i.prototype.iand=function(w){return n((this.negative|w.negative)==0),this.iuand(w)},i.prototype.and=function(w){return this.length>w.length?this.clone().iand(w):w.clone().iand(this)},i.prototype.uand=function(w){return this.length>w.length?this.clone().iuand(w):w.clone().iuand(this)},i.prototype.iuxor=function(w){var S,I;this.length>w.length?(S=this,I=w):(S=w,I=this);for(var T=0;T<I.length;T++)this.words[T]=S.words[T]^I.words[T];if(this!==S)for(;T<S.length;T++)this.words[T]=S.words[T];return this.length=S.length,this.strip()},i.prototype.ixor=function(w){return n((this.negative|w.negative)==0),this.iuxor(w)},i.prototype.xor=function(w){return this.length>w.length?this.clone().ixor(w):w.clone().ixor(this)},i.prototype.uxor=function(w){return this.length>w.length?this.clone().iuxor(w):w.clone().iuxor(this)},i.prototype.inotn=function(w){n(typeof w=="number"&&w>=0);var S=0|Math.ceil(w/26),I=w%26;this._expand(S),I>0&&S--;for(var T=0;T<S;T++)this.words[T]=67108863&~this.words[T];return I>0&&(this.words[T]=~this.words[T]&67108863>>26-I),this.strip()},i.prototype.notn=function(w){return this.clone().inotn(w)},i.prototype.setn=function(w,S){n(typeof w=="number"&&w>=0);var I=w/26|0,T=w%26;return this._expand(I+1),this.words[I]=S?this.words[I]|1<<T:this.words[I]&~(1<<T),this.strip()},i.prototype.iadd=function(w){var S,I,T;if(this.negative!==0&&w.negative===0)return this.negative=0,S=this.isub(w),this.negative^=1,this._normSign();if(this.negative===0&&w.negative!==0)return w.negative=0,S=this.isub(w),w.negative=1,S._normSign();this.length>w.length?(I=this,T=w):(I=w,T=this);for(var g=0,A=0;A<T.length;A++)S=(0|I.words[A])+(0|T.words[A])+g,this.words[A]=67108863&S,g=S>>>26;for(;g!==0&&A<I.length;A++)S=(0|I.words[A])+g,this.words[A]=67108863&S,g=S>>>26;if(this.length=I.length,g!==0)this.words[this.length]=g,this.length++;else if(I!==this)for(;A<I.length;A++)this.words[A]=I.words[A];return this},i.prototype.add=function(w){var S;return w.negative!==0&&this.negative===0?(w.negative=0,S=this.sub(w),w.negative^=1,S):w.negative===0&&this.negative!==0?(this.negative=0,S=w.sub(this),this.negative=1,S):this.length>w.length?this.clone().iadd(w):w.clone().iadd(this)},i.prototype.isub=function(w){if(w.negative!==0){w.negative=0;var S=this.iadd(w);return w.negative=1,S._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(w),this.negative=1,this._normSign();var I,T,g=this.cmp(w);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;g>0?(I=this,T=w):(I=w,T=this);for(var A=0,P=0;P<T.length;P++)A=(S=(0|I.words[P])-(0|T.words[P])+A)>>26,this.words[P]=67108863&S;for(;A!==0&&P<I.length;P++)A=(S=(0|I.words[P])+A)>>26,this.words[P]=67108863&S;if(A===0&&P<I.length&&I!==this)for(;P<I.length;P++)this.words[P]=I.words[P];return this.length=Math.max(this.length,P),I!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(w){return this.clone().isub(w)};var f=function(w,S,I){var T,g,A,P=w.words,O=S.words,N=I.words,M=0,L=0|P[0],x=8191&L,R=L>>>13,K=0|P[1],V=8191&K,J=K>>>13,se=0|P[2],j=8191&se,re=se>>>13,G=0|P[3],B=8191&G,X=G>>>13,ge=0|P[4],_e=8191&ge,Se=ge>>>13,F=0|P[5],q=8191&F,z=F>>>13,ee=0|P[6],le=8191&ee,ce=ee>>>13,ne=0|P[7],je=8191&ne,De=ne>>>13,Fe=0|P[8],he=8191&Fe,ue=Fe>>>13,pe=0|P[9],de=8191&pe,fe=pe>>>13,ye=0|O[0],ie=8191&ye,Q=ye>>>13,qe=0|O[1],He=8191&qe,Qe=qe>>>13,dt=0|O[2],rt=8191&dt,be=dt>>>13,W=0|O[3],oe=8191&W,me=W>>>13,Te=0|O[4],Pe=8191&Te,ke=Te>>>13,Ne=0|O[5],Ue=8191&Ne,Re=Ne>>>13,Me=0|O[6],et=8191&Me,Ee=Me>>>13,Ce=0|O[7],Oe=8191&Ce,Be=Ce>>>13,Ve=0|O[8],$=8191&Ve,Y=Ve>>>13,Z=0|O[9],U=8191&Z,ae=Z>>>13;I.negative=w.negative^S.negative,I.length=19;var Ae=(M+(T=Math.imul(x,ie))|0)+((8191&(g=(g=Math.imul(x,Q))+Math.imul(R,ie)|0))<<13)|0;M=((A=Math.imul(R,Q))+(g>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,T=Math.imul(V,ie),g=(g=Math.imul(V,Q))+Math.imul(J,ie)|0,A=Math.imul(J,Q);var Ie=(M+(T=T+Math.imul(x,He)|0)|0)+((8191&(g=(g=g+Math.imul(x,Qe)|0)+Math.imul(R,He)|0))<<13)|0;M=((A=A+Math.imul(R,Qe)|0)+(g>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,T=Math.imul(j,ie),g=(g=Math.imul(j,Q))+Math.imul(re,ie)|0,A=Math.imul(re,Q),T=T+Math.imul(V,He)|0,g=(g=g+Math.imul(V,Qe)|0)+Math.imul(J,He)|0,A=A+Math.imul(J,Qe)|0;var xe=(M+(T=T+Math.imul(x,rt)|0)|0)+((8191&(g=(g=g+Math.imul(x,be)|0)+Math.imul(R,rt)|0))<<13)|0;M=((A=A+Math.imul(R,be)|0)+(g>>>13)|0)+(xe>>>26)|0,xe&=67108863,T=Math.imul(B,ie),g=(g=Math.imul(B,Q))+Math.imul(X,ie)|0,A=Math.imul(X,Q),T=T+Math.imul(j,He)|0,g=(g=g+Math.imul(j,Qe)|0)+Math.imul(re,He)|0,A=A+Math.imul(re,Qe)|0,T=T+Math.imul(V,rt)|0,g=(g=g+Math.imul(V,be)|0)+Math.imul(J,rt)|0,A=A+Math.imul(J,be)|0;var Ge=(M+(T=T+Math.imul(x,oe)|0)|0)+((8191&(g=(g=g+Math.imul(x,me)|0)+Math.imul(R,oe)|0))<<13)|0;M=((A=A+Math.imul(R,me)|0)+(g>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,T=Math.imul(_e,ie),g=(g=Math.imul(_e,Q))+Math.imul(Se,ie)|0,A=Math.imul(Se,Q),T=T+Math.imul(B,He)|0,g=(g=g+Math.imul(B,Qe)|0)+Math.imul(X,He)|0,A=A+Math.imul(X,Qe)|0,T=T+Math.imul(j,rt)|0,g=(g=g+Math.imul(j,be)|0)+Math.imul(re,rt)|0,A=A+Math.imul(re,be)|0,T=T+Math.imul(V,oe)|0,g=(g=g+Math.imul(V,me)|0)+Math.imul(J,oe)|0,A=A+Math.imul(J,me)|0;var ut=(M+(T=T+Math.imul(x,Pe)|0)|0)+((8191&(g=(g=g+Math.imul(x,ke)|0)+Math.imul(R,Pe)|0))<<13)|0;M=((A=A+Math.imul(R,ke)|0)+(g>>>13)|0)+(ut>>>26)|0,ut&=67108863,T=Math.imul(q,ie),g=(g=Math.imul(q,Q))+Math.imul(z,ie)|0,A=Math.imul(z,Q),T=T+Math.imul(_e,He)|0,g=(g=g+Math.imul(_e,Qe)|0)+Math.imul(Se,He)|0,A=A+Math.imul(Se,Qe)|0,T=T+Math.imul(B,rt)|0,g=(g=g+Math.imul(B,be)|0)+Math.imul(X,rt)|0,A=A+Math.imul(X,be)|0,T=T+Math.imul(j,oe)|0,g=(g=g+Math.imul(j,me)|0)+Math.imul(re,oe)|0,A=A+Math.imul(re,me)|0,T=T+Math.imul(V,Pe)|0,g=(g=g+Math.imul(V,ke)|0)+Math.imul(J,Pe)|0,A=A+Math.imul(J,ke)|0;var nt=(M+(T=T+Math.imul(x,Ue)|0)|0)+((8191&(g=(g=g+Math.imul(x,Re)|0)+Math.imul(R,Ue)|0))<<13)|0;M=((A=A+Math.imul(R,Re)|0)+(g>>>13)|0)+(nt>>>26)|0,nt&=67108863,T=Math.imul(le,ie),g=(g=Math.imul(le,Q))+Math.imul(ce,ie)|0,A=Math.imul(ce,Q),T=T+Math.imul(q,He)|0,g=(g=g+Math.imul(q,Qe)|0)+Math.imul(z,He)|0,A=A+Math.imul(z,Qe)|0,T=T+Math.imul(_e,rt)|0,g=(g=g+Math.imul(_e,be)|0)+Math.imul(Se,rt)|0,A=A+Math.imul(Se,be)|0,T=T+Math.imul(B,oe)|0,g=(g=g+Math.imul(B,me)|0)+Math.imul(X,oe)|0,A=A+Math.imul(X,me)|0,T=T+Math.imul(j,Pe)|0,g=(g=g+Math.imul(j,ke)|0)+Math.imul(re,Pe)|0,A=A+Math.imul(re,ke)|0,T=T+Math.imul(V,Ue)|0,g=(g=g+Math.imul(V,Re)|0)+Math.imul(J,Ue)|0,A=A+Math.imul(J,Re)|0;var Ct=(M+(T=T+Math.imul(x,et)|0)|0)+((8191&(g=(g=g+Math.imul(x,Ee)|0)+Math.imul(R,et)|0))<<13)|0;M=((A=A+Math.imul(R,Ee)|0)+(g>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,T=Math.imul(je,ie),g=(g=Math.imul(je,Q))+Math.imul(De,ie)|0,A=Math.imul(De,Q),T=T+Math.imul(le,He)|0,g=(g=g+Math.imul(le,Qe)|0)+Math.imul(ce,He)|0,A=A+Math.imul(ce,Qe)|0,T=T+Math.imul(q,rt)|0,g=(g=g+Math.imul(q,be)|0)+Math.imul(z,rt)|0,A=A+Math.imul(z,be)|0,T=T+Math.imul(_e,oe)|0,g=(g=g+Math.imul(_e,me)|0)+Math.imul(Se,oe)|0,A=A+Math.imul(Se,me)|0,T=T+Math.imul(B,Pe)|0,g=(g=g+Math.imul(B,ke)|0)+Math.imul(X,Pe)|0,A=A+Math.imul(X,ke)|0,T=T+Math.imul(j,Ue)|0,g=(g=g+Math.imul(j,Re)|0)+Math.imul(re,Ue)|0,A=A+Math.imul(re,Re)|0,T=T+Math.imul(V,et)|0,g=(g=g+Math.imul(V,Ee)|0)+Math.imul(J,et)|0,A=A+Math.imul(J,Ee)|0;var st=(M+(T=T+Math.imul(x,Oe)|0)|0)+((8191&(g=(g=g+Math.imul(x,Be)|0)+Math.imul(R,Oe)|0))<<13)|0;M=((A=A+Math.imul(R,Be)|0)+(g>>>13)|0)+(st>>>26)|0,st&=67108863,T=Math.imul(he,ie),g=(g=Math.imul(he,Q))+Math.imul(ue,ie)|0,A=Math.imul(ue,Q),T=T+Math.imul(je,He)|0,g=(g=g+Math.imul(je,Qe)|0)+Math.imul(De,He)|0,A=A+Math.imul(De,Qe)|0,T=T+Math.imul(le,rt)|0,g=(g=g+Math.imul(le,be)|0)+Math.imul(ce,rt)|0,A=A+Math.imul(ce,be)|0,T=T+Math.imul(q,oe)|0,g=(g=g+Math.imul(q,me)|0)+Math.imul(z,oe)|0,A=A+Math.imul(z,me)|0,T=T+Math.imul(_e,Pe)|0,g=(g=g+Math.imul(_e,ke)|0)+Math.imul(Se,Pe)|0,A=A+Math.imul(Se,ke)|0,T=T+Math.imul(B,Ue)|0,g=(g=g+Math.imul(B,Re)|0)+Math.imul(X,Ue)|0,A=A+Math.imul(X,Re)|0,T=T+Math.imul(j,et)|0,g=(g=g+Math.imul(j,Ee)|0)+Math.imul(re,et)|0,A=A+Math.imul(re,Ee)|0,T=T+Math.imul(V,Oe)|0,g=(g=g+Math.imul(V,Be)|0)+Math.imul(J,Oe)|0,A=A+Math.imul(J,Be)|0;var mt=(M+(T=T+Math.imul(x,$)|0)|0)+((8191&(g=(g=g+Math.imul(x,Y)|0)+Math.imul(R,$)|0))<<13)|0;M=((A=A+Math.imul(R,Y)|0)+(g>>>13)|0)+(mt>>>26)|0,mt&=67108863,T=Math.imul(de,ie),g=(g=Math.imul(de,Q))+Math.imul(fe,ie)|0,A=Math.imul(fe,Q),T=T+Math.imul(he,He)|0,g=(g=g+Math.imul(he,Qe)|0)+Math.imul(ue,He)|0,A=A+Math.imul(ue,Qe)|0,T=T+Math.imul(je,rt)|0,g=(g=g+Math.imul(je,be)|0)+Math.imul(De,rt)|0,A=A+Math.imul(De,be)|0,T=T+Math.imul(le,oe)|0,g=(g=g+Math.imul(le,me)|0)+Math.imul(ce,oe)|0,A=A+Math.imul(ce,me)|0,T=T+Math.imul(q,Pe)|0,g=(g=g+Math.imul(q,ke)|0)+Math.imul(z,Pe)|0,A=A+Math.imul(z,ke)|0,T=T+Math.imul(_e,Ue)|0,g=(g=g+Math.imul(_e,Re)|0)+Math.imul(Se,Ue)|0,A=A+Math.imul(Se,Re)|0,T=T+Math.imul(B,et)|0,g=(g=g+Math.imul(B,Ee)|0)+Math.imul(X,et)|0,A=A+Math.imul(X,Ee)|0,T=T+Math.imul(j,Oe)|0,g=(g=g+Math.imul(j,Be)|0)+Math.imul(re,Oe)|0,A=A+Math.imul(re,Be)|0,T=T+Math.imul(V,$)|0,g=(g=g+Math.imul(V,Y)|0)+Math.imul(J,$)|0,A=A+Math.imul(J,Y)|0;var bt=(M+(T=T+Math.imul(x,U)|0)|0)+((8191&(g=(g=g+Math.imul(x,ae)|0)+Math.imul(R,U)|0))<<13)|0;M=((A=A+Math.imul(R,ae)|0)+(g>>>13)|0)+(bt>>>26)|0,bt&=67108863,T=Math.imul(de,He),g=(g=Math.imul(de,Qe))+Math.imul(fe,He)|0,A=Math.imul(fe,Qe),T=T+Math.imul(he,rt)|0,g=(g=g+Math.imul(he,be)|0)+Math.imul(ue,rt)|0,A=A+Math.imul(ue,be)|0,T=T+Math.imul(je,oe)|0,g=(g=g+Math.imul(je,me)|0)+Math.imul(De,oe)|0,A=A+Math.imul(De,me)|0,T=T+Math.imul(le,Pe)|0,g=(g=g+Math.imul(le,ke)|0)+Math.imul(ce,Pe)|0,A=A+Math.imul(ce,ke)|0,T=T+Math.imul(q,Ue)|0,g=(g=g+Math.imul(q,Re)|0)+Math.imul(z,Ue)|0,A=A+Math.imul(z,Re)|0,T=T+Math.imul(_e,et)|0,g=(g=g+Math.imul(_e,Ee)|0)+Math.imul(Se,et)|0,A=A+Math.imul(Se,Ee)|0,T=T+Math.imul(B,Oe)|0,g=(g=g+Math.imul(B,Be)|0)+Math.imul(X,Oe)|0,A=A+Math.imul(X,Be)|0,T=T+Math.imul(j,$)|0,g=(g=g+Math.imul(j,Y)|0)+Math.imul(re,$)|0,A=A+Math.imul(re,Y)|0;var At=(M+(T=T+Math.imul(V,U)|0)|0)+((8191&(g=(g=g+Math.imul(V,ae)|0)+Math.imul(J,U)|0))<<13)|0;M=((A=A+Math.imul(J,ae)|0)+(g>>>13)|0)+(At>>>26)|0,At&=67108863,T=Math.imul(de,rt),g=(g=Math.imul(de,be))+Math.imul(fe,rt)|0,A=Math.imul(fe,be),T=T+Math.imul(he,oe)|0,g=(g=g+Math.imul(he,me)|0)+Math.imul(ue,oe)|0,A=A+Math.imul(ue,me)|0,T=T+Math.imul(je,Pe)|0,g=(g=g+Math.imul(je,ke)|0)+Math.imul(De,Pe)|0,A=A+Math.imul(De,ke)|0,T=T+Math.imul(le,Ue)|0,g=(g=g+Math.imul(le,Re)|0)+Math.imul(ce,Ue)|0,A=A+Math.imul(ce,Re)|0,T=T+Math.imul(q,et)|0,g=(g=g+Math.imul(q,Ee)|0)+Math.imul(z,et)|0,A=A+Math.imul(z,Ee)|0,T=T+Math.imul(_e,Oe)|0,g=(g=g+Math.imul(_e,Be)|0)+Math.imul(Se,Oe)|0,A=A+Math.imul(Se,Be)|0,T=T+Math.imul(B,$)|0,g=(g=g+Math.imul(B,Y)|0)+Math.imul(X,$)|0,A=A+Math.imul(X,Y)|0;var Et=(M+(T=T+Math.imul(j,U)|0)|0)+((8191&(g=(g=g+Math.imul(j,ae)|0)+Math.imul(re,U)|0))<<13)|0;M=((A=A+Math.imul(re,ae)|0)+(g>>>13)|0)+(Et>>>26)|0,Et&=67108863,T=Math.imul(de,oe),g=(g=Math.imul(de,me))+Math.imul(fe,oe)|0,A=Math.imul(fe,me),T=T+Math.imul(he,Pe)|0,g=(g=g+Math.imul(he,ke)|0)+Math.imul(ue,Pe)|0,A=A+Math.imul(ue,ke)|0,T=T+Math.imul(je,Ue)|0,g=(g=g+Math.imul(je,Re)|0)+Math.imul(De,Ue)|0,A=A+Math.imul(De,Re)|0,T=T+Math.imul(le,et)|0,g=(g=g+Math.imul(le,Ee)|0)+Math.imul(ce,et)|0,A=A+Math.imul(ce,Ee)|0,T=T+Math.imul(q,Oe)|0,g=(g=g+Math.imul(q,Be)|0)+Math.imul(z,Oe)|0,A=A+Math.imul(z,Be)|0,T=T+Math.imul(_e,$)|0,g=(g=g+Math.imul(_e,Y)|0)+Math.imul(Se,$)|0,A=A+Math.imul(Se,Y)|0;var vt=(M+(T=T+Math.imul(B,U)|0)|0)+((8191&(g=(g=g+Math.imul(B,ae)|0)+Math.imul(X,U)|0))<<13)|0;M=((A=A+Math.imul(X,ae)|0)+(g>>>13)|0)+(vt>>>26)|0,vt&=67108863,T=Math.imul(de,Pe),g=(g=Math.imul(de,ke))+Math.imul(fe,Pe)|0,A=Math.imul(fe,ke),T=T+Math.imul(he,Ue)|0,g=(g=g+Math.imul(he,Re)|0)+Math.imul(ue,Ue)|0,A=A+Math.imul(ue,Re)|0,T=T+Math.imul(je,et)|0,g=(g=g+Math.imul(je,Ee)|0)+Math.imul(De,et)|0,A=A+Math.imul(De,Ee)|0,T=T+Math.imul(le,Oe)|0,g=(g=g+Math.imul(le,Be)|0)+Math.imul(ce,Oe)|0,A=A+Math.imul(ce,Be)|0,T=T+Math.imul(q,$)|0,g=(g=g+Math.imul(q,Y)|0)+Math.imul(z,$)|0,A=A+Math.imul(z,Y)|0;var wt=(M+(T=T+Math.imul(_e,U)|0)|0)+((8191&(g=(g=g+Math.imul(_e,ae)|0)+Math.imul(Se,U)|0))<<13)|0;M=((A=A+Math.imul(Se,ae)|0)+(g>>>13)|0)+(wt>>>26)|0,wt&=67108863,T=Math.imul(de,Ue),g=(g=Math.imul(de,Re))+Math.imul(fe,Ue)|0,A=Math.imul(fe,Re),T=T+Math.imul(he,et)|0,g=(g=g+Math.imul(he,Ee)|0)+Math.imul(ue,et)|0,A=A+Math.imul(ue,Ee)|0,T=T+Math.imul(je,Oe)|0,g=(g=g+Math.imul(je,Be)|0)+Math.imul(De,Oe)|0,A=A+Math.imul(De,Be)|0,T=T+Math.imul(le,$)|0,g=(g=g+Math.imul(le,Y)|0)+Math.imul(ce,$)|0,A=A+Math.imul(ce,Y)|0;var _t=(M+(T=T+Math.imul(q,U)|0)|0)+((8191&(g=(g=g+Math.imul(q,ae)|0)+Math.imul(z,U)|0))<<13)|0;M=((A=A+Math.imul(z,ae)|0)+(g>>>13)|0)+(_t>>>26)|0,_t&=67108863,T=Math.imul(de,et),g=(g=Math.imul(de,Ee))+Math.imul(fe,et)|0,A=Math.imul(fe,Ee),T=T+Math.imul(he,Oe)|0,g=(g=g+Math.imul(he,Be)|0)+Math.imul(ue,Oe)|0,A=A+Math.imul(ue,Be)|0,T=T+Math.imul(je,$)|0,g=(g=g+Math.imul(je,Y)|0)+Math.imul(De,$)|0,A=A+Math.imul(De,Y)|0;var ct=(M+(T=T+Math.imul(le,U)|0)|0)+((8191&(g=(g=g+Math.imul(le,ae)|0)+Math.imul(ce,U)|0))<<13)|0;M=((A=A+Math.imul(ce,ae)|0)+(g>>>13)|0)+(ct>>>26)|0,ct&=67108863,T=Math.imul(de,Oe),g=(g=Math.imul(de,Be))+Math.imul(fe,Oe)|0,A=Math.imul(fe,Be),T=T+Math.imul(he,$)|0,g=(g=g+Math.imul(he,Y)|0)+Math.imul(ue,$)|0,A=A+Math.imul(ue,Y)|0;var ft=(M+(T=T+Math.imul(je,U)|0)|0)+((8191&(g=(g=g+Math.imul(je,ae)|0)+Math.imul(De,U)|0))<<13)|0;M=((A=A+Math.imul(De,ae)|0)+(g>>>13)|0)+(ft>>>26)|0,ft&=67108863,T=Math.imul(de,$),g=(g=Math.imul(de,Y))+Math.imul(fe,$)|0,A=Math.imul(fe,Y);var it=(M+(T=T+Math.imul(he,U)|0)|0)+((8191&(g=(g=g+Math.imul(he,ae)|0)+Math.imul(ue,U)|0))<<13)|0;M=((A=A+Math.imul(ue,ae)|0)+(g>>>13)|0)+(it>>>26)|0,it&=67108863;var lt=(M+(T=Math.imul(de,U))|0)+((8191&(g=(g=Math.imul(de,ae))+Math.imul(fe,U)|0))<<13)|0;return M=((A=Math.imul(fe,ae))+(g>>>13)|0)+(lt>>>26)|0,lt&=67108863,N[0]=Ae,N[1]=Ie,N[2]=xe,N[3]=Ge,N[4]=ut,N[5]=nt,N[6]=Ct,N[7]=st,N[8]=mt,N[9]=bt,N[10]=At,N[11]=Et,N[12]=vt,N[13]=wt,N[14]=_t,N[15]=ct,N[16]=ft,N[17]=it,N[18]=lt,M!==0&&(N[19]=M,I.length++),I};function h(w,S,I){return new y().mulp(w,S,I)}function y(w,S){this.x=w,this.y=S}Math.imul||(f=p),i.prototype.mulTo=function(w,S){var I,T=this.length+w.length;return I=this.length===10&&w.length===10?f(this,w,S):T<63?p(this,w,S):T<1024?function(g,A,P){P.negative=A.negative^g.negative,P.length=g.length+A.length;for(var O=0,N=0,M=0;M<P.length-1;M++){var L=N;N=0;for(var x=67108863&O,R=Math.min(M,A.length-1),K=Math.max(0,M-g.length+1);K<=R;K++){var V=M-K,J=(0|g.words[V])*(0|A.words[K]),se=67108863&J;x=67108863&(se=se+x|0),N+=(L=(L=L+(J/67108864|0)|0)+(se>>>26)|0)>>>26,L&=67108863}P.words[M]=x,O=L,L=N}return O!==0?P.words[M]=O:P.length--,P.strip()}(this,w,S):h(this,w,S),I},y.prototype.makeRBT=function(w){for(var S=Array(w),I=i.prototype._countBits(w)-1,T=0;T<w;T++)S[T]=this.revBin(T,I,w);return S},y.prototype.revBin=function(w,S,I){if(w===0||w===I-1)return w;for(var T=0,g=0;g<S;g++)T|=(1&w)<<S-g-1,w>>=1;return T},y.prototype.permute=function(w,S,I,T,g,A){for(var P=0;P<A;P++)T[P]=S[w[P]],g[P]=I[w[P]]},y.prototype.transform=function(w,S,I,T,g,A){this.permute(A,w,S,I,T,g);for(var P=1;P<g;P<<=1)for(var O=P<<1,N=Math.cos(2*Math.PI/O),M=Math.sin(2*Math.PI/O),L=0;L<g;L+=O)for(var x=N,R=M,K=0;K<P;K++){var V=I[L+K],J=T[L+K],se=I[L+K+P],j=T[L+K+P],re=x*se-R*j;j=x*j+R*se,se=re,I[L+K]=V+se,T[L+K]=J+j,I[L+K+P]=V-se,T[L+K+P]=J-j,K!==O&&(re=N*x-M*R,R=N*R+M*x,x=re)}},y.prototype.guessLen13b=function(w,S){var I=1|Math.max(S,w),T=1&I,g=0;for(I=I/2|0;I;I>>>=1)g++;return 1<<g+1+T},y.prototype.conjugate=function(w,S,I){if(!(I<=1))for(var T=0;T<I/2;T++){var g=w[T];w[T]=w[I-T-1],w[I-T-1]=g,g=S[T],S[T]=-S[I-T-1],S[I-T-1]=-g}},y.prototype.normalize13b=function(w,S){for(var I=0,T=0;T<S/2;T++){var g=8192*Math.round(w[2*T+1]/S)+Math.round(w[2*T]/S)+I;w[T]=67108863&g,I=g<67108864?0:g/67108864|0}return w},y.prototype.convert13b=function(w,S,I,T){for(var g=0,A=0;A<S;A++)g+=0|w[A],I[2*A]=8191&g,g>>>=13,I[2*A+1]=8191&g,g>>>=13;for(A=2*S;A<T;++A)I[A]=0;n(g===0),n((-8192&g)==0)},y.prototype.stub=function(w){for(var S=Array(w),I=0;I<w;I++)S[I]=0;return S},y.prototype.mulp=function(w,S,I){var T=2*this.guessLen13b(w.length,S.length),g=this.makeRBT(T),A=this.stub(T),P=Array(T),O=Array(T),N=Array(T),M=Array(T),L=Array(T),x=Array(T),R=I.words;R.length=T,this.convert13b(w.words,w.length,P,T),this.convert13b(S.words,S.length,M,T),this.transform(P,A,O,N,T,g),this.transform(M,A,L,x,T,g);for(var K=0;K<T;K++){var V=O[K]*L[K]-N[K]*x[K];N[K]=O[K]*x[K]+N[K]*L[K],O[K]=V}return this.conjugate(O,N,T),this.transform(O,N,R,A,T,g),this.conjugate(R,A,T),this.normalize13b(R,T),I.negative=w.negative^S.negative,I.length=w.length+S.length,I.strip()},i.prototype.mul=function(w){var S=new i(null);return S.words=Array(this.length+w.length),this.mulTo(w,S)},i.prototype.mulf=function(w){var S=new i(null);return S.words=Array(this.length+w.length),h(this,w,S)},i.prototype.imul=function(w){return this.clone().mulTo(w,this)},i.prototype.imuln=function(w){n(typeof w=="number"),n(w<67108864);for(var S=0,I=0;I<this.length;I++){var T=(0|this.words[I])*w,g=(67108863&T)+(67108863&S);S>>=26,S+=T/67108864|0,S+=g>>>26,this.words[I]=67108863&g}return S!==0&&(this.words[I]=S,this.length++),this},i.prototype.muln=function(w){return this.clone().imuln(w)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(w){var S=function(A){for(var P=Array(A.bitLength()),O=0;O<P.length;O++){var N=O/26|0,M=O%26;P[O]=(A.words[N]&1<<M)>>>M}return P}(w);if(S.length===0)return new i(1);for(var I=this,T=0;T<S.length&&S[T]===0;T++,I=I.sqr());if(++T<S.length)for(var g=I.sqr();T<S.length;T++,g=g.sqr())S[T]!==0&&(I=I.mul(g));return I},i.prototype.iushln=function(w){n(typeof w=="number"&&w>=0);var S,I=w%26,T=(w-I)/26,g=67108863>>>26-I<<26-I;if(I!==0){var A=0;for(S=0;S<this.length;S++){var P=this.words[S]&g,O=(0|this.words[S])-P<<I;this.words[S]=O|A,A=P>>>26-I}A&&(this.words[S]=A,this.length++)}if(T!==0){for(S=this.length-1;S>=0;S--)this.words[S+T]=this.words[S];for(S=0;S<T;S++)this.words[S]=0;this.length+=T}return this.strip()},i.prototype.ishln=function(w){return n(this.negative===0),this.iushln(w)},i.prototype.iushrn=function(w,S,I){var T;n(typeof w=="number"&&w>=0),T=S?(S-S%26)/26:0;var g=w%26,A=Math.min((w-g)/26,this.length),P=67108863^67108863>>>g<<g,O=I;if(T=Math.max(0,T-=A),O){for(var N=0;N<A;N++)O.words[N]=this.words[N];O.length=A}if(A!==0)if(this.length>A)for(this.length-=A,N=0;N<this.length;N++)this.words[N]=this.words[N+A];else this.words[0]=0,this.length=1;var M=0;for(N=this.length-1;N>=0&&(M!==0||N>=T);N--){var L=0|this.words[N];this.words[N]=M<<26-g|L>>>g,M=L&P}return O&&M!==0&&(O.words[O.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(w,S,I){return n(this.negative===0),this.iushrn(w,S,I)},i.prototype.shln=function(w){return this.clone().ishln(w)},i.prototype.ushln=function(w){return this.clone().iushln(w)},i.prototype.shrn=function(w){return this.clone().ishrn(w)},i.prototype.ushrn=function(w){return this.clone().iushrn(w)},i.prototype.testn=function(w){n(typeof w=="number"&&w>=0);var S=w%26,I=(w-S)/26,T=1<<S;return!(this.length<=I)&&!!(this.words[I]&T)},i.prototype.imaskn=function(w){n(typeof w=="number"&&w>=0);var S=w%26,I=(w-S)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(S!==0&&I++,this.length=Math.min(I,this.length),S!==0){var T=67108863^67108863>>>S<<S;this.words[this.length-1]&=T}return this.strip()},i.prototype.maskn=function(w){return this.clone().imaskn(w)},i.prototype.iaddn=function(w){return n(typeof w=="number"),n(w<67108864),w<0?this.isubn(-w):this.negative!==0?this.length===1&&(0|this.words[0])<w?(this.words[0]=w-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(w),this.negative=1,this):this._iaddn(w)},i.prototype._iaddn=function(w){this.words[0]+=w;for(var S=0;S<this.length&&this.words[S]>=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},i.prototype.isubn=function(w){if(n(typeof w=="number"),n(w<67108864),w<0)return this.iaddn(-w);if(this.negative!==0)return this.negative=0,this.iaddn(w),this.negative=1,this;if(this.words[0]-=w,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S<this.length&&this.words[S]<0;S++)this.words[S]+=67108864,this.words[S+1]-=1;return this.strip()},i.prototype.addn=function(w){return this.clone().iaddn(w)},i.prototype.subn=function(w){return this.clone().isubn(w)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(w,S,I){var T,g,A=w.length+I;this._expand(A);var P=0;for(T=0;T<w.length;T++){g=(0|this.words[T+I])+P;var O=(0|w.words[T])*S;P=((g-=67108863&O)>>26)-(O/67108864|0),this.words[T+I]=67108863&g}for(;T<this.length-I;T++)P=(g=(0|this.words[T+I])+P)>>26,this.words[T+I]=67108863&g;if(P===0)return this.strip();for(n(P===-1),P=0,T=0;T<this.length;T++)P=(g=-(0|this.words[T])+P)>>26,this.words[T]=67108863&g;return this.negative=1,this.strip()},i.prototype._wordDiv=function(w,S){var I=(this.length,w.length),T=this.clone(),g=w,A=0|g.words[g.length-1];(I=26-this._countBits(A))!==0&&(g=g.ushln(I),T.iushln(I),A=0|g.words[g.length-1]);var P,O=T.length-g.length;if(S!=="mod"){(P=new i(null)).length=O+1,P.words=Array(P.length);for(var N=0;N<P.length;N++)P.words[N]=0}var M=T.clone()._ishlnsubmul(g,1,O);M.negative===0&&(T=M,P&&(P.words[O]=1));for(var L=O-1;L>=0;L--){var x=67108864*(0|T.words[g.length+L])+(0|T.words[g.length+L-1]);for(x=Math.min(x/A|0,67108863),T._ishlnsubmul(g,x,L);T.negative!==0;)x--,T.negative=0,T._ishlnsubmul(g,1,L),T.isZero()||(T.negative^=1);P&&(P.words[L]=x)}return P&&P.strip(),T.strip(),S!=="div"&&I!==0&&T.iushrn(I),{div:P||null,mod:T}},i.prototype.divmod=function(w,S,I){return n(!w.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&w.negative===0?(A=this.neg().divmod(w,S),S!=="mod"&&(T=A.div.neg()),S!=="div"&&(g=A.mod.neg(),I&&g.negative!==0&&g.iadd(w)),{div:T,mod:g}):this.negative===0&&w.negative!==0?(A=this.divmod(w.neg(),S),S!=="mod"&&(T=A.div.neg()),{div:T,mod:A.mod}):this.negative&w.negative?(A=this.neg().divmod(w.neg(),S),S!=="div"&&(g=A.mod.neg(),I&&g.negative!==0&&g.isub(w)),{div:A.div,mod:g}):w.length>this.length||this.cmp(w)<0?{div:new i(0),mod:this}:w.length===1?S==="div"?{div:this.divn(w.words[0]),mod:null}:S==="mod"?{div:null,mod:new i(this.modn(w.words[0]))}:{div:this.divn(w.words[0]),mod:new i(this.modn(w.words[0]))}:this._wordDiv(w,S);var T,g,A},i.prototype.div=function(w){return this.divmod(w,"div",!1).div},i.prototype.mod=function(w){return this.divmod(w,"mod",!1).mod},i.prototype.umod=function(w){return this.divmod(w,"mod",!0).mod},i.prototype.divRound=function(w){var S=this.divmod(w);if(S.mod.isZero())return S.div;var I=S.div.negative!==0?S.mod.isub(w):S.mod,T=w.ushrn(1),g=w.andln(1),A=I.cmp(T);return A<0||g===1&&A===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},i.prototype.modn=function(w){n(w<=67108863);for(var S=(1<<26)%w,I=0,T=this.length-1;T>=0;T--)I=(S*I+(0|this.words[T]))%w;return I},i.prototype.idivn=function(w){n(w<=67108863);for(var S=0,I=this.length-1;I>=0;I--){var T=(0|this.words[I])+67108864*S;this.words[I]=T/w|0,S=T%w}return this.strip()},i.prototype.divn=function(w){return this.clone().idivn(w)},i.prototype.egcd=function(w){n(w.negative===0),n(!w.isZero());var S=this,I=w.clone();S=S.negative!==0?S.umod(w):S.clone();for(var T=new i(1),g=new i(0),A=new i(0),P=new i(1),O=0;S.isEven()&&I.isEven();)S.iushrn(1),I.iushrn(1),++O;for(var N=I.clone(),M=S.clone();!S.isZero();){for(var L=0,x=1;!(S.words[0]&x)&&L<26;++L,x<<=1);if(L>0)for(S.iushrn(L);L-- >0;)(T.isOdd()||g.isOdd())&&(T.iadd(N),g.isub(M)),T.iushrn(1),g.iushrn(1);for(var R=0,K=1;!(I.words[0]&K)&&R<26;++R,K<<=1);if(R>0)for(I.iushrn(R);R-- >0;)(A.isOdd()||P.isOdd())&&(A.iadd(N),P.isub(M)),A.iushrn(1),P.iushrn(1);S.cmp(I)>=0?(S.isub(I),T.isub(A),g.isub(P)):(I.isub(S),A.isub(T),P.isub(g))}return{a:A,b:P,gcd:I.iushln(O)}},i.prototype._invmp=function(w){n(w.negative===0),n(!w.isZero());var S=this,I=w.clone();S=S.negative!==0?S.umod(w):S.clone();for(var T,g=new i(1),A=new i(0),P=I.clone();S.cmpn(1)>0&&I.cmpn(1)>0;){for(var O=0,N=1;!(S.words[0]&N)&&O<26;++O,N<<=1);if(O>0)for(S.iushrn(O);O-- >0;)g.isOdd()&&g.iadd(P),g.iushrn(1);for(var M=0,L=1;!(I.words[0]&L)&&M<26;++M,L<<=1);if(M>0)for(I.iushrn(M);M-- >0;)A.isOdd()&&A.iadd(P),A.iushrn(1);S.cmp(I)>=0?(S.isub(I),g.isub(A)):(I.isub(S),A.isub(g))}return(T=S.cmpn(1)===0?g:A).cmpn(0)<0&&T.iadd(w),T},i.prototype.gcd=function(w){if(this.isZero())return w.abs();if(w.isZero())return this.abs();var S=this.clone(),I=w.clone();S.negative=0,I.negative=0;for(var T=0;S.isEven()&&I.isEven();T++)S.iushrn(1),I.iushrn(1);for(;;){for(;S.isEven();)S.iushrn(1);for(;I.isEven();)I.iushrn(1);var g=S.cmp(I);if(g<0){var A=S;S=I,I=A}else if(g===0||I.cmpn(1)===0)break;S.isub(I)}return I.iushln(T)},i.prototype.invm=function(w){return this.egcd(w).a.umod(w)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(w){return this.words[0]&w},i.prototype.bincn=function(w){n(typeof w=="number");var S=w%26,I=(w-S)/26,T=1<<S;if(this.length<=I)return this._expand(I+1),this.words[I]|=T,this;for(var g=T,A=I;g!==0&&A<this.length;A++){var P=0|this.words[A];g=(P+=g)>>>26,P&=67108863,this.words[A]=P}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(w){var S,I=w<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;if(this.strip(),this.length>1)S=1;else{I&&(w=-w),n(w<=67108863,"Number is too big");var T=0|this.words[0];S=T===w?0:T<w?-1:1}return this.negative!==0?0|-S:S},i.prototype.cmp=function(w){if(this.negative!==0&&w.negative===0)return-1;if(this.negative===0&&w.negative!==0)return 1;var S=this.ucmp(w);return this.negative!==0?0|-S:S},i.prototype.ucmp=function(w){if(this.length>w.length)return 1;if(this.length<w.length)return-1;for(var S=0,I=this.length-1;I>=0;I--){var T=0|this.words[I],g=0|w.words[I];if(T!==g){T<g?S=-1:T>g&&(S=1);break}}return S},i.prototype.gtn=function(w){return this.cmpn(w)===1},i.prototype.gt=function(w){return this.cmp(w)===1},i.prototype.gten=function(w){return this.cmpn(w)>=0},i.prototype.gte=function(w){return this.cmp(w)>=0},i.prototype.ltn=function(w){return this.cmpn(w)===-1},i.prototype.lt=function(w){return this.cmp(w)===-1},i.prototype.lten=function(w){return this.cmpn(w)<=0},i.prototype.lte=function(w){return this.cmp(w)<=0},i.prototype.eqn=function(w){return this.cmpn(w)===0},i.prototype.eq=function(w){return this.cmp(w)===0},i.red=function(w){return new k(w)},i.prototype.toRed=function(w){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),w.convertTo(this)._forceRed(w)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(w){return this.red=w,this},i.prototype.forceRed=function(w){return n(!this.red,"Already a number in reduction context"),this._forceRed(w)},i.prototype.redAdd=function(w){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,w)},i.prototype.redIAdd=function(w){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,w)},i.prototype.redSub=function(w){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,w)},i.prototype.redISub=function(w){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,w)},i.prototype.redShl=function(w){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,w)},i.prototype.redMul=function(w){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,w),this.red.mul(this,w)},i.prototype.redIMul=function(w){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,w),this.red.imul(this,w)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(w){return n(this.red&&!w.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,w)};var m={k256:null,p224:null,p192:null,p25519:null};function b(w,S){this.name=w,this.p=new i(S,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function C(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(w){if(typeof w=="string"){var S=i._prime(w);this.m=S.p,this.prime=S}else n(w.gtn(1),"modulus must be greater than 1"),this.m=w,this.prime=null}function D(w){k.call(this,w),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var w=new i(null);return w.words=Array(Math.ceil(this.n/13)),w},b.prototype.ireduce=function(w){var S,I=w;do this.split(I,this.tmp),S=(I=(I=this.imulK(I)).iadd(this.tmp)).bitLength();while(S>this.n);var T=S<this.n?-1:I.ucmp(this.p);return T===0?(I.words[0]=0,I.length=1):T>0?I.isub(this.p):I.strip(),I},b.prototype.split=function(w,S){w.iushrn(this.n,0,S)},b.prototype.imulK=function(w){return w.imul(this.k)},s(v,b),v.prototype.split=function(w,S){for(var I=4194303,T=Math.min(w.length,9),g=0;g<T;g++)S.words[g]=w.words[g];if(S.length=T,w.length<=9)return w.words[0]=0,void(w.length=1);var A=w.words[9];for(S.words[S.length++]=A&I,g=10;g<w.length;g++){var P=0|w.words[g];w.words[g-10]=(P&I)<<4|A>>>22,A=P}A>>>=22,w.words[g-10]=A,A===0&&w.length>10?w.length-=10:w.length-=9},v.prototype.imulK=function(w){w.words[w.length]=0,w.words[w.length+1]=0,w.length+=2;for(var S=0,I=0;I<w.length;I++){var T=0|w.words[I];S+=977*T,w.words[I]=67108863&S,S=64*T+(S/67108864|0)}return w.words[w.length-1]===0&&(w.length--,w.words[w.length-1]===0&&w.length--),w},s(E,b),s(_,b),s(C,b),C.prototype.imulK=function(w){for(var S=0,I=0;I<w.length;I++){var T=19*(0|w.words[I])+S,g=67108863&T;T>>>=26,w.words[I]=g,S=T}return S!==0&&(w.words[w.length++]=S),w},i._prime=function(w){if(m[w])return m[w];var S;if(w==="k256")S=new v;else if(w==="p224")S=new E;else if(w==="p192")S=new _;else{if(w!=="p25519")throw Error("Unknown prime "+w);S=new C}return m[w]=S,S},k.prototype._verify1=function(w){n(w.negative===0,"red works only with positives"),n(w.red,"red works only with red numbers")},k.prototype._verify2=function(w,S){n((w.negative|S.negative)==0,"red works only with positives"),n(w.red&&w.red===S.red,"red works only with red numbers")},k.prototype.imod=function(w){return this.prime?this.prime.ireduce(w)._forceRed(this):w.umod(this.m)._forceRed(this)},k.prototype.neg=function(w){return w.isZero()?w.clone():this.m.sub(w)._forceRed(this)},k.prototype.add=function(w,S){this._verify2(w,S);var I=w.add(S);return I.cmp(this.m)>=0&&I.isub(this.m),I._forceRed(this)},k.prototype.iadd=function(w,S){this._verify2(w,S);var I=w.iadd(S);return I.cmp(this.m)>=0&&I.isub(this.m),I},k.prototype.sub=function(w,S){this._verify2(w,S);var I=w.sub(S);return I.cmpn(0)<0&&I.iadd(this.m),I._forceRed(this)},k.prototype.isub=function(w,S){this._verify2(w,S);var I=w.isub(S);return I.cmpn(0)<0&&I.iadd(this.m),I},k.prototype.shl=function(w,S){return this._verify1(w),this.imod(w.ushln(S))},k.prototype.imul=function(w,S){return this._verify2(w,S),this.imod(w.imul(S))},k.prototype.mul=function(w,S){return this._verify2(w,S),this.imod(w.mul(S))},k.prototype.isqr=function(w){return this.imul(w,w.clone())},k.prototype.sqr=function(w){return this.mul(w,w)},k.prototype.sqrt=function(w){if(w.isZero())return w.clone();var S=this.m.andln(3);if(n(S%2==1),S===3){var I=this.m.add(new i(1)).iushrn(2);return this.pow(w,I)}for(var T=this.m.subn(1),g=0;!T.isZero()&&T.andln(1)===0;)g++,T.iushrn(1);n(!T.isZero());var A=new i(1).toRed(this),P=A.redNeg(),O=this.m.subn(1).iushrn(1),N=this.m.bitLength();for(N=new i(2*N*N).toRed(this);this.pow(N,O).cmp(P)!==0;)N.redIAdd(P);for(var M=this.pow(N,T),L=this.pow(w,T.addn(1).iushrn(1)),x=this.pow(w,T),R=g;x.cmp(A)!==0;){for(var K=x,V=0;K.cmp(A)!==0;V++)K=K.redSqr();n(V<R);var J=this.pow(M,new i(1).iushln(R-V-1));L=L.redMul(J),M=J.redSqr(),x=x.redMul(M),R=V}return L},k.prototype.invm=function(w){var S=w._invmp(this.m);return S.negative!==0?(S.negative=0,this.imod(S).redNeg()):this.imod(S)},k.prototype.pow=function(w,S){if(S.isZero())return new i(1).toRed(this);if(S.cmpn(1)===0)return w.clone();var I=Array(16);I[0]=new i(1).toRed(this),I[1]=w;for(var T=2;T<I.length;T++)I[T]=this.mul(I[T-1],w);var g=I[0],A=0,P=0,O=S.bitLength()%26;for(O===0&&(O=26),T=S.length-1;T>=0;T--){for(var N=S.words[T],M=O-1;M>=0;M--){var L=N>>M&1;g!==I[0]&&(g=this.sqr(g)),L!==0||A!==0?(A<<=1,A|=L,(++P===4||T===0&&M===0)&&(g=this.mul(g,I[A]),P=0,A=0)):P=0}O=26}return g},k.prototype.convertTo=function(w){var S=w.umod(this.m);return S===w?S.clone():S},k.prototype.convertFrom=function(w){var S=w.clone();return S.red=null,S},i.mont=function(w){return new D(w)},s(D,k),D.prototype.convertTo=function(w){return this.imod(w.ushln(this.shift))},D.prototype.convertFrom=function(w){var S=this.imod(w.mul(this.rinv));return S.red=null,S},D.prototype.imul=function(w,S){if(w.isZero()||S.isZero())return w.words[0]=0,w.length=1,w;var I=w.imul(S),T=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=I.isub(T).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},D.prototype.mul=function(w,S){if(w.isZero()||S.isZero())return new i(0)._forceRed(this);var I=w.mul(S),T=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=I.isub(T).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},D.prototype.invm=function(w){return this.imod(w._invmp(this.m).mul(this.r2))._forceRed(this)}})(e,cP)}),rl=Object.freeze({__proto__:null,default:pt,__moduleExports:pt});class bl{constructor(t){if(t===void 0)throw Error("Invalid BigInteger input");this.value=new pt(t)}clone(){const t=new bl(null);return this.value.copy(t.value),t}iinc(){return this.value.iadd(new pt(1)),this}inc(){return this.clone().iinc()}idec(){return this.value.isub(new pt(1)),this}dec(){return this.clone().idec()}iadd(t){return this.value.iadd(t.value),this}add(t){return this.clone().iadd(t)}isub(t){return this.value.isub(t.value),this}sub(t){return this.clone().isub(t)}imul(t){return this.value.imul(t.value),this}mul(t){return this.clone().imul(t)}imod(t){return this.value=this.value.umod(t.value),this}mod(t){return this.clone().imod(t)}modExp(t,r){const n=r.isEven()?pt.red(r.value):pt.mont(r.value),s=this.clone();return s.value=s.value.toRed(n).redPow(t.value).fromRed(),s}modInv(t){if(!this.gcd(t).isOne())throw Error("Inverse does not exist");return new bl(this.value.invm(t.value))}gcd(t){return new bl(this.value.gcd(t.value))}ileftShift(t){return this.value.ishln(t.value.toNumber()),this}leftShift(t){return this.clone().ileftShift(t)}irightShift(t){return this.value.ishrn(t.value.toNumber()),this}rightShift(t){return this.clone().irightShift(t)}equal(t){return this.value.eq(t.value)}lt(t){return this.value.lt(t.value)}lte(t){return this.value.lte(t.value)}gt(t){return this.value.gt(t.value)}gte(t){return this.value.gte(t.value)}isZero(){return this.value.isZero()}isOne(){return this.value.eq(new pt(1))}isNegative(){return this.value.isNeg()}isEven(){return this.value.isEven()}abs(){const t=this.clone();return t.value=t.value.abs(),t}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}getBit(t){return this.value.testn(t)?1:0}bitLength(){return this.value.bitLength()}byteLength(){return this.value.byteLength()}toUint8Array(t="be",r){return this.value.toArrayLike(Uint8Array,t,r)}}var D0,RC=Object.freeze({__proto__:null,default:bl}),Qn=Ni(function(e,t){var r=t;function n(i){return i.length===1?"0"+i:i}function s(i){for(var o="",a=0;a<i.length;a++)o+=n(i[a].toString(16));return o}r.toArray=function(i,o){if(Array.isArray(i))return i.slice();if(!i)return[];var a=[];if(typeof i!="string"){for(var d=0;d<i.length;d++)a[d]=0|i[d];return a}if(o==="hex")for((i=i.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(i="0"+i),d=0;d<i.length;d+=2)a.push(parseInt(i[d]+i[d+1],16));else for(d=0;d<i.length;d++){var c=i.charCodeAt(d),l=c>>8,u=255&c;l?a.push(l,u):a.push(u)}return a},r.zero2=n,r.toHex=s,r.encode=function(i,o){return o==="hex"?s(i):i}}),Zt=Ni(function(e,t){var r=t;r.assert=$s,r.toArray=Qn.toArray,r.zero2=Qn.zero2,r.toHex=Qn.toHex,r.encode=Qn.encode,r.getNAF=function(n,s){for(var i=[],o=1<<s+1,a=n.clone();a.cmpn(1)>=0;){var d;if(a.isOdd()){var c=a.andln(o-1);d=c>(o>>1)-1?(o>>1)-c:c,a.isubn(d)}else d=0;i.push(d);for(var l=a.cmpn(0)!==0&&a.andln(o-1)===0?s+1:1,u=1;u<l;u++)i.push(0);a.iushrn(l)}return i},r.getJSF=function(n,s){var i=[[],[]];n=n.clone(),s=s.clone();for(var o=0,a=0;n.cmpn(-o)>0||s.cmpn(-a)>0;){var d,c,l,u=n.andln(3)+o&3,p=s.andln(3)+a&3;u===3&&(u=-1),p===3&&(p=-1),(1&u)==0?d=0:d=(l=n.andln(7)+o&7)!==3&&l!==5||p!==2?u:-u,i[0].push(d),(1&p)==0?c=0:c=(l=s.andln(7)+a&7)!==3&&l!==5||u!==2?p:-p,i[1].push(c),2*o===d+1&&(o=1-o),2*a===c+1&&(a=1-a),n.iushrn(1),s.iushrn(1)}return i},r.cachedProperty=function(n,s,i){var o="_"+s;n.prototype[s]=function(){return this[o]!==void 0?this[o]:this[o]=i.call(this)}},r.parseBytes=function(n){return typeof n=="string"?r.toArray(n,"hex"):n},r.intFromLE=function(n){return new pt(n,"hex","le")}}),Rh=function(e){return D0||(D0=new Ps(null)),D0.generate(e)};function Ps(e){this.rand=e}var kC=Ps;if(Ps.prototype.generate=function(e){return this._rand(e)},Ps.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?Ps.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?Ps.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(Ps.prototype._rand=function(){throw Error("Not implemented yet")});else try{var $3=void 0;if(typeof $3.randomBytes!="function")throw Error("Not supported");Ps.prototype._rand=function(e){return $3.randomBytes(e)}}catch{}Rh.Rand=kC;var Md=Zt.getNAF,MC=Zt.getJSF,Od=Zt.assert;function _s(e,t){this.type=e,this.p=new pt(t.p,16),this.red=t.prime?pt.red(t.prime):pt.mont(this.p),this.zero=new pt(0).toRed(this.red),this.one=new pt(1).toRed(this.red),this.two=new pt(2).toRed(this.red),this.n=t.n&&new pt(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,];var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var hn=_s;function Mn(e,t){this.curve=e,this.type=t,this.precomputed=null}_s.prototype.point=function(){throw Error("Not implemented")},_s.prototype.validate=function(){throw Error("Not implemented")},_s.prototype._fixedNafMul=function(e,t){Od(e.precomputed);var r=e._getDoubles(),n=Md(t,1),s=(1<<r.step+1)-(r.step%2==0?2:1);s/=3;for(var i=[],o=0;o<n.length;o+=r.step){var a=0;for(t=o+r.step-1;t>=o;t--)a=(a<<1)+n[t];i.push(a)}for(var d=this.jpoint(null,null,null),c=this.jpoint(null,null,null),l=s;l>0;l--){for(o=0;o<i.length;o++)(a=i[o])===l?c=c.mixedAdd(r.points[o]):a===-l&&(c=c.mixedAdd(r.points[o].neg()));d=d.add(c)}return d.toP()},_s.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var s=n.points,i=Md(t,r),o=this.jpoint(null,null,null),a=i.length-1;a>=0;a--){for(t=0;a>=0&&i[a]===0;a--)t++;if(a>=0&&t++,o=o.dblp(t),a<0)break;var d=i[a];Od(d!==0),o=e.type==="affine"?d>0?o.mixedAdd(s[d-1>>1]):o.mixedAdd(s[-d-1>>1].neg()):d>0?o.add(s[d-1>>1]):o.add(s[-d-1>>1].neg())}return e.type==="affine"?o.toP():o},_s.prototype._wnafMulAdd=function(e,t,r,n,s){for(var i=this._wnafT1,o=this._wnafT2,a=this._wnafT3,d=0,c=0;c<n;c++){var l=(D=t[c])._getNAFPoints(e);i[c]=l.wnd,o[c]=l.points}for(c=n-1;c>=1;c-=2){var u=c-1,p=c;if(i[u]===1&&i[p]===1){var f=[t[u],null,null,t[p]];t[u].y.cmp(t[p].y)===0?(f[1]=t[u].add(t[p]),f[2]=t[u].toJ().mixedAdd(t[p].neg())):t[u].y.cmp(t[p].y.redNeg())===0?(f[1]=t[u].toJ().mixedAdd(t[p]),f[2]=t[u].add(t[p].neg())):(f[1]=t[u].toJ().mixedAdd(t[p]),f[2]=t[u].toJ().mixedAdd(t[p].neg()));var h=[-3,-1,-5,-7,0,7,5,1,3],y=MC(r[u],r[p]);d=Math.max(y[0].length,d),a[u]=Array(d),a[p]=Array(d);for(var m=0;m<d;m++){var b=0|y[0][m],v=0|y[1][m];a[u][m]=h[3*(b+1)+(v+1)],a[p][m]=0,o[u]=f}}else a[u]=Md(r[u],i[u]),a[p]=Md(r[p],i[p]),d=Math.max(a[u].length,d),d=Math.max(a[p].length,d)}var E=this.jpoint(null,null,null),_=this._wnafT4;for(c=d;c>=0;c--){for(var C=0;c>=0;){var k=!0;for(m=0;m<n;m++)_[m]=0|a[m][c],_[m]!==0&&(k=!1);if(!k)break;C++,c--}if(c>=0&&C++,E=E.dblp(C),c<0)break;for(m=0;m<n;m++){var D,w=_[m];w!==0&&(w>0?D=o[m][w-1>>1]:w<0&&(D=o[m][-w-1>>1].neg()),E=D.type==="affine"?E.mixedAdd(D):E.add(D))}}for(c=0;c<n;c++)o[c]=null;return s?E:E.toP()},_s.BasePoint=Mn,Mn.prototype.eq=function(){throw Error("Not implemented")},Mn.prototype.validate=function(){return this.curve.validate(this)},_s.prototype.decodePoint=function(e,t){e=Zt.toArray(e,t);var r=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1==2*r)return e[0]===6?Od(e[e.length-1]%2==0):e[0]===7&&Od(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((e[0]===2||e[0]===3)&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),e[0]===3);throw Error("Unknown point format")},Mn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Mn.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Mn.prototype.encode=function(e,t){return Zt.encode(this._encode(t),e)},Mn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Mn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Mn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,s=0;s<t;s+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},Mn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=r===1?null:this.dbl(),s=1;s<r;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Mn.prototype._getBeta=function(){return null},Mn.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var OC=Zt.assert;function Dn(e){hn.call(this,"short",e),this.a=new pt(e.a,16).toRed(this.red),this.b=new pt(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}Ds(Dn,hn);var NC=Dn;function Tr(e,t,r,n){hn.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new pt(t,16),this.y=new pt(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Br(e,t,r,n){hn.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new pt(0)):(this.x=new pt(t,16),this.y=new pt(r,16),this.z=new pt(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}function Qa(e){hn.call(this,"mont",e),this.a=new pt(e.a,16).toRed(this.red),this.b=new pt(e.b,16).toRed(this.red),this.i4=new pt(4).toRed(this.red).redInvm(),this.two=new pt(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Dn.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&this.p.modn(3)===1){var t,r;if(e.beta)t=new pt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new pt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?r=s[0]:(r=s[1],OC(this.g.mul(r).x.cmp(this.g.x.redMul(t))===0))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(i){return{a:new pt(i.a,16),b:new pt(i.b,16)}}):this._getEndoBasis(r)}}},Dn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:pt.mont(e),r=new pt(2).toRed(t).redInvm(),n=r.redNeg(),s=new pt(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(s).fromRed(),n.redSub(s).fromRed()]},Dn.prototype._getEndoBasis=function(e){for(var t,r,n,s,i,o,a,d,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=e,p=this.n.clone(),f=new pt(1),h=new pt(0),y=new pt(0),m=new pt(1),b=0;u.cmpn(0)!==0;){var v=p.div(u);d=p.sub(v.mul(u)),c=y.sub(v.mul(f));var E=m.sub(v.mul(h));if(!n&&d.cmp(l)<0)t=a.neg(),r=f,n=d.neg(),s=c;else if(n&&++b==2)break;a=d,p=u,u=d,y=f,f=c,m=h,h=E}i=d.neg(),o=c;var _=n.sqr().add(s.sqr());return i.sqr().add(o.sqr()).cmp(_)>=0&&(i=t,o=r),n.negative&&(n=n.neg(),s=s.neg()),i.negative&&(i=i.neg(),o=o.neg()),[{a:n,b:s},{a:i,b:o}]},Dn.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),o=s.mul(r.a),a=i.mul(n.a),d=s.mul(r.b),c=i.mul(n.b);return{k1:e.sub(o).sub(a),k2:d.add(c).neg()}},Dn.prototype.pointFromX=function(e,t){(e=new pt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Dn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0},Dn.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,s=this._endoWnafT2,i=0;i<e.length;i++){var o=this._endoSplit(t[i]),a=e[i],d=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),d=d.neg(!0)),n[2*i]=a,n[2*i+1]=d,s[2*i]=o.k1,s[2*i+1]=o.k2}for(var c=this._wnafMulAdd(1,n,s,2*i,r),l=0;l<2*i;l++)n[l]=null,s[l]=null;return c},Ds(Tr,hn.BasePoint),Dn.prototype.point=function(e,t,r){return new Tr(this,e,t,r)},Dn.prototype.pointFromJSON=function(e,t){return Tr.fromJSON(this,e,t)},Tr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(s){return r.point(s.x.redMul(r.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Tr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Tr.fromJSON=function(e,t,r){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function s(o){return e.point(o[0],o[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(s))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(s))}},n},Tr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Tr.prototype.isInfinity=function(){return this.inf},Tr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Tr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=s.redSqr().redISub(this.x.redAdd(this.x)),o=s.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,o)},Tr.prototype.getX=function(){return this.x.fromRed()},Tr.prototype.getY=function(){return this.y.fromRed()},Tr.prototype.mul=function(e){return e=new pt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Tr.prototype.mulAdd=function(e,t,r){var n=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Tr.prototype.jmulAdd=function(e,t,r){var n=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Tr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Tr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Tr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Ds(Br,hn.BasePoint),Dn.prototype.jpoint=function(e,t,r){return new Br(this,e,t,r)},Br.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Br.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Br.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(s),d=i.redSub(o);if(a.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),l=c.redMul(a),u=n.redMul(c),p=d.redSqr().redIAdd(l).redISub(u).redISub(u),f=d.redMul(u.redISub(p)).redISub(i.redMul(l)),h=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(p,f,h)},Br.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),s=this.y,i=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=s.redSub(i);if(o.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=o.redSqr(),c=d.redMul(o),l=r.redMul(d),u=a.redSqr().redIAdd(c).redISub(l).redISub(l),p=a.redMul(l.redISub(u)).redISub(s.redMul(c)),f=this.z.redMul(o);return this.curve.jpoint(u,p,f)},Br.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,s=this.curve.tinv,i=this.x,o=this.y,a=this.z,d=a.redSqr().redSqr(),c=o.redAdd(o);for(r=0;r<e;r++){var l=i.redSqr(),u=c.redSqr(),p=u.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(d)),h=i.redMul(u),y=f.redSqr().redISub(h.redAdd(h)),m=h.redISub(y),b=f.redMul(m);b=b.redIAdd(b).redISub(p);var v=c.redMul(a);r+1<e&&(d=d.redMul(p)),i=y,a=v,c=b}return this.curve.jpoint(i,c.redMul(s),a)},Br.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Br.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),i=s.redSqr(),o=this.x.redAdd(s).redSqr().redISub(n).redISub(i);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),d=a.redSqr().redISub(o).redISub(o),c=i.redIAdd(i);c=(c=c.redIAdd(c)).redIAdd(c),e=d,t=a.redMul(o.redISub(d)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),u=this.y.redSqr(),p=u.redSqr(),f=this.x.redAdd(u).redSqr().redISub(l).redISub(p);f=f.redIAdd(f);var h=l.redAdd(l).redIAdd(l),y=h.redSqr(),m=p.redIAdd(p);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(f).redISub(f),t=h.redMul(f.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},Br.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),i=s.redSqr(),o=this.x.redAdd(s).redSqr().redISub(n).redISub(i);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),d=a.redSqr().redISub(o).redISub(o);e=d;var c=i.redIAdd(i);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(d)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),u=this.y.redSqr(),p=this.x.redMul(u),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var h=p.redIAdd(p),y=(h=h.redIAdd(h)).redAdd(h);e=f.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(u).redISub(l);var m=u.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=f.redMul(h.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},Br.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,s=n.redSqr().redSqr(),i=t.redSqr(),o=r.redSqr(),a=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(s)),d=t.redAdd(t),c=(d=d.redIAdd(d)).redMul(o),l=a.redSqr().redISub(c.redAdd(c)),u=c.redISub(l),p=o.redSqr();p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var f=a.redMul(u).redISub(p),h=r.redAdd(r).redMul(n);return this.curve.jpoint(l,f,h)},Br.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),i=s.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(i)).redSqr(),d=n.redIAdd(n);d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var c=s.redIAdd(o).redSqr().redISub(i).redISub(a).redISub(d),l=t.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var u=this.x.redMul(a).redISub(l);u=(u=u.redIAdd(u)).redIAdd(u);var p=this.y.redMul(c.redMul(d.redISub(c)).redISub(o.redMul(a)));p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var f=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(u,p,f)},Br.prototype.mul=function(e,t){return e=new pt(e,t),this.curve._wnafMul(this,e)},Br.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=r.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Br.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}},Br.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Br.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Ds(Qa,hn);var DC=Qa;function Ir(e,t,r){hn.BasePoint.call(this,e,"projective"),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new pt(t,16),this.z=new pt(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Qa.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return n.redSqrt().redSqr().cmp(n)===0},Ds(Ir,hn.BasePoint),Qa.prototype.decodePoint=function(e,t){if((e=Zt.toArray(e,t)).length===33&&e[0]===64&&(e=e.slice(1,33).reverse()),e.length!==32)throw Error("Unknown point compression format");return this.point(e,1)},Qa.prototype.point=function(e,t){return new Ir(this,e,t)},Qa.prototype.pointFromJSON=function(e){return Ir.fromJSON(this,e)},Ir.prototype.precompute=function(){},Ir.prototype._encode=function(e){var t=this.curve.p.byteLength();return e?[64].concat(this.getX().toArray("le",t)):this.getX().toArray("be",t)},Ir.fromJSON=function(e,t){return new Ir(e,t[0],t[1]||e.one)},Ir.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Ir.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Ir.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),s=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,s)},Ir.prototype.add=function(){throw Error("Not supported on Montgomery curve")},Ir.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),o=s.redMul(n),a=t.z.redMul(i.redAdd(o).redSqr()),d=t.x.redMul(i.redISub(o).redSqr());return this.curve.point(a,d)},Ir.prototype.mul=function(e){for(var t=(e=new pt(e,16)).clone(),r=this,n=this.curve.point(null,null),s=[];t.cmpn(0)!==0;t.iushrn(1))s.push(t.andln(1));for(var i=s.length-1;i>=0;i--)s[i]===0?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Ir.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},Ir.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},Ir.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Ir.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Ir.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var xC=Zt.assert;function li(e){this.twisted=(0|e.a)!=1,this.mOneA=this.twisted&&(0|e.a)==-1,this.extended=this.mOneA,hn.call(this,"edwards",e),this.a=new pt(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new pt(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new pt(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),xC(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(0|e.c)==1}Ds(li,hn);var UC=li;function nr(e,t,r,n,s){hn.BasePoint.call(this,e,"projective"),t===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new pt(t,16),this.y=new pt(r,16),this.z=n?new pt(n,16):this.curve.one,this.t=s&&new pt(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}li.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},li.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},li.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},li.prototype.pointFromX=function(e,t){(e=new pt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(s.redInvm()),o=i.redSqrt();if(o.redSqr().redSub(i).cmp(this.zero)!==0)throw Error("invalid point");var a=o.fromRed().isOdd();return(t&&!a||!t&&a)&&(o=o.redNeg()),this.point(e,o)},li.prototype.pointFromY=function(e,t){(e=new pt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(s.redInvm());if(i.cmp(this.zero)===0){if(t)throw Error("invalid point");return this.point(this.zero,e)}var o=i.redSqrt();if(o.redSqr().redSub(i).cmp(this.zero)!==0)throw Error("invalid point");return o.fromRed().isOdd()!==t&&(o=o.redNeg()),this.point(o,e)},li.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return n.cmp(s)===0},Ds(nr,hn.BasePoint),li.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},li.prototype.point=function(e,t,r,n){return new nr(this,e,t,r,n)},nr.fromJSON=function(e,t){return new nr(e,t[0],t[1],t[2])},nr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},nr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),o=i.redSub(r),a=n.redSub(t),d=s.redMul(o),c=i.redMul(a),l=s.redMul(a),u=o.redMul(i);return this.curve.point(d,c,u,l)},nr.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),i=this.y.redSqr();if(this.curve.twisted){var o=(c=this.curve._mulA(s)).redAdd(i);if(this.zOne)e=n.redSub(s).redSub(i).redMul(o.redSub(this.curve.two)),t=o.redMul(c.redSub(i)),r=o.redSqr().redSub(o).redSub(o);else{var a=this.z.redSqr(),d=o.redSub(a).redISub(a);e=n.redSub(s).redISub(i).redMul(d),t=o.redMul(c.redSub(i)),r=o.redMul(d)}}else{var c=s.redAdd(i);a=this.curve._mulC(this.z).redSqr(),d=c.redSub(a).redSub(a),e=this.curve._mulC(n.redISub(c)).redMul(d),t=this.curve._mulC(c).redMul(s.redISub(i)),r=c.redMul(d)}return this.curve.point(e,t,r)},nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},nr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),o=s.redSub(n),a=s.redAdd(n),d=r.redAdd(t),c=i.redMul(o),l=a.redMul(d),u=i.redMul(d),p=o.redMul(a);return this.curve.point(c,l,p,u)},nr.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),s=n.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(o),d=s.redSub(a),c=s.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),u=n.redMul(d).redMul(l);return this.curve.twisted?(t=n.redMul(c).redMul(o.redSub(this.curve._mulA(i))),r=d.redMul(c)):(t=n.redMul(c).redMul(o.redSub(i)),r=this.curve._mulC(d).redMul(c)),this.curve.point(u,t,r)},nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},nr.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},nr.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},nr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add;var yf=Ni(function(e,t){var r=t;r.base=hn,r.short=NC,r.mont=DC,r.edwards=UC}),x0=Dt.rotl32,Vo=Dt.sum32,BC=Dt.sum32_5,LC=Ma.ft_1,z7=jl.BlockHash,KC=[1518500249,1859775393,2400959708,3395469782];function yi(){if(!(this instanceof yi))return new yi;z7.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}Dt.inherits(yi,z7);var qC=yi;yi.blockSize=512,yi.outSize=160,yi.hmacStrength=80,yi.padLength=64,yi.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=x0(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var s=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],d=this.h[4];for(n=0;n<r.length;n++){var c=~~(n/20),l=BC(x0(s,5),LC(c,i,o,a),d,r[n],KC[c]);d=a,a=o,o=x0(i,30),i=s,s=l}this.h[0]=Vo(this.h[0],s),this.h[1]=Vo(this.h[1],i),this.h[2]=Vo(this.h[2],o),this.h[3]=Vo(this.h[3],a),this.h[4]=Vo(this.h[4],d)},yi.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"big"):Dt.split32(this.h,"big")};var jC={sha1:qC,sha224:Z8,sha256:f2,sha384:tw,sha512:mo};function co(e,t,r){if(!(this instanceof co))return new co(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Dt.toArray(t,r))}var $C=co;co.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),$s(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},co.prototype.update=function(e,t){return this.inner.update(e,t),this},co.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)};var Pn=Ni(function(e,t){var r=t;r.utils=Dt,r.common=jl,r.sha=jC,r.ripemd=YP,r.hmac=$C,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}),VC={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}},vl=Ni(function(e,t){var r,n=t,s=Zt.assert;function i(a){if(a.type==="short")this.curve=new yf.short(a);else if(a.type==="edwards")this.curve=new yf.edwards(a);else{if(a.type!=="mont")throw Error("Unknown curve type.");this.curve=new yf.mont(a)}this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, n*G != O")}function o(a,d){Object.defineProperty(n,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(d);return Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:c}),c}})}n.PresetCurve=i,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Pn.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Pn.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Pn.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Pn.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Pn.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:Pn.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:Pn.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]}),o("brainpoolP256r1",{type:"short",prime:null,p:"A9FB57DB A1EEA9BC 3E660A90 9D838D72 6E3BF623 D5262028 2013481D 1F6E5377",a:"7D5A0975 FC2C3057 EEF67530 417AFFE7 FB8055C1 26DC5C6C E94A4B44 F330B5D9",b:"26DC5C6C E94A4B44 F330B5D9 BBD77CBF 95841629 5CF7E1CE 6BCCDC18 FF8C07B6",n:"A9FB57DB A1EEA9BC 3E660A90 9D838D71 8C397AA3 B561A6F7 901E0E82 974856A7",hash:Pn.sha256,gRed:!1,g:["8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262","547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997"]}),o("brainpoolP384r1",{type:"short",prime:null,p:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B4 12B1DA19 7FB71123ACD3A729 901D1A71 87470013 3107EC53",a:"7BC382C6 3D8C150C 3C72080A CE05AFA0 C2BEA28E 4FB22787 139165EF BA91F90F8AA5814A 503AD4EB 04A8C7DD 22CE2826",b:"04A8C7DD 22CE2826 8B39B554 16F0447C 2FB77DE1 07DCD2A6 2E880EA5 3EEB62D57CB43902 95DBC994 3AB78696 FA504C11",n:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B3 1F166E6C AC0425A7CF3AB6AF 6B7FC310 3B883202 E9046565",hash:Pn.sha384,gRed:!1,g:["1D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D646AAEF87B2E247D4AF1E","8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E4646217791811142820341263C5315"]}),o("brainpoolP512r1",{type:"short",prime:null,p:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 703308717D4D9B00 9BC66842 AECDA12A E6A380E6 2881FF2F 2D82C685 28AA6056 583A48F3",a:"7830A331 8B603B89 E2327145 AC234CC5 94CBDD8D 3DF91610 A83441CA EA9863BC2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A7 2BF2C7B9 E7C1AC4D 77FC94CA",b:"3DF91610 A83441CA EA9863BC 2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A72BF2C7B9 E7C1AC4D 77FC94CA DC083E67 984050B7 5EBAE5DD 2809BD63 8016F723",n:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 70330870553E5C41 4CA92619 41866119 7FAC1047 1DB1D381 085DDADD B5879682 9CA90069",hash:Pn.sha512,gRed:!1,g:["81AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F822","7DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892"]});try{r=VC}catch{r=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Pn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})});function Cs(e){if(!(this instanceof Cs))return new Cs(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Qn.toArray(e.entropy,e.entropyEnc||"hex"),r=Qn.toArray(e.nonce,e.nonceEnc||"hex"),n=Qn.toArray(e.pers,e.persEnc||"hex");$s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Vy=Cs;Cs.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Cs.prototype._hmac=function(){return new Pn.hmac(this.hash,this.K)},Cs.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Cs.prototype.reseed=function(e,t,r,n){typeof t!="string"&&(n=r,r=t,t=null),e=Qn.toArray(e,t),r=Qn.toArray(r,n),$s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Cs.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");typeof t!="string"&&(n=r,r=t,t=null),r&&(r=Qn.toArray(r,n||"hex"),this._update(r));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var i=s.slice(0,e);return this._update(r),this._reseed++,Qn.encode(i,t)};var V3=Zt.assert;function Qr(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var U0=Qr;Qr.fromPublic=function(e,t,r){return t instanceof Qr?t:new Qr(e,{pub:t,pubEnc:r})},Qr.fromPrivate=function(e,t,r){return t instanceof Qr?t:new Qr(e,{priv:t,privEnc:r})},Qr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Qr.prototype.getPublic=function(e,t){return this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Qr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Qr.prototype._importPrivate=function(e,t){if(this.priv=new pt(e,t||16),this.ec.curve.type==="mont"){var r=this.ec.curve.one,n=r.ushln(252).sub(r).ushln(3);this.priv=this.priv.or(r.ushln(254)),this.priv=this.priv.and(n)}else this.priv=this.priv.umod(this.ec.curve.n)},Qr.prototype._importPublic=function(e,t){if(e.x||e.y)return this.ec.curve.type==="mont"?V3(e.x,"Need x coordinate"):this.ec.curve.type!=="short"&&this.ec.curve.type!=="edwards"||V3(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},Qr.prototype.derive=function(e){return e.mul(this.priv).getX()},Qr.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},Qr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Qr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var FC=Zt.assert;function ah(e,t){if(e instanceof ah)return e;this._importDER(e,t)||(FC(e.r&&e.s,"Signature without r or s"),this.r=new pt(e.r,16),this.s=new pt(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var Nd=ah;function HC(){this.place=0}function B0(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,s=0,i=0,o=t.place;i<n;i++,o++)s<<=8,s|=e[o];return t.place=o,s}function F3(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return t===0?e:e.slice(t)}function L0(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}ah.prototype._importDER=function(e,t){e=Zt.toArray(e,t);var r=new HC;if(e[r.place++]!==48||B0(e,r)+r.place!==e.length||e[r.place++]!==2)return!1;var n=B0(e,r),s=e.slice(r.place,n+r.place);if(r.place+=n,e[r.place++]!==2)return!1;var i=B0(e,r);if(e.length!==i+r.place)return!1;var o=e.slice(r.place,i+r.place);return s[0]===0&&128&s[1]&&(s=s.slice(1)),o[0]===0&&128&o[1]&&(o=o.slice(1)),this.r=new pt(s),this.s=new pt(o),this.recoveryParam=null,!0},ah.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=F3(t),r=F3(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];L0(n,t.length),(n=n.concat(t)).push(2),L0(n,r.length);var s=n.concat(r),i=[48];return L0(i,s.length),i=i.concat(s),Zt.encode(i,e)};var W7=Zt.assert;function gn(e){if(!(this instanceof gn))return new gn(e);typeof e=="string"&&(W7(vl.hasOwnProperty(e),"Unknown curve "+e),e=vl[e]),e instanceof vl.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var GC=gn;gn.prototype.keyPair=function(e){return new U0(this,e)},gn.prototype.keyFromPrivate=function(e,t){return U0.fromPrivate(this,e,t)},gn.prototype.keyFromPublic=function(e,t){return U0.fromPublic(this,e,t)},gn.prototype.genKeyPair=function(e){e||(e={});var t=new Vy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Rh(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()});if(this.curve.type==="mont"){var r=new pt(t.generate(32));return this.keyFromPrivate(r)}for(var n=this.n.byteLength(),s=this.n.sub(new pt(2));;)if(!((r=new pt(t.generate(n))).cmp(s)>0))return r.iaddn(1),this.keyFromPrivate(r)},gn.prototype._truncateToN=function(e,t,r){var n=(r=r||8*e.byteLength())-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},gn.prototype.truncateMsg=function(e){var t;return e instanceof Uint8Array?(t=8*e.byteLength,e=this._truncateToN(new pt(e,16),!1,t)):typeof e=="string"?(t=4*e.length,e=this._truncateToN(new pt(e,16),!1,t)):e=this._truncateToN(new pt(e,16)),e},gn.prototype.sign=function(e,t,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this.truncateMsg(e);for(var s=this.n.byteLength(),i=t.getPrivate().toArray("be",s),o=e.toArray("be",s),a=new Vy({hash:this.hash,entropy:i,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),d=this.n.sub(new pt(1)),c=0;;c++){var l=n.k?n.k(c):new pt(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(d)>=0)){var u=this.g.mul(l);if(!u.isInfinity()){var p=u.getX(),f=p.umod(this.n);if(f.cmpn(0)!==0){var h=l.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if((h=h.umod(this.n)).cmpn(0)!==0){var y=(u.getY().isOdd()?1:0)|(p.cmp(f)!==0?2:0);return n.canonical&&h.cmp(this.nh)>0&&(h=this.n.sub(h),y^=1),new Nd({r:f,s:h,recoveryParam:y})}}}}}},gn.prototype.verify=function(e,t,r,n){return r=this.keyFromPublic(r,n),t=new Nd(t,"hex"),this._verify(this.truncateMsg(e),t,r)||this._verify(this._truncateToN(new pt(e,16)),t,r)},gn.prototype._verify=function(e,t,r){var n=t.r,s=t.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var i,o=s.invm(this.n),a=o.mul(e).umod(this.n),d=o.mul(n).umod(this.n);return this.curve._maxwellTrick?!(i=this.g.jmulAdd(a,r.getPublic(),d)).isInfinity()&&i.eqXToP(n):!(i=this.g.mulAdd(a,r.getPublic(),d)).isInfinity()&&i.getX().umod(this.n).cmp(n)===0},gn.prototype.recoverPubKey=function(e,t,r,n){W7((3&r)===r,"The recovery param is more than two bits"),t=new Nd(t,n);var s=this.n,i=new pt(e),o=t.r,a=t.s,d=1&r,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),d):this.curve.pointFromX(o,d);var l=t.r.invm(s),u=s.sub(i).mul(l).umod(s),p=a.mul(l).umod(s);return this.g.mulAdd(u,o,p)},gn.prototype.getKeyRecoveryParam=function(e,t,r,n){if((t=new Nd(t,n)).recoveryParam!==null)return t.recoveryParam;for(var s=0;s<4;s++){var i;try{i=this.recoverPubKey(e,t,s)}catch{continue}if(i.eq(r))return s}throw Error("Unable to find valid recovery factor")};var H3=Zt.assert,G3=Zt.parseBytes,qa=Zt.cachedProperty;function Rr(e,t){if(this.eddsa=e,t.hasOwnProperty("secret")&&(this._secret=G3(t.secret)),e.isPoint(t.pub))this._pub=t.pub;else if(this._pubBytes=G3(t.pub),this._pubBytes&&this._pubBytes.length===33&&this._pubBytes[0]===64&&(this._pubBytes=this._pubBytes.slice(1,33)),this._pubBytes&&this._pubBytes.length!==32)throw Error("Unknown point compression format")}Rr.fromPublic=function(e,t){return t instanceof Rr?t:new Rr(e,{pub:t})},Rr.fromSecret=function(e,t){return t instanceof Rr?t:new Rr(e,{secret:t})},Rr.prototype.secret=function(){return this._secret},qa(Rr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),qa(Rr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),qa(Rr,"privBytes",function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n}),qa(Rr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),qa(Rr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),qa(Rr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Rr.prototype.sign=function(e){return H3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Rr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Rr.prototype.getSecret=function(e){return H3(this._secret,"KeyPair is public only"),Zt.encode(this.secret(),e)},Rr.prototype.getPublic=function(e,t){return Zt.encode((t?[64]:[]).concat(this.pubBytes()),e)};var K0=Rr,zC=Zt.assert,Dd=Zt.cachedProperty,WC=Zt.parseBytes;function ua(e,t){this.eddsa=e,typeof t!="object"&&(t=WC(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),zC(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof pt&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Dd(ua,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Dd(ua,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Dd(ua,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Dd(ua,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),ua.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},ua.prototype.toHex=function(){return Zt.encode(this.toBytes(),"hex").toUpperCase()};var z3=ua,YC=Zt.assert,W3=Zt.parseBytes;function tn(e){if(YC(e==="ed25519","only tested with ed25519 so far"),!(this instanceof tn))return new tn(e);e=vl[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Pn.sha512}var JC=tn;tn.prototype.sign=function(e,t){e=W3(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),s=this.g.mul(n),i=this.encodePoint(s),o=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),a=n.add(o).umod(this.curve.n);return this.makeSignature({R:s,S:a,Rencoded:i})},tn.prototype.verify=function(e,t,r){e=W3(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(s)).eq(i)},tn.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Zt.intFromLE(e.digest()).umod(this.curve.n)},tn.prototype.keyPair=function(e){return new K0(this,e)},tn.prototype.keyFromPublic=function(e){return K0.fromPublic(this,e)},tn.prototype.keyFromSecret=function(e){return K0.fromSecret(this,e)},tn.prototype.genKeyPair=function(e){e||(e={});var t=new Vy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Rh(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.curve.n.toArray()});return this.keyFromSecret(t.generate(32))},tn.prototype.makeSignature=function(e){return e instanceof z3?e:new z3(this,e)},tn.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},tn.prototype.decodePoint=function(e){var t=(e=Zt.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=(128&e[t])!=0,s=Zt.intFromLE(r);return this.curve.pointFromY(s,n)},tn.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},tn.prototype.decodeInt=function(e){return Zt.intFromLE(e)},tn.prototype.isPoint=function(e){return e instanceof this.pointClass};var Y3=Ni(function(e,t){var r=t;r.utils=Zt,r.rand=Rh,r.curve=yf,r.curves=vl,r.ec=GC,r.eddsa=JC}),ZC=Object.freeze({__proto__:null,default:Y3,__moduleExports:Y3});const XC=Object.freeze(Object.defineProperty({__proto__:null,AEADEncryptedDataPacket:Hl,CleartextMessage:Ci,CompressedDataPacket:wo,LiteralDataPacket:ss,MarkerPacket:EI,Message:rn,OnePassSignaturePacket:Bn,PacketList:Ft,PrivateKey:Oa,PublicKey:$f,PublicKeyEncryptedSessionKeyPacket:qf,PublicKeyPacket:Xn,PublicSubkeyPacket:Gl,SecretKeyPacket:_h,SecretSubkeyPacket:A2,Signature:Us,SignaturePacket:xr,Subkey:Ca,SymEncryptedIntegrityProtectedDataPacket:E2,SymEncryptedSessionKeyPacket:Ia,SymmetricallyEncryptedDataPacket:Vw,TrustPacket:SI,UnparseablePacket:Cf,UserAttributePacket:vh,UserIDPacket:zl,armor:ka,config:Xe,createCleartextMessage:qI,createMessage:BI,decrypt:zI,decryptKey:FI,decryptSessionKeys:XI,encrypt:GI,encryptKey:HI,encryptSessionKey:ZI,enums:H,generateKey:jI,generateSessionKey:JI,readCleartextMessage:KI,readKey:RI,readKeys:MI,readMessage:UI,readPrivateKey:kI,readPrivateKeys:OI,readSignature:TI,reformatKey:$I,revokeKey:VI,sign:WI,unarmor:Oi,verify:YI},Symbol.toStringTag,{value:"Module"})),QC=Bl(XC);var J3;function kh(){if(J3)return an;J3=1,Object.defineProperty(an,"__esModule",{value:!0}),an.pgpDecrypt=an.verifySignature=an.sign=an.pgpEncrypt=an.generateKeyPair=an.PGPHelper=void 0;const e=$e,t=QC,r={generateKeyPair(){return e.__awaiter(this,void 0,void 0,function*(){const d=yield t.generateKey({type:"rsa",rsaBits:2048,userIDs:[{name:"",email:""}]});return{privateKeyArmored:d.privateKey,publicKeyArmored:d.publicKey}})},sign({message:d,signingKey:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=yield t.createMessage({text:d}),u=yield t.readPrivateKey({armoredKey:c});return yield t.sign({message:l,signingKeys:u,detached:!0})})},pgpEncrypt({plainText:d,keys:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=[];for(let f=0;f<c.length;f++)l.push(yield t.readKey({armoredKey:c[f]}));const u=yield t.createMessage({text:d});return yield t.encrypt({message:u,encryptionKeys:l})})},pgpDecrypt({cipherText:d,toPrivateKeyArmored:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=yield t.readMessage({armoredMessage:d}),u=yield t.readPrivateKey({armoredKey:c}),{data:p}=yield t.decrypt({message:l,decryptionKeys:u});return p})},verifySignature({messageContent:d,signatureArmored:c,publicKeyArmored:l}){return e.__awaiter(this,void 0,void 0,function*(){const u=yield t.createMessage({text:d}),p=yield t.readSignature({armoredSignature:c}),f=yield t.readKey({armoredKey:l}),h=yield t.verify({date:new Date(Date.now()+1e3*60*60*24),message:u,signature:p,verificationKeys:f}),{verified:y}=h.signatures[0];try{yield y}catch(m){throw new Error("Signature could not be verified: "+m)}})}};an.PGPHelper=r;const n=()=>e.__awaiter(void 0,void 0,void 0,function*(){const d=yield t.generateKey({type:"rsa",rsaBits:2048,userIDs:[{name:"",email:""}]});return{privateKeyArmored:d.privateKey,publicKeyArmored:d.publicKey}});an.generateKeyPair=n;const s=({plainText:d,keys:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=[];for(let f=0;f<c.length;f++)l.push(yield t.readKey({armoredKey:c[f]}));const u=yield t.createMessage({text:d});return yield t.encrypt({message:u,encryptionKeys:l})});an.pgpEncrypt=s;const i=({message:d,signingKey:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=yield t.createMessage({text:d}),u=yield t.readPrivateKey({armoredKey:c});return yield t.sign({message:l,signingKeys:u,detached:!0})});an.sign=i;const o=({messageContent:d,signatureArmored:c,publicKeyArmored:l})=>e.__awaiter(void 0,void 0,void 0,function*(){const u=yield t.createMessage({text:d}),p=yield t.readSignature({armoredSignature:c}),f=yield t.readKey({armoredKey:l}),h=yield t.verify({message:u,signature:p,verificationKeys:f}),{verified:y}=h.signatures[0];try{yield y}catch(m){throw new Error("Signature could not be verified: "+m)}});an.verifySignature=o;const a=({cipherText:d,toPrivateKeyArmored:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=yield t.readMessage({armoredMessage:d}),u=yield t.readPrivateKey({armoredKey:c}),{data:p}=yield t.decrypt({message:l,decryptionKeys:u});return p});return an.pgpDecrypt=a,an}var q0={},Qs={},Z3;function Y7(){if(Z3)return Qs;Z3=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.getAccountAddress=Qs.getWallet=void 0;const e=$e,t=tt(),r=s=>{const{account:i,signer:o}=s||{};return{account:i&&(0,t.pCAIP10ToWallet)(i),signer:o}};Qs.getWallet=r;const n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{account:i,signer:o}=s||{},a=new t.Signer(o);return i||(yield a.getAddress())||""});return Qs.getAccountAddress=n,Qs}var X3;function eR(){return X3||(X3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getConnectedUserV2Core=e.getConnectedUserV2=void 0;const t=$e,r=Je(),n=kn(),s=Y7(),i=Mt(),o=(d,c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.getConnectedUserV2Core)(d,c,l,i.PGPHelper)});e.getConnectedUserV2=o;const a=(d,c,l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const p=yield(0,s.getAccountAddress)(d),f=yield(0,n.get)({account:p,env:l||r.default.ENV.PROD});if(f!=null&&f.encryptedPrivateKey){if(c)return Object.assign(Object.assign({},f),{privateKey:c});{console.warn("Please note that if you don't pass the pgpPrivateKey parameter, a wallet popup will appear every time the approveRequest endpoint is called. We strongly recommend passing this parameter, and it will become mandatory in future versions of the API.");const h=yield(0,i.getDecryptedPrivateKey)(d,f,p,l);return Object.assign(Object.assign({},f),{privateKey:h})}}else{const h={};d.account&&(h.account=d.account),f&&f.did&&(h.account=f.did),d.signer&&(h.signer=d.signer),h.env=l;const y=yield(0,n.createUserCore)(h,u),m=yield(0,i.getDecryptedPrivateKey)(d,y,p,l);return Object.assign(Object.assign({},y),{privateKey:m})}});e.getConnectedUserV2Core=a}(q0)),q0}var j0={},$n={},Fo={},Q3;function Mh(){if(Q3)return Fo;Q3=1,Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.populateDeprecatedUser=void 0;const e=t=>{if(!t)return t;t.name=t.profile.name,t.about=t.profile.desc,t.profilePicture=t.profile.picture,t.numMsg=t.msgSent,t.allowedNumMsg=t.maxMsgPersisted;let r="",n="",s="";try{const{version:i}=JSON.parse(t.encryptedPrivateKey);r=i}catch{}t.encryptionType=r;try{n=t.verificationProof.split(":")[0],s=t.verificationProof.split(":")[1]}catch{}return t.signature=s,t.sigType=n,t.encryptedPassword=null,t.nftOwner=null,t.linkedListHash=null,t.nfts=null,t};return Fo.populateDeprecatedUser=e,Fo}var Vn={},xd={exports:{}},$0,eb;function J7(){return eb||(eb=1,$0=function(t,r){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return t.apply(r,s)}}),$0}var V0,tb;function Hr(){if(tb)return V0;tb=1;var e=J7(),t=Object.prototype.toString,r=function(N){return function(M){var L=t.call(M);return N[L]||(N[L]=L.slice(8,-1).toLowerCase())}}(Object.create(null));function n(N){return N=N.toLowerCase(),function(L){return r(L)===N}}function s(N){return Array.isArray(N)}function i(N){return typeof N>"u"}function o(N){return N!==null&&!i(N)&&N.constructor!==null&&!i(N.constructor)&&typeof N.constructor.isBuffer=="function"&&N.constructor.isBuffer(N)}var a=n("ArrayBuffer");function d(N){var M;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?M=ArrayBuffer.isView(N):M=N&&N.buffer&&a(N.buffer),M}function c(N){return typeof N=="string"}function l(N){return typeof N=="number"}function u(N){return N!==null&&typeof N=="object"}function p(N){if(r(N)!=="object")return!1;var M=Object.getPrototypeOf(N);return M===null||M===Object.prototype}var f=n("Date"),h=n("File"),y=n("Blob"),m=n("FileList");function b(N){return t.call(N)==="[object Function]"}function v(N){return u(N)&&b(N.pipe)}function E(N){var M="[object FormData]";return N&&(typeof FormData=="function"&&N instanceof FormData||t.call(N)===M||b(N.toString)&&N.toString()===M)}var _=n("URLSearchParams");function C(N){return N.trim?N.trim():N.replace(/^\s+|\s+$/g,"")}function k(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function D(N,M){if(!(N===null||typeof N>"u"))if(typeof N!="object"&&(N=[N]),s(N))for(var L=0,x=N.length;L<x;L++)M.call(null,N[L],L,N);else for(var R in N)Object.prototype.hasOwnProperty.call(N,R)&&M.call(null,N[R],R,N)}function w(){var N={};function M(R,K){p(N[K])&&p(R)?N[K]=w(N[K],R):p(R)?N[K]=w({},R):s(R)?N[K]=R.slice():N[K]=R}for(var L=0,x=arguments.length;L<x;L++)D(arguments[L],M);return N}function S(N,M,L){return D(M,function(R,K){L&&typeof R=="function"?N[K]=e(R,L):N[K]=R}),N}function I(N){return N.charCodeAt(0)===65279&&(N=N.slice(1)),N}function T(N,M,L,x){N.prototype=Object.create(M.prototype,x),N.prototype.constructor=N,L&&Object.assign(N.prototype,L)}function g(N,M,L){var x,R,K,V={};M=M||{};do{for(x=Object.getOwnPropertyNames(N),R=x.length;R-- >0;)K=x[R],V[K]||(M[K]=N[K],V[K]=!0);N=Object.getPrototypeOf(N)}while(N&&(!L||L(N,M))&&N!==Object.prototype);return M}function A(N,M,L){N=String(N),(L===void 0||L>N.length)&&(L=N.length),L-=M.length;var x=N.indexOf(M,L);return x!==-1&&x===L}function P(N){if(!N)return null;var M=N.length;if(i(M))return null;for(var L=new Array(M);M-- >0;)L[M]=N[M];return L}var O=function(N){return function(M){return N&&M instanceof N}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));return V0={isArray:s,isArrayBuffer:a,isBuffer:o,isFormData:E,isArrayBufferView:d,isString:c,isNumber:l,isObject:u,isPlainObject:p,isUndefined:i,isDate:f,isFile:h,isBlob:y,isFunction:b,isStream:v,isURLSearchParams:_,isStandardBrowserEnv:k,forEach:D,merge:w,extend:S,trim:C,stripBOM:I,inherits:T,toFlatObject:g,kindOf:r,kindOfTest:n,endsWith:A,toArray:P,isTypedArray:O,isFileList:m},V0}var F0,rb;function Z7(){if(rb)return F0;rb=1;var e=Hr();function t(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}return F0=function(n,s,i){if(!s)return n;var o;if(i)o=i(s);else if(e.isURLSearchParams(s))o=s.toString();else{var a=[];e.forEach(s,function(l,u){l===null||typeof l>"u"||(e.isArray(l)?u=u+"[]":l=[l],e.forEach(l,function(f){e.isDate(f)?f=f.toISOString():e.isObject(f)&&(f=JSON.stringify(f)),a.push(t(u)+"="+t(f))}))}),o=a.join("&")}if(o){var d=n.indexOf("#");d!==-1&&(n=n.slice(0,d)),n+=(n.indexOf("?")===-1?"?":"&")+o}return n},F0}var H0,nb;function tR(){if(nb)return H0;nb=1;var e=Hr();function t(){this.handlers=[]}return t.prototype.use=function(n,s,i){return this.handlers.push({fulfilled:n,rejected:s,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1},t.prototype.eject=function(n){this.handlers[n]&&(this.handlers[n]=null)},t.prototype.forEach=function(n){e.forEach(this.handlers,function(i){i!==null&&n(i)})},H0=t,H0}var G0,ib;function rR(){if(ib)return G0;ib=1;var e=Hr();return G0=function(r,n){e.forEach(r,function(i,o){o!==n&&o.toUpperCase()===n.toUpperCase()&&(r[n]=i,delete r[o])})},G0}var z0,sb;function Eo(){if(sb)return z0;sb=1;var e=Hr();function t(s,i,o,a,d){Error.call(this),this.message=s,this.name="AxiosError",i&&(this.code=i),o&&(this.config=o),a&&(this.request=a),d&&(this.response=d)}e.inherits(t,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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var r=t.prototype,n={};return["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"].forEach(function(s){n[s]={value:s}}),Object.defineProperties(t,n),Object.defineProperty(r,"isAxiosError",{value:!0}),t.from=function(s,i,o,a,d,c){var l=Object.create(r);return e.toFlatObject(s,l,function(p){return p!==Error.prototype}),t.call(l,s.message,i,o,a,d),l.name=s.name,c&&Object.assign(l,c),l},z0=t,z0}var W0,ab;function X7(){return ab||(ab=1,W0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}),W0}var Y0,ob;function Q7(){if(ob)return Y0;ob=1;var e=Hr();function t(r,n){n=n||new FormData;var s=[];function i(a){return a===null?"":e.isDate(a)?a.toISOString():e.isArrayBuffer(a)||e.isTypedArray(a)?typeof Blob=="function"?new Blob([a]):at.from(a):a}function o(a,d){if(e.isPlainObject(a)||e.isArray(a)){if(s.indexOf(a)!==-1)throw Error("Circular reference detected in "+d);s.push(a),e.forEach(a,function(l,u){if(!e.isUndefined(l)){var p=d?d+"."+u:u,f;if(l&&!d&&typeof l=="object"){if(e.endsWith(u,"{}"))l=JSON.stringify(l);else if(e.endsWith(u,"[]")&&(f=e.toArray(l))){f.forEach(function(h){!e.isUndefined(h)&&n.append(p,i(h))});return}}o(l,p)}}),s.pop()}else n.append(d,i(a))}return o(r),n}return Y0=t,Y0}var J0,cb;function nR(){if(cb)return J0;cb=1;var e=Eo();return J0=function(r,n,s){var i=s.config.validateStatus;!s.status||!i||i(s.status)?r(s):n(new e("Request failed with status code "+s.status,[e.ERR_BAD_REQUEST,e.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))},J0}var Z0,ub;function iR(){if(ub)return Z0;ub=1;var e=Hr();return Z0=e.isStandardBrowserEnv()?function(){return{write:function(n,s,i,o,a,d){var c=[];c.push(n+"="+encodeURIComponent(s)),e.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),e.isString(o)&&c.push("path="+o),e.isString(a)&&c.push("domain="+a),d===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(n){var s=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Z0}var X0,lb;function sR(){return lb||(lb=1,X0=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}),X0}var Q0,db;function aR(){return db||(db=1,Q0=function(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t}),Q0}var e1,fb;function e9(){if(fb)return e1;fb=1;var e=sR(),t=aR();return e1=function(n,s){return n&&!e(s)?t(n,s):s},e1}var t1,hb;function oR(){if(hb)return t1;hb=1;var e=Hr(),t=["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"];return t1=function(n){var s={},i,o,a;return n&&e.forEach(n.split(`
|
|
53
|
-
`),function(c){if(a=c.indexOf(":"),i=e.trim(c.substr(0,a)).toLowerCase(),o=e.trim(c.substr(a+1)),i){if(s[i]&&t.indexOf(i)>=0)return;i==="set-cookie"?s[i]=(s[i]?s[i]:[]).concat([o]):s[i]=s[i]?s[i]+", "+o:o}}),s},t1}var r1,pb;function cR(){if(pb)return r1;pb=1;var e=Hr();return r1=e.isStandardBrowserEnv()?function(){var r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),s;function i(o){var a=o;return r&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return s=i(window.location.href),function(a){var d=e.isString(a)?i(a):a;return d.protocol===s.protocol&&d.host===s.host}}():function(){return function(){return!0}}(),r1}var n1,yb;function Oh(){if(yb)return n1;yb=1;var e=Eo(),t=Hr();function r(n){e.call(this,n??"canceled",e.ERR_CANCELED),this.name="CanceledError"}return t.inherits(r,e,{__CANCEL__:!0}),n1=r,n1}var i1,gb;function uR(){return gb||(gb=1,i1=function(t){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return r&&r[1]||""}),i1}var s1,mb;function bb(){if(mb)return s1;mb=1;var e=Hr(),t=nR(),r=iR(),n=Z7(),s=e9(),i=oR(),o=cR(),a=X7(),d=Eo(),c=Oh(),l=uR();return s1=function(p){return new Promise(function(h,y){var m=p.data,b=p.headers,v=p.responseType,E;function _(){p.cancelToken&&p.cancelToken.unsubscribe(E),p.signal&&p.signal.removeEventListener("abort",E)}e.isFormData(m)&&e.isStandardBrowserEnv()&&delete b["Content-Type"];var C=new XMLHttpRequest;if(p.auth){var k=p.auth.username||"",D=p.auth.password?unescape(encodeURIComponent(p.auth.password)):"";b.Authorization="Basic "+btoa(k+":"+D)}var w=s(p.baseURL,p.url);C.open(p.method.toUpperCase(),n(w,p.params,p.paramsSerializer),!0),C.timeout=p.timeout;function S(){if(C){var g="getAllResponseHeaders"in C?i(C.getAllResponseHeaders()):null,A=!v||v==="text"||v==="json"?C.responseText:C.response,P={data:A,status:C.status,statusText:C.statusText,headers:g,config:p,request:C};t(function(N){h(N),_()},function(N){y(N),_()},P),C=null}}if("onloadend"in C?C.onloadend=S:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(S)},C.onabort=function(){C&&(y(new d("Request aborted",d.ECONNABORTED,p,C)),C=null)},C.onerror=function(){y(new d("Network Error",d.ERR_NETWORK,p,C,C)),C=null},C.ontimeout=function(){var A=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded",P=p.transitional||a;p.timeoutErrorMessage&&(A=p.timeoutErrorMessage),y(new d(A,P.clarifyTimeoutError?d.ETIMEDOUT:d.ECONNABORTED,p,C)),C=null},e.isStandardBrowserEnv()){var I=(p.withCredentials||o(w))&&p.xsrfCookieName?r.read(p.xsrfCookieName):void 0;I&&(b[p.xsrfHeaderName]=I)}"setRequestHeader"in C&&e.forEach(b,function(A,P){typeof m>"u"&&P.toLowerCase()==="content-type"?delete b[P]:C.setRequestHeader(P,A)}),e.isUndefined(p.withCredentials)||(C.withCredentials=!!p.withCredentials),v&&v!=="json"&&(C.responseType=p.responseType),typeof p.onDownloadProgress=="function"&&C.addEventListener("progress",p.onDownloadProgress),typeof p.onUploadProgress=="function"&&C.upload&&C.upload.addEventListener("progress",p.onUploadProgress),(p.cancelToken||p.signal)&&(E=function(g){C&&(y(!g||g&&g.type?new c:g),C.abort(),C=null)},p.cancelToken&&p.cancelToken.subscribe(E),p.signal&&(p.signal.aborted?E():p.signal.addEventListener("abort",E))),m||(m=null);var T=l(w);if(T&&["http","https","file"].indexOf(T)===-1){y(new d("Unsupported protocol "+T+":",d.ERR_BAD_REQUEST,p));return}C.send(m)})},s1}var a1,vb;function lR(){return vb||(vb=1,a1=null),a1}var o1,_b;function W2(){if(_b)return o1;_b=1;var e=Hr(),t=rR(),r=Eo(),n=X7(),s=Q7(),i={"Content-Type":"application/x-www-form-urlencoded"};function o(l,u){!e.isUndefined(l)&&e.isUndefined(l["Content-Type"])&&(l["Content-Type"]=u)}function a(){var l;return(typeof XMLHttpRequest<"u"||typeof Mr<"u"&&Object.prototype.toString.call(Mr)==="[object process]")&&(l=bb()),l}function d(l,u,p){if(e.isString(l))try{return(u||JSON.parse)(l),e.trim(l)}catch(f){if(f.name!=="SyntaxError")throw f}return(p||JSON.stringify)(l)}var c={transitional:n,adapter:a(),transformRequest:[function(u,p){if(t(p,"Accept"),t(p,"Content-Type"),e.isFormData(u)||e.isArrayBuffer(u)||e.isBuffer(u)||e.isStream(u)||e.isFile(u)||e.isBlob(u))return u;if(e.isArrayBufferView(u))return u.buffer;if(e.isURLSearchParams(u))return o(p,"application/x-www-form-urlencoded;charset=utf-8"),u.toString();var f=e.isObject(u),h=p&&p["Content-Type"],y;if((y=e.isFileList(u))||f&&h==="multipart/form-data"){var m=this.env&&this.env.FormData;return s(y?{"files[]":u}:u,m&&new m)}else if(f||h==="application/json")return o(p,"application/json"),d(u);return u}],transformResponse:[function(u){var p=this.transitional||c.transitional,f=p&&p.silentJSONParsing,h=p&&p.forcedJSONParsing,y=!f&&this.responseType==="json";if(y||h&&e.isString(u)&&u.length)try{return JSON.parse(u)}catch(m){if(y)throw m.name==="SyntaxError"?r.from(m,r.ERR_BAD_RESPONSE,this,null,this.response):m}return u}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:lR()},validateStatus:function(u){return u>=200&&u<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return e.forEach(["delete","get","head"],function(u){c.headers[u]={}}),e.forEach(["post","put","patch"],function(u){c.headers[u]=e.merge(i)}),o1=c,o1}var c1,wb;function dR(){if(wb)return c1;wb=1;var e=Hr(),t=W2();return c1=function(n,s,i){var o=this||t;return e.forEach(i,function(d){n=d.call(o,n,s)}),n},c1}var u1,Eb;function t9(){return Eb||(Eb=1,u1=function(t){return!!(t&&t.__CANCEL__)}),u1}var l1,Ab;function fR(){if(Ab)return l1;Ab=1;var e=Hr(),t=dR(),r=t9(),n=W2(),s=Oh();function i(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new s}return l1=function(a){i(a),a.headers=a.headers||{},a.data=t.call(a,a.data,a.headers,a.transformRequest),a.headers=e.merge(a.headers.common||{},a.headers[a.method]||{},a.headers),e.forEach(["delete","get","head","post","put","patch","common"],function(l){delete a.headers[l]});var d=a.adapter||n.adapter;return d(a).then(function(l){return i(a),l.data=t.call(a,l.data,l.headers,a.transformResponse),l},function(l){return r(l)||(i(a),l&&l.response&&(l.response.data=t.call(a,l.response.data,l.response.headers,a.transformResponse))),Promise.reject(l)})},l1}var d1,Sb;function r9(){if(Sb)return d1;Sb=1;var e=Hr();return d1=function(r,n){n=n||{};var s={};function i(u,p){return e.isPlainObject(u)&&e.isPlainObject(p)?e.merge(u,p):e.isPlainObject(p)?e.merge({},p):e.isArray(p)?p.slice():p}function o(u){if(e.isUndefined(n[u])){if(!e.isUndefined(r[u]))return i(void 0,r[u])}else return i(r[u],n[u])}function a(u){if(!e.isUndefined(n[u]))return i(void 0,n[u])}function d(u){if(e.isUndefined(n[u])){if(!e.isUndefined(r[u]))return i(void 0,r[u])}else return i(void 0,n[u])}function c(u){if(u in n)return i(r[u],n[u]);if(u in r)return i(void 0,r[u])}var l={url:a,method:a,data:a,baseURL:d,transformRequest:d,transformResponse:d,paramsSerializer:d,timeout:d,timeoutMessage:d,withCredentials:d,adapter:d,responseType:d,xsrfCookieName:d,xsrfHeaderName:d,onUploadProgress:d,onDownloadProgress:d,decompress:d,maxContentLength:d,maxBodyLength:d,beforeRedirect:d,transport:d,httpAgent:d,httpsAgent:d,cancelToken:d,socketPath:d,responseEncoding:d,validateStatus:c};return e.forEach(Object.keys(r).concat(Object.keys(n)),function(p){var f=l[p]||o,h=f(p);e.isUndefined(h)&&f!==c||(s[p]=h)}),s},d1}var f1,Pb;function n9(){return Pb||(Pb=1,f1={version:"0.27.2"}),f1}var h1,Tb;function hR(){if(Tb)return h1;Tb=1;var e=n9().version,t=Eo(),r={};["object","boolean","number","function","string","symbol"].forEach(function(i,o){r[i]=function(d){return typeof d===i||"a"+(o<1?"n ":" ")+i}});var n={};r.transitional=function(o,a,d){function c(l,u){return"[Axios v"+e+"] Transitional option '"+l+"'"+u+(d?". "+d:"")}return function(l,u,p){if(o===!1)throw new t(c(u," has been removed"+(a?" in "+a:"")),t.ERR_DEPRECATED);return a&&!n[u]&&(n[u]=!0,console.warn(c(u," has been deprecated since v"+a+" and will be removed in the near future"))),o?o(l,u,p):!0}};function s(i,o,a){if(typeof i!="object")throw new t("options must be an object",t.ERR_BAD_OPTION_VALUE);for(var d=Object.keys(i),c=d.length;c-- >0;){var l=d[c],u=o[l];if(u){var p=i[l],f=p===void 0||u(p,l,i);if(f!==!0)throw new t("option "+l+" must be "+f,t.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new t("Unknown option "+l,t.ERR_BAD_OPTION)}}return h1={assertOptions:s,validators:r},h1}var p1,Ib;function pR(){if(Ib)return p1;Ib=1;var e=Hr(),t=Z7(),r=tR(),n=fR(),s=r9(),i=e9(),o=hR(),a=o.validators;function d(c){this.defaults=c,this.interceptors={request:new r,response:new r}}return d.prototype.request=function(l,u){typeof l=="string"?(u=u||{},u.url=l):u=l||{},u=s(this.defaults,u),u.method?u.method=u.method.toLowerCase():this.defaults.method?u.method=this.defaults.method.toLowerCase():u.method="get";var p=u.transitional;p!==void 0&&o.assertOptions(p,{silentJSONParsing:a.transitional(a.boolean),forcedJSONParsing:a.transitional(a.boolean),clarifyTimeoutError:a.transitional(a.boolean)},!1);var f=[],h=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(u)===!1||(h=h&&k.synchronous,f.unshift(k.fulfilled,k.rejected))});var y=[];this.interceptors.response.forEach(function(k){y.push(k.fulfilled,k.rejected)});var m;if(!h){var b=[n,void 0];for(Array.prototype.unshift.apply(b,f),b=b.concat(y),m=Promise.resolve(u);b.length;)m=m.then(b.shift(),b.shift());return m}for(var v=u;f.length;){var E=f.shift(),_=f.shift();try{v=E(v)}catch(C){_(C);break}}try{m=n(v)}catch(C){return Promise.reject(C)}for(;y.length;)m=m.then(y.shift(),y.shift());return m},d.prototype.getUri=function(l){l=s(this.defaults,l);var u=i(l.baseURL,l.url);return t(u,l.params,l.paramsSerializer)},e.forEach(["delete","get","head","options"],function(l){d.prototype[l]=function(u,p){return this.request(s(p||{},{method:l,url:u,data:(p||{}).data}))}}),e.forEach(["post","put","patch"],function(l){function u(p){return function(h,y,m){return this.request(s(m||{},{method:l,headers:p?{"Content-Type":"multipart/form-data"}:{},url:h,data:y}))}}d.prototype[l]=u(),d.prototype[l+"Form"]=u(!0)}),p1=d,p1}var y1,Cb;function yR(){if(Cb)return y1;Cb=1;var e=Oh();function t(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(o){n=o});var s=this;this.promise.then(function(i){if(s._listeners){var o,a=s._listeners.length;for(o=0;o<a;o++)s._listeners[o](i);s._listeners=null}}),this.promise.then=function(i){var o,a=new Promise(function(d){s.subscribe(d),o=d}).then(i);return a.cancel=function(){s.unsubscribe(o)},a},r(function(o){s.reason||(s.reason=new e(o),n(s.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]},t.prototype.unsubscribe=function(n){if(this._listeners){var s=this._listeners.indexOf(n);s!==-1&&this._listeners.splice(s,1)}},t.source=function(){var n,s=new t(function(o){n=o});return{token:s,cancel:n}},y1=t,y1}var g1,Rb;function gR(){return Rb||(Rb=1,g1=function(t){return function(n){return t.apply(null,n)}}),g1}var m1,kb;function mR(){if(kb)return m1;kb=1;var e=Hr();return m1=function(r){return e.isObject(r)&&r.isAxiosError===!0},m1}var Mb;function bR(){if(Mb)return xd.exports;Mb=1;var e=Hr(),t=J7(),r=pR(),n=r9(),s=W2();function i(a){var d=new r(a),c=t(r.prototype.request,d);return e.extend(c,r.prototype,d),e.extend(c,d),c.create=function(u){return i(n(a,u))},c}var o=i(s);return o.Axios=r,o.CanceledError=Oh(),o.CancelToken=yR(),o.isCancel=t9(),o.VERSION=n9().version,o.toFormData=Q7(),o.AxiosError=Eo(),o.Cancel=o.CanceledError,o.all=function(d){return Promise.all(d)},o.spread=gR(),o.isAxiosError=mR(),xd.exports=o,xd.exports.default=o,xd.exports}var b1,Ob;function Ao(){return Ob||(Ob=1,b1=bR()),b1}var Nb;function It(){if(Nb)return Vn;Nb=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.axiosDelete=Vn.axiosPut=Vn.axiosPost=Vn.axiosGet=void 0;const e=$e,t=Ao(),n=C8.version,s=l=>{const u=Object.assign(Object.assign({},l==null?void 0:l.headers),{"X-JS-SDK-VERSION":n});return Object.assign(Object.assign({},l),{headers:u})},i=l=>{var u;const p=l.headers["x-deprecation-notice"];if(p){const f=(u=l.config.method)===null||u===void 0?void 0:u.toUpperCase(),h=l.config.url;console.warn(`%cDeprecation Notice%c Method: ${f}, Path: ${h}, Notice: ${p}`,"color: white; background-color: red; font-weight: bold; padding: 2px 4px;","color: red; font-weight: bold;")}return l},o=(l,u)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.get(l,s(u)).then(p=>i(p))});Vn.axiosGet=o;const a=(l,u,p)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.post(l,u,s(p)).then(f=>i(f))});Vn.axiosPost=a;const d=(l,u,p)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.put(l,u,s(p)).then(f=>i(f))});Vn.axiosPut=d;const c=(l,u)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.delete(l,s(u)).then(p=>i(p))});return Vn.axiosDelete=c,Vn}var Db;function i9(){if(Db)return $n;Db=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.getMessagesService=$n.getConversationHashService=$n.authUpdateUserService=$n.createUserService=void 0;const e=$e,t=Je(),r=tt(),n=xh(),s=Mh(),i=It(),o=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{wallet:u,publicKey:p="",encryptedPrivateKey:f="",env:h=t.default.ENV.PROD,origin:y}=l||{};let{user:m}=l||{};const v=`${(0,r.getAPIBaseUrls)(h)}/v2/users/`;if((0,r.isValidNFTCAIP)(m)){const D=Math.floor(Date.now()/1e3);m.split(":").length!==6&&(m=`${m}:${D}`)}const E={caip10:(0,r.walletToPCAIP10)(m),did:(0,r.walletToPCAIP10)(m),publicKey:p,encryptedPrivateKey:f},_=(0,r.generateHash)(E),C=yield(0,n.getEip191Signature)(u,_,"v2"),k=Object.assign(Object.assign(Object.assign({},E),{origin:y}),C);return(0,i.axiosPost)(v,k).then(D=>e.__awaiter(void 0,void 0,void 0,function*(){return D.data&&(D.data.publicKey=yield(0,r.verifyProfileKeys)(D.data.encryptedPrivateKey,D.data.publicKey,D.data.did,D.data.wallets,D.data.verificationProof)),(0,s.populateDeprecatedUser)(D.data)})).catch(D=>{throw Error(`[Push SDK] - API ${v}: ${D}`)})});$n.createUserService=o;const a=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:u,wallet:p,publicKey:f="",encryptedPrivateKey:h="",env:y=t.default.ENV.PROD}=l||{},b=`${(0,r.getAPIBaseUrls)(y)}/v2/users/${(0,r.walletToPCAIP10)(u)}/auth`,v={caip10:(0,r.walletToPCAIP10)(u),did:(0,r.walletToPCAIP10)(u),publicKey:f,encryptedPrivateKey:h},E=(0,r.generateHash)(v),_=yield(0,n.getEip191Signature)(p,E,"v2"),C=Object.assign(Object.assign({},v),_),k=e.__rest(C,["did"]);return(0,i.axiosPut)(b,k).then(D=>e.__awaiter(void 0,void 0,void 0,function*(){return D.data&&(D.data.publicKey=yield(0,r.verifyProfileKeys)(D.data.encryptedPrivateKey,D.data.publicKey,D.data.did,D.data.wallets,D.data.verificationProof)),(0,s.populateDeprecatedUser)(D.data)})).catch(D=>{throw Error(`[Push SDK] - API ${b}: ${D}`)})});$n.authUpdateUserService=a;const d=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{conversationId:u,account:p,env:f=t.default.ENV.PROD}=l||{},y=`${(0,r.getAPIBaseUrls)(f)}/v1/chat/users/${(0,r.walletToPCAIP10)(p)}/conversations/${u}/hash`;return(0,i.axiosGet)(y).then(m=>m.data).catch(m=>{throw new Error(m)})});$n.getConversationHashService=d;const c=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:u,limit:p,env:f=t.default.ENV.PROD}=l||{},y=`${(0,r.getAPIBaseUrls)(f)}/v1/chat/conversationhash/${u}`,m={fetchLimit:p},b=`${y}?${(0,r.getQueryParams)(m)}`;return(0,i.axiosGet)(b).then(v=>v.data).catch(v=>{throw new Error(v)})});return $n.getMessagesService=c,$n}var v1={},_1={},Li={},w1={},E1={},A1={},S1={},ea={},Ki={},Cr={},xb;function So(){if(xb)return Cr;xb=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.output=Cr.exists=Cr.hash=Cr.bytes=Cr.bool=Cr.number=Cr.isBytes=void 0;function e(d){if(!Number.isSafeInteger(d)||d<0)throw new Error(`positive integer expected, not ${d}`)}Cr.number=e;function t(d){if(typeof d!="boolean")throw new Error(`boolean expected, not ${d}`)}Cr.bool=t;function r(d){return d instanceof Uint8Array||d!=null&&typeof d=="object"&&d.constructor.name==="Uint8Array"}Cr.isBytes=r;function n(d,...c){if(!r(d))throw new Error("Uint8Array expected");if(c.length>0&&!c.includes(d.length))throw new Error(`Uint8Array expected of length ${c}, not of length=${d.length}`)}Cr.bytes=n;function s(d){if(typeof d!="function"||typeof d.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(d.outputLen),e(d.blockLen)}Cr.hash=s;function i(d,c=!0){if(d.destroyed)throw new Error("Hash instance has been destroyed");if(c&&d.finished)throw new Error("Hash#digest() has already been called")}Cr.exists=i;function o(d,c){n(d);const l=c.outputLen;if(d.length<l)throw new Error(`digestInto() expects output buffer of length at least ${l}`)}Cr.output=o;const a={number:e,bool:t,bytes:n,hash:s,exists:i,output:o};return Cr.default=a,Cr}var P1={},Ho={},Ub;function vR(){return Ub||(Ub=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.crypto=void 0,Ho.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Ho}var Bb;function ki(){return Bb||(Bb=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=vR(),r=So();function n(g){return g instanceof Uint8Array||g!=null&&typeof g=="object"&&g.constructor.name==="Uint8Array"}e.isBytes=n;const s=g=>new Uint8Array(g.buffer,g.byteOffset,g.byteLength);e.u8=s;const i=g=>new Uint32Array(g.buffer,g.byteOffset,Math.floor(g.byteLength/4));e.u32=i;const o=g=>new DataView(g.buffer,g.byteOffset,g.byteLength);e.createView=o;const a=(g,A)=>g<<32-A|g>>>A;e.rotr=a;const d=(g,A)=>g<<A|g>>>32-A>>>0;e.rotl=d,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const c=g=>g<<24&4278190080|g<<8&16711680|g>>>8&65280|g>>>24&255;e.byteSwap=c,e.byteSwapIfBE=e.isLE?g=>g:g=>(0,e.byteSwap)(g);function l(g){for(let A=0;A<g.length;A++)g[A]=(0,e.byteSwap)(g[A])}e.byteSwap32=l;const u=Array.from({length:256},(g,A)=>A.toString(16).padStart(2,"0"));function p(g){(0,r.bytes)(g);let A="";for(let P=0;P<g.length;P++)A+=u[g[P]];return A}e.bytesToHex=p;const f={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function h(g){if(g>=f._0&&g<=f._9)return g-f._0;if(g>=f._A&&g<=f._F)return g-(f._A-10);if(g>=f._a&&g<=f._f)return g-(f._a-10)}function y(g){if(typeof g!="string")throw new Error("hex string expected, got "+typeof g);const A=g.length,P=A/2;if(A%2)throw new Error("padded hex string expected, got unpadded hex of length "+A);const O=new Uint8Array(P);for(let N=0,M=0;N<P;N++,M+=2){const L=h(g.charCodeAt(M)),x=h(g.charCodeAt(M+1));if(L===void 0||x===void 0){const R=g[M]+g[M+1];throw new Error('hex string expected, got non-hex character "'+R+'" at index '+M)}O[N]=L*16+x}return O}e.hexToBytes=y;const m=async()=>{};e.nextTick=m;async function b(g,A,P){let O=Date.now();for(let N=0;N<g;N++){P(N);const M=Date.now()-O;M>=0&&M<A||(await(0,e.nextTick)(),O+=M)}}e.asyncLoop=b;function v(g){if(typeof g!="string")throw new Error(`utf8ToBytes expected string, got ${typeof g}`);return new Uint8Array(new TextEncoder().encode(g))}e.utf8ToBytes=v;function E(g){return typeof g=="string"&&(g=v(g)),(0,r.bytes)(g),g}e.toBytes=E;function _(...g){let A=0;for(let O=0;O<g.length;O++){const N=g[O];(0,r.bytes)(N),A+=N.length}const P=new Uint8Array(A);for(let O=0,N=0;O<g.length;O++){const M=g[O];P.set(M,N),N+=M.length}return P}e.concatBytes=_;class C{clone(){return this._cloneInto()}}e.Hash=C;const k={}.toString;function D(g,A){if(A!==void 0&&k.call(A)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(g,A)}e.checkOpts=D;function w(g){const A=O=>g().update(E(O)).digest(),P=g();return A.outputLen=P.outputLen,A.blockLen=P.blockLen,A.create=()=>g(),A}e.wrapConstructor=w;function S(g){const A=(O,N)=>g(N).update(E(O)).digest(),P=g({});return A.outputLen=P.outputLen,A.blockLen=P.blockLen,A.create=O=>g(O),A}e.wrapConstructorWithOpts=S;function I(g){const A=(O,N)=>g(N).update(E(O)).digest(),P=g({});return A.outputLen=P.outputLen,A.blockLen=P.blockLen,A.create=O=>g(O),A}e.wrapXOFConstructorWithOpts=I;function T(g=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(g));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=T}(P1)),P1}var Lb;function _R(){if(Lb)return Ki;Lb=1,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.HashMD=Ki.Maj=Ki.Chi=void 0;const e=So(),t=ki();function r(o,a,d,c){if(typeof o.setBigUint64=="function")return o.setBigUint64(a,d,c);const l=BigInt(32),u=BigInt(4294967295),p=Number(d>>l&u),f=Number(d&u),h=c?4:0,y=c?0:4;o.setUint32(a+h,p,c),o.setUint32(a+y,f,c)}const n=(o,a,d)=>o&a^~o&d;Ki.Chi=n;const s=(o,a,d)=>o&a^o&d^a&d;Ki.Maj=s;class i extends t.Hash{constructor(a,d,c,l){super(),this.blockLen=a,this.outputLen=d,this.padOffset=c,this.isLE=l,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,t.createView)(this.buffer)}update(a){(0,e.exists)(this);const{view:d,buffer:c,blockLen:l}=this;a=(0,t.toBytes)(a);const u=a.length;for(let p=0;p<u;){const f=Math.min(l-this.pos,u-p);if(f===l){const h=(0,t.createView)(a);for(;l<=u-p;p+=l)this.process(h,p);continue}c.set(a.subarray(p,p+f),this.pos),this.pos+=f,p+=f,this.pos===l&&(this.process(d,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){(0,e.exists)(this),(0,e.output)(a,this),this.finished=!0;const{buffer:d,view:c,blockLen:l,isLE:u}=this;let{pos:p}=this;d[p++]=128,this.buffer.subarray(p).fill(0),this.padOffset>l-p&&(this.process(c,0),p=0);for(let b=p;b<l;b++)d[b]=0;r(c,l-8,BigInt(this.length*8),u),this.process(c,0);const f=(0,t.createView)(a),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const y=h/4,m=this.get();if(y>m.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;b<y;b++)f.setUint32(4*b,m[b],u)}digest(){const{buffer:a,outputLen:d}=this;this.digestInto(a);const c=a.slice(0,d);return this.destroy(),c}_cloneInto(a){a||(a=new this.constructor),a.set(...this.get());const{blockLen:d,buffer:c,length:l,finished:u,destroyed:p,pos:f}=this;return a.length=l,a.pos=f,a.finished=u,a.destroyed=p,l%d&&a.buffer.set(c),a}}return Ki.HashMD=i,Ki}var Kb;function wR(){if(Kb)return ea;Kb=1,Object.defineProperty(ea,"__esModule",{value:!0}),ea.sha224=ea.sha256=void 0;const e=_R(),t=ki(),r=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);class i extends e.HashMD{constructor(){super(64,32,8,!1),this.A=n[0]|0,this.B=n[1]|0,this.C=n[2]|0,this.D=n[3]|0,this.E=n[4]|0,this.F=n[5]|0,this.G=n[6]|0,this.H=n[7]|0}get(){const{A:d,B:c,C:l,D:u,E:p,F:f,G:h,H:y}=this;return[d,c,l,u,p,f,h,y]}set(d,c,l,u,p,f,h,y){this.A=d|0,this.B=c|0,this.C=l|0,this.D=u|0,this.E=p|0,this.F=f|0,this.G=h|0,this.H=y|0}process(d,c){for(let v=0;v<16;v++,c+=4)s[v]=d.getUint32(c,!1);for(let v=16;v<64;v++){const E=s[v-15],_=s[v-2],C=(0,t.rotr)(E,7)^(0,t.rotr)(E,18)^E>>>3,k=(0,t.rotr)(_,17)^(0,t.rotr)(_,19)^_>>>10;s[v]=k+s[v-7]+C+s[v-16]|0}let{A:l,B:u,C:p,D:f,E:h,F:y,G:m,H:b}=this;for(let v=0;v<64;v++){const E=(0,t.rotr)(h,6)^(0,t.rotr)(h,11)^(0,t.rotr)(h,25),_=b+E+(0,e.Chi)(h,y,m)+r[v]+s[v]|0,k=((0,t.rotr)(l,2)^(0,t.rotr)(l,13)^(0,t.rotr)(l,22))+(0,e.Maj)(l,u,p)|0;b=m,m=y,y=h,h=f+_|0,f=p,p=u,u=l,l=_+k|0}l=l+this.A|0,u=u+this.B|0,p=p+this.C|0,f=f+this.D|0,h=h+this.E|0,y=y+this.F|0,m=m+this.G|0,b=b+this.H|0,this.set(l,u,p,f,h,y,m,b)}roundClean(){s.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class o extends i{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}return ea.sha256=(0,t.wrapConstructor)(()=>new i),ea.sha224=(0,t.wrapConstructor)(()=>new o),ea}var Go={},T1={},qb;function ER(){return qb||(qb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=So(),r=ki();class n extends r.Hash{constructor(o,a){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(o);const d=(0,r.toBytes)(a);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const c=this.blockLen,l=new Uint8Array(c);l.set(d.length>c?o.create().update(d).digest():d);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=o.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),l.fill(0)}update(o){return(0,t.exists)(this),this.iHash.update(o),this}digestInto(o){(0,t.exists)(this),(0,t.bytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:a,iHash:d,finished:c,destroyed:l,blockLen:u,outputLen:p}=this;return o=o,o.finished=c,o.destroyed=l,o.blockLen=u,o.outputLen=p,o.oHash=a._cloneInto(o.oHash),o.iHash=d._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n;const s=(i,o,a)=>new n(i,o).update(a).digest();e.hmac=s,e.hmac.create=(i,o)=>new n(i,o)}(T1)),T1}var I1={},zo={},dr={},ar={},jb;function go(){if(jb)return ar;jb=1,Object.defineProperty(ar,"__esModule",{value:!0}),ar.bitMask=void 0,ar.isBytes=n,ar.abytes=s,ar.bytesToHex=o,ar.numberToHexUnpadded=a,ar.hexToNumber=d,ar.hexToBytes=u,ar.bytesToNumberBE=p,ar.bytesToNumberLE=f,ar.numberToBytesBE=h,ar.numberToBytesLE=y,ar.numberToVarBytesBE=m,ar.ensureBytes=b,ar.concatBytes=v,ar.equalBytes=E,ar.utf8ToBytes=_,ar.bitLen=C,ar.bitGet=k,ar.bitSet=D,ar.createHmacDrbg=T,ar.validateObject=A;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=BigInt(0),t=BigInt(1),r=BigInt(2);function n(P){return P instanceof Uint8Array||P!=null&&typeof P=="object"&&P.constructor.name==="Uint8Array"}function s(P){if(!n(P))throw new Error("Uint8Array expected")}const i=Array.from({length:256},(P,O)=>O.toString(16).padStart(2,"0"));function o(P){s(P);let O="";for(let N=0;N<P.length;N++)O+=i[P[N]];return O}function a(P){const O=P.toString(16);return O.length&1?`0${O}`:O}function d(P){if(typeof P!="string")throw new Error("hex string expected, got "+typeof P);return BigInt(P===""?"0":`0x${P}`)}const c={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function l(P){if(P>=c._0&&P<=c._9)return P-c._0;if(P>=c._A&&P<=c._F)return P-(c._A-10);if(P>=c._a&&P<=c._f)return P-(c._a-10)}function u(P){if(typeof P!="string")throw new Error("hex string expected, got "+typeof P);const O=P.length,N=O/2;if(O%2)throw new Error("padded hex string expected, got unpadded hex of length "+O);const M=new Uint8Array(N);for(let L=0,x=0;L<N;L++,x+=2){const R=l(P.charCodeAt(x)),K=l(P.charCodeAt(x+1));if(R===void 0||K===void 0){const V=P[x]+P[x+1];throw new Error('hex string expected, got non-hex character "'+V+'" at index '+x)}M[L]=R*16+K}return M}function p(P){return d(o(P))}function f(P){return s(P),d(o(Uint8Array.from(P).reverse()))}function h(P,O){return u(P.toString(16).padStart(O*2,"0"))}function y(P,O){return h(P,O).reverse()}function m(P){return u(a(P))}function b(P,O,N){let M;if(typeof O=="string")try{M=u(O)}catch(x){throw new Error(`${P} must be valid hex string, got "${O}". Cause: ${x}`)}else if(n(O))M=Uint8Array.from(O);else throw new Error(`${P} must be hex string or Uint8Array`);const L=M.length;if(typeof N=="number"&&L!==N)throw new Error(`${P} expected ${N} bytes, got ${L}`);return M}function v(...P){let O=0;for(let M=0;M<P.length;M++){const L=P[M];s(L),O+=L.length}const N=new Uint8Array(O);for(let M=0,L=0;M<P.length;M++){const x=P[M];N.set(x,L),L+=x.length}return N}function E(P,O){if(P.length!==O.length)return!1;let N=0;for(let M=0;M<P.length;M++)N|=P[M]^O[M];return N===0}function _(P){if(typeof P!="string")throw new Error(`utf8ToBytes expected string, got ${typeof P}`);return new Uint8Array(new TextEncoder().encode(P))}function C(P){let O;for(O=0;P>e;P>>=t,O+=1);return O}function k(P,O){return P>>BigInt(O)&t}function D(P,O,N){return P|(N?t:e)<<BigInt(O)}const w=P=>(r<<BigInt(P-1))-t;ar.bitMask=w;const S=P=>new Uint8Array(P),I=P=>Uint8Array.from(P);function T(P,O,N){if(typeof P!="number"||P<2)throw new Error("hashLen must be a number");if(typeof O!="number"||O<2)throw new Error("qByteLen must be a number");if(typeof N!="function")throw new Error("hmacFn must be a function");let M=S(P),L=S(P),x=0;const R=()=>{M.fill(1),L.fill(0),x=0},K=(...j)=>N(L,M,...j),V=(j=S())=>{L=K(I([0]),j),M=K(),j.length!==0&&(L=K(I([1]),j),M=K())},J=()=>{if(x++>=1e3)throw new Error("drbg: tried 1000 values");let j=0;const re=[];for(;j<O;){M=K();const G=M.slice();re.push(G),j+=M.length}return v(...re)};return(j,re)=>{R(),V(j);let G;for(;!(G=re(J()));)V();return R(),G}}const g={bigint:P=>typeof P=="bigint",function:P=>typeof P=="function",boolean:P=>typeof P=="boolean",string:P=>typeof P=="string",stringOrUint8Array:P=>typeof P=="string"||n(P),isSafeInteger:P=>Number.isSafeInteger(P),array:P=>Array.isArray(P),field:(P,O)=>O.Fp.isValid(P),hash:P=>typeof P=="function"&&Number.isSafeInteger(P.outputLen)};function A(P,O,N={}){const M=(L,x,R)=>{const K=g[x];if(typeof K!="function")throw new Error(`Invalid validator "${x}", expected function`);const V=P[L];if(!(R&&V===void 0)&&!K(V,P))throw new Error(`Invalid param ${String(L)}=${V} (${typeof V}), expected ${x}`)};for(const[L,x]of Object.entries(O))M(L,x,!1);for(const[L,x]of Object.entries(N))M(L,x,!0);return P}return ar}var $b;function Nh(){if($b)return dr;$b=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.isNegativeLE=void 0,dr.mod=d,dr.pow=c,dr.pow2=l,dr.invert=u,dr.tonelliShanks=p,dr.FpSqrt=f,dr.validateField=m,dr.FpPow=b,dr.FpInvertBatch=v,dr.FpDiv=E,dr.FpIsSquare=_,dr.nLength=C,dr.Field=k,dr.FpSqrtOdd=D,dr.FpSqrtEven=w,dr.hashToPrivateScalar=S,dr.getFieldBytesLength=I,dr.getMinHashLength=T,dr.mapHashToField=g;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=go(),t=BigInt(0),r=BigInt(1),n=BigInt(2),s=BigInt(3),i=BigInt(4),o=BigInt(5),a=BigInt(8);BigInt(9),BigInt(16);function d(A,P){const O=A%P;return O>=t?O:P+O}function c(A,P,O){if(O<=t||P<t)throw new Error("Expected power/modulo > 0");if(O===r)return t;let N=r;for(;P>t;)P&r&&(N=N*A%O),A=A*A%O,P>>=r;return N}function l(A,P,O){let N=A;for(;P-- >t;)N*=N,N%=O;return N}function u(A,P){if(A===t||P<=t)throw new Error(`invert: expected positive integers, got n=${A} mod=${P}`);let O=d(A,P),N=P,M=t,L=r;for(;O!==t;){const R=N/O,K=N%O,V=M-L*R;N=O,O=K,M=L,L=V}if(N!==r)throw new Error("invert: does not exist");return d(M,P)}function p(A){const P=(A-r)/n;let O,N,M;for(O=A-r,N=0;O%n===t;O/=n,N++);for(M=n;M<A&&c(M,P,A)!==A-r;M++);if(N===1){const x=(A+r)/i;return function(K,V){const J=K.pow(V,x);if(!K.eql(K.sqr(J),V))throw new Error("Cannot find square root");return J}}const L=(O+r)/n;return function(R,K){if(R.pow(K,P)===R.neg(R.ONE))throw new Error("Cannot find square root");let V=N,J=R.pow(R.mul(R.ONE,M),O),se=R.pow(K,L),j=R.pow(K,O);for(;!R.eql(j,R.ONE);){if(R.eql(j,R.ZERO))return R.ZERO;let re=1;for(let B=R.sqr(j);re<V&&!R.eql(B,R.ONE);re++)B=R.sqr(B);const G=R.pow(J,r<<BigInt(V-re-1));J=R.sqr(G),se=R.mul(se,G),j=R.mul(j,J),V=re}return se}}function f(A){if(A%i===s){const P=(A+r)/i;return function(N,M){const L=N.pow(M,P);if(!N.eql(N.sqr(L),M))throw new Error("Cannot find square root");return L}}if(A%a===o){const P=(A-o)/a;return function(N,M){const L=N.mul(M,n),x=N.pow(L,P),R=N.mul(M,x),K=N.mul(N.mul(R,n),x),V=N.mul(R,N.sub(K,N.ONE));if(!N.eql(N.sqr(V),M))throw new Error("Cannot find square root");return V}}return p(A)}const h=(A,P)=>(d(A,P)&r)===r;dr.isNegativeLE=h;const y=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m(A){const P={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},O=y.reduce((N,M)=>(N[M]="function",N),P);return(0,e.validateObject)(A,O)}function b(A,P,O){if(O<t)throw new Error("Expected power > 0");if(O===t)return A.ONE;if(O===r)return P;let N=A.ONE,M=P;for(;O>t;)O&r&&(N=A.mul(N,M)),M=A.sqr(M),O>>=r;return N}function v(A,P){const O=new Array(P.length),N=P.reduce((L,x,R)=>A.is0(x)?L:(O[R]=L,A.mul(L,x)),A.ONE),M=A.inv(N);return P.reduceRight((L,x,R)=>A.is0(x)?L:(O[R]=A.mul(L,O[R]),A.mul(L,x)),M),O}function E(A,P,O){return A.mul(P,typeof O=="bigint"?u(O,A.ORDER):A.inv(O))}function _(A){const P=(A.ORDER-r)/n;return O=>{const N=A.pow(O,P);return A.eql(N,A.ZERO)||A.eql(N,A.ONE)}}function C(A,P){const O=P!==void 0?P:A.toString(2).length,N=Math.ceil(O/8);return{nBitLength:O,nByteLength:N}}function k(A,P,O=!1,N={}){if(A<=t)throw new Error(`Expected Field ORDER > 0, got ${A}`);const{nBitLength:M,nByteLength:L}=C(A,P);if(L>2048)throw new Error("Field lengths over 2048 bytes are not supported");const x=f(A),R=Object.freeze({ORDER:A,BITS:M,BYTES:L,MASK:(0,e.bitMask)(M),ZERO:t,ONE:r,create:K=>d(K,A),isValid:K=>{if(typeof K!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof K}`);return t<=K&&K<A},is0:K=>K===t,isOdd:K=>(K&r)===r,neg:K=>d(-K,A),eql:(K,V)=>K===V,sqr:K=>d(K*K,A),add:(K,V)=>d(K+V,A),sub:(K,V)=>d(K-V,A),mul:(K,V)=>d(K*V,A),pow:(K,V)=>b(R,K,V),div:(K,V)=>d(K*u(V,A),A),sqrN:K=>K*K,addN:(K,V)=>K+V,subN:(K,V)=>K-V,mulN:(K,V)=>K*V,inv:K=>u(K,A),sqrt:N.sqrt||(K=>x(R,K)),invertBatch:K=>v(R,K),cmov:(K,V,J)=>J?V:K,toBytes:K=>O?(0,e.numberToBytesLE)(K,L):(0,e.numberToBytesBE)(K,L),fromBytes:K=>{if(K.length!==L)throw new Error(`Fp.fromBytes: expected ${L}, got ${K.length}`);return O?(0,e.bytesToNumberLE)(K):(0,e.bytesToNumberBE)(K)}});return Object.freeze(R)}function D(A,P){if(!A.isOdd)throw new Error("Field doesn't have isOdd");const O=A.sqrt(P);return A.isOdd(O)?O:A.neg(O)}function w(A,P){if(!A.isOdd)throw new Error("Field doesn't have isOdd");const O=A.sqrt(P);return A.isOdd(O)?A.neg(O):O}function S(A,P,O=!1){A=(0,e.ensureBytes)("privateHash",A);const N=A.length,M=C(P).nByteLength+8;if(M<24||N<M||N>1024)throw new Error(`hashToPrivateScalar: expected ${M}-1024 bytes of input, got ${N}`);const L=O?(0,e.bytesToNumberLE)(A):(0,e.bytesToNumberBE)(A);return d(L,P-r)+r}function I(A){if(typeof A!="bigint")throw new Error("field order must be bigint");const P=A.toString(2).length;return Math.ceil(P/8)}function T(A){const P=I(A);return P+Math.ceil(P/2)}function g(A,P,O=!1){const N=A.length,M=I(P),L=T(P);if(N<16||N<L||N>1024)throw new Error(`expected ${L}-1024 bytes of input, got ${N}`);const x=O?(0,e.bytesToNumberBE)(A):(0,e.bytesToNumberLE)(A),R=d(x,P-r)+r;return O?(0,e.numberToBytesLE)(R,M):(0,e.numberToBytesBE)(R,M)}return dr}var Vb;function AR(){if(Vb)return zo;Vb=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.wNAF=s,zo.validateBasic=i;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=Nh(),t=go(),r=BigInt(0),n=BigInt(1);function s(o,a){const d=(l,u)=>{const p=u.negate();return l?p:u},c=l=>{const u=Math.ceil(a/l)+1,p=2**(l-1);return{windows:u,windowSize:p}};return{constTimeNegate:d,unsafeLadder(l,u){let p=o.ZERO,f=l;for(;u>r;)u&n&&(p=p.add(f)),f=f.double(),u>>=n;return p},precomputeWindow(l,u){const{windows:p,windowSize:f}=c(u),h=[];let y=l,m=y;for(let b=0;b<p;b++){m=y,h.push(m);for(let v=1;v<f;v++)m=m.add(y),h.push(m);y=m.double()}return h},wNAF(l,u,p){const{windows:f,windowSize:h}=c(l);let y=o.ZERO,m=o.BASE;const b=BigInt(2**l-1),v=2**l,E=BigInt(l);for(let _=0;_<f;_++){const C=_*h;let k=Number(p&b);p>>=E,k>h&&(k-=v,p+=n);const D=C,w=C+Math.abs(k)-1,S=_%2!==0,I=k<0;k===0?m=m.add(d(S,u[D])):y=y.add(d(I,u[w]))}return{p:y,f:m}},wNAFCached(l,u,p,f){const h=l._WINDOW_SIZE||1;let y=u.get(l);return y||(y=this.precomputeWindow(l,h),h!==1&&u.set(l,f(y))),this.wNAF(h,y,p)}}}function i(o){return(0,e.validateField)(o.Fp),(0,t.validateObject)(o,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,e.nLength)(o.n,o.nBitLength),...o,p:o.Fp.ORDER})}return zo}var Fb;function s9(){return Fb||(Fb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=f,e.weierstrass=y,e.SWUFpSqrtRatio=m,e.mapToCurveSimpleSWU=b;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=AR(),r=Nh(),n=go(),s=go();function i(v){const E=(0,t.validateBasic)(v);n.validateObject(E,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:_,Fp:C,a:k}=E;if(_){if(!C.eql(k,C.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof _!="object"||typeof _.beta!="bigint"||typeof _.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...E})}const{bytesToNumberBE:o,hexToBytes:a}=n;e.DER={Err:class extends Error{constructor(E=""){super(E)}},_parseInt(v){const{Err:E}=e.DER;if(v.length<2||v[0]!==2)throw new E("Invalid signature integer tag");const _=v[1],C=v.subarray(2,_+2);if(!_||C.length!==_)throw new E("Invalid signature integer: wrong length");if(C[0]&128)throw new E("Invalid signature integer: negative");if(C[0]===0&&!(C[1]&128))throw new E("Invalid signature integer: unnecessary leading zero");return{d:o(C),l:v.subarray(_+2)}},toSig(v){const{Err:E}=e.DER,_=typeof v=="string"?a(v):v;n.abytes(_);let C=_.length;if(C<2||_[0]!=48)throw new E("Invalid signature tag");if(_[1]!==C-2)throw new E("Invalid signature: incorrect length");const{d:k,l:D}=e.DER._parseInt(_.subarray(2)),{d:w,l:S}=e.DER._parseInt(D);if(S.length)throw new E("Invalid signature: left bytes after parsing");return{r:k,s:w}},hexFromSig(v){const E=T=>Number.parseInt(T[0],16)&8?"00"+T:T,_=T=>{const g=T.toString(16);return g.length&1?`0${g}`:g},C=E(_(v.s)),k=E(_(v.r)),D=C.length/2,w=k.length/2,S=_(D),I=_(w);return`30${_(w+D+4)}02${I}${k}02${S}${C}`}};const d=BigInt(0),c=BigInt(1),l=BigInt(2),u=BigInt(3),p=BigInt(4);function f(v){const E=i(v),{Fp:_}=E,C=E.toBytes||((N,M,L)=>{const x=M.toAffine();return n.concatBytes(Uint8Array.from([4]),_.toBytes(x.x),_.toBytes(x.y))}),k=E.fromBytes||(N=>{const M=N.subarray(1),L=_.fromBytes(M.subarray(0,_.BYTES)),x=_.fromBytes(M.subarray(_.BYTES,2*_.BYTES));return{x:L,y:x}});function D(N){const{a:M,b:L}=E,x=_.sqr(N),R=_.mul(x,N);return _.add(_.add(R,_.mul(N,M)),L)}if(!_.eql(_.sqr(E.Gy),D(E.Gx)))throw new Error("bad generator point: equation left != right");function w(N){return typeof N=="bigint"&&d<N&&N<E.n}function S(N){if(!w(N))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function I(N){const{allowedPrivateKeyLengths:M,nByteLength:L,wrapPrivateKey:x,n:R}=E;if(M&&typeof N!="bigint"){if(n.isBytes(N)&&(N=n.bytesToHex(N)),typeof N!="string"||!M.includes(N.length))throw new Error("Invalid key");N=N.padStart(L*2,"0")}let K;try{K=typeof N=="bigint"?N:n.bytesToNumberBE((0,s.ensureBytes)("private key",N,L))}catch{throw new Error(`private key must be ${L} bytes, hex or bigint, not ${typeof N}`)}return x&&(K=r.mod(K,R)),S(K),K}const T=new Map;function g(N){if(!(N instanceof A))throw new Error("ProjectivePoint expected")}class A{constructor(M,L,x){if(this.px=M,this.py=L,this.pz=x,M==null||!_.isValid(M))throw new Error("x required");if(L==null||!_.isValid(L))throw new Error("y required");if(x==null||!_.isValid(x))throw new Error("z required")}static fromAffine(M){const{x:L,y:x}=M||{};if(!M||!_.isValid(L)||!_.isValid(x))throw new Error("invalid affine point");if(M instanceof A)throw new Error("projective point not allowed");const R=K=>_.eql(K,_.ZERO);return R(L)&&R(x)?A.ZERO:new A(L,x,_.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(M){const L=_.invertBatch(M.map(x=>x.pz));return M.map((x,R)=>x.toAffine(L[R])).map(A.fromAffine)}static fromHex(M){const L=A.fromAffine(k((0,s.ensureBytes)("pointHex",M)));return L.assertValidity(),L}static fromPrivateKey(M){return A.BASE.multiply(I(M))}_setWindowSize(M){this._WINDOW_SIZE=M,T.delete(this)}assertValidity(){if(this.is0()){if(E.allowInfinityPoint&&!_.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:M,y:L}=this.toAffine();if(!_.isValid(M)||!_.isValid(L))throw new Error("bad point: x or y not FE");const x=_.sqr(L),R=D(M);if(!_.eql(x,R))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:M}=this.toAffine();if(_.isOdd)return!_.isOdd(M);throw new Error("Field doesn't support isOdd")}equals(M){g(M);const{px:L,py:x,pz:R}=this,{px:K,py:V,pz:J}=M,se=_.eql(_.mul(L,J),_.mul(K,R)),j=_.eql(_.mul(x,J),_.mul(V,R));return se&&j}negate(){return new A(this.px,_.neg(this.py),this.pz)}double(){const{a:M,b:L}=E,x=_.mul(L,u),{px:R,py:K,pz:V}=this;let J=_.ZERO,se=_.ZERO,j=_.ZERO,re=_.mul(R,R),G=_.mul(K,K),B=_.mul(V,V),X=_.mul(R,K);return X=_.add(X,X),j=_.mul(R,V),j=_.add(j,j),J=_.mul(M,j),se=_.mul(x,B),se=_.add(J,se),J=_.sub(G,se),se=_.add(G,se),se=_.mul(J,se),J=_.mul(X,J),j=_.mul(x,j),B=_.mul(M,B),X=_.sub(re,B),X=_.mul(M,X),X=_.add(X,j),j=_.add(re,re),re=_.add(j,re),re=_.add(re,B),re=_.mul(re,X),se=_.add(se,re),B=_.mul(K,V),B=_.add(B,B),re=_.mul(B,X),J=_.sub(J,re),j=_.mul(B,G),j=_.add(j,j),j=_.add(j,j),new A(J,se,j)}add(M){g(M);const{px:L,py:x,pz:R}=this,{px:K,py:V,pz:J}=M;let se=_.ZERO,j=_.ZERO,re=_.ZERO;const G=E.a,B=_.mul(E.b,u);let X=_.mul(L,K),ge=_.mul(x,V),_e=_.mul(R,J),Se=_.add(L,x),F=_.add(K,V);Se=_.mul(Se,F),F=_.add(X,ge),Se=_.sub(Se,F),F=_.add(L,R);let q=_.add(K,J);return F=_.mul(F,q),q=_.add(X,_e),F=_.sub(F,q),q=_.add(x,R),se=_.add(V,J),q=_.mul(q,se),se=_.add(ge,_e),q=_.sub(q,se),re=_.mul(G,F),se=_.mul(B,_e),re=_.add(se,re),se=_.sub(ge,re),re=_.add(ge,re),j=_.mul(se,re),ge=_.add(X,X),ge=_.add(ge,X),_e=_.mul(G,_e),F=_.mul(B,F),ge=_.add(ge,_e),_e=_.sub(X,_e),_e=_.mul(G,_e),F=_.add(F,_e),X=_.mul(ge,F),j=_.add(j,X),X=_.mul(q,F),se=_.mul(Se,se),se=_.sub(se,X),X=_.mul(Se,ge),re=_.mul(q,re),re=_.add(re,X),new A(se,j,re)}subtract(M){return this.add(M.negate())}is0(){return this.equals(A.ZERO)}wNAF(M){return O.wNAFCached(this,T,M,L=>{const x=_.invertBatch(L.map(R=>R.pz));return L.map((R,K)=>R.toAffine(x[K])).map(A.fromAffine)})}multiplyUnsafe(M){const L=A.ZERO;if(M===d)return L;if(S(M),M===c)return this;const{endo:x}=E;if(!x)return O.unsafeLadder(this,M);let{k1neg:R,k1:K,k2neg:V,k2:J}=x.splitScalar(M),se=L,j=L,re=this;for(;K>d||J>d;)K&c&&(se=se.add(re)),J&c&&(j=j.add(re)),re=re.double(),K>>=c,J>>=c;return R&&(se=se.negate()),V&&(j=j.negate()),j=new A(_.mul(j.px,x.beta),j.py,j.pz),se.add(j)}multiply(M){S(M);let L=M,x,R;const{endo:K}=E;if(K){const{k1neg:V,k1:J,k2neg:se,k2:j}=K.splitScalar(L);let{p:re,f:G}=this.wNAF(J),{p:B,f:X}=this.wNAF(j);re=O.constTimeNegate(V,re),B=O.constTimeNegate(se,B),B=new A(_.mul(B.px,K.beta),B.py,B.pz),x=re.add(B),R=G.add(X)}else{const{p:V,f:J}=this.wNAF(L);x=V,R=J}return A.normalizeZ([x,R])[0]}multiplyAndAddUnsafe(M,L,x){const R=A.BASE,K=(J,se)=>se===d||se===c||!J.equals(R)?J.multiplyUnsafe(se):J.multiply(se),V=K(this,L).add(K(M,x));return V.is0()?void 0:V}toAffine(M){const{px:L,py:x,pz:R}=this,K=this.is0();M==null&&(M=K?_.ONE:_.inv(R));const V=_.mul(L,M),J=_.mul(x,M),se=_.mul(R,M);if(K)return{x:_.ZERO,y:_.ZERO};if(!_.eql(se,_.ONE))throw new Error("invZ was invalid");return{x:V,y:J}}isTorsionFree(){const{h:M,isTorsionFree:L}=E;if(M===c)return!0;if(L)return L(A,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:M,clearCofactor:L}=E;return M===c?this:L?L(A,this):this.multiplyUnsafe(E.h)}toRawBytes(M=!0){return this.assertValidity(),C(A,this,M)}toHex(M=!0){return n.bytesToHex(this.toRawBytes(M))}}A.BASE=new A(E.Gx,E.Gy,_.ONE),A.ZERO=new A(_.ZERO,_.ONE,_.ZERO);const P=E.nBitLength,O=(0,t.wNAF)(A,E.endo?Math.ceil(P/2):P);return{CURVE:E,ProjectivePoint:A,normPrivateKeyToScalar:I,weierstrassEquation:D,isWithinCurveOrder:w}}function h(v){const E=(0,t.validateBasic)(v);return n.validateObject(E,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...E})}function y(v){const E=h(v),{Fp:_,n:C}=E,k=_.BYTES+1,D=2*_.BYTES+1;function w(F){return d<F&&F<_.ORDER}function S(F){return r.mod(F,C)}function I(F){return r.invert(F,C)}const{ProjectivePoint:T,normPrivateKeyToScalar:g,weierstrassEquation:A,isWithinCurveOrder:P}=f({...E,toBytes(F,q,z){const ee=q.toAffine(),le=_.toBytes(ee.x),ce=n.concatBytes;return z?ce(Uint8Array.from([q.hasEvenY()?2:3]),le):ce(Uint8Array.from([4]),le,_.toBytes(ee.y))},fromBytes(F){const q=F.length,z=F[0],ee=F.subarray(1);if(q===k&&(z===2||z===3)){const le=n.bytesToNumberBE(ee);if(!w(le))throw new Error("Point is not on curve");const ce=A(le);let ne;try{ne=_.sqrt(ce)}catch(Fe){const he=Fe instanceof Error?": "+Fe.message:"";throw new Error("Point is not on curve"+he)}const je=(ne&c)===c;return(z&1)===1!==je&&(ne=_.neg(ne)),{x:le,y:ne}}else if(q===D&&z===4){const le=_.fromBytes(ee.subarray(0,_.BYTES)),ce=_.fromBytes(ee.subarray(_.BYTES,2*_.BYTES));return{x:le,y:ce}}else throw new Error(`Point of length ${q} was invalid. Expected ${k} compressed bytes or ${D} uncompressed bytes`)}}),O=F=>n.bytesToHex(n.numberToBytesBE(F,E.nByteLength));function N(F){const q=C>>c;return F>q}function M(F){return N(F)?S(-F):F}const L=(F,q,z)=>n.bytesToNumberBE(F.slice(q,z));class x{constructor(q,z,ee){this.r=q,this.s=z,this.recovery=ee,this.assertValidity()}static fromCompact(q){const z=E.nByteLength;return q=(0,s.ensureBytes)("compactSignature",q,z*2),new x(L(q,0,z),L(q,z,2*z))}static fromDER(q){const{r:z,s:ee}=e.DER.toSig((0,s.ensureBytes)("DER",q));return new x(z,ee)}assertValidity(){if(!P(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!P(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(q){return new x(this.r,this.s,q)}recoverPublicKey(q){const{r:z,s:ee,recovery:le}=this,ce=j((0,s.ensureBytes)("msgHash",q));if(le==null||![0,1,2,3].includes(le))throw new Error("recovery id invalid");const ne=le===2||le===3?z+E.n:z;if(ne>=_.ORDER)throw new Error("recovery id 2 or 3 invalid");const je=le&1?"03":"02",De=T.fromHex(je+O(ne)),Fe=I(ne),he=S(-ce*Fe),ue=S(ee*Fe),pe=T.BASE.multiplyAndAddUnsafe(De,he,ue);if(!pe)throw new Error("point at infinify");return pe.assertValidity(),pe}hasHighS(){return N(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,S(-this.s),this.recovery):this}toDERRawBytes(){return n.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return n.hexToBytes(this.toCompactHex())}toCompactHex(){return O(this.r)+O(this.s)}}const R={isValidPrivateKey(F){try{return g(F),!0}catch{return!1}},normPrivateKeyToScalar:g,randomPrivateKey:()=>{const F=r.getMinHashLength(E.n);return r.mapHashToField(E.randomBytes(F),E.n)},precompute(F=8,q=T.BASE){return q._setWindowSize(F),q.multiply(BigInt(3)),q}};function K(F,q=!0){return T.fromPrivateKey(F).toRawBytes(q)}function V(F){const q=n.isBytes(F),z=typeof F=="string",ee=(q||z)&&F.length;return q?ee===k||ee===D:z?ee===2*k||ee===2*D:F instanceof T}function J(F,q,z=!0){if(V(F))throw new Error("first arg must be private key");if(!V(q))throw new Error("second arg must be public key");return T.fromHex(q).multiply(g(F)).toRawBytes(z)}const se=E.bits2int||function(F){const q=n.bytesToNumberBE(F),z=F.length*8-E.nBitLength;return z>0?q>>BigInt(z):q},j=E.bits2int_modN||function(F){return S(se(F))},re=n.bitMask(E.nBitLength);function G(F){if(typeof F!="bigint")throw new Error("bigint expected");if(!(d<=F&&F<re))throw new Error(`bigint expected < 2^${E.nBitLength}`);return n.numberToBytesBE(F,E.nByteLength)}function B(F,q,z=X){if(["recovered","canonical"].some(fe=>fe in z))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:le}=E;let{lowS:ce,prehash:ne,extraEntropy:je}=z;ce==null&&(ce=!0),F=(0,s.ensureBytes)("msgHash",F),ne&&(F=(0,s.ensureBytes)("prehashed msgHash",ee(F)));const De=j(F),Fe=g(q),he=[G(Fe),G(De)];if(je!=null&&je!==!1){const fe=je===!0?le(_.BYTES):je;he.push((0,s.ensureBytes)("extraEntropy",fe))}const ue=n.concatBytes(...he),pe=De;function de(fe){const ye=se(fe);if(!P(ye))return;const ie=I(ye),Q=T.BASE.multiply(ye).toAffine(),qe=S(Q.x);if(qe===d)return;const He=S(ie*S(pe+qe*Fe));if(He===d)return;let Qe=(Q.x===qe?0:2)|Number(Q.y&c),dt=He;return ce&&N(He)&&(dt=M(He),Qe^=1),new x(qe,dt,Qe)}return{seed:ue,k2sig:de}}const X={lowS:E.lowS,prehash:!1},ge={lowS:E.lowS,prehash:!1};function _e(F,q,z=X){const{seed:ee,k2sig:le}=B(F,q,z),ce=E;return n.createHmacDrbg(ce.hash.outputLen,ce.nByteLength,ce.hmac)(ee,le)}T.BASE._setWindowSize(8);function Se(F,q,z,ee=ge){var Q;const le=F;if(q=(0,s.ensureBytes)("msgHash",q),z=(0,s.ensureBytes)("publicKey",z),"strict"in ee)throw new Error("options.strict was renamed to lowS");const{lowS:ce,prehash:ne}=ee;let je,De;try{if(typeof le=="string"||n.isBytes(le))try{je=x.fromDER(le)}catch(qe){if(!(qe instanceof e.DER.Err))throw qe;je=x.fromCompact(le)}else if(typeof le=="object"&&typeof le.r=="bigint"&&typeof le.s=="bigint"){const{r:qe,s:He}=le;je=new x(qe,He)}else throw new Error("PARSE");De=T.fromHex(z)}catch(qe){if(qe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ce&&je.hasHighS())return!1;ne&&(q=E.hash(q));const{r:Fe,s:he}=je,ue=j(q),pe=I(he),de=S(ue*pe),fe=S(Fe*pe),ye=(Q=T.BASE.multiplyAndAddUnsafe(De,de,fe))==null?void 0:Q.toAffine();return ye?S(ye.x)===Fe:!1}return{CURVE:E,getPublicKey:K,getSharedSecret:J,sign:_e,verify:Se,ProjectivePoint:T,Signature:x,utils:R}}function m(v,E){const _=v.ORDER;let C=d;for(let N=_-c;N%l===d;N/=l)C+=c;const k=C,D=l<<k-c-c,w=D*l,S=(_-c)/w,I=(S-c)/l,T=w-c,g=D,A=v.pow(E,S),P=v.pow(E,(S+c)/l);let O=(N,M)=>{let L=A,x=v.pow(M,T),R=v.sqr(x);R=v.mul(R,M);let K=v.mul(N,R);K=v.pow(K,I),K=v.mul(K,x),x=v.mul(K,M),R=v.mul(K,N);let V=v.mul(R,x);K=v.pow(V,g);let J=v.eql(K,v.ONE);x=v.mul(R,P),K=v.mul(V,L),R=v.cmov(x,R,J),V=v.cmov(K,V,J);for(let se=k;se>c;se--){let j=se-l;j=l<<j-c;let re=v.pow(V,j);const G=v.eql(re,v.ONE);x=v.mul(R,L),L=v.mul(L,L),re=v.mul(V,L),R=v.cmov(x,R,G),V=v.cmov(re,V,G)}return{isValid:J,value:R}};if(v.ORDER%p===u){const N=(v.ORDER-u)/p,M=v.sqrt(v.neg(E));O=(L,x)=>{let R=v.sqr(x);const K=v.mul(L,x);R=v.mul(R,K);let V=v.pow(R,N);V=v.mul(V,K);const J=v.mul(V,M),se=v.mul(v.sqr(V),x),j=v.eql(se,L);let re=v.cmov(J,V,j);return{isValid:j,value:re}}}return O}function b(v,E){if(r.validateField(v),!v.isValid(E.A)||!v.isValid(E.B)||!v.isValid(E.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const _=m(v,E.Z);if(!v.isOdd)throw new Error("Fp.isOdd is not implemented!");return C=>{let k,D,w,S,I,T,g,A;k=v.sqr(C),k=v.mul(k,E.Z),D=v.sqr(k),D=v.add(D,k),w=v.add(D,v.ONE),w=v.mul(w,E.B),S=v.cmov(E.Z,v.neg(D),!v.eql(D,v.ZERO)),S=v.mul(S,E.A),D=v.sqr(w),T=v.sqr(S),I=v.mul(T,E.A),D=v.add(D,I),D=v.mul(D,w),T=v.mul(T,S),I=v.mul(T,E.B),D=v.add(D,I),g=v.mul(k,w);const{isValid:P,value:O}=_(D,T);A=v.mul(k,C),A=v.mul(A,O),g=v.cmov(g,w,P),A=v.cmov(A,O,P);const N=v.isOdd(C)===v.isOdd(A);return A=v.cmov(v.neg(A),A,N),g=v.div(g,S),{x:g,y:A}}}}(I1)),I1}var Hb;function SR(){if(Hb)return Go;Hb=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.getHash=n,Go.createCurve=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ER(),t=ki(),r=s9();function n(i){return{hash:i,hmac:(o,...a)=>(0,e.hmac)(i,o,(0,t.concatBytes)(...a)),randomBytes:t.randomBytes}}function s(i,o){const a=d=>(0,r.weierstrass)({...i,...n(d)});return Object.freeze({...a(o),create:a})}return Go}var ds={},Gb;function PR(){if(Gb)return ds;Gb=1,Object.defineProperty(ds,"__esModule",{value:!0}),ds.expand_message_xmd=o,ds.expand_message_xof=a,ds.hash_to_field=d,ds.isogenyMap=c,ds.createHasher=l;const e=Nh(),t=go(),r=t.bytesToNumberBE;function n(u,p){if(u<0||u>=1<<8*p)throw new Error(`bad I2OSP call: value=${u} length=${p}`);const f=Array.from({length:p}).fill(0);for(let h=p-1;h>=0;h--)f[h]=u&255,u>>>=8;return new Uint8Array(f)}function s(u,p){const f=new Uint8Array(u.length);for(let h=0;h<u.length;h++)f[h]=u[h]^p[h];return f}function i(u){if(!Number.isSafeInteger(u))throw new Error("number expected")}function o(u,p,f,h){(0,t.abytes)(u),(0,t.abytes)(p),i(f),p.length>255&&(p=h((0,t.concatBytes)((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-"),p)));const{outputLen:y,blockLen:m}=h,b=Math.ceil(f/y);if(b>255)throw new Error("Invalid xmd length");const v=(0,t.concatBytes)(p,n(p.length,1)),E=n(0,m),_=n(f,2),C=new Array(b),k=h((0,t.concatBytes)(E,u,_,n(0,1),v));C[0]=h((0,t.concatBytes)(k,n(1,1),v));for(let w=1;w<=b;w++){const S=[s(k,C[w-1]),n(w+1,1),v];C[w]=h((0,t.concatBytes)(...S))}return(0,t.concatBytes)(...C).slice(0,f)}function a(u,p,f,h,y){if((0,t.abytes)(u),(0,t.abytes)(p),i(f),p.length>255){const m=Math.ceil(2*h/8);p=y.create({dkLen:m}).update((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(p).digest()}if(f>65535||p.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return y.create({dkLen:f}).update(u).update(n(f,2)).update(p).update(n(p.length,1)).digest()}function d(u,p,f){(0,t.validateObject)(f,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:h,k:y,m,hash:b,expand:v,DST:E}=f;(0,t.abytes)(u),i(p);const _=typeof E=="string"?(0,t.utf8ToBytes)(E):E,C=h.toString(2).length,k=Math.ceil((C+y)/8),D=p*m*k;let w;if(v==="xmd")w=o(u,_,D,b);else if(v==="xof")w=a(u,_,D,y,b);else if(v==="_internal_pass")w=u;else throw new Error('expand must be "xmd" or "xof"');const S=new Array(p);for(let I=0;I<p;I++){const T=new Array(m);for(let g=0;g<m;g++){const A=k*(g+I*m),P=w.subarray(A,A+k);T[g]=(0,e.mod)(r(P),h)}S[I]=T}return S}function c(u,p){const f=p.map(h=>Array.from(h).reverse());return(h,y)=>{const[m,b,v,E]=f.map(_=>_.reduce((C,k)=>u.add(u.mul(C,h),k)));return h=u.div(m,b),y=u.mul(y,u.div(v,E)),{x:h,y}}}function l(u,p,f){if(typeof p!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(h,y){const m=d(h,2,{...f,DST:f.DST,...y}),b=u.fromAffine(p(m[0])),v=u.fromAffine(p(m[1])),E=b.add(v).clearCofactor();return E.assertValidity(),E},encodeToCurve(h,y){const m=d(h,1,{...f,DST:f.encodeDST,...y}),b=u.fromAffine(p(m[0])).clearCofactor();return b.assertValidity(),b},mapToCurve(h){if(!Array.isArray(h))throw new Error("mapToCurve: expected array of bigints");for(const m of h)if(typeof m!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${m} in array`);const y=u.fromAffine(p(h)).clearCofactor();return y.assertValidity(),y}}}return ds}var zb;function TR(){return zb||(zb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=wR(),r=ki(),n=SR(),s=PR(),i=Nh(),o=go(),a=s9(),d=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),c=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),u=BigInt(2),p=(x,R)=>(x+R/u)/R;function f(x){const R=d,K=BigInt(3),V=BigInt(6),J=BigInt(11),se=BigInt(22),j=BigInt(23),re=BigInt(44),G=BigInt(88),B=x*x*x%R,X=B*B*x%R,ge=(0,i.pow2)(X,K,R)*X%R,_e=(0,i.pow2)(ge,K,R)*X%R,Se=(0,i.pow2)(_e,u,R)*B%R,F=(0,i.pow2)(Se,J,R)*Se%R,q=(0,i.pow2)(F,se,R)*F%R,z=(0,i.pow2)(q,re,R)*q%R,ee=(0,i.pow2)(z,G,R)*z%R,le=(0,i.pow2)(ee,re,R)*q%R,ce=(0,i.pow2)(le,K,R)*X%R,ne=(0,i.pow2)(ce,j,R)*F%R,je=(0,i.pow2)(ne,V,R)*B%R,De=(0,i.pow2)(je,u,R);if(!h.eql(h.sqr(De),x))throw new Error("Cannot find square root");return De}const h=(0,i.Field)(d,void 0,void 0,{sqrt:f});e.secp256k1=(0,n.createCurve)({a:BigInt(0),b:BigInt(7),Fp:h,n:c,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:x=>{const R=c,K=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),V=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),J=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),se=K,j=BigInt("0x100000000000000000000000000000000"),re=p(se*x,R),G=p(-V*x,R);let B=(0,i.mod)(x-re*K-G*J,R),X=(0,i.mod)(-re*V-G*se,R);const ge=B>j,_e=X>j;if(ge&&(B=R-B),_e&&(X=R-X),B>j||X>j)throw new Error("splitScalar: Endomorphism failed, k="+x);return{k1neg:ge,k1:B,k2neg:_e,k2:X}}}},t.sha256);const y=BigInt(0),m=x=>typeof x=="bigint"&&y<x&&x<d,b=x=>typeof x=="bigint"&&y<x&&x<c,v={};function E(x,...R){let K=v[x];if(K===void 0){const V=(0,t.sha256)(Uint8Array.from(x,J=>J.charCodeAt(0)));K=(0,o.concatBytes)(V,V),v[x]=K}return(0,t.sha256)((0,o.concatBytes)(K,...R))}const _=x=>x.toRawBytes(!0).slice(1),C=x=>(0,o.numberToBytesBE)(x,32),k=x=>(0,i.mod)(x,d),D=x=>(0,i.mod)(x,c),w=e.secp256k1.ProjectivePoint,S=(x,R,K)=>w.BASE.multiplyAndAddUnsafe(x,R,K);function I(x){let R=e.secp256k1.utils.normPrivateKeyToScalar(x),K=w.fromPrivateKey(R);return{scalar:K.hasEvenY()?R:D(-R),bytes:_(K)}}function T(x){if(!m(x))throw new Error("bad x: need 0 < x < p");const R=k(x*x),K=k(R*x+BigInt(7));let V=f(K);V%u!==y&&(V=k(-V));const J=new w(x,V,l);return J.assertValidity(),J}function g(...x){return D((0,o.bytesToNumberBE)(E("BIP0340/challenge",...x)))}function A(x){return I(x).bytes}function P(x,R,K=(0,r.randomBytes)(32)){const V=(0,o.ensureBytes)("message",x),{bytes:J,scalar:se}=I(R),j=(0,o.ensureBytes)("auxRand",K,32),re=C(se^(0,o.bytesToNumberBE)(E("BIP0340/aux",j))),G=E("BIP0340/nonce",re,J,V),B=D((0,o.bytesToNumberBE)(G));if(B===y)throw new Error("sign failed: k is zero");const{bytes:X,scalar:ge}=I(B),_e=g(X,J,V),Se=new Uint8Array(64);if(Se.set(X,0),Se.set(C(D(ge+_e*se)),32),!O(Se,V,J))throw new Error("sign: Invalid signature produced");return Se}function O(x,R,K){const V=(0,o.ensureBytes)("signature",x,64),J=(0,o.ensureBytes)("message",R),se=(0,o.ensureBytes)("publicKey",K,32);try{const j=T((0,o.bytesToNumberBE)(se)),re=(0,o.bytesToNumberBE)(V.subarray(0,32));if(!m(re))return!1;const G=(0,o.bytesToNumberBE)(V.subarray(32,64));if(!b(G))return!1;const B=g(C(re),_(j),J),X=S(j,G,D(-B));return!(!X||!X.hasEvenY()||X.toAffine().x!==re)}catch{return!1}}e.schnorr=(()=>({getPublicKey:A,sign:P,verify:O,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:T,pointToBytes:_,numberToBytesBE:o.numberToBytesBE,bytesToNumberBE:o.bytesToNumberBE,taggedHash:E,mod:i.mod}}))();const N=(()=>(0,s.isogenyMap)(h,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(x=>x.map(R=>BigInt(R)))))(),M=(()=>(0,a.mapToCurveSimpleSWU)(h,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:h.create(BigInt("-11"))}))(),L=(()=>(0,s.createHasher)(e.secp256k1.ProjectivePoint,x=>{const{x:R,y:K}=M(h.create(x[0]));return N(R,K)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:h.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=(()=>L.hashToCurve)(),e.encodeToCurve=(()=>L.encodeToCurve)()}(S1)),S1}var Wb;function Y2(){return Wb||(Wb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=TR();Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(A1)),A1}var Yb;function J2(){return Yb||(Yb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=u8,r=Y2();e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16}(E1)),E1}var Wo={},Jb;function IR(){return Jb||(Jb=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.GWEI_TO_WEI=void 0,Wo.GWEI_TO_WEI=BigInt(1e9)),Wo}var C1={},Fn={},Zb;function CR(){if(Zb)return Fn;Zb=1,Object.defineProperty(Fn,"__esModule",{value:!0}),Fn.RLP=Fn.utils=Fn.decode=Fn.encode=void 0;function e(b){if(Array.isArray(b)){const E=[];let _=0;for(let C=0;C<b.length;C++){const k=e(b[C]);E.push(k),_+=k.length}return l(n(_,192),...E)}const v=m(b);return v.length===1&&v[0]<128?v:l(n(v.length,128),v)}Fn.encode=e;function t(b,v,E){if(E>b.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return b.slice(v,E)}function r(b){if(b[0]===0)throw new Error("invalid RLP: extra zeros");return d(a(b))}function n(b,v){if(b<56)return Uint8Array.from([b+v]);const E=p(b),_=E.length/2,C=p(v+55+_);return Uint8Array.from(c(C+E))}function s(b,v=!1){if(typeof b>"u"||b===null||b.length===0)return Uint8Array.from([]);const E=m(b),_=i(E);if(v)return _;if(_.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return _.data}Fn.decode=s;function i(b){let v,E,_,C,k;const D=[],w=b[0];if(w<=127)return{data:b.slice(0,1),remainder:b.slice(1)};if(w<=183){if(v=w-127,w===128?_=Uint8Array.from([]):_=t(b,1,v),v===2&&_[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:_,remainder:b.slice(v)}}else if(w<=191){if(E=w-182,b.length-1<E)throw new Error("invalid RLP: not enough bytes for string length");if(v=r(t(b,1,E)),v<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return _=t(b,E,v+E),{data:_,remainder:b.slice(v+E)}}else if(w<=247){for(v=w-191,C=t(b,1,v);C.length;)k=i(C),D.push(k.data),C=k.remainder;return{data:D,remainder:b.slice(v)}}else{if(E=w-246,v=r(t(b,1,E)),v<56)throw new Error("invalid RLP: encoded list too short");const S=E+v;if(S>b.length)throw new Error("invalid RLP: total length is larger than the data");for(C=t(b,E,S);C.length;)k=i(C),D.push(k.data),C=k.remainder;return{data:D,remainder:b.slice(S)}}}const o=Array.from({length:256},(b,v)=>v.toString(16).padStart(2,"0"));function a(b){let v="";for(let E=0;E<b.length;E++)v+=o[b[E]];return v}function d(b){const v=Number.parseInt(b,16);if(Number.isNaN(v))throw new Error("Invalid byte sequence");return v}function c(b){if(typeof b!="string")throw new TypeError("hexToBytes: expected string, got "+typeof b);if(b.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const v=new Uint8Array(b.length/2);for(let E=0;E<v.length;E++){const _=E*2;v[E]=d(b.slice(_,_+2))}return v}function l(...b){if(b.length===1)return b[0];const v=b.reduce((_,C)=>_+C.length,0),E=new Uint8Array(v);for(let _=0,C=0;_<b.length;_++){const k=b[_];E.set(k,C),C+=k.length}return E}function u(b){return new TextEncoder().encode(b)}function p(b){if(b<0)throw new Error("Invalid integer as argument, must be unsigned!");const v=b.toString(16);return v.length%2?`0${v}`:v}function f(b){return b.length%2?`0${b}`:b}function h(b){return b.length>=2&&b[0]==="0"&&b[1]==="x"}function y(b){return typeof b!="string"?b:h(b)?b.slice(2):b}function m(b){if(b instanceof Uint8Array)return b;if(typeof b=="string")return h(b)?c(f(y(b))):u(b);if(typeof b=="number"||typeof b=="bigint")return b?c(p(b)):Uint8Array.from([]);if(b==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof b)}return Fn.utils={bytesToHex:a,concatBytes:l,hexToBytes:c,utf8ToBytes:u},Fn.RLP={encode:e,decode:s},Fn}var Hn={},tr={},Rt={},Xb;function RR(){if(Xb)return Rt;Xb=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.add5L=Rt.add5H=Rt.add4H=Rt.add4L=Rt.add3H=Rt.add3L=Rt.add=Rt.rotlBL=Rt.rotlBH=Rt.rotlSL=Rt.rotlSH=Rt.rotr32L=Rt.rotr32H=Rt.rotrBL=Rt.rotrBH=Rt.rotrSL=Rt.rotrSH=Rt.shrSL=Rt.shrSH=Rt.toBig=Rt.split=Rt.fromBig=void 0;const e=BigInt(2**32-1),t=BigInt(32);function r(S,I=!1){return I?{h:Number(S&e),l:Number(S>>t&e)}:{h:Number(S>>t&e)|0,l:Number(S&e)|0}}Rt.fromBig=r;function n(S,I=!1){let T=new Uint32Array(S.length),g=new Uint32Array(S.length);for(let A=0;A<S.length;A++){const{h:P,l:O}=r(S[A],I);[T[A],g[A]]=[P,O]}return[T,g]}Rt.split=n;const s=(S,I)=>BigInt(S>>>0)<<t|BigInt(I>>>0);Rt.toBig=s;const i=(S,I,T)=>S>>>T;Rt.shrSH=i;const o=(S,I,T)=>S<<32-T|I>>>T;Rt.shrSL=o;const a=(S,I,T)=>S>>>T|I<<32-T;Rt.rotrSH=a;const d=(S,I,T)=>S<<32-T|I>>>T;Rt.rotrSL=d;const c=(S,I,T)=>S<<64-T|I>>>T-32;Rt.rotrBH=c;const l=(S,I,T)=>S>>>T-32|I<<64-T;Rt.rotrBL=l;const u=(S,I)=>I;Rt.rotr32H=u;const p=(S,I)=>S;Rt.rotr32L=p;const f=(S,I,T)=>S<<T|I>>>32-T;Rt.rotlSH=f;const h=(S,I,T)=>I<<T|S>>>32-T;Rt.rotlSL=h;const y=(S,I,T)=>I<<T-32|S>>>64-T;Rt.rotlBH=y;const m=(S,I,T)=>S<<T-32|I>>>64-T;Rt.rotlBL=m;function b(S,I,T,g){const A=(I>>>0)+(g>>>0);return{h:S+T+(A/2**32|0)|0,l:A|0}}Rt.add=b;const v=(S,I,T)=>(S>>>0)+(I>>>0)+(T>>>0);Rt.add3L=v;const E=(S,I,T,g)=>I+T+g+(S/2**32|0)|0;Rt.add3H=E;const _=(S,I,T,g)=>(S>>>0)+(I>>>0)+(T>>>0)+(g>>>0);Rt.add4L=_;const C=(S,I,T,g,A)=>I+T+g+A+(S/2**32|0)|0;Rt.add4H=C;const k=(S,I,T,g,A)=>(S>>>0)+(I>>>0)+(T>>>0)+(g>>>0)+(A>>>0);Rt.add5L=k;const D=(S,I,T,g,A,P)=>I+T+g+A+P+(S/2**32|0)|0;Rt.add5H=D;const w={fromBig:r,split:n,toBig:s,shrSH:i,shrSL:o,rotrSH:a,rotrSL:d,rotrBH:c,rotrBL:l,rotr32H:u,rotr32L:p,rotlSH:f,rotlSL:h,rotlBH:y,rotlBL:m,add:b,add3L:v,add3H:E,add4L:_,add4H:C,add5H:D,add5L:k};return Rt.default=w,Rt}var Qb;function a9(){if(Qb)return tr;Qb=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.shake256=tr.shake128=tr.keccak_512=tr.keccak_384=tr.keccak_256=tr.keccak_224=tr.sha3_512=tr.sha3_384=tr.sha3_256=tr.sha3_224=tr.Keccak=tr.keccakP=void 0;const e=So(),t=RR(),r=ki(),n=[],s=[],i=[],o=BigInt(0),a=BigInt(1),d=BigInt(2),c=BigInt(7),l=BigInt(256),u=BigInt(113);for(let _=0,C=a,k=1,D=0;_<24;_++){[k,D]=[D,(2*k+3*D)%5],n.push(2*(5*D+k)),s.push((_+1)*(_+2)/2%64);let w=o;for(let S=0;S<7;S++)C=(C<<a^(C>>c)*u)%l,C&d&&(w^=a<<(a<<BigInt(S))-a);i.push(w)}const[p,f]=(0,t.split)(i,!0),h=(_,C,k)=>k>32?(0,t.rotlBH)(_,C,k):(0,t.rotlSH)(_,C,k),y=(_,C,k)=>k>32?(0,t.rotlBL)(_,C,k):(0,t.rotlSL)(_,C,k);function m(_,C=24){const k=new Uint32Array(10);for(let D=24-C;D<24;D++){for(let I=0;I<10;I++)k[I]=_[I]^_[I+10]^_[I+20]^_[I+30]^_[I+40];for(let I=0;I<10;I+=2){const T=(I+8)%10,g=(I+2)%10,A=k[g],P=k[g+1],O=h(A,P,1)^k[T],N=y(A,P,1)^k[T+1];for(let M=0;M<50;M+=10)_[I+M]^=O,_[I+M+1]^=N}let w=_[2],S=_[3];for(let I=0;I<24;I++){const T=s[I],g=h(w,S,T),A=y(w,S,T),P=n[I];w=_[P],S=_[P+1],_[P]=g,_[P+1]=A}for(let I=0;I<50;I+=10){for(let T=0;T<10;T++)k[T]=_[I+T];for(let T=0;T<10;T++)_[I+T]^=~k[(T+2)%10]&k[(T+4)%10]}_[0]^=p[D],_[1]^=f[D]}k.fill(0)}tr.keccakP=m;class b extends r.Hash{constructor(C,k,D,w=!1,S=24){if(super(),this.blockLen=C,this.suffix=k,this.outputLen=D,this.enableXOF=w,this.rounds=S,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,e.number)(D),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,r.u32)(this.state)}keccak(){r.isLE||(0,r.byteSwap32)(this.state32),m(this.state32,this.rounds),r.isLE||(0,r.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(C){(0,e.exists)(this);const{blockLen:k,state:D}=this;C=(0,r.toBytes)(C);const w=C.length;for(let S=0;S<w;){const I=Math.min(k-this.pos,w-S);for(let T=0;T<I;T++)D[this.pos++]^=C[S++];this.pos===k&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:C,suffix:k,pos:D,blockLen:w}=this;C[D]^=k,k&128&&D===w-1&&this.keccak(),C[w-1]^=128,this.keccak()}writeInto(C){(0,e.exists)(this,!1),(0,e.bytes)(C),this.finish();const k=this.state,{blockLen:D}=this;for(let w=0,S=C.length;w<S;){this.posOut>=D&&this.keccak();const I=Math.min(D-this.posOut,S-w);C.set(k.subarray(this.posOut,this.posOut+I),w),this.posOut+=I,w+=I}return C}xofInto(C){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(C)}xof(C){return(0,e.number)(C),this.xofInto(new Uint8Array(C))}digestInto(C){if((0,e.output)(C,this),this.finished)throw new Error("digest() was already called");return this.writeInto(C),this.destroy(),C}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(C){const{blockLen:k,suffix:D,outputLen:w,rounds:S,enableXOF:I}=this;return C||(C=new b(k,D,w,I,S)),C.state32.set(this.state32),C.pos=this.pos,C.posOut=this.posOut,C.finished=this.finished,C.rounds=S,C.suffix=D,C.outputLen=w,C.enableXOF=I,C.destroyed=this.destroyed,C}}tr.Keccak=b;const v=(_,C,k)=>(0,r.wrapConstructor)(()=>new b(C,_,k));tr.sha3_224=v(6,144,224/8),tr.sha3_256=v(6,136,256/8),tr.sha3_384=v(6,104,384/8),tr.sha3_512=v(6,72,512/8),tr.keccak_224=v(1,144,224/8),tr.keccak_256=v(1,136,256/8),tr.keccak_384=v(1,104,384/8),tr.keccak_512=v(1,72,512/8);const E=(_,C,k)=>(0,r.wrapXOFConstructorWithOpts)((D={})=>new b(C,_,D.dkLen===void 0?k:D.dkLen,!0));return tr.shake128=E(31,168,128/8),tr.shake256=E(31,136,256/8),tr}var nl={exports:{}};nl.exports;var ev;function o9(){return ev||(ev=1,function(e,t){var r=Tt&&Tt.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=d,t.hexToBytes=c,t.equalsBytes=l,t.wrapHash=u;const n=r(So()),s=ki(),i=n.default.bool;t.assertBool=i;const o=n.default.bytes;t.assertBytes=o;var a=ki();Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return a.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return a.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return a.utf8ToBytes}});function d(p){if(!(p instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof p}`);return new TextDecoder().decode(p)}function c(p){const f=p.startsWith("0x")?p.substring(2):p;return(0,s.hexToBytes)(f)}function l(p,f){if(p.length!==f.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==f[h])return!1;return!0}function u(p){return f=>(n.default.bytes(f),p(f))}t.crypto=(()=>{const p=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,f=typeof uo=="function"&&uo.bind(e);return{node:f&&!p?f("crypto"):void 0,web:p}})()}(nl,nl.exports)),nl.exports}var tv;function c9(){if(tv)return Hn;tv=1,Object.defineProperty(Hn,"__esModule",{value:!0}),Hn.keccak512=Hn.keccak384=Hn.keccak256=Hn.keccak224=void 0;const e=a9(),t=o9();return Hn.keccak224=(0,t.wrapHash)(e.keccak_224),Hn.keccak256=(()=>{const r=(0,t.wrapHash)(e.keccak_256);return r.create=e.keccak_256.create,r})(),Hn.keccak384=(0,t.wrapHash)(e.keccak_384),Hn.keccak512=(0,t.wrapHash)(e.keccak_512),Hn}var R1={},Gn={},pr={},rv;function Jl(){if(rv)return pr;rv=1,Object.defineProperty(pr,"__esModule",{value:!0}),pr.isHexString=pr.getKeys=pr.fromAscii=pr.fromUtf8=pr.toAscii=pr.arrayContainsArray=pr.getBinarySize=pr.padToEven=pr.stripHexPrefix=pr.isHexPrefixed=void 0;function e(l){if(typeof l!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof l}`);return l[0]==="0"&&l[1]==="x"}pr.isHexPrefixed=e;const t=l=>{if(typeof l!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof l}`);return e(l)?l.slice(2):l};pr.stripHexPrefix=t;function r(l){let u=l;if(typeof u!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof u}`);return u.length%2&&(u=`0${u}`),u}pr.padToEven=r;function n(l){if(typeof l!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof l}`);return at.byteLength(l,"utf8")}pr.getBinarySize=n;function s(l,u,p){if(Array.isArray(l)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof l}'`);if(Array.isArray(u)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof u}'`);return u[p===!0?"some":"every"](f=>l.indexOf(f)>=0)}pr.arrayContainsArray=s;function i(l){let u="",p=0;const f=l.length;for(l.substring(0,2)==="0x"&&(p=2);p<f;p+=2){const h=parseInt(l.substr(p,2),16);u+=String.fromCharCode(h)}return u}pr.toAscii=i;function o(l){const u=at.from(l,"utf8");return`0x${r(u.toString("hex")).replace(/^0+|0+$/g,"")}`}pr.fromUtf8=o;function a(l){let u="";for(let p=0;p<l.length;p++){const h=l.charCodeAt(p).toString(16);u+=h.length<2?`0${h}`:h}return`0x${u}`}pr.fromAscii=a;function d(l,u,p){if(!Array.isArray(l))throw new Error(`[getKeys] method expects input 'params' to be an array, got ${typeof l}`);if(typeof u!="string")throw new Error(`[getKeys] method expects input 'key' to be type 'string', got ${typeof l}`);const f=[];for(let h=0;h<l.length;h++){let y=l[h][u];if(p===!0&&!y)y="";else if(typeof y!="string")throw new Error(`invalid abi - expected type 'string', received ${typeof y}`);f.push(y)}return f}pr.getKeys=d;function c(l,u){return!(typeof l!="string"||!l.match(/^0x[0-9A-Fa-f]*$/)||typeof u<"u"&&u>0&&l.length!==2+2*u)}return pr.isHexString=c,pr}var nv;function Z2(){if(nv)return Gn;nv=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.assertIsString=Gn.assertIsArray=Gn.assertIsBuffer=Gn.assertIsHexString=void 0;const e=Jl(),t=function(i){if(!(0,e.isHexString)(i)){const o=`This method only supports 0x-prefixed hex strings but input was: ${i}`;throw new Error(o)}};Gn.assertIsHexString=t;const r=function(i){if(!at.isBuffer(i)){const o=`This method only supports Buffer but input was: ${i}`;throw new Error(o)}};Gn.assertIsBuffer=r;const n=function(i){if(!Array.isArray(i)){const o=`This method only supports number arrays but input was: ${i}`;throw new Error(o)}};Gn.assertIsArray=n;const s=function(i){if(typeof i!="string"){const o=`This method only supports strings but input was: ${i}`;throw new Error(o)}};return Gn.assertIsString=s,Gn}var iv;function Po(){return iv||(iv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=Z2(),r=Jl(),n=function(P){if(!Number.isSafeInteger(P)||P<0)throw new Error(`Received an invalid integer type: ${P}`);return`0x${P.toString(16)}`};e.intToHex=n;const s=function(P){const O=(0,e.intToHex)(P);return at.from((0,r.padToEven)(O.slice(2)),"hex")};e.intToBuffer=s;const i=function(P){return at.allocUnsafe(P).fill(0)};e.zeros=i;const o=function(P,O,N){const M=(0,e.zeros)(O);return N?P.length<O?(P.copy(M),M):P.slice(0,O):P.length<O?(P.copy(M,O-P.length),M):P.slice(-O)},a=function(P,O){return(0,t.assertIsBuffer)(P),o(P,O,!1)};e.setLengthLeft=a;const d=function(P,O){return(0,t.assertIsBuffer)(P),o(P,O,!0)};e.setLengthRight=d;const c=function(P){let O=P[0];for(;P.length>0&&O.toString()==="0";)P=P.slice(1),O=P[0];return P},l=function(P){return(0,t.assertIsBuffer)(P),c(P)};e.unpadBuffer=l;const u=function(P){return(0,t.assertIsArray)(P),c(P)};e.unpadArray=u;const p=function(P){return(0,t.assertIsHexString)(P),P=(0,r.stripHexPrefix)(P),"0x"+c(P)};e.unpadHexString=p;const f=function(P){if(P==null)return at.allocUnsafe(0);if(at.isBuffer(P))return at.from(P);if(Array.isArray(P)||P instanceof Uint8Array)return at.from(P);if(typeof P=="string"){if(!(0,r.isHexString)(P))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${P}`);return at.from((0,r.padToEven)((0,r.stripHexPrefix)(P)),"hex")}if(typeof P=="number")return(0,e.intToBuffer)(P);if(typeof P=="bigint"){if(P<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${P}`);let O=P.toString(16);return O.length%2&&(O="0"+O),at.from(O,"hex")}if(P.toArray)return at.from(P.toArray());if(P.toBuffer)return at.from(P.toBuffer());throw new Error("invalid type")};e.toBuffer=f;const h=function(P){return P=(0,e.toBuffer)(P),"0x"+P.toString("hex")};e.bufferToHex=h;function y(P){const O=(0,e.bufferToHex)(P);return BigInt(O==="0x"?0:O)}e.bufferToBigInt=y;function m(P){return(0,e.toBuffer)("0x"+P.toString(16))}e.bigIntToBuffer=m;const b=function(P){const O=Number(y(P));if(!Number.isSafeInteger(O))throw new Error("Number exceeds 53 bits");return O};e.bufferToInt=b;const v=function(P){return BigInt.asIntN(256,y(P))};e.fromSigned=v;const E=function(P){return m(BigInt.asUintN(256,P))};e.toUnsigned=E;const _=function(P){return typeof P!="string"||(0,r.isHexPrefixed)(P)?P:"0x"+P};e.addHexPrefix=_;function C(P,O=50){const N=at.isBuffer(P)?P.toString("hex"):P;return N.length<=O?N:N.slice(0,O)+"…"}e.short=C;const k=function(P){const O=/^(00)+|(00)+$/g;if(P=(0,r.stripHexPrefix)(P),P.length%2!==0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return at.from(P.replace(O,""),"hex").toString("utf8")};e.toUtf8=k;const D=function(P){if(at.isBuffer(P))return`0x${P.toString("hex")}`;if(P instanceof Array){const O=[];for(let N=0;N<P.length;N++)O.push((0,e.baToJSON)(P[N]));return O}};e.baToJSON=D;const w=function(P){for(const[O,N]of Object.entries(P))if(N!==void 0&&N.length>0&&N[0]===0)throw new Error(`${O} cannot have leading zeroes, received: ${N.toString("hex")}`)};e.validateNoLeadingZeroes=w;function S(P){return Array.isArray(P)?P.map(O=>S(O)):at.from(P)}e.arrToBufArr=S;function I(P){return Array.isArray(P)?P.map(O=>I(O)):Uint8Array.from(P??[])}e.bufArrToArr=I;const T=P=>"0x"+P.toString(16);e.bigIntToHex=T;function g(P){return(0,e.unpadBuffer)(m(P))}e.bigIntToUnpaddedBuffer=g;function A(P){return(0,e.unpadBuffer)((0,e.intToBuffer)(P))}e.intToUnpaddedBuffer=A}(R1)),R1}var sv;function u9(){return sv||(sv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=CR(),r=c9(),n=Y2(),s=o9(),i=Po(),o=J2(),a=Z2(),d=Jl(),c=BigInt(0);class l{constructor(A=c,P=c,O=o.KECCAK256_RLP,N=o.KECCAK256_NULL){this.nonce=A,this.balance=P,this.storageRoot=O,this.codeHash=N,this._validate()}static fromAccountData(A){const{nonce:P,balance:O,storageRoot:N,codeHash:M}=A;return new l(P!==void 0?(0,i.bufferToBigInt)((0,i.toBuffer)(P)):void 0,O!==void 0?(0,i.bufferToBigInt)((0,i.toBuffer)(O)):void 0,N!==void 0?(0,i.toBuffer)(N):void 0,M!==void 0?(0,i.toBuffer)(M):void 0)}static fromRlpSerializedAccount(A){const P=(0,i.arrToBufArr)(t.RLP.decode(Uint8Array.from(A)));if(!Array.isArray(P))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(P)}static fromValuesArray(A){const[P,O,N,M]=A;return new l((0,i.bufferToBigInt)(P),(0,i.bufferToBigInt)(O),N,M)}_validate(){if(this.nonce<c)throw new Error("nonce must be greater than zero");if(this.balance<c)throw new Error("balance must be greater than zero");if(this.storageRoot.length!==32)throw new Error("storageRoot must have a length of 32");if(this.codeHash.length!==32)throw new Error("codeHash must have a length of 32")}raw(){return[(0,i.bigIntToUnpaddedBuffer)(this.nonce),(0,i.bigIntToUnpaddedBuffer)(this.balance),this.storageRoot,this.codeHash]}serialize(){return at.from(t.RLP.encode((0,i.bufArrToArr)(this.raw())))}isContract(){return!this.codeHash.equals(o.KECCAK256_NULL)}isEmpty(){return this.balance===c&&this.nonce===c&&this.codeHash.equals(o.KECCAK256_NULL)}}e.Account=l;const u=function(g){try{(0,a.assertIsString)(g)}catch{return!1}return/^0x[0-9a-fA-F]{40}$/.test(g)};e.isValidAddress=u;const p=function(g,A){(0,a.assertIsHexString)(g);const P=(0,d.stripHexPrefix)(g).toLowerCase();let O="";A!==void 0&&(O=(0,i.bufferToBigInt)((0,i.toBuffer)(A)).toString()+"0x");const N=at.from(O+P,"utf8"),M=(0,s.bytesToHex)((0,r.keccak256)(N));let L="0x";for(let x=0;x<P.length;x++)parseInt(M[x],16)>=8?L+=P[x].toUpperCase():L+=P[x];return L};e.toChecksumAddress=p;const f=function(g,A){return(0,e.isValidAddress)(g)&&(0,e.toChecksumAddress)(g,A)===g};e.isValidChecksumAddress=f;const h=function(g,A){return(0,a.assertIsBuffer)(g),(0,a.assertIsBuffer)(A),(0,i.bufferToBigInt)(A)===BigInt(0)?at.from((0,r.keccak256)(t.RLP.encode((0,i.bufArrToArr)([g,null])))).slice(-20):at.from((0,r.keccak256)(t.RLP.encode((0,i.bufArrToArr)([g,A])))).slice(-20)};e.generateAddress=h;const y=function(g,A,P){if((0,a.assertIsBuffer)(g),(0,a.assertIsBuffer)(A),(0,a.assertIsBuffer)(P),g.length!==20)throw new Error("Expected from to be of length 20");if(A.length!==32)throw new Error("Expected salt to be of length 32");const O=(0,r.keccak256)(at.concat([at.from("ff","hex"),g,A,(0,r.keccak256)(P)]));return(0,i.toBuffer)(O).slice(-20)};e.generateAddress2=y;const m=function(g){return n.secp256k1.utils.isValidPrivateKey(g)};e.isValidPrivate=m;const b=function(g,A=!1){if((0,a.assertIsBuffer)(g),g.length===64)try{return n.secp256k1.ProjectivePoint.fromHex(at.concat([at.from([4]),g])),!0}catch{return!1}if(!A)return!1;try{return n.secp256k1.ProjectivePoint.fromHex(g),!0}catch{return!1}};e.isValidPublic=b;const v=function(g,A=!1){if((0,a.assertIsBuffer)(g),A&&g.length!==64&&(g=at.from(n.secp256k1.ProjectivePoint.fromHex(g).toRawBytes(!1).slice(1))),g.length!==64)throw new Error("Expected pubKey to be of length 64");return at.from((0,r.keccak256)(g)).slice(-20)};e.pubToAddress=v,e.publicToAddress=e.pubToAddress;const E=function(g){return(0,a.assertIsBuffer)(g),at.from(n.secp256k1.ProjectivePoint.fromPrivateKey(g).toRawBytes(!1).slice(1))};e.privateToPublic=E;const _=function(g){return(0,e.publicToAddress)((0,e.privateToPublic)(g))};e.privateToAddress=_;const C=function(g){return(0,a.assertIsBuffer)(g),g.length!==64&&(g=at.from(n.secp256k1.ProjectivePoint.fromHex(g).toRawBytes(!1).slice(1))),g};e.importPublic=C;const k=function(){const A=(0,i.zeros)(20);return(0,i.bufferToHex)(A)};e.zeroAddress=k;const D=function(g){try{(0,a.assertIsString)(g)}catch{return!1}return(0,e.zeroAddress)()===g};e.isZeroAddress=D;function w(g){const[A,P,O,N]=g;return[A,P,(0,i.arrToBufArr)(O).length===0?o.KECCAK256_RLP:O,(0,i.arrToBufArr)(N).length===0?o.KECCAK256_NULL:N]}e.accountBodyFromSlim=w;const S=new Uint8Array(0);function I(g){const[A,P,O,N]=g;return[A,P,(0,i.arrToBufArr)(O).equals(o.KECCAK256_RLP)?S:O,(0,i.arrToBufArr)(N).equals(o.KECCAK256_NULL)?S:N]}e.accountBodyToSlim=I;function T(g,A=!0){const P=A?w(g):g;return(0,i.arrToBufArr)(t.RLP.encode(P))}e.accountBodyToRLP=T}(C1)),C1}var Yo={},av;function l9(){if(av)return Yo;av=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.Address=void 0;const e=u9(),t=Po();class r{constructor(s){if(s.length!==20)throw new Error("Invalid address length");this.buf=s}static zero(){return new r((0,t.zeros)(20))}static fromString(s){if(!(0,e.isValidAddress)(s))throw new Error("Invalid address");return new r((0,t.toBuffer)(s))}static fromPublicKey(s){if(!at.isBuffer(s))throw new Error("Public key should be Buffer");const i=(0,e.pubToAddress)(s);return new r(i)}static fromPrivateKey(s){if(!at.isBuffer(s))throw new Error("Private key should be Buffer");const i=(0,e.privateToAddress)(s);return new r(i)}static generate(s,i){if(typeof i!="bigint")throw new Error("Expected nonce to be a bigint");return new r((0,e.generateAddress)(s.buf,(0,t.bigIntToBuffer)(i)))}static generate2(s,i,o){if(!at.isBuffer(i))throw new Error("Expected salt to be a Buffer");if(!at.isBuffer(o))throw new Error("Expected initCode to be a Buffer");return new r((0,e.generateAddress2)(s.buf,i,o))}equals(s){return this.buf.equals(s.buf)}isZero(){return this.equals(r.zero())}isPrecompileOrSystemAddress(){const s=(0,t.bufferToBigInt)(this.buf),i=BigInt(0),o=BigInt("0xffff");return s>=i&&s<=o}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return at.from(this.buf)}}return Yo.Address=r,Yo}var Jo={},k1={},ov;function d9(){return ov||(ov=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=Po(),r=Jl();var n;(function(i){i[i.Number=0]="Number",i[i.BigInt=1]="BigInt",i[i.Buffer=2]="Buffer",i[i.PrefixedHexString=3]="PrefixedHexString"})(n=e.TypeOutput||(e.TypeOutput={}));function s(i,o){if(i===null)return null;if(i===void 0)return;if(typeof i=="string"&&!(0,r.isHexString)(i))throw new Error(`A string must be provided with a 0x-prefix, given: ${i}`);if(typeof i=="number"&&!Number.isSafeInteger(i))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const a=(0,t.toBuffer)(i);switch(o){case n.Buffer:return a;case n.BigInt:return(0,t.bufferToBigInt)(a);case n.Number:{const d=(0,t.bufferToBigInt)(a);if(d>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(d)}case n.PrefixedHexString:return(0,t.bufferToHex)(a);default:throw new Error("unknown outputType")}}e.toType=s}(k1)),k1}var cv;function kR(){if(cv)return Jo;cv=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.Withdrawal=void 0;const e=l9(),t=Po(),r=d9();class n{constructor(i,o,a,d){this.index=i,this.validatorIndex=o,this.address=a,this.amount=d}static fromWithdrawalData(i){const{index:o,validatorIndex:a,address:d,amount:c}=i,l=(0,r.toType)(o,r.TypeOutput.BigInt),u=(0,r.toType)(a,r.TypeOutput.BigInt),p=new e.Address((0,r.toType)(d,r.TypeOutput.Buffer)),f=(0,r.toType)(c,r.TypeOutput.BigInt);return new n(l,u,p,f)}static fromValuesArray(i){if(i.length!==4)throw Error(`Invalid withdrawalArray length expected=4 actual=${i.length}`);const[o,a,d,c]=i;return n.fromWithdrawalData({index:o,validatorIndex:a,address:d,amount:c})}static toBufferArray(i){const{index:o,validatorIndex:a,address:d,amount:c}=i,l=(0,r.toType)(o,r.TypeOutput.BigInt)===BigInt(0)?at.alloc(0):(0,r.toType)(o,r.TypeOutput.Buffer),u=(0,r.toType)(a,r.TypeOutput.BigInt)===BigInt(0)?at.alloc(0):(0,r.toType)(a,r.TypeOutput.Buffer);let p;d instanceof e.Address?p=d.buf:p=(0,r.toType)(d,r.TypeOutput.Buffer);const f=(0,r.toType)(c,r.TypeOutput.BigInt)===BigInt(0)?at.alloc(0):(0,r.toType)(c,r.TypeOutput.Buffer);return[l,u,p,f]}raw(){return n.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,t.bigIntToHex)(this.index),validatorIndex:(0,t.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,t.bigIntToHex)(this.amount)}}}return Jo.Withdrawal=n,Jo}var Lr={},uv;function MR(){if(uv)return Lr;uv=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.hashPersonalMessage=Lr.isValidSignature=Lr.fromRpcSig=Lr.toCompactSig=Lr.toRpcSig=Lr.ecrecover=Lr.ecsign=void 0;const e=c9(),t=Y2(),r=Po(),n=J2(),s=Z2();function i(h,y,m){const b=t.secp256k1.sign(h,y),v=b.toCompactRawBytes(),E=at.from(v.slice(0,32)),_=at.from(v.slice(32,64)),C=m===void 0?BigInt(b.recovery+27):BigInt(b.recovery+35)+BigInt(m)*BigInt(2);return{r:E,s:_,v:C}}Lr.ecsign=i;function o(h,y){return h===BigInt(0)||h===BigInt(1)?h:y===void 0?h-BigInt(27):h-(y*BigInt(2)+BigInt(35))}function a(h){return h===BigInt(0)||h===BigInt(1)}const d=function(h,y,m,b,v){const E=at.concat([(0,r.setLengthLeft)(m,32),(0,r.setLengthLeft)(b,32)],64),_=o(y,v);if(!a(_))throw new Error("Invalid signature v value");const k=t.secp256k1.Signature.fromCompact(E).addRecoveryBit(Number(_)).recoverPublicKey(h);return at.from(k.toRawBytes(!1).slice(1))};Lr.ecrecover=d;const c=function(h,y,m,b){const v=o(h,b);if(!a(v))throw new Error("Invalid signature v value");return(0,r.bufferToHex)(at.concat([(0,r.setLengthLeft)(y,32),(0,r.setLengthLeft)(m,32),(0,r.toBuffer)(h)]))};Lr.toRpcSig=c;const l=function(h,y,m,b){const v=o(h,b);if(!a(v))throw new Error("Invalid signature v value");let E=m;return(h>BigInt(28)&&h%BigInt(2)===BigInt(1)||h===BigInt(1)||h===BigInt(28))&&(E=at.from(m),E[0]|=128),(0,r.bufferToHex)(at.concat([(0,r.setLengthLeft)(y,32),(0,r.setLengthLeft)(E,32)]))};Lr.toCompactSig=l;const u=function(h){const y=(0,r.toBuffer)(h);let m,b,v;if(y.length>=65)m=y.slice(0,32),b=y.slice(32,64),v=(0,r.bufferToBigInt)(y.slice(64));else if(y.length===64)m=y.slice(0,32),b=y.slice(32,64),v=BigInt((0,r.bufferToInt)(y.slice(32,33))>>7),b[0]&=127;else throw new Error("Invalid signature length");return v<27&&(v=v+BigInt(27)),{v,r:m,s:b}};Lr.fromRpcSig=u;const p=function(h,y,m,b=!0,v){if(y.length!==32||m.length!==32||!a(o(h,v)))return!1;const E=(0,r.bufferToBigInt)(y),_=(0,r.bufferToBigInt)(m);return!(E===BigInt(0)||E>=n.SECP256K1_ORDER||_===BigInt(0)||_>=n.SECP256K1_ORDER||b&&_>=n.SECP256K1_ORDER_DIV_2)};Lr.isValidSignature=p;const f=function(h){(0,s.assertIsBuffer)(h);const y=at.from(`Ethereum Signed Message:
|
|
54
|
-
${h.length}`,"utf-8");return at.from((0,e.keccak256)(at.concat([y,h])))};return Lr.hashPersonalMessage=f,Lr}var M1={},lv;function OR(){return lv||(lv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;const t=o=>o.length>0&&o[o.length-1]===16;e.hasTerminator=t;const r=(o,a)=>{for(let d=0,c=0;c<o.length;d+=1,c+=2)a[d]=o[c]<<4|o[c+1]};e.nibblesToBytes=r;const n=o=>{let a=0;(0,e.hasTerminator)(o)&&(a=1,o=o.subarray(0,o.length-1));const d=new Uint8Array(o.length/2+1);return d[0]=a<<5,(o.length&1)===1&&(d[0]|=16,d[0]|=o[0],o=o.subarray(1)),(0,e.nibblesToBytes)(o,d.subarray(1)),d};e.nibblesToCompactBytes=n;const s=o=>{const a=o.length*2+1,d=new Uint8Array(a);for(let c=0;c<o.length;c++){const l=o[c];d[c*2]=l/16,d[c*2+1]=l%16}return d[a-1]=16,d};e.bytesToNibbles=s;const i=o=>{if(o.length===0)return o;let a=(0,e.bytesToNibbles)(o);a[0]<2&&(a=a.subarray(0,a.length-1));const d=2-(a[0]&1);return a.subarray(d)};e.compactBytesToNibbles=i}(M1)),M1}var Zo={},dv;function NR(){if(dv)return Zo;dv=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.AsyncEventEmitter=void 0;const e=c8;async function t(n,s,i){let o;for await(const a of s)try{a.length<2?a.call(n,i):await new Promise((d,c)=>{a.call(n,i,l=>{l?c(l):d()})})}catch(d){o=d}if(o)throw o}class r extends e.EventEmitter{emit(s,...i){let[o,a]=i;const d=this;let c=d._events[s]??[];return a===void 0&&typeof o=="function"&&(a=o,o=void 0),(s==="newListener"||s==="removeListener")&&(o={event:o,fn:a},a=void 0),c=Array.isArray(c)?c:[c],t(d,c.slice(),o).then(a).catch(a),d.listenerCount(s)>0}once(s,i){const o=this;let a;if(typeof i!="function")throw new TypeError("listener must be a function");return i.length>=2?a=function(d,c){o.removeListener(s,a),i(d,c)}:a=function(d){o.removeListener(s,a),i(d,a)},o.on(s,a),o}first(s,i){let o=this._events[s]??[];if(typeof i!="function")throw new TypeError("listener must be a function");return Array.isArray(o)||(this._events[s]=o=[o]),o.unshift(i),this}before(s,i,o){return this.beforeOrAfter(s,i,o)}after(s,i,o){return this.beforeOrAfter(s,i,o,"after")}beforeOrAfter(s,i,o,a){let d=this._events[s]??[],c,l;const u=a==="after"?1:0;if(typeof o!="function")throw new TypeError("listener must be a function");if(typeof i!="function")throw new TypeError("target must be a function");for(Array.isArray(d)||(this._events[s]=d=[d]),l=d.length,c=d.length;c--;)if(d[c]===i){l=c+u;break}return d.splice(l,0,o),this}on(s,i){return super.on(s,i)}addListener(s,i){return super.addListener(s,i)}prependListener(s,i){return super.prependListener(s,i)}prependOnceListener(s,i){return super.prependOnceListener(s,i)}removeAllListeners(s){return super.removeAllListeners(s)}removeListener(s,i){return super.removeListener(s,i)}eventNames(){return super.eventNames()}listeners(s){return super.listeners(s)}listenerCount(s){return super.listenerCount(s)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(s){return super.setMaxListeners(s)}}return Zo.AsyncEventEmitter=r,Zo}var Xo={},fv;function DR(){if(fv)return Xo;fv=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.Lock=void 0;class e{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise(r=>this.promiseResolverQueue.push(r))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(this.permits===1&&this.promiseResolverQueue.length>0){this.permits-=1;const r=this.promiseResolverQueue.shift();r&&r(!0)}}}return Xo.Lock=e,Xo}var ta={},fs={},O1={},N1={},D1,hv;function xR(){if(hv)return D1;hv=1;const e=(function*(){}).constructor;return D1=()=>e,D1}var x1,pv;function UR(){if(pv)return x1;pv=1;var e=UA,t=GA(),r=t(/^\s*(?:function)?\*/),n=WA(),s=BA,i=e("Object.prototype.toString"),o=e("Function.prototype.toString"),a=xR();return x1=function(c){if(typeof c!="function")return!1;if(r(o(c)))return!0;if(!n){var l=i(c);return l==="[object GeneratorFunction]"}if(!s)return!1;var u=a();return u&&s(c)===u.prototype},x1}var yv;function BR(){return yv||(yv=1,function(e){var t=zA,r=UR(),n=YA,s=jA();function i(ne){return ne.call.bind(ne)}var o=typeof BigInt<"u",a=typeof Symbol<"u",d=i(Object.prototype.toString),c=i(Number.prototype.valueOf),l=i(String.prototype.valueOf),u=i(Boolean.prototype.valueOf);if(o)var p=i(BigInt.prototype.valueOf);if(a)var f=i(Symbol.prototype.valueOf);function h(ne,je){if(typeof ne!="object")return!1;try{return je(ne),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=s;function y(ne){return typeof Promise<"u"&&ne instanceof Promise||ne!==null&&typeof ne=="object"&&typeof ne.then=="function"&&typeof ne.catch=="function"}e.isPromise=y;function m(ne){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(ne):s(ne)||J(ne)}e.isArrayBufferView=m;function b(ne){return n(ne)==="Uint8Array"}e.isUint8Array=b;function v(ne){return n(ne)==="Uint8ClampedArray"}e.isUint8ClampedArray=v;function E(ne){return n(ne)==="Uint16Array"}e.isUint16Array=E;function _(ne){return n(ne)==="Uint32Array"}e.isUint32Array=_;function C(ne){return n(ne)==="Int8Array"}e.isInt8Array=C;function k(ne){return n(ne)==="Int16Array"}e.isInt16Array=k;function D(ne){return n(ne)==="Int32Array"}e.isInt32Array=D;function w(ne){return n(ne)==="Float32Array"}e.isFloat32Array=w;function S(ne){return n(ne)==="Float64Array"}e.isFloat64Array=S;function I(ne){return n(ne)==="BigInt64Array"}e.isBigInt64Array=I;function T(ne){return n(ne)==="BigUint64Array"}e.isBigUint64Array=T;function g(ne){return d(ne)==="[object Map]"}g.working=typeof Map<"u"&&g(new Map);function A(ne){return typeof Map>"u"?!1:g.working?g(ne):ne instanceof Map}e.isMap=A;function P(ne){return d(ne)==="[object Set]"}P.working=typeof Set<"u"&&P(new Set);function O(ne){return typeof Set>"u"?!1:P.working?P(ne):ne instanceof Set}e.isSet=O;function N(ne){return d(ne)==="[object WeakMap]"}N.working=typeof WeakMap<"u"&&N(new WeakMap);function M(ne){return typeof WeakMap>"u"?!1:N.working?N(ne):ne instanceof WeakMap}e.isWeakMap=M;function L(ne){return d(ne)==="[object WeakSet]"}L.working=typeof WeakSet<"u"&&L(new WeakSet);function x(ne){return L(ne)}e.isWeakSet=x;function R(ne){return d(ne)==="[object ArrayBuffer]"}R.working=typeof ArrayBuffer<"u"&&R(new ArrayBuffer);function K(ne){return typeof ArrayBuffer>"u"?!1:R.working?R(ne):ne instanceof ArrayBuffer}e.isArrayBuffer=K;function V(ne){return d(ne)==="[object DataView]"}V.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&V(new DataView(new ArrayBuffer(1),0,1));function J(ne){return typeof DataView>"u"?!1:V.working?V(ne):ne instanceof DataView}e.isDataView=J;var se=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function j(ne){return d(ne)==="[object SharedArrayBuffer]"}function re(ne){return typeof se>"u"?!1:(typeof j.working>"u"&&(j.working=j(new se)),j.working?j(ne):ne instanceof se)}e.isSharedArrayBuffer=re;function G(ne){return d(ne)==="[object AsyncFunction]"}e.isAsyncFunction=G;function B(ne){return d(ne)==="[object Map Iterator]"}e.isMapIterator=B;function X(ne){return d(ne)==="[object Set Iterator]"}e.isSetIterator=X;function ge(ne){return d(ne)==="[object Generator]"}e.isGeneratorObject=ge;function _e(ne){return d(ne)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=_e;function Se(ne){return h(ne,c)}e.isNumberObject=Se;function F(ne){return h(ne,l)}e.isStringObject=F;function q(ne){return h(ne,u)}e.isBooleanObject=q;function z(ne){return o&&h(ne,p)}e.isBigIntObject=z;function ee(ne){return a&&h(ne,f)}e.isSymbolObject=ee;function le(ne){return Se(ne)||F(ne)||q(ne)||z(ne)||ee(ne)}e.isBoxedPrimitive=le;function ce(ne){return typeof Uint8Array<"u"&&(K(ne)||re(ne))}e.isAnyArrayBuffer=ce,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(ne){Object.defineProperty(e,ne,{enumerable:!1,value:function(){throw new Error(ne+" is not supported in userland")}})})}(N1)),N1}var U1,gv;function LR(){return gv||(gv=1,U1=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}),U1}var mv;function KR(){return mv||(mv=1,function(e){var t=Object.getOwnPropertyDescriptors||function(J){for(var se=Object.keys(J),j={},re=0;re<se.length;re++)j[se[re]]=Object.getOwnPropertyDescriptor(J,se[re]);return j},r=/%[sdj%]/g;e.format=function(V){if(!C(V)){for(var J=[],se=0;se<arguments.length;se++)J.push(o(arguments[se]));return J.join(" ")}for(var se=1,j=arguments,re=j.length,G=String(V).replace(r,function(X){if(X==="%%")return"%";if(se>=re)return X;switch(X){case"%s":return String(j[se++]);case"%d":return Number(j[se++]);case"%j":try{return JSON.stringify(j[se++])}catch{return"[Circular]"}default:return X}}),B=j[se];se<re;B=j[++se])v(B)||!S(B)?G+=" "+B:G+=" "+o(B);return G},e.deprecate=function(V,J){if(typeof Mr<"u"&&Mr.noDeprecation===!0)return V;if(typeof Mr>"u")return function(){return e.deprecate(V,J).apply(this,arguments)};var se=!1;function j(){if(!se){if(Mr.throwDeprecation)throw new Error(J);Mr.traceDeprecation?console.trace(J):console.error(J),se=!0}return V.apply(this,arguments)}return j};var n={},s=/^$/;if({}.NODE_DEBUG){var i={}.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+i+"$","i")}e.debuglog=function(V){if(V=V.toUpperCase(),!n[V])if(s.test(V)){var J=Mr.pid;n[V]=function(){var se=e.format.apply(e,arguments);console.error("%s %d: %s",V,J,se)}}else n[V]=function(){};return n[V]};function o(V,J){var se={seen:[],stylize:d};return arguments.length>=3&&(se.depth=arguments[2]),arguments.length>=4&&(se.colors=arguments[3]),b(J)?se.showHidden=J:J&&e._extend(se,J),D(se.showHidden)&&(se.showHidden=!1),D(se.depth)&&(se.depth=2),D(se.colors)&&(se.colors=!1),D(se.customInspect)&&(se.customInspect=!0),se.colors&&(se.stylize=a),l(se,V,se.depth)}e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(V,J){var se=o.styles[J];return se?"\x1B["+o.colors[se][0]+"m"+V+"\x1B["+o.colors[se][1]+"m":V}function d(V,J){return V}function c(V){var J={};return V.forEach(function(se,j){J[se]=!0}),J}function l(V,J,se){if(V.customInspect&&J&&g(J.inspect)&&J.inspect!==e.inspect&&!(J.constructor&&J.constructor.prototype===J)){var j=J.inspect(se,V);return C(j)||(j=l(V,j,se)),j}var re=u(V,J);if(re)return re;var G=Object.keys(J),B=c(G);if(V.showHidden&&(G=Object.getOwnPropertyNames(J)),T(J)&&(G.indexOf("message")>=0||G.indexOf("description")>=0))return p(J);if(G.length===0){if(g(J)){var X=J.name?": "+J.name:"";return V.stylize("[Function"+X+"]","special")}if(w(J))return V.stylize(RegExp.prototype.toString.call(J),"regexp");if(I(J))return V.stylize(Date.prototype.toString.call(J),"date");if(T(J))return p(J)}var ge="",_e=!1,Se=["{","}"];if(m(J)&&(_e=!0,Se=["[","]"]),g(J)){var F=J.name?": "+J.name:"";ge=" [Function"+F+"]"}if(w(J)&&(ge=" "+RegExp.prototype.toString.call(J)),I(J)&&(ge=" "+Date.prototype.toUTCString.call(J)),T(J)&&(ge=" "+p(J)),G.length===0&&(!_e||J.length==0))return Se[0]+ge+Se[1];if(se<0)return w(J)?V.stylize(RegExp.prototype.toString.call(J),"regexp"):V.stylize("[Object]","special");V.seen.push(J);var q;return _e?q=f(V,J,se,B,G):q=G.map(function(z){return h(V,J,se,B,z,_e)}),V.seen.pop(),y(q,ge,Se)}function u(V,J){if(D(J))return V.stylize("undefined","undefined");if(C(J)){var se="'"+JSON.stringify(J).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return V.stylize(se,"string")}if(_(J))return V.stylize(""+J,"number");if(b(J))return V.stylize(""+J,"boolean");if(v(J))return V.stylize("null","null")}function p(V){return"["+Error.prototype.toString.call(V)+"]"}function f(V,J,se,j,re){for(var G=[],B=0,X=J.length;B<X;++B)L(J,String(B))?G.push(h(V,J,se,j,String(B),!0)):G.push("");return re.forEach(function(ge){ge.match(/^\d+$/)||G.push(h(V,J,se,j,ge,!0))}),G}function h(V,J,se,j,re,G){var B,X,ge;if(ge=Object.getOwnPropertyDescriptor(J,re)||{value:J[re]},ge.get?ge.set?X=V.stylize("[Getter/Setter]","special"):X=V.stylize("[Getter]","special"):ge.set&&(X=V.stylize("[Setter]","special")),L(j,re)||(B="["+re+"]"),X||(V.seen.indexOf(ge.value)<0?(v(se)?X=l(V,ge.value,null):X=l(V,ge.value,se-1),X.indexOf(`
|
|
55
|
-
`)>-1&&(G?X=X.split(`
|
|
56
|
-
`).map(function(_e){return" "+_e}).join(`
|
|
57
|
-
`).slice(2):X=`
|
|
58
|
-
`+X.split(`
|
|
59
|
-
`).map(function(_e){return" "+_e}).join(`
|
|
60
|
-
`))):X=V.stylize("[Circular]","special")),D(B)){if(G&&re.match(/^\d+$/))return X;B=JSON.stringify(""+re),B.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(B=B.slice(1,-1),B=V.stylize(B,"name")):(B=B.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),B=V.stylize(B,"string"))}return B+": "+X}function y(V,J,se){var j=V.reduce(function(re,G){return G.indexOf(`
|
|
61
|
-
`)>=0,re+G.replace(/\u001b\[\d\d?m/g,"").length+1},0);return j>60?se[0]+(J===""?"":J+`
|
|
62
|
-
`)+" "+V.join(`,
|
|
63
|
-
`)+" "+se[1]:se[0]+J+" "+V.join(", ")+" "+se[1]}e.types=BR();function m(V){return Array.isArray(V)}e.isArray=m;function b(V){return typeof V=="boolean"}e.isBoolean=b;function v(V){return V===null}e.isNull=v;function E(V){return V==null}e.isNullOrUndefined=E;function _(V){return typeof V=="number"}e.isNumber=_;function C(V){return typeof V=="string"}e.isString=C;function k(V){return typeof V=="symbol"}e.isSymbol=k;function D(V){return V===void 0}e.isUndefined=D;function w(V){return S(V)&&P(V)==="[object RegExp]"}e.isRegExp=w,e.types.isRegExp=w;function S(V){return typeof V=="object"&&V!==null}e.isObject=S;function I(V){return S(V)&&P(V)==="[object Date]"}e.isDate=I,e.types.isDate=I;function T(V){return S(V)&&(P(V)==="[object Error]"||V instanceof Error)}e.isError=T,e.types.isNativeError=T;function g(V){return typeof V=="function"}e.isFunction=g;function A(V){return V===null||typeof V=="boolean"||typeof V=="number"||typeof V=="string"||typeof V=="symbol"||typeof V>"u"}e.isPrimitive=A,e.isBuffer=LR();function P(V){return Object.prototype.toString.call(V)}function O(V){return V<10?"0"+V.toString(10):V.toString(10)}var N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var V=new Date,J=[O(V.getHours()),O(V.getMinutes()),O(V.getSeconds())].join(":");return[V.getDate(),N[V.getMonth()],J].join(" ")}e.log=function(){console.log("%s - %s",M(),e.format.apply(e,arguments))},e.inherits=LA,e._extend=function(V,J){if(!J||!S(J))return V;for(var se=Object.keys(J),j=se.length;j--;)V[se[j]]=J[se[j]];return V};function L(V,J){return Object.prototype.hasOwnProperty.call(V,J)}var x=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(J){if(typeof J!="function")throw new TypeError('The "original" argument must be of type Function');if(x&&J[x]){var se=J[x];if(typeof se!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(se,x,{value:se,enumerable:!1,writable:!1,configurable:!0}),se}function se(){for(var j,re,G=new Promise(function(ge,_e){j=ge,re=_e}),B=[],X=0;X<arguments.length;X++)B.push(arguments[X]);B.push(function(ge,_e){ge?re(ge):j(_e)});try{J.apply(this,B)}catch(ge){re(ge)}return G}return Object.setPrototypeOf(se,Object.getPrototypeOf(J)),x&&Object.defineProperty(se,x,{value:se,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(se,t(J))},e.promisify.custom=x;function R(V,J){if(!V){var se=new Error("Promise was rejected with a falsy value");se.reason=V,V=se}return J(V)}function K(V){if(typeof V!="function")throw new TypeError('The "original" argument must be of type Function');function J(){for(var se=[],j=0;j<arguments.length;j++)se.push(arguments[j]);var re=se.pop();if(typeof re!="function")throw new TypeError("The last argument must be of type Function");var G=this,B=function(){return re.apply(G,arguments)};V.apply(this,se).then(function(X){Mr.nextTick(B.bind(null,null,X))},function(X){Mr.nextTick(R.bind(null,X,B))})}return Object.setPrototypeOf(J,Object.getPrototypeOf(V)),Object.defineProperties(J,t(V)),J}e.callbackify=K}(O1)),O1}var bv;function qR(){if(bv)return fs;bv=1,Object.defineProperty(fs,"__esModule",{value:!0}),fs.InvalidStatusCodeError=fs.InvalidCertError=void 0;const e=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class t extends Error{constructor(p,f){super(p),this.fingerprint256=f}}fs.InvalidCertError=t;class r extends Error{constructor(p){super(`Request Failed. Status Code: ${p}`),this.statusCode=p}}fs.InvalidStatusCodeError=r;function n(u,p){if(!p||p==="text"||p==="json")try{let f=new TextDecoder("utf8",{fatal:!0}).decode(u);if(p==="text")return f;try{return JSON.parse(f)}catch(h){if(p==="json")throw h;return f}}catch(f){if(p==="text"||p==="json")throw f}return u}let s={};function i(u,p){var D;let f={...e,...p};const h=ro,y=ro,m=ro,{promisify:b}=KR(),{resolve:v}=KA,E=!!/^https/.test(u);let _={method:f.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const C=w=>w.replace(/:| /g,"").toLowerCase();if(f.keepAlive){const w={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},S=[E,E&&((D=f.sslPinnedCertificates)==null?void 0:D.map(I=>C(I)).sort())].join();_.agent=s[S]||(s[S]=new(E?y:h).Agent(w))}f.type==="json"&&(_.headers["Content-Type"]="application/json"),f.data&&(f.method||(_.method="POST"),_.body=f.type==="json"?JSON.stringify(f.data):f.data),_.headers={..._.headers,...f.headers},f.sslAllowSelfSigned&&(_.rejectUnauthorized=!1);const k=async w=>{const S=w.statusCode;if(f.redirect&&300<=S&&S<400&&w.headers.location){if(f._redirectCount==10)throw new Error("Request failed. Too much redirects.");return f._redirectCount+=1,await i(v(u,w.headers.location),f)}if(f.expectStatusCode&&S!==f.expectStatusCode)throw w.resume(),new r(S);let I=[];for await(const P of w)I.push(P);let T=at.concat(I);const g=w.headers["content-encoding"];g==="br"&&(T=await b(m.brotliDecompress)(T)),(g==="gzip"||g==="deflate")&&(T=await b(m.unzip)(T));const A=n(T,f.type);return f.full?{headers:w.headers,status:S,body:A}:A};return new Promise((w,S)=>{var P;const I=async O=>{if(O&&O.code==="DEPTH_ZERO_SELF_SIGNED_CERT")try{await i(u,{...f,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(N){N&&N.fingerprint256&&(O=new t(`Self-signed SSL certificate: ${N.fingerprint256}`,N.fingerprint256))}S(O)},T=(E?y:h).request(u,_,O=>{O.on("error",I),(async()=>{try{w(await k(O))}catch(N){S(N)}})()});T.on("error",I);const g=(P=f.sslPinnedCertificates)==null?void 0:P.map(O=>C(O)),A=O=>{var M;const N=C(((M=O.getPeerCertificate())==null?void 0:M.fingerprint256)||"");if(!(!N&&O.isSessionReused())&&!g.includes(N))return T.emit("error",new t(`Invalid SSL certificate: ${N} Expected: ${g}`,N)),T.abort()};f.sslPinnedCertificates&&T.on("socket",O=>{O.listeners("secureConnect").map(M=>(M.name||"").replace("bound ","")).includes("mfetchSecureConnect")||O.on("secureConnect",A.bind(null,O))}),f.keepAlive&&T.setNoDelay(!0),_.body&&T.write(_.body),T.end()})}const o=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(u=>u.toLowerCase())),a=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map(u=>u.toLowerCase()));async function d(u,p){let f={...e,...p};const h=new Headers;f.type==="json"&&h.set("Content-Type","application/json");let y=new URL(u);if(y.username){const E=btoa(`${y.username}:${y.password}`);h.set("Authorization",`Basic ${E}`),y.username="",y.password=""}u=""+y;for(let E in f.headers){const _=E.toLowerCase();(o.has(_)||f.cors&&!a.has(_))&&h.set(E,f.headers[E])}let m={headers:h,redirect:f.redirect?"follow":"manual"};f.referrer||(m.referrerPolicy="no-referrer"),f.cors&&(m.mode="cors"),f.data&&(f.method||(m.method="POST"),m.body=f.type==="json"?JSON.stringify(f.data):f.data);const b=await fetch(u,m);if(f.expectStatusCode&&b.status!==f.expectStatusCode)throw new r(b.status);const v=n(new Uint8Array(await b.arrayBuffer()),f.type);return f.full?{headers:Object.fromEntries(b.headers.entries()),status:b.status,body:v}:v}const c=!!(typeof Mr=="object"&&Mr.versions&&Mr.versions.node&&Mr.versions.v8);function l(u,p){return(c?i:d)(u,p)}return fs.default=l,fs}var vv;function jR(){if(vv)return ta;vv=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.getProvider=ta.fetchFromProvider=void 0;const e=qR(),t=async(n,s)=>(await(0,e.default)(n,{headers:{"content-type":"application/json"},type:"json",data:{method:s.method,params:s.params,jsonrpc:"2.0",id:1}})).result;ta.fetchFromProvider=t;const r=n=>{var s;if(typeof n=="string")return n;if(((s=n==null?void 0:n.connection)==null?void 0:s.url)!==void 0)return n.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")};return ta.getProvider=r,ta}var _v;function Dh(){return _v||(_v=1,function(e){var t=Tt&&Tt.__createBinding||(Object.create?function(s,i,o,a){a===void 0&&(a=o);var d=Object.getOwnPropertyDescriptor(i,o);(!d||("get"in d?!i.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(s,a,d)}:function(s,i,o,a){a===void 0&&(a=o),s[a]=i[o]}),r=Tt&&Tt.__exportStar||function(s,i){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(J2(),e),r(IR(),e),r(u9(),e),r(l9(),e),r(kR(),e),r(MR(),e),r(Po(),e),r(d9(),e),r(OR(),e),r(NR(),e);var n=Jl();Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return n.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return n.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return n.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return n.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return n.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return n.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return n.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return n.toAscii}}),r(DR(),e),r(jR(),e)}(w1)),w1}var Kr={},B1,wv;function f9(){return wv||(wv=1,B1=function(t){if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return t.slice(0,2)==="0x"}),B1}var L1,Ev;function $R(){if(Ev)return L1;Ev=1;var e=f9();return L1=function(r){return typeof r!="string"?r:e(r)?r.slice(2):r},L1}var K1,Av;function X2(){if(Av)return K1;Av=1;var e=f9(),t=$R();function r(f){var h=f;if(typeof h!="string")throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof h+", while padToEven.");return h.length%2&&(h="0"+h),h}function n(f){var h=f.toString(16);return"0x"+h}function s(f){var h=n(f);return new at(r(h.slice(2)),"hex")}function i(f){if(typeof f!="string")throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof f+"'.");return at.byteLength(f,"utf8")}function o(f,h,y){if(Array.isArray(f)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof f+"'");if(Array.isArray(h)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof h+"'");return h[!!y&&"some"||"every"](function(m){return f.indexOf(m)>=0})}function a(f){var h=new at(r(t(f).replace(/^0+|0+$/g,"")),"hex");return h.toString("utf8")}function d(f){var h="",y=0,m=f.length;for(f.substring(0,2)==="0x"&&(y=2);y<m;y+=2){var b=parseInt(f.substr(y,2),16);h+=String.fromCharCode(b)}return h}function c(f){var h=new at(f,"utf8");return"0x"+r(h.toString("hex")).replace(/^0+|0+$/g,"")}function l(f){for(var h="",y=0;y<f.length;y++){var m=f.charCodeAt(y),b=m.toString(16);h+=b.length<2?"0"+b:b}return"0x"+h}function u(f,h,y){if(!Array.isArray(f))throw new Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof f+"'");if(typeof h!="string")throw new Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof h+"'.");for(var m=[],b=0;b<f.length;b++){var v=f[b][h];if(y&&!v)v="";else if(typeof v!="string")throw new Error("invalid abi");m.push(v)}return m}function p(f,h){return!(typeof f!="string"||!f.match(/^0x[0-9A-Fa-f]*$/)||h&&f.length!==2+2*h)}return K1={arrayContainsArray:o,intToBuffer:s,getBinarySize:i,isHexPrefixed:e,stripHexPrefix:t,padToEven:r,intToHex:n,fromAscii:l,fromUtf8:c,toAscii:d,toUtf8:a,getKeys:u,isHexString:p},K1}var Sv;function Zl(){if(Sv)return Kr;Sv=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.numberToBuffer=Kr.normalize=Kr.recoverPublicKey=Kr.concatSig=Kr.legacyToBuffer=Kr.isNullish=Kr.padWithZeroes=void 0;const e=Dh(),t=X2();function r(c,l){if(c!==""&&!/^[a-f0-9]+$/iu.test(c))throw new Error(`Expected an unprefixed hex string. Received: ${c}`);if(l<0)throw new Error(`Expected a non-negative integer target length. Received: ${l}`);return String.prototype.padStart.call(c,l,"0")}Kr.padWithZeroes=r;function n(c){return c==null}Kr.isNullish=n;function s(c){return typeof c=="string"&&!(0,t.isHexString)(c)?at.from(c):(0,e.toBuffer)(c)}Kr.legacyToBuffer=s;function i(c,l,u){const p=(0,e.fromSigned)(l),f=(0,e.fromSigned)(u),h=(0,e.bufferToInt)(c),y=r((0,e.toUnsigned)(p).toString("hex"),64),m=r((0,e.toUnsigned)(f).toString("hex"),64),b=(0,t.stripHexPrefix)((0,t.intToHex)(h));return(0,e.addHexPrefix)(y.concat(m,b))}Kr.concatSig=i;function o(c,l){const u=(0,e.fromRpcSig)(l);return(0,e.ecrecover)(c,u.v,u.r,u.s)}Kr.recoverPublicKey=o;function a(c){if(c){if(typeof c=="number"){if(c<0)return"0x";const l=(0,e.toBuffer)(c);c=(0,e.bufferToHex)(l)}if(typeof c!="string"){let l="eth-sig-util.normalize() requires hex string or integer input.";throw l+=` received ${typeof c}: ${c}`,new Error(l)}return(0,e.addHexPrefix)(c.toLowerCase())}}Kr.normalize=a;function d(c){const l=c.toString(16),u=l.length%2?"0":"";return at.from(u+l,"hex")}return Kr.numberToBuffer=d,Kr}var Pv;function VR(){if(Pv)return Li;Pv=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.extractPublicKey=Li.recoverPersonalSignature=Li.personalSign=void 0;const e=Dh(),t=Zl();function r({privateKey:o,data:a}){if((0,t.isNullish)(a))throw new Error("Missing data parameter");if((0,t.isNullish)(o))throw new Error("Missing privateKey parameter");const d=(0,t.legacyToBuffer)(a),c=(0,e.hashPersonalMessage)(d),l=(0,e.ecsign)(c,o);return(0,t.concatSig)((0,e.toBuffer)(l.v),l.r,l.s)}Li.personalSign=r;function n({data:o,signature:a}){if((0,t.isNullish)(o))throw new Error("Missing data parameter");if((0,t.isNullish)(a))throw new Error("Missing signature parameter");const d=i(o,a),c=(0,e.publicToAddress)(d);return(0,e.bufferToHex)(c)}Li.recoverPersonalSignature=n;function s({data:o,signature:a}){if((0,t.isNullish)(o))throw new Error("Missing data parameter");if((0,t.isNullish)(a))throw new Error("Missing signature parameter");return`0x${i(o,a).toString("hex")}`}Li.extractPublicKey=s;function i(o,a){const d=(0,e.hashPersonalMessage)((0,t.legacyToBuffer)(o));return(0,t.recoverPublicKey)(d,a)}return Li}var q1={},zn={},il={exports:{}};il.exports;var Tv;function FR(){return Tv||(Tv=1,function(e,t){var r=Tt&&Tt.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=d,t.hexToBytes=c,t.equalsBytes=l,t.wrapHash=u;const n=r(So()),s=ki(),i=n.default.bool;t.assertBool=i;const o=n.default.bytes;t.assertBytes=o;var a=ki();Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return a.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return a.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return a.utf8ToBytes}});function d(p){if(!(p instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof p}`);return new TextDecoder().decode(p)}function c(p){const f=p.startsWith("0x")?p.substring(2):p;return(0,s.hexToBytes)(f)}function l(p,f){if(p.length!==f.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==f[h])return!1;return!0}function u(p){return f=>(n.default.bytes(f),p(f))}t.crypto=(()=>{const p=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,f=typeof uo=="function"&&uo.bind(e);return{node:f&&!p?f("crypto"):void 0,web:p}})()}(il,il.exports)),il.exports}var Iv;function HR(){if(Iv)return zn;Iv=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.keccak512=zn.keccak384=zn.keccak256=zn.keccak224=void 0;const e=a9(),t=FR();return zn.keccak224=(0,t.wrapHash)(e.keccak_224),zn.keccak256=(()=>{const r=(0,t.wrapHash)(e.keccak_256);return r.create=e.keccak_256.create,r})(),zn.keccak384=(0,t.wrapHash)(e.keccak_384),zn.keccak512=(0,t.wrapHash)(e.keccak_512),zn}var qi={},gf={exports:{}};gf.exports;var Cv;function GR(){return Cv||(Cv=1,function(e){(function(t,r){function n(T,g){if(!T)throw new Error(g||"Assertion failed")}function s(T,g){T.super_=g;var A=function(){};A.prototype=g.prototype,T.prototype=new A,T.prototype.constructor=T}function i(T,g,A){if(i.isBN(T))return T;this.negative=0,this.words=null,this.length=0,this.red=null,T!==null&&((g==="le"||g==="be")&&(A=g,g=10),this._init(T||0,g||10,A||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=ro.Buffer}catch{}i.isBN=function(g){return g instanceof i?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===i.wordSize&&Array.isArray(g.words)},i.max=function(g,A){return g.cmp(A)>0?g:A},i.min=function(g,A){return g.cmp(A)<0?g:A},i.prototype._init=function(g,A,P){if(typeof g=="number")return this._initNumber(g,A,P);if(typeof g=="object")return this._initArray(g,A,P);A==="hex"&&(A=16),n(A===(A|0)&&A>=2&&A<=36),g=g.toString().replace(/\s+/g,"");var O=0;g[0]==="-"&&(O++,this.negative=1),O<g.length&&(A===16?this._parseHex(g,O,P):(this._parseBase(g,A,O),P==="le"&&this._initArray(this.toArray(),A,P)))},i.prototype._initNumber=function(g,A,P){g<0&&(this.negative=1,g=-g),g<67108864?(this.words=[g&67108863],this.length=1):g<4503599627370496?(this.words=[g&67108863,g/67108864&67108863],this.length=2):(n(g<9007199254740992),this.words=[g&67108863,g/67108864&67108863,1],this.length=3),P==="le"&&this._initArray(this.toArray(),A,P)},i.prototype._initArray=function(g,A,P){if(n(typeof g.length=="number"),g.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(g.length/3),this.words=new Array(this.length);for(var O=0;O<this.length;O++)this.words[O]=0;var N,M,L=0;if(P==="be")for(O=g.length-1,N=0;O>=0;O-=3)M=g[O]|g[O-1]<<8|g[O-2]<<16,this.words[N]|=M<<L&67108863,this.words[N+1]=M>>>26-L&67108863,L+=24,L>=26&&(L-=26,N++);else if(P==="le")for(O=0,N=0;O<g.length;O+=3)M=g[O]|g[O+1]<<8|g[O+2]<<16,this.words[N]|=M<<L&67108863,this.words[N+1]=M>>>26-L&67108863,L+=24,L>=26&&(L-=26,N++);return this.strip()};function a(T,g){var A=T.charCodeAt(g);return A>=65&&A<=70?A-55:A>=97&&A<=102?A-87:A-48&15}function d(T,g,A){var P=a(T,A);return A-1>=g&&(P|=a(T,A-1)<<4),P}i.prototype._parseHex=function(g,A,P){this.length=Math.ceil((g.length-A)/6),this.words=new Array(this.length);for(var O=0;O<this.length;O++)this.words[O]=0;var N=0,M=0,L;if(P==="be")for(O=g.length-1;O>=A;O-=2)L=d(g,A,O)<<N,this.words[M]|=L&67108863,N>=18?(N-=18,M+=1,this.words[M]|=L>>>26):N+=8;else{var x=g.length-A;for(O=x%2===0?A+1:A;O<g.length;O+=2)L=d(g,A,O)<<N,this.words[M]|=L&67108863,N>=18?(N-=18,M+=1,this.words[M]|=L>>>26):N+=8}this.strip()};function c(T,g,A,P){for(var O=0,N=Math.min(T.length,A),M=g;M<N;M++){var L=T.charCodeAt(M)-48;O*=P,L>=49?O+=L-49+10:L>=17?O+=L-17+10:O+=L}return O}i.prototype._parseBase=function(g,A,P){this.words=[0],this.length=1;for(var O=0,N=1;N<=67108863;N*=A)O++;O--,N=N/A|0;for(var M=g.length-P,L=M%O,x=Math.min(M,M-L)+P,R=0,K=P;K<x;K+=O)R=c(g,K,K+O,A),this.imuln(N),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R);if(L!==0){var V=1;for(R=c(g,K,g.length,A),K=0;K<L;K++)V*=A;this.imuln(V),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R)}this.strip()},i.prototype.copy=function(g){g.words=new Array(this.length);for(var A=0;A<this.length;A++)g.words[A]=this.words[A];g.length=this.length,g.negative=this.negative,g.red=this.red},i.prototype.clone=function(){var g=new i(null);return this.copy(g),g},i.prototype._expand=function(g){for(;this.length<g;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(g,A){g=g||10,A=A|0||1;var P;if(g===16||g==="hex"){P="";for(var O=0,N=0,M=0;M<this.length;M++){var L=this.words[M],x=((L<<O|N)&16777215).toString(16);N=L>>>24-O&16777215,O+=2,O>=26&&(O-=26,M--),N!==0||M!==this.length-1?P=l[6-x.length]+x+P:P=x+P}for(N!==0&&(P=N.toString(16)+P);P.length%A!==0;)P="0"+P;return this.negative!==0&&(P="-"+P),P}if(g===(g|0)&&g>=2&&g<=36){var R=u[g],K=p[g];P="";var V=this.clone();for(V.negative=0;!V.isZero();){var J=V.modn(K).toString(g);V=V.idivn(K),V.isZero()?P=J+P:P=l[R-J.length]+J+P}for(this.isZero()&&(P="0"+P);P.length%A!==0;)P="0"+P;return this.negative!==0&&(P="-"+P),P}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(g,A){return n(typeof o<"u"),this.toArrayLike(o,g,A)},i.prototype.toArray=function(g,A){return this.toArrayLike(Array,g,A)},i.prototype.toArrayLike=function(g,A,P){var O=this.byteLength(),N=P||Math.max(1,O);n(O<=N,"byte array longer than desired length"),n(N>0,"Requested array length <= 0"),this.strip();var M=A==="le",L=new g(N),x,R,K=this.clone();if(M){for(R=0;!K.isZero();R++)x=K.andln(255),K.iushrn(8),L[R]=x;for(;R<N;R++)L[R]=0}else{for(R=0;R<N-O;R++)L[R]=0;for(R=0;!K.isZero();R++)x=K.andln(255),K.iushrn(8),L[N-R-1]=x}return L},Math.clz32?i.prototype._countBits=function(g){return 32-Math.clz32(g)}:i.prototype._countBits=function(g){var A=g,P=0;return A>=4096&&(P+=13,A>>>=13),A>=64&&(P+=7,A>>>=7),A>=8&&(P+=4,A>>>=4),A>=2&&(P+=2,A>>>=2),P+A},i.prototype._zeroBits=function(g){if(g===0)return 26;var A=g,P=0;return A&8191||(P+=13,A>>>=13),A&127||(P+=7,A>>>=7),A&15||(P+=4,A>>>=4),A&3||(P+=2,A>>>=2),A&1||P++,P},i.prototype.bitLength=function(){var g=this.words[this.length-1],A=this._countBits(g);return(this.length-1)*26+A};function f(T){for(var g=new Array(T.bitLength()),A=0;A<g.length;A++){var P=A/26|0,O=A%26;g[A]=(T.words[P]&1<<O)>>>O}return g}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,A=0;A<this.length;A++){var P=this._zeroBits(this.words[A]);if(g+=P,P!==26)break}return g},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(g){return this.negative!==0?this.abs().inotn(g).iaddn(1):this.clone()},i.prototype.fromTwos=function(g){return this.testn(g-1)?this.notn(g).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(g){for(;this.length<g.length;)this.words[this.length++]=0;for(var A=0;A<g.length;A++)this.words[A]=this.words[A]|g.words[A];return this.strip()},i.prototype.ior=function(g){return n((this.negative|g.negative)===0),this.iuor(g)},i.prototype.or=function(g){return this.length>g.length?this.clone().ior(g):g.clone().ior(this)},i.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},i.prototype.iuand=function(g){var A;this.length>g.length?A=g:A=this;for(var P=0;P<A.length;P++)this.words[P]=this.words[P]&g.words[P];return this.length=A.length,this.strip()},i.prototype.iand=function(g){return n((this.negative|g.negative)===0),this.iuand(g)},i.prototype.and=function(g){return this.length>g.length?this.clone().iand(g):g.clone().iand(this)},i.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},i.prototype.iuxor=function(g){var A,P;this.length>g.length?(A=this,P=g):(A=g,P=this);for(var O=0;O<P.length;O++)this.words[O]=A.words[O]^P.words[O];if(this!==A)for(;O<A.length;O++)this.words[O]=A.words[O];return this.length=A.length,this.strip()},i.prototype.ixor=function(g){return n((this.negative|g.negative)===0),this.iuxor(g)},i.prototype.xor=function(g){return this.length>g.length?this.clone().ixor(g):g.clone().ixor(this)},i.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},i.prototype.inotn=function(g){n(typeof g=="number"&&g>=0);var A=Math.ceil(g/26)|0,P=g%26;this._expand(A),P>0&&A--;for(var O=0;O<A;O++)this.words[O]=~this.words[O]&67108863;return P>0&&(this.words[O]=~this.words[O]&67108863>>26-P),this.strip()},i.prototype.notn=function(g){return this.clone().inotn(g)},i.prototype.setn=function(g,A){n(typeof g=="number"&&g>=0);var P=g/26|0,O=g%26;return this._expand(P+1),A?this.words[P]=this.words[P]|1<<O:this.words[P]=this.words[P]&~(1<<O),this.strip()},i.prototype.iadd=function(g){var A;if(this.negative!==0&&g.negative===0)return this.negative=0,A=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,A=this.isub(g),g.negative=1,A._normSign();var P,O;this.length>g.length?(P=this,O=g):(P=g,O=this);for(var N=0,M=0;M<O.length;M++)A=(P.words[M]|0)+(O.words[M]|0)+N,this.words[M]=A&67108863,N=A>>>26;for(;N!==0&&M<P.length;M++)A=(P.words[M]|0)+N,this.words[M]=A&67108863,N=A>>>26;if(this.length=P.length,N!==0)this.words[this.length]=N,this.length++;else if(P!==this)for(;M<P.length;M++)this.words[M]=P.words[M];return this},i.prototype.add=function(g){var A;return g.negative!==0&&this.negative===0?(g.negative=0,A=this.sub(g),g.negative^=1,A):g.negative===0&&this.negative!==0?(this.negative=0,A=g.sub(this),this.negative=1,A):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},i.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var A=this.iadd(g);return g.negative=1,A._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var P=this.cmp(g);if(P===0)return this.negative=0,this.length=1,this.words[0]=0,this;var O,N;P>0?(O=this,N=g):(O=g,N=this);for(var M=0,L=0;L<N.length;L++)A=(O.words[L]|0)-(N.words[L]|0)+M,M=A>>26,this.words[L]=A&67108863;for(;M!==0&&L<O.length;L++)A=(O.words[L]|0)+M,M=A>>26,this.words[L]=A&67108863;if(M===0&&L<O.length&&O!==this)for(;L<O.length;L++)this.words[L]=O.words[L];return this.length=Math.max(this.length,L),O!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(g){return this.clone().isub(g)};function h(T,g,A){A.negative=g.negative^T.negative;var P=T.length+g.length|0;A.length=P,P=P-1|0;var O=T.words[0]|0,N=g.words[0]|0,M=O*N,L=M&67108863,x=M/67108864|0;A.words[0]=L;for(var R=1;R<P;R++){for(var K=x>>>26,V=x&67108863,J=Math.min(R,g.length-1),se=Math.max(0,R-T.length+1);se<=J;se++){var j=R-se|0;O=T.words[j]|0,N=g.words[se]|0,M=O*N+V,K+=M/67108864|0,V=M&67108863}A.words[R]=V|0,x=K|0}return x!==0?A.words[R]=x|0:A.length--,A.strip()}var y=function(g,A,P){var O=g.words,N=A.words,M=P.words,L=0,x,R,K,V=O[0]|0,J=V&8191,se=V>>>13,j=O[1]|0,re=j&8191,G=j>>>13,B=O[2]|0,X=B&8191,ge=B>>>13,_e=O[3]|0,Se=_e&8191,F=_e>>>13,q=O[4]|0,z=q&8191,ee=q>>>13,le=O[5]|0,ce=le&8191,ne=le>>>13,je=O[6]|0,De=je&8191,Fe=je>>>13,he=O[7]|0,ue=he&8191,pe=he>>>13,de=O[8]|0,fe=de&8191,ye=de>>>13,ie=O[9]|0,Q=ie&8191,qe=ie>>>13,He=N[0]|0,Qe=He&8191,dt=He>>>13,rt=N[1]|0,be=rt&8191,W=rt>>>13,oe=N[2]|0,me=oe&8191,Te=oe>>>13,Pe=N[3]|0,ke=Pe&8191,Ne=Pe>>>13,Ue=N[4]|0,Re=Ue&8191,Me=Ue>>>13,et=N[5]|0,Ee=et&8191,Ce=et>>>13,Oe=N[6]|0,Be=Oe&8191,Ve=Oe>>>13,$=N[7]|0,Y=$&8191,Z=$>>>13,U=N[8]|0,ae=U&8191,Ae=U>>>13,Ie=N[9]|0,xe=Ie&8191,Ge=Ie>>>13;P.negative=g.negative^A.negative,P.length=19,x=Math.imul(J,Qe),R=Math.imul(J,dt),R=R+Math.imul(se,Qe)|0,K=Math.imul(se,dt);var ut=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(ut>>>26)|0,ut&=67108863,x=Math.imul(re,Qe),R=Math.imul(re,dt),R=R+Math.imul(G,Qe)|0,K=Math.imul(G,dt),x=x+Math.imul(J,be)|0,R=R+Math.imul(J,W)|0,R=R+Math.imul(se,be)|0,K=K+Math.imul(se,W)|0;var nt=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(nt>>>26)|0,nt&=67108863,x=Math.imul(X,Qe),R=Math.imul(X,dt),R=R+Math.imul(ge,Qe)|0,K=Math.imul(ge,dt),x=x+Math.imul(re,be)|0,R=R+Math.imul(re,W)|0,R=R+Math.imul(G,be)|0,K=K+Math.imul(G,W)|0,x=x+Math.imul(J,me)|0,R=R+Math.imul(J,Te)|0,R=R+Math.imul(se,me)|0,K=K+Math.imul(se,Te)|0;var Ct=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,x=Math.imul(Se,Qe),R=Math.imul(Se,dt),R=R+Math.imul(F,Qe)|0,K=Math.imul(F,dt),x=x+Math.imul(X,be)|0,R=R+Math.imul(X,W)|0,R=R+Math.imul(ge,be)|0,K=K+Math.imul(ge,W)|0,x=x+Math.imul(re,me)|0,R=R+Math.imul(re,Te)|0,R=R+Math.imul(G,me)|0,K=K+Math.imul(G,Te)|0,x=x+Math.imul(J,ke)|0,R=R+Math.imul(J,Ne)|0,R=R+Math.imul(se,ke)|0,K=K+Math.imul(se,Ne)|0;var st=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(st>>>26)|0,st&=67108863,x=Math.imul(z,Qe),R=Math.imul(z,dt),R=R+Math.imul(ee,Qe)|0,K=Math.imul(ee,dt),x=x+Math.imul(Se,be)|0,R=R+Math.imul(Se,W)|0,R=R+Math.imul(F,be)|0,K=K+Math.imul(F,W)|0,x=x+Math.imul(X,me)|0,R=R+Math.imul(X,Te)|0,R=R+Math.imul(ge,me)|0,K=K+Math.imul(ge,Te)|0,x=x+Math.imul(re,ke)|0,R=R+Math.imul(re,Ne)|0,R=R+Math.imul(G,ke)|0,K=K+Math.imul(G,Ne)|0,x=x+Math.imul(J,Re)|0,R=R+Math.imul(J,Me)|0,R=R+Math.imul(se,Re)|0,K=K+Math.imul(se,Me)|0;var mt=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(mt>>>26)|0,mt&=67108863,x=Math.imul(ce,Qe),R=Math.imul(ce,dt),R=R+Math.imul(ne,Qe)|0,K=Math.imul(ne,dt),x=x+Math.imul(z,be)|0,R=R+Math.imul(z,W)|0,R=R+Math.imul(ee,be)|0,K=K+Math.imul(ee,W)|0,x=x+Math.imul(Se,me)|0,R=R+Math.imul(Se,Te)|0,R=R+Math.imul(F,me)|0,K=K+Math.imul(F,Te)|0,x=x+Math.imul(X,ke)|0,R=R+Math.imul(X,Ne)|0,R=R+Math.imul(ge,ke)|0,K=K+Math.imul(ge,Ne)|0,x=x+Math.imul(re,Re)|0,R=R+Math.imul(re,Me)|0,R=R+Math.imul(G,Re)|0,K=K+Math.imul(G,Me)|0,x=x+Math.imul(J,Ee)|0,R=R+Math.imul(J,Ce)|0,R=R+Math.imul(se,Ee)|0,K=K+Math.imul(se,Ce)|0;var bt=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(bt>>>26)|0,bt&=67108863,x=Math.imul(De,Qe),R=Math.imul(De,dt),R=R+Math.imul(Fe,Qe)|0,K=Math.imul(Fe,dt),x=x+Math.imul(ce,be)|0,R=R+Math.imul(ce,W)|0,R=R+Math.imul(ne,be)|0,K=K+Math.imul(ne,W)|0,x=x+Math.imul(z,me)|0,R=R+Math.imul(z,Te)|0,R=R+Math.imul(ee,me)|0,K=K+Math.imul(ee,Te)|0,x=x+Math.imul(Se,ke)|0,R=R+Math.imul(Se,Ne)|0,R=R+Math.imul(F,ke)|0,K=K+Math.imul(F,Ne)|0,x=x+Math.imul(X,Re)|0,R=R+Math.imul(X,Me)|0,R=R+Math.imul(ge,Re)|0,K=K+Math.imul(ge,Me)|0,x=x+Math.imul(re,Ee)|0,R=R+Math.imul(re,Ce)|0,R=R+Math.imul(G,Ee)|0,K=K+Math.imul(G,Ce)|0,x=x+Math.imul(J,Be)|0,R=R+Math.imul(J,Ve)|0,R=R+Math.imul(se,Be)|0,K=K+Math.imul(se,Ve)|0;var At=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(At>>>26)|0,At&=67108863,x=Math.imul(ue,Qe),R=Math.imul(ue,dt),R=R+Math.imul(pe,Qe)|0,K=Math.imul(pe,dt),x=x+Math.imul(De,be)|0,R=R+Math.imul(De,W)|0,R=R+Math.imul(Fe,be)|0,K=K+Math.imul(Fe,W)|0,x=x+Math.imul(ce,me)|0,R=R+Math.imul(ce,Te)|0,R=R+Math.imul(ne,me)|0,K=K+Math.imul(ne,Te)|0,x=x+Math.imul(z,ke)|0,R=R+Math.imul(z,Ne)|0,R=R+Math.imul(ee,ke)|0,K=K+Math.imul(ee,Ne)|0,x=x+Math.imul(Se,Re)|0,R=R+Math.imul(Se,Me)|0,R=R+Math.imul(F,Re)|0,K=K+Math.imul(F,Me)|0,x=x+Math.imul(X,Ee)|0,R=R+Math.imul(X,Ce)|0,R=R+Math.imul(ge,Ee)|0,K=K+Math.imul(ge,Ce)|0,x=x+Math.imul(re,Be)|0,R=R+Math.imul(re,Ve)|0,R=R+Math.imul(G,Be)|0,K=K+Math.imul(G,Ve)|0,x=x+Math.imul(J,Y)|0,R=R+Math.imul(J,Z)|0,R=R+Math.imul(se,Y)|0,K=K+Math.imul(se,Z)|0;var Et=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(Et>>>26)|0,Et&=67108863,x=Math.imul(fe,Qe),R=Math.imul(fe,dt),R=R+Math.imul(ye,Qe)|0,K=Math.imul(ye,dt),x=x+Math.imul(ue,be)|0,R=R+Math.imul(ue,W)|0,R=R+Math.imul(pe,be)|0,K=K+Math.imul(pe,W)|0,x=x+Math.imul(De,me)|0,R=R+Math.imul(De,Te)|0,R=R+Math.imul(Fe,me)|0,K=K+Math.imul(Fe,Te)|0,x=x+Math.imul(ce,ke)|0,R=R+Math.imul(ce,Ne)|0,R=R+Math.imul(ne,ke)|0,K=K+Math.imul(ne,Ne)|0,x=x+Math.imul(z,Re)|0,R=R+Math.imul(z,Me)|0,R=R+Math.imul(ee,Re)|0,K=K+Math.imul(ee,Me)|0,x=x+Math.imul(Se,Ee)|0,R=R+Math.imul(Se,Ce)|0,R=R+Math.imul(F,Ee)|0,K=K+Math.imul(F,Ce)|0,x=x+Math.imul(X,Be)|0,R=R+Math.imul(X,Ve)|0,R=R+Math.imul(ge,Be)|0,K=K+Math.imul(ge,Ve)|0,x=x+Math.imul(re,Y)|0,R=R+Math.imul(re,Z)|0,R=R+Math.imul(G,Y)|0,K=K+Math.imul(G,Z)|0,x=x+Math.imul(J,ae)|0,R=R+Math.imul(J,Ae)|0,R=R+Math.imul(se,ae)|0,K=K+Math.imul(se,Ae)|0;var vt=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(vt>>>26)|0,vt&=67108863,x=Math.imul(Q,Qe),R=Math.imul(Q,dt),R=R+Math.imul(qe,Qe)|0,K=Math.imul(qe,dt),x=x+Math.imul(fe,be)|0,R=R+Math.imul(fe,W)|0,R=R+Math.imul(ye,be)|0,K=K+Math.imul(ye,W)|0,x=x+Math.imul(ue,me)|0,R=R+Math.imul(ue,Te)|0,R=R+Math.imul(pe,me)|0,K=K+Math.imul(pe,Te)|0,x=x+Math.imul(De,ke)|0,R=R+Math.imul(De,Ne)|0,R=R+Math.imul(Fe,ke)|0,K=K+Math.imul(Fe,Ne)|0,x=x+Math.imul(ce,Re)|0,R=R+Math.imul(ce,Me)|0,R=R+Math.imul(ne,Re)|0,K=K+Math.imul(ne,Me)|0,x=x+Math.imul(z,Ee)|0,R=R+Math.imul(z,Ce)|0,R=R+Math.imul(ee,Ee)|0,K=K+Math.imul(ee,Ce)|0,x=x+Math.imul(Se,Be)|0,R=R+Math.imul(Se,Ve)|0,R=R+Math.imul(F,Be)|0,K=K+Math.imul(F,Ve)|0,x=x+Math.imul(X,Y)|0,R=R+Math.imul(X,Z)|0,R=R+Math.imul(ge,Y)|0,K=K+Math.imul(ge,Z)|0,x=x+Math.imul(re,ae)|0,R=R+Math.imul(re,Ae)|0,R=R+Math.imul(G,ae)|0,K=K+Math.imul(G,Ae)|0,x=x+Math.imul(J,xe)|0,R=R+Math.imul(J,Ge)|0,R=R+Math.imul(se,xe)|0,K=K+Math.imul(se,Ge)|0;var wt=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(wt>>>26)|0,wt&=67108863,x=Math.imul(Q,be),R=Math.imul(Q,W),R=R+Math.imul(qe,be)|0,K=Math.imul(qe,W),x=x+Math.imul(fe,me)|0,R=R+Math.imul(fe,Te)|0,R=R+Math.imul(ye,me)|0,K=K+Math.imul(ye,Te)|0,x=x+Math.imul(ue,ke)|0,R=R+Math.imul(ue,Ne)|0,R=R+Math.imul(pe,ke)|0,K=K+Math.imul(pe,Ne)|0,x=x+Math.imul(De,Re)|0,R=R+Math.imul(De,Me)|0,R=R+Math.imul(Fe,Re)|0,K=K+Math.imul(Fe,Me)|0,x=x+Math.imul(ce,Ee)|0,R=R+Math.imul(ce,Ce)|0,R=R+Math.imul(ne,Ee)|0,K=K+Math.imul(ne,Ce)|0,x=x+Math.imul(z,Be)|0,R=R+Math.imul(z,Ve)|0,R=R+Math.imul(ee,Be)|0,K=K+Math.imul(ee,Ve)|0,x=x+Math.imul(Se,Y)|0,R=R+Math.imul(Se,Z)|0,R=R+Math.imul(F,Y)|0,K=K+Math.imul(F,Z)|0,x=x+Math.imul(X,ae)|0,R=R+Math.imul(X,Ae)|0,R=R+Math.imul(ge,ae)|0,K=K+Math.imul(ge,Ae)|0,x=x+Math.imul(re,xe)|0,R=R+Math.imul(re,Ge)|0,R=R+Math.imul(G,xe)|0,K=K+Math.imul(G,Ge)|0;var _t=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(_t>>>26)|0,_t&=67108863,x=Math.imul(Q,me),R=Math.imul(Q,Te),R=R+Math.imul(qe,me)|0,K=Math.imul(qe,Te),x=x+Math.imul(fe,ke)|0,R=R+Math.imul(fe,Ne)|0,R=R+Math.imul(ye,ke)|0,K=K+Math.imul(ye,Ne)|0,x=x+Math.imul(ue,Re)|0,R=R+Math.imul(ue,Me)|0,R=R+Math.imul(pe,Re)|0,K=K+Math.imul(pe,Me)|0,x=x+Math.imul(De,Ee)|0,R=R+Math.imul(De,Ce)|0,R=R+Math.imul(Fe,Ee)|0,K=K+Math.imul(Fe,Ce)|0,x=x+Math.imul(ce,Be)|0,R=R+Math.imul(ce,Ve)|0,R=R+Math.imul(ne,Be)|0,K=K+Math.imul(ne,Ve)|0,x=x+Math.imul(z,Y)|0,R=R+Math.imul(z,Z)|0,R=R+Math.imul(ee,Y)|0,K=K+Math.imul(ee,Z)|0,x=x+Math.imul(Se,ae)|0,R=R+Math.imul(Se,Ae)|0,R=R+Math.imul(F,ae)|0,K=K+Math.imul(F,Ae)|0,x=x+Math.imul(X,xe)|0,R=R+Math.imul(X,Ge)|0,R=R+Math.imul(ge,xe)|0,K=K+Math.imul(ge,Ge)|0;var ct=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(ct>>>26)|0,ct&=67108863,x=Math.imul(Q,ke),R=Math.imul(Q,Ne),R=R+Math.imul(qe,ke)|0,K=Math.imul(qe,Ne),x=x+Math.imul(fe,Re)|0,R=R+Math.imul(fe,Me)|0,R=R+Math.imul(ye,Re)|0,K=K+Math.imul(ye,Me)|0,x=x+Math.imul(ue,Ee)|0,R=R+Math.imul(ue,Ce)|0,R=R+Math.imul(pe,Ee)|0,K=K+Math.imul(pe,Ce)|0,x=x+Math.imul(De,Be)|0,R=R+Math.imul(De,Ve)|0,R=R+Math.imul(Fe,Be)|0,K=K+Math.imul(Fe,Ve)|0,x=x+Math.imul(ce,Y)|0,R=R+Math.imul(ce,Z)|0,R=R+Math.imul(ne,Y)|0,K=K+Math.imul(ne,Z)|0,x=x+Math.imul(z,ae)|0,R=R+Math.imul(z,Ae)|0,R=R+Math.imul(ee,ae)|0,K=K+Math.imul(ee,Ae)|0,x=x+Math.imul(Se,xe)|0,R=R+Math.imul(Se,Ge)|0,R=R+Math.imul(F,xe)|0,K=K+Math.imul(F,Ge)|0;var ft=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(ft>>>26)|0,ft&=67108863,x=Math.imul(Q,Re),R=Math.imul(Q,Me),R=R+Math.imul(qe,Re)|0,K=Math.imul(qe,Me),x=x+Math.imul(fe,Ee)|0,R=R+Math.imul(fe,Ce)|0,R=R+Math.imul(ye,Ee)|0,K=K+Math.imul(ye,Ce)|0,x=x+Math.imul(ue,Be)|0,R=R+Math.imul(ue,Ve)|0,R=R+Math.imul(pe,Be)|0,K=K+Math.imul(pe,Ve)|0,x=x+Math.imul(De,Y)|0,R=R+Math.imul(De,Z)|0,R=R+Math.imul(Fe,Y)|0,K=K+Math.imul(Fe,Z)|0,x=x+Math.imul(ce,ae)|0,R=R+Math.imul(ce,Ae)|0,R=R+Math.imul(ne,ae)|0,K=K+Math.imul(ne,Ae)|0,x=x+Math.imul(z,xe)|0,R=R+Math.imul(z,Ge)|0,R=R+Math.imul(ee,xe)|0,K=K+Math.imul(ee,Ge)|0;var it=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(it>>>26)|0,it&=67108863,x=Math.imul(Q,Ee),R=Math.imul(Q,Ce),R=R+Math.imul(qe,Ee)|0,K=Math.imul(qe,Ce),x=x+Math.imul(fe,Be)|0,R=R+Math.imul(fe,Ve)|0,R=R+Math.imul(ye,Be)|0,K=K+Math.imul(ye,Ve)|0,x=x+Math.imul(ue,Y)|0,R=R+Math.imul(ue,Z)|0,R=R+Math.imul(pe,Y)|0,K=K+Math.imul(pe,Z)|0,x=x+Math.imul(De,ae)|0,R=R+Math.imul(De,Ae)|0,R=R+Math.imul(Fe,ae)|0,K=K+Math.imul(Fe,Ae)|0,x=x+Math.imul(ce,xe)|0,R=R+Math.imul(ce,Ge)|0,R=R+Math.imul(ne,xe)|0,K=K+Math.imul(ne,Ge)|0;var lt=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(lt>>>26)|0,lt&=67108863,x=Math.imul(Q,Be),R=Math.imul(Q,Ve),R=R+Math.imul(qe,Be)|0,K=Math.imul(qe,Ve),x=x+Math.imul(fe,Y)|0,R=R+Math.imul(fe,Z)|0,R=R+Math.imul(ye,Y)|0,K=K+Math.imul(ye,Z)|0,x=x+Math.imul(ue,ae)|0,R=R+Math.imul(ue,Ae)|0,R=R+Math.imul(pe,ae)|0,K=K+Math.imul(pe,Ae)|0,x=x+Math.imul(De,xe)|0,R=R+Math.imul(De,Ge)|0,R=R+Math.imul(Fe,xe)|0,K=K+Math.imul(Fe,Ge)|0;var ht=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(ht>>>26)|0,ht&=67108863,x=Math.imul(Q,Y),R=Math.imul(Q,Z),R=R+Math.imul(qe,Y)|0,K=Math.imul(qe,Z),x=x+Math.imul(fe,ae)|0,R=R+Math.imul(fe,Ae)|0,R=R+Math.imul(ye,ae)|0,K=K+Math.imul(ye,Ae)|0,x=x+Math.imul(ue,xe)|0,R=R+Math.imul(ue,Ge)|0,R=R+Math.imul(pe,xe)|0,K=K+Math.imul(pe,Ge)|0;var ot=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(ot>>>26)|0,ot&=67108863,x=Math.imul(Q,ae),R=Math.imul(Q,Ae),R=R+Math.imul(qe,ae)|0,K=Math.imul(qe,Ae),x=x+Math.imul(fe,xe)|0,R=R+Math.imul(fe,Ge)|0,R=R+Math.imul(ye,xe)|0,K=K+Math.imul(ye,Ge)|0;var Le=(L+x|0)+((R&8191)<<13)|0;L=(K+(R>>>13)|0)+(Le>>>26)|0,Le&=67108863,x=Math.imul(Q,xe),R=Math.imul(Q,Ge),R=R+Math.imul(qe,xe)|0,K=Math.imul(qe,Ge);var Ke=(L+x|0)+((R&8191)<<13)|0;return L=(K+(R>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,M[0]=ut,M[1]=nt,M[2]=Ct,M[3]=st,M[4]=mt,M[5]=bt,M[6]=At,M[7]=Et,M[8]=vt,M[9]=wt,M[10]=_t,M[11]=ct,M[12]=ft,M[13]=it,M[14]=lt,M[15]=ht,M[16]=ot,M[17]=Le,M[18]=Ke,L!==0&&(M[19]=L,P.length++),P};Math.imul||(y=h);function m(T,g,A){A.negative=g.negative^T.negative,A.length=T.length+g.length;for(var P=0,O=0,N=0;N<A.length-1;N++){var M=O;O=0;for(var L=P&67108863,x=Math.min(N,g.length-1),R=Math.max(0,N-T.length+1);R<=x;R++){var K=N-R,V=T.words[K]|0,J=g.words[R]|0,se=V*J,j=se&67108863;M=M+(se/67108864|0)|0,j=j+L|0,L=j&67108863,M=M+(j>>>26)|0,O+=M>>>26,M&=67108863}A.words[N]=L,P=M,M=O}return P!==0?A.words[N]=P:A.length--,A.strip()}function b(T,g,A){var P=new v;return P.mulp(T,g,A)}i.prototype.mulTo=function(g,A){var P,O=this.length+g.length;return this.length===10&&g.length===10?P=y(this,g,A):O<63?P=h(this,g,A):O<1024?P=m(this,g,A):P=b(this,g,A),P};function v(T,g){this.x=T,this.y=g}v.prototype.makeRBT=function(g){for(var A=new Array(g),P=i.prototype._countBits(g)-1,O=0;O<g;O++)A[O]=this.revBin(O,P,g);return A},v.prototype.revBin=function(g,A,P){if(g===0||g===P-1)return g;for(var O=0,N=0;N<A;N++)O|=(g&1)<<A-N-1,g>>=1;return O},v.prototype.permute=function(g,A,P,O,N,M){for(var L=0;L<M;L++)O[L]=A[g[L]],N[L]=P[g[L]]},v.prototype.transform=function(g,A,P,O,N,M){this.permute(M,g,A,P,O,N);for(var L=1;L<N;L<<=1)for(var x=L<<1,R=Math.cos(2*Math.PI/x),K=Math.sin(2*Math.PI/x),V=0;V<N;V+=x)for(var J=R,se=K,j=0;j<L;j++){var re=P[V+j],G=O[V+j],B=P[V+j+L],X=O[V+j+L],ge=J*B-se*X;X=J*X+se*B,B=ge,P[V+j]=re+B,O[V+j]=G+X,P[V+j+L]=re-B,O[V+j+L]=G-X,j!==x&&(ge=R*J-K*se,se=R*se+K*J,J=ge)}},v.prototype.guessLen13b=function(g,A){var P=Math.max(A,g)|1,O=P&1,N=0;for(P=P/2|0;P;P=P>>>1)N++;return 1<<N+1+O},v.prototype.conjugate=function(g,A,P){if(!(P<=1))for(var O=0;O<P/2;O++){var N=g[O];g[O]=g[P-O-1],g[P-O-1]=N,N=A[O],A[O]=-A[P-O-1],A[P-O-1]=-N}},v.prototype.normalize13b=function(g,A){for(var P=0,O=0;O<A/2;O++){var N=Math.round(g[2*O+1]/A)*8192+Math.round(g[2*O]/A)+P;g[O]=N&67108863,N<67108864?P=0:P=N/67108864|0}return g},v.prototype.convert13b=function(g,A,P,O){for(var N=0,M=0;M<A;M++)N=N+(g[M]|0),P[2*M]=N&8191,N=N>>>13,P[2*M+1]=N&8191,N=N>>>13;for(M=2*A;M<O;++M)P[M]=0;n(N===0),n((N&-8192)===0)},v.prototype.stub=function(g){for(var A=new Array(g),P=0;P<g;P++)A[P]=0;return A},v.prototype.mulp=function(g,A,P){var O=2*this.guessLen13b(g.length,A.length),N=this.makeRBT(O),M=this.stub(O),L=new Array(O),x=new Array(O),R=new Array(O),K=new Array(O),V=new Array(O),J=new Array(O),se=P.words;se.length=O,this.convert13b(g.words,g.length,L,O),this.convert13b(A.words,A.length,K,O),this.transform(L,M,x,R,O,N),this.transform(K,M,V,J,O,N);for(var j=0;j<O;j++){var re=x[j]*V[j]-R[j]*J[j];R[j]=x[j]*J[j]+R[j]*V[j],x[j]=re}return this.conjugate(x,R,O),this.transform(x,R,se,M,O,N),this.conjugate(se,M,O),this.normalize13b(se,O),P.negative=g.negative^A.negative,P.length=g.length+A.length,P.strip()},i.prototype.mul=function(g){var A=new i(null);return A.words=new Array(this.length+g.length),this.mulTo(g,A)},i.prototype.mulf=function(g){var A=new i(null);return A.words=new Array(this.length+g.length),b(this,g,A)},i.prototype.imul=function(g){return this.clone().mulTo(g,this)},i.prototype.imuln=function(g){n(typeof g=="number"),n(g<67108864);for(var A=0,P=0;P<this.length;P++){var O=(this.words[P]|0)*g,N=(O&67108863)+(A&67108863);A>>=26,A+=O/67108864|0,A+=N>>>26,this.words[P]=N&67108863}return A!==0&&(this.words[P]=A,this.length++),this.length=g===0?1:this.length,this},i.prototype.muln=function(g){return this.clone().imuln(g)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(g){var A=f(g);if(A.length===0)return new i(1);for(var P=this,O=0;O<A.length&&A[O]===0;O++,P=P.sqr());if(++O<A.length)for(var N=P.sqr();O<A.length;O++,N=N.sqr())A[O]!==0&&(P=P.mul(N));return P},i.prototype.iushln=function(g){n(typeof g=="number"&&g>=0);var A=g%26,P=(g-A)/26,O=67108863>>>26-A<<26-A,N;if(A!==0){var M=0;for(N=0;N<this.length;N++){var L=this.words[N]&O,x=(this.words[N]|0)-L<<A;this.words[N]=x|M,M=L>>>26-A}M&&(this.words[N]=M,this.length++)}if(P!==0){for(N=this.length-1;N>=0;N--)this.words[N+P]=this.words[N];for(N=0;N<P;N++)this.words[N]=0;this.length+=P}return this.strip()},i.prototype.ishln=function(g){return n(this.negative===0),this.iushln(g)},i.prototype.iushrn=function(g,A,P){n(typeof g=="number"&&g>=0);var O;A?O=(A-A%26)/26:O=0;var N=g%26,M=Math.min((g-N)/26,this.length),L=67108863^67108863>>>N<<N,x=P;if(O-=M,O=Math.max(0,O),x){for(var R=0;R<M;R++)x.words[R]=this.words[R];x.length=M}if(M!==0)if(this.length>M)for(this.length-=M,R=0;R<this.length;R++)this.words[R]=this.words[R+M];else this.words[0]=0,this.length=1;var K=0;for(R=this.length-1;R>=0&&(K!==0||R>=O);R--){var V=this.words[R]|0;this.words[R]=K<<26-N|V>>>N,K=V&L}return x&&K!==0&&(x.words[x.length++]=K),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(g,A,P){return n(this.negative===0),this.iushrn(g,A,P)},i.prototype.shln=function(g){return this.clone().ishln(g)},i.prototype.ushln=function(g){return this.clone().iushln(g)},i.prototype.shrn=function(g){return this.clone().ishrn(g)},i.prototype.ushrn=function(g){return this.clone().iushrn(g)},i.prototype.testn=function(g){n(typeof g=="number"&&g>=0);var A=g%26,P=(g-A)/26,O=1<<A;if(this.length<=P)return!1;var N=this.words[P];return!!(N&O)},i.prototype.imaskn=function(g){n(typeof g=="number"&&g>=0);var A=g%26,P=(g-A)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=P)return this;if(A!==0&&P++,this.length=Math.min(P,this.length),A!==0){var O=67108863^67108863>>>A<<A;this.words[this.length-1]&=O}return this.strip()},i.prototype.maskn=function(g){return this.clone().imaskn(g)},i.prototype.iaddn=function(g){return n(typeof g=="number"),n(g<67108864),g<0?this.isubn(-g):this.negative!==0?this.length===1&&(this.words[0]|0)<g?(this.words[0]=g-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(g),this.negative=1,this):this._iaddn(g)},i.prototype._iaddn=function(g){this.words[0]+=g;for(var A=0;A<this.length&&this.words[A]>=67108864;A++)this.words[A]-=67108864,A===this.length-1?this.words[A+1]=1:this.words[A+1]++;return this.length=Math.max(this.length,A+1),this},i.prototype.isubn=function(g){if(n(typeof g=="number"),n(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var A=0;A<this.length&&this.words[A]<0;A++)this.words[A]+=67108864,this.words[A+1]-=1;return this.strip()},i.prototype.addn=function(g){return this.clone().iaddn(g)},i.prototype.subn=function(g){return this.clone().isubn(g)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(g,A,P){var O=g.length+P,N;this._expand(O);var M,L=0;for(N=0;N<g.length;N++){M=(this.words[N+P]|0)+L;var x=(g.words[N]|0)*A;M-=x&67108863,L=(M>>26)-(x/67108864|0),this.words[N+P]=M&67108863}for(;N<this.length-P;N++)M=(this.words[N+P]|0)+L,L=M>>26,this.words[N+P]=M&67108863;if(L===0)return this.strip();for(n(L===-1),L=0,N=0;N<this.length;N++)M=-(this.words[N]|0)+L,L=M>>26,this.words[N]=M&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(g,A){var P=this.length-g.length,O=this.clone(),N=g,M=N.words[N.length-1]|0,L=this._countBits(M);P=26-L,P!==0&&(N=N.ushln(P),O.iushln(P),M=N.words[N.length-1]|0);var x=O.length-N.length,R;if(A!=="mod"){R=new i(null),R.length=x+1,R.words=new Array(R.length);for(var K=0;K<R.length;K++)R.words[K]=0}var V=O.clone()._ishlnsubmul(N,1,x);V.negative===0&&(O=V,R&&(R.words[x]=1));for(var J=x-1;J>=0;J--){var se=(O.words[N.length+J]|0)*67108864+(O.words[N.length+J-1]|0);for(se=Math.min(se/M|0,67108863),O._ishlnsubmul(N,se,J);O.negative!==0;)se--,O.negative=0,O._ishlnsubmul(N,1,J),O.isZero()||(O.negative^=1);R&&(R.words[J]=se)}return R&&R.strip(),O.strip(),A!=="div"&&P!==0&&O.iushrn(P),{div:R||null,mod:O}},i.prototype.divmod=function(g,A,P){if(n(!g.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var O,N,M;return this.negative!==0&&g.negative===0?(M=this.neg().divmod(g,A),A!=="mod"&&(O=M.div.neg()),A!=="div"&&(N=M.mod.neg(),P&&N.negative!==0&&N.iadd(g)),{div:O,mod:N}):this.negative===0&&g.negative!==0?(M=this.divmod(g.neg(),A),A!=="mod"&&(O=M.div.neg()),{div:O,mod:M.mod}):this.negative&g.negative?(M=this.neg().divmod(g.neg(),A),A!=="div"&&(N=M.mod.neg(),P&&N.negative!==0&&N.isub(g)),{div:M.div,mod:N}):g.length>this.length||this.cmp(g)<0?{div:new i(0),mod:this}:g.length===1?A==="div"?{div:this.divn(g.words[0]),mod:null}:A==="mod"?{div:null,mod:new i(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new i(this.modn(g.words[0]))}:this._wordDiv(g,A)},i.prototype.div=function(g){return this.divmod(g,"div",!1).div},i.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},i.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},i.prototype.divRound=function(g){var A=this.divmod(g);if(A.mod.isZero())return A.div;var P=A.div.negative!==0?A.mod.isub(g):A.mod,O=g.ushrn(1),N=g.andln(1),M=P.cmp(O);return M<0||N===1&&M===0?A.div:A.div.negative!==0?A.div.isubn(1):A.div.iaddn(1)},i.prototype.modn=function(g){n(g<=67108863);for(var A=(1<<26)%g,P=0,O=this.length-1;O>=0;O--)P=(A*P+(this.words[O]|0))%g;return P},i.prototype.idivn=function(g){n(g<=67108863);for(var A=0,P=this.length-1;P>=0;P--){var O=(this.words[P]|0)+A*67108864;this.words[P]=O/g|0,A=O%g}return this.strip()},i.prototype.divn=function(g){return this.clone().idivn(g)},i.prototype.egcd=function(g){n(g.negative===0),n(!g.isZero());var A=this,P=g.clone();A.negative!==0?A=A.umod(g):A=A.clone();for(var O=new i(1),N=new i(0),M=new i(0),L=new i(1),x=0;A.isEven()&&P.isEven();)A.iushrn(1),P.iushrn(1),++x;for(var R=P.clone(),K=A.clone();!A.isZero();){for(var V=0,J=1;!(A.words[0]&J)&&V<26;++V,J<<=1);if(V>0)for(A.iushrn(V);V-- >0;)(O.isOdd()||N.isOdd())&&(O.iadd(R),N.isub(K)),O.iushrn(1),N.iushrn(1);for(var se=0,j=1;!(P.words[0]&j)&&se<26;++se,j<<=1);if(se>0)for(P.iushrn(se);se-- >0;)(M.isOdd()||L.isOdd())&&(M.iadd(R),L.isub(K)),M.iushrn(1),L.iushrn(1);A.cmp(P)>=0?(A.isub(P),O.isub(M),N.isub(L)):(P.isub(A),M.isub(O),L.isub(N))}return{a:M,b:L,gcd:P.iushln(x)}},i.prototype._invmp=function(g){n(g.negative===0),n(!g.isZero());var A=this,P=g.clone();A.negative!==0?A=A.umod(g):A=A.clone();for(var O=new i(1),N=new i(0),M=P.clone();A.cmpn(1)>0&&P.cmpn(1)>0;){for(var L=0,x=1;!(A.words[0]&x)&&L<26;++L,x<<=1);if(L>0)for(A.iushrn(L);L-- >0;)O.isOdd()&&O.iadd(M),O.iushrn(1);for(var R=0,K=1;!(P.words[0]&K)&&R<26;++R,K<<=1);if(R>0)for(P.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);A.cmp(P)>=0?(A.isub(P),O.isub(N)):(P.isub(A),N.isub(O))}var V;return A.cmpn(1)===0?V=O:V=N,V.cmpn(0)<0&&V.iadd(g),V},i.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var A=this.clone(),P=g.clone();A.negative=0,P.negative=0;for(var O=0;A.isEven()&&P.isEven();O++)A.iushrn(1),P.iushrn(1);do{for(;A.isEven();)A.iushrn(1);for(;P.isEven();)P.iushrn(1);var N=A.cmp(P);if(N<0){var M=A;A=P,P=M}else if(N===0||P.cmpn(1)===0)break;A.isub(P)}while(!0);return P.iushln(O)},i.prototype.invm=function(g){return this.egcd(g).a.umod(g)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(g){return this.words[0]&g},i.prototype.bincn=function(g){n(typeof g=="number");var A=g%26,P=(g-A)/26,O=1<<A;if(this.length<=P)return this._expand(P+1),this.words[P]|=O,this;for(var N=O,M=P;N!==0&&M<this.length;M++){var L=this.words[M]|0;L+=N,N=L>>>26,L&=67108863,this.words[M]=L}return N!==0&&(this.words[M]=N,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(g){var A=g<0;if(this.negative!==0&&!A)return-1;if(this.negative===0&&A)return 1;this.strip();var P;if(this.length>1)P=1;else{A&&(g=-g),n(g<=67108863,"Number is too big");var O=this.words[0]|0;P=O===g?0:O<g?-1:1}return this.negative!==0?-P|0:P},i.prototype.cmp=function(g){if(this.negative!==0&&g.negative===0)return-1;if(this.negative===0&&g.negative!==0)return 1;var A=this.ucmp(g);return this.negative!==0?-A|0:A},i.prototype.ucmp=function(g){if(this.length>g.length)return 1;if(this.length<g.length)return-1;for(var A=0,P=this.length-1;P>=0;P--){var O=this.words[P]|0,N=g.words[P]|0;if(O!==N){O<N?A=-1:O>N&&(A=1);break}}return A},i.prototype.gtn=function(g){return this.cmpn(g)===1},i.prototype.gt=function(g){return this.cmp(g)===1},i.prototype.gten=function(g){return this.cmpn(g)>=0},i.prototype.gte=function(g){return this.cmp(g)>=0},i.prototype.ltn=function(g){return this.cmpn(g)===-1},i.prototype.lt=function(g){return this.cmp(g)===-1},i.prototype.lten=function(g){return this.cmpn(g)<=0},i.prototype.lte=function(g){return this.cmp(g)<=0},i.prototype.eqn=function(g){return this.cmpn(g)===0},i.prototype.eq=function(g){return this.cmp(g)===0},i.red=function(g){return new S(g)},i.prototype.toRed=function(g){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(g){return this.red=g,this},i.prototype.forceRed=function(g){return n(!this.red,"Already a number in reduction context"),this._forceRed(g)},i.prototype.redAdd=function(g){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},i.prototype.redIAdd=function(g){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},i.prototype.redSub=function(g){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},i.prototype.redISub=function(g){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},i.prototype.redShl=function(g){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},i.prototype.redMul=function(g){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},i.prototype.redIMul=function(g){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(g){return n(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var E={k256:null,p224:null,p192:null,p25519:null};function _(T,g){this.name=T,this.p=new i(g,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}_.prototype._tmp=function(){var g=new i(null);return g.words=new Array(Math.ceil(this.n/13)),g},_.prototype.ireduce=function(g){var A=g,P;do this.split(A,this.tmp),A=this.imulK(A),A=A.iadd(this.tmp),P=A.bitLength();while(P>this.n);var O=P<this.n?-1:A.ucmp(this.p);return O===0?(A.words[0]=0,A.length=1):O>0?A.isub(this.p):A.strip!==void 0?A.strip():A._strip(),A},_.prototype.split=function(g,A){g.iushrn(this.n,0,A)},_.prototype.imulK=function(g){return g.imul(this.k)};function C(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(C,_),C.prototype.split=function(g,A){for(var P=4194303,O=Math.min(g.length,9),N=0;N<O;N++)A.words[N]=g.words[N];if(A.length=O,g.length<=9){g.words[0]=0,g.length=1;return}var M=g.words[9];for(A.words[A.length++]=M&P,N=10;N<g.length;N++){var L=g.words[N]|0;g.words[N-10]=(L&P)<<4|M>>>22,M=L}M>>>=22,g.words[N-10]=M,M===0&&g.length>10?g.length-=10:g.length-=9},C.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var A=0,P=0;P<g.length;P++){var O=g.words[P]|0;A+=O*977,g.words[P]=A&67108863,A=O*64+(A/67108864|0)}return g.words[g.length-1]===0&&(g.length--,g.words[g.length-1]===0&&g.length--),g};function k(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(k,_);function D(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(D,_);function w(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(w,_),w.prototype.imulK=function(g){for(var A=0,P=0;P<g.length;P++){var O=(g.words[P]|0)*19+A,N=O&67108863;O>>>=26,g.words[P]=N,A=O}return A!==0&&(g.words[g.length++]=A),g},i._prime=function(g){if(E[g])return E[g];var A;if(g==="k256")A=new C;else if(g==="p224")A=new k;else if(g==="p192")A=new D;else if(g==="p25519")A=new w;else throw new Error("Unknown prime "+g);return E[g]=A,A};function S(T){if(typeof T=="string"){var g=i._prime(T);this.m=g.p,this.prime=g}else n(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}S.prototype._verify1=function(g){n(g.negative===0,"red works only with positives"),n(g.red,"red works only with red numbers")},S.prototype._verify2=function(g,A){n((g.negative|A.negative)===0,"red works only with positives"),n(g.red&&g.red===A.red,"red works only with red numbers")},S.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},S.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},S.prototype.add=function(g,A){this._verify2(g,A);var P=g.add(A);return P.cmp(this.m)>=0&&P.isub(this.m),P._forceRed(this)},S.prototype.iadd=function(g,A){this._verify2(g,A);var P=g.iadd(A);return P.cmp(this.m)>=0&&P.isub(this.m),P},S.prototype.sub=function(g,A){this._verify2(g,A);var P=g.sub(A);return P.cmpn(0)<0&&P.iadd(this.m),P._forceRed(this)},S.prototype.isub=function(g,A){this._verify2(g,A);var P=g.isub(A);return P.cmpn(0)<0&&P.iadd(this.m),P},S.prototype.shl=function(g,A){return this._verify1(g),this.imod(g.ushln(A))},S.prototype.imul=function(g,A){return this._verify2(g,A),this.imod(g.imul(A))},S.prototype.mul=function(g,A){return this._verify2(g,A),this.imod(g.mul(A))},S.prototype.isqr=function(g){return this.imul(g,g.clone())},S.prototype.sqr=function(g){return this.mul(g,g)},S.prototype.sqrt=function(g){if(g.isZero())return g.clone();var A=this.m.andln(3);if(n(A%2===1),A===3){var P=this.m.add(new i(1)).iushrn(2);return this.pow(g,P)}for(var O=this.m.subn(1),N=0;!O.isZero()&&O.andln(1)===0;)N++,O.iushrn(1);n(!O.isZero());var M=new i(1).toRed(this),L=M.redNeg(),x=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new i(2*R*R).toRed(this);this.pow(R,x).cmp(L)!==0;)R.redIAdd(L);for(var K=this.pow(R,O),V=this.pow(g,O.addn(1).iushrn(1)),J=this.pow(g,O),se=N;J.cmp(M)!==0;){for(var j=J,re=0;j.cmp(M)!==0;re++)j=j.redSqr();n(re<se);var G=this.pow(K,new i(1).iushln(se-re-1));V=V.redMul(G),K=G.redSqr(),J=J.redMul(K),se=re}return V},S.prototype.invm=function(g){var A=g._invmp(this.m);return A.negative!==0?(A.negative=0,this.imod(A).redNeg()):this.imod(A)},S.prototype.pow=function(g,A){if(A.isZero())return new i(1).toRed(this);if(A.cmpn(1)===0)return g.clone();var P=4,O=new Array(1<<P);O[0]=new i(1).toRed(this),O[1]=g;for(var N=2;N<O.length;N++)O[N]=this.mul(O[N-1],g);var M=O[0],L=0,x=0,R=A.bitLength()%26;for(R===0&&(R=26),N=A.length-1;N>=0;N--){for(var K=A.words[N],V=R-1;V>=0;V--){var J=K>>V&1;if(M!==O[0]&&(M=this.sqr(M)),J===0&&L===0){x=0;continue}L<<=1,L|=J,x++,!(x!==P&&(N!==0||V!==0))&&(M=this.mul(M,O[L]),x=0,L=0)}R=26}return M},S.prototype.convertTo=function(g){var A=g.umod(this.m);return A===g?A.clone():A},S.prototype.convertFrom=function(g){var A=g.clone();return A.red=null,A},i.mont=function(g){return new I(g)};function I(T){S.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(I,S),I.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},I.prototype.convertFrom=function(g){var A=this.imod(g.mul(this.rinv));return A.red=null,A},I.prototype.imul=function(g,A){if(g.isZero()||A.isZero())return g.words[0]=0,g.length=1,g;var P=g.imul(A),O=P.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=P.isub(O).iushrn(this.shift),M=N;return N.cmp(this.m)>=0?M=N.isub(this.m):N.cmpn(0)<0&&(M=N.iadd(this.m)),M._forceRed(this)},I.prototype.mul=function(g,A){if(g.isZero()||A.isZero())return new i(0)._forceRed(this);var P=g.mul(A),O=P.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=P.isub(O).iushrn(this.shift),M=N;return N.cmp(this.m)>=0?M=N.isub(this.m):N.cmpn(0)<0&&(M=N.iadd(this.m)),M._forceRed(this)},I.prototype.invm=function(g){var A=this.imod(g._invmp(this.m).mul(this.r2));return A._forceRed(this)}})(e,Tt)}(gf)),gf.exports}var Rv;function zR(){if(Rv)return qi;Rv=1;var e=Tt&&Tt.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(qi,"__esModule",{value:!0}),qi.rawEncode=qi.parseNumber=qi.solidityPack=void 0;const t=Dh(),r=e(GR()),n=X2(),s=Zl();function i(m,b){if(m.length!==b.length)throw new Error("Number of types are not matching the values");const v=[];for(let E=0;E<m.length;E++){const _=u(m[E]),C=b[E];v.push(l(_,C,null))}return at.concat(v)}qi.solidityPack=i;function o(m){return m.endsWith("]")}function a(m){const b=m.match(/(.*)\[(.*?)\]$/u);return b?b[2]===""?"dynamic":parseInt(b[2],10):null}function d(m){const b=/^\D+(\d+)$/u.exec(m);if(b===null)throw new Error(`Invalid parseTypeN input "${m}".`);return parseInt(b[1],10)}function c(m){const b=typeof m;if(b==="string")return(0,t.isHexPrefixed)(m)?new r.default((0,n.stripHexPrefix)(m),16):new r.default(m,10);if(b==="number")return new r.default(m);if(m&&Object.prototype.hasOwnProperty.call(m,"toArray")||r.default.isBN(m))return m;throw new Error("Argument is not a number")}qi.parseNumber=c;function l(m,b,v){if(o(m)){const E=m.replace(/\[.*?\]/u,"");if(!o(E)){const C=a(m);if(C!=="dynamic"&&C!==0&&C!==null&&b.length>C)throw new Error(`Elements exceed array size: ${C}`)}const _=b.map(C=>l(E,C,256));return at.concat(_)}else{if(m==="bytes")return b;if(m==="string")return at.from(b,"utf8");if(m==="bool"){v=v||8;const E=Array(v/4).join("0");return at.from(b?`${E}1`:`${E}0`,"hex")}else if(m==="address"){let E=20;return v&&(E=v/8),(0,t.setLengthLeft)((0,t.toBuffer)(b),E)}else if(m.startsWith("bytes")){const E=d(m);if(E<1||E>32)throw new Error(`Invalid bytes<N> width: ${E}`);return typeof b=="number"&&(b=(0,s.normalize)(b)),(0,t.setLengthRight)((0,t.toBuffer)(b),E)}else if(m.startsWith("uint")){const E=d(m);if(E%8||E<8||E>256)throw new Error(`Invalid uint<N> width: ${E}`);const _=c(b);if(_.bitLength()>E)throw new Error(`Supplied uint exceeds width: ${E} vs ${_.bitLength()}`);return v=v||E,_.toArrayLike(at,"be",v/8)}else if(m.startsWith("int")){const E=d(m);if(E%8||E<8||E>256)throw new Error(`Invalid int<N> width: ${E}`);const _=c(b);if(_.bitLength()>E)throw new Error(`Supplied int exceeds width: ${E} vs ${_.bitLength()}`);return v=v||E,_.toTwos(E).toArrayLike(at,"be",v/8)}}throw new Error(`Unsupported or invalid type: ${JSON.stringify(m)}`)}function u(m){return m.startsWith("int[")?`int256${m.slice(3)}`:m==="int"?"int256":m.startsWith("uint[")?`uint256${m.slice(4)}`:m==="uint"?"uint256":m.startsWith("fixed[")?`fixed128x128${m.slice(5)}`:m==="fixed"?"fixed128x128":m.startsWith("ufixed[")?`ufixed128x128${m.slice(6)}`:m==="ufixed"?"ufixed128x128":m}function p(m,b){const v=[],E=[];let _=0;m.forEach(C=>{if(o(C)){const k=a(C);k!=="dynamic"&&k!==null?_+=32*k:_+=32}else _+=32});for(let C=0;C<m.length;C++){const k=u(m[C]),D=b[C],w=f(k,D);h(k)?(v.push(f("uint256",_)),E.push(w),_+=w.length):v.push(w)}return at.concat(v.concat(E))}qi.rawEncode=p;function f(m,b){if(m==="address")return f("uint160",c(b));if(m==="bool")return f("uint8",b?1:0);if(m==="string")return f("bytes",at.from(b,"utf8"));if(o(m)){if(typeof b.length>"u")throw new Error("Not an array?");const v=a(m);if(v!=="dynamic"&&v!==0&&v!==null&&b.length>v)throw new Error(`Elements exceed array size: ${v}`);const E=[];m=m.slice(0,m.lastIndexOf("[")),typeof b=="string"&&(b=JSON.parse(b));for(const _ in b)Object.prototype.hasOwnProperty.call(b,_)&&E.push(f(m,b[_]));if(v==="dynamic"){const _=f("uint256",b.length);E.unshift(_)}return at.concat(E)}else if(m==="bytes"){b=at.from(b);let v=at.concat([f("uint256",b.length),b]);return b.length%32!==0&&(v=at.concat([v,(0,t.zeros)(32-b.length%32)])),v}else if(m.startsWith("bytes")){const v=d(m);if(v<1||v>32)throw new Error(`Invalid bytes<N> width: ${v}`);const E=typeof b=="number"?(0,s.normalize)(b):b;return(0,t.setLengthRight)((0,t.toBuffer)(E),32)}else if(m.startsWith("uint")){const v=d(m);if(v%8||v<8||v>256)throw new Error(`Invalid uint<N> width: ${v}`);const E=c(b);if(E.bitLength()>v)throw new Error(`Supplied uint exceeds width: ${v} vs ${E.bitLength()}`);if(E.isNeg())throw new Error("Supplied uint is negative");return E.toArrayLike(at,"be",32)}else if(m.startsWith("int")){const v=d(m);if(v%8||v<8||v>256)throw new Error(`Invalid int<N> width: ${v}`);const E=c(b);if(E.bitLength()>v)throw new Error(`Supplied int exceeds width: ${v} vs ${E.bitLength()}`);return E.toTwos(256).toArrayLike(at,"be",32)}else if(m.startsWith("ufixed")){const v=y(m),E=c(b);if(E.isNeg())throw new Error("Supplied ufixed is negative");return f("uint256",E.mul(new r.default(2).pow(new r.default(v[1]))))}else if(m.startsWith("fixed")){const v=y(m);return f("int256",c(b).mul(new r.default(2).pow(new r.default(v[1]))))}throw new Error(`Unsupported or invalid type: ${JSON.stringify(m)}`)}function h(m){return m==="string"||m==="bytes"||a(m)==="dynamic"}function y(m){const b=/^\D+(\d+)x(\d+)$/u.exec(m);if(b===null||b.length<1)throw new Error(`Invalid parseTypeNxM input "${m}".`);return[parseInt(b[1],10),parseInt(b[2],10)]}return qi}var kv;function WR(){return kv||(kv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature=e.signTypedData=e.typedSignatureHash=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=e.SignTypedDataVersion=void 0;const t=Dh(),r=HR(),n=X2(),s=zR(),i=Zl();var o;(function(C){C.V1="V1",C.V3="V3",C.V4="V4"})(o=e.SignTypedDataVersion||(e.SignTypedDataVersion={})),e.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]};function a(C,k){if(Object.keys(o).includes(C)){if(k&&!k.includes(C))throw new Error(`SignTypedDataVersion not allowed: '${C}'. Allowed versions are: ${k.join(", ")}`)}else throw new Error(`Invalid version: '${C}'`)}function d(C,k,D,w,S){if(a(S,[o.V3,o.V4]),C[D]!==void 0)return["bytes32",S===o.V4&&w==null?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,r.keccak256)(c(D,w,C,S)))];if(w===void 0)throw new Error(`missing value for field ${k} of type ${D}`);if(D==="bytes"){if(typeof w=="number")w=(0,i.numberToBuffer)(w);else if((0,n.isHexString)(w)){const I=w.length%2?"0":"";w=at.from(I+w.slice(2),"hex")}else w=at.from(w,"utf8");return["bytes32",(0,t.arrToBufArr)((0,r.keccak256)(w))]}if(D==="string")return typeof w=="number"?w=(0,i.numberToBuffer)(w):w=at.from(w??"","utf8"),["bytes32",(0,t.arrToBufArr)((0,r.keccak256)(w))];if(D.endsWith("]")){if(S===o.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const I=D.slice(0,D.lastIndexOf("[")),T=w.map(g=>d(C,k,I,g,S));return["bytes32",(0,t.arrToBufArr)((0,r.keccak256)((0,s.rawEncode)(T.map(([g])=>g),T.map(([,g])=>g))))]}return[D,w]}function c(C,k,D,w){a(w,[o.V3,o.V4]);const S=["bytes32"],I=[f(C,D)];for(const T of D[C]){if(w===o.V3&&k[T.name]===void 0)continue;const[g,A]=d(D,T.name,T.type,k[T.name],w);S.push(g),I.push(A)}return(0,s.rawEncode)(S,I)}function l(C,k){let D="";const w=u(C,k);w.delete(C);const S=[C,...Array.from(w).sort()];for(const I of S){if(!k[I])throw new Error(`No type definition specified: ${I}`);D+=`${I}(${k[I].map(({name:g,type:A})=>`${A} ${g}`).join(",")})`}return D}function u(C,k,D=new Set){if(typeof C!="string")throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(C)}`);if([C]=C.match(/^\w*/u),D.has(C)||k[C]===void 0)return D;D.add(C);for(const S of k[C])u(S.type,k,D);return D}function p(C,k,D,w){a(w,[o.V3,o.V4]);const S=c(C,k,D,w),I=(0,r.keccak256)(S);return(0,t.arrToBufArr)(I)}function f(C,k){const D=at.from(l(C,k),"utf-8");return(0,t.arrToBufArr)((0,r.keccak256)(D))}function h(C){const k={};for(const D in e.TYPED_MESSAGE_SCHEMA.properties)C[D]&&(k[D]=C[D]);return"types"in k&&(k.types=Object.assign({EIP712Domain:[]},k.types)),k}function y(C,k){a(k,[o.V3,o.V4]);const D=h(C),{domain:w}=D,S={EIP712Domain:D.types.EIP712Domain};return p("EIP712Domain",w,S,k)}function m(C,k){a(k,[o.V3,o.V4]);const D=h(C),w=[at.from("1901","hex")];return w.push(y(C,k)),D.primaryType!=="EIP712Domain"&&w.push(p(D.primaryType,D.message,D.types,k)),(0,t.arrToBufArr)((0,r.keccak256)(at.concat(w)))}e.TypedDataUtils={encodeData:c,encodeType:l,findTypeDependencies:u,hashStruct:p,hashType:f,sanitizeData:h,eip712Hash:m,eip712DomainHash:y};function b(C){const k=v(C);return(0,t.bufferToHex)(k)}e.typedSignatureHash=b;function v(C){const k=new Error("Expect argument to be non-empty array");if(typeof C!="object"||!("length"in C)||!C.length)throw k;const D=C.map(function(I){return I.type!=="bytes"?I.value:(0,i.legacyToBuffer)(I.value)}),w=C.map(function(I){return I.type}),S=C.map(function(I){if(!I.name)throw k;return`${I.type} ${I.name}`});return(0,t.arrToBufArr)((0,r.keccak256)((0,s.solidityPack)(["bytes32","bytes32"],[(0,r.keccak256)((0,s.solidityPack)(new Array(C.length).fill("string"),S)),(0,r.keccak256)((0,s.solidityPack)(w,D))])))}function E({privateKey:C,data:k,version:D}){if(a(D),(0,i.isNullish)(k))throw new Error("Missing data parameter");if((0,i.isNullish)(C))throw new Error("Missing private key parameter");const w=D===o.V1?v(k):e.TypedDataUtils.eip712Hash(k,D),S=(0,t.ecsign)(w,C);return(0,i.concatSig)((0,t.toBuffer)(S.v),S.r,S.s)}e.signTypedData=E;function _({data:C,signature:k,version:D}){if(a(D),(0,i.isNullish)(C))throw new Error("Missing data parameter");if((0,i.isNullish)(k))throw new Error("Missing signature parameter");const w=D===o.V1?v(C):e.TypedDataUtils.eip712Hash(C,D),S=(0,i.recoverPublicKey)(w,k),I=(0,t.publicToAddress)(S);return(0,t.bufferToHex)(I)}e.recoverTypedSignature=_}(q1)),q1}var wn={},j1={exports:{}},Mv;function YR(){return Mv||(Mv=1,function(e){(function(t){var r=function($){var Y,Z=new Float64Array(16);if($)for(Y=0;Y<$.length;Y++)Z[Y]=$[Y];return Z},n=function(){throw new Error("no PRNG")},s=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var o=r(),a=r([1]),d=r([56129,1]),c=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h($,Y,Z,U){$[Y]=Z>>24&255,$[Y+1]=Z>>16&255,$[Y+2]=Z>>8&255,$[Y+3]=Z&255,$[Y+4]=U>>24&255,$[Y+5]=U>>16&255,$[Y+6]=U>>8&255,$[Y+7]=U&255}function y($,Y,Z,U,ae){var Ae,Ie=0;for(Ae=0;Ae<ae;Ae++)Ie|=$[Y+Ae]^Z[U+Ae];return(1&Ie-1>>>8)-1}function m($,Y,Z,U){return y($,Y,Z,U,16)}function b($,Y,Z,U){return y($,Y,Z,U,32)}function v($,Y,Z,U){for(var ae=U[0]&255|(U[1]&255)<<8|(U[2]&255)<<16|(U[3]&255)<<24,Ae=Z[0]&255|(Z[1]&255)<<8|(Z[2]&255)<<16|(Z[3]&255)<<24,Ie=Z[4]&255|(Z[5]&255)<<8|(Z[6]&255)<<16|(Z[7]&255)<<24,xe=Z[8]&255|(Z[9]&255)<<8|(Z[10]&255)<<16|(Z[11]&255)<<24,Ge=Z[12]&255|(Z[13]&255)<<8|(Z[14]&255)<<16|(Z[15]&255)<<24,ut=U[4]&255|(U[5]&255)<<8|(U[6]&255)<<16|(U[7]&255)<<24,nt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,Ct=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,st=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,mt=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,bt=U[8]&255|(U[9]&255)<<8|(U[10]&255)<<16|(U[11]&255)<<24,At=Z[16]&255|(Z[17]&255)<<8|(Z[18]&255)<<16|(Z[19]&255)<<24,Et=Z[20]&255|(Z[21]&255)<<8|(Z[22]&255)<<16|(Z[23]&255)<<24,vt=Z[24]&255|(Z[25]&255)<<8|(Z[26]&255)<<16|(Z[27]&255)<<24,wt=Z[28]&255|(Z[29]&255)<<8|(Z[30]&255)<<16|(Z[31]&255)<<24,_t=U[12]&255|(U[13]&255)<<8|(U[14]&255)<<16|(U[15]&255)<<24,ct=ae,ft=Ae,it=Ie,lt=xe,ht=Ge,ot=ut,Le=nt,Ke=Ct,Ye=st,ze=mt,We=bt,Ze=At,St=Et,xt=vt,Bt=wt,Ut=_t,we,jt=0;jt<20;jt+=2)we=ct+St|0,ht^=we<<7|we>>>32-7,we=ht+ct|0,Ye^=we<<9|we>>>32-9,we=Ye+ht|0,St^=we<<13|we>>>32-13,we=St+Ye|0,ct^=we<<18|we>>>32-18,we=ot+ft|0,ze^=we<<7|we>>>32-7,we=ze+ot|0,xt^=we<<9|we>>>32-9,we=xt+ze|0,ft^=we<<13|we>>>32-13,we=ft+xt|0,ot^=we<<18|we>>>32-18,we=We+Le|0,Bt^=we<<7|we>>>32-7,we=Bt+We|0,it^=we<<9|we>>>32-9,we=it+Bt|0,Le^=we<<13|we>>>32-13,we=Le+it|0,We^=we<<18|we>>>32-18,we=Ut+Ze|0,lt^=we<<7|we>>>32-7,we=lt+Ut|0,Ke^=we<<9|we>>>32-9,we=Ke+lt|0,Ze^=we<<13|we>>>32-13,we=Ze+Ke|0,Ut^=we<<18|we>>>32-18,we=ct+lt|0,ft^=we<<7|we>>>32-7,we=ft+ct|0,it^=we<<9|we>>>32-9,we=it+ft|0,lt^=we<<13|we>>>32-13,we=lt+it|0,ct^=we<<18|we>>>32-18,we=ot+ht|0,Le^=we<<7|we>>>32-7,we=Le+ot|0,Ke^=we<<9|we>>>32-9,we=Ke+Le|0,ht^=we<<13|we>>>32-13,we=ht+Ke|0,ot^=we<<18|we>>>32-18,we=We+ze|0,Ze^=we<<7|we>>>32-7,we=Ze+We|0,Ye^=we<<9|we>>>32-9,we=Ye+Ze|0,ze^=we<<13|we>>>32-13,we=ze+Ye|0,We^=we<<18|we>>>32-18,we=Ut+Bt|0,St^=we<<7|we>>>32-7,we=St+Ut|0,xt^=we<<9|we>>>32-9,we=xt+St|0,Bt^=we<<13|we>>>32-13,we=Bt+xt|0,Ut^=we<<18|we>>>32-18;ct=ct+ae|0,ft=ft+Ae|0,it=it+Ie|0,lt=lt+xe|0,ht=ht+Ge|0,ot=ot+ut|0,Le=Le+nt|0,Ke=Ke+Ct|0,Ye=Ye+st|0,ze=ze+mt|0,We=We+bt|0,Ze=Ze+At|0,St=St+Et|0,xt=xt+vt|0,Bt=Bt+wt|0,Ut=Ut+_t|0,$[0]=ct>>>0&255,$[1]=ct>>>8&255,$[2]=ct>>>16&255,$[3]=ct>>>24&255,$[4]=ft>>>0&255,$[5]=ft>>>8&255,$[6]=ft>>>16&255,$[7]=ft>>>24&255,$[8]=it>>>0&255,$[9]=it>>>8&255,$[10]=it>>>16&255,$[11]=it>>>24&255,$[12]=lt>>>0&255,$[13]=lt>>>8&255,$[14]=lt>>>16&255,$[15]=lt>>>24&255,$[16]=ht>>>0&255,$[17]=ht>>>8&255,$[18]=ht>>>16&255,$[19]=ht>>>24&255,$[20]=ot>>>0&255,$[21]=ot>>>8&255,$[22]=ot>>>16&255,$[23]=ot>>>24&255,$[24]=Le>>>0&255,$[25]=Le>>>8&255,$[26]=Le>>>16&255,$[27]=Le>>>24&255,$[28]=Ke>>>0&255,$[29]=Ke>>>8&255,$[30]=Ke>>>16&255,$[31]=Ke>>>24&255,$[32]=Ye>>>0&255,$[33]=Ye>>>8&255,$[34]=Ye>>>16&255,$[35]=Ye>>>24&255,$[36]=ze>>>0&255,$[37]=ze>>>8&255,$[38]=ze>>>16&255,$[39]=ze>>>24&255,$[40]=We>>>0&255,$[41]=We>>>8&255,$[42]=We>>>16&255,$[43]=We>>>24&255,$[44]=Ze>>>0&255,$[45]=Ze>>>8&255,$[46]=Ze>>>16&255,$[47]=Ze>>>24&255,$[48]=St>>>0&255,$[49]=St>>>8&255,$[50]=St>>>16&255,$[51]=St>>>24&255,$[52]=xt>>>0&255,$[53]=xt>>>8&255,$[54]=xt>>>16&255,$[55]=xt>>>24&255,$[56]=Bt>>>0&255,$[57]=Bt>>>8&255,$[58]=Bt>>>16&255,$[59]=Bt>>>24&255,$[60]=Ut>>>0&255,$[61]=Ut>>>8&255,$[62]=Ut>>>16&255,$[63]=Ut>>>24&255}function E($,Y,Z,U){for(var ae=U[0]&255|(U[1]&255)<<8|(U[2]&255)<<16|(U[3]&255)<<24,Ae=Z[0]&255|(Z[1]&255)<<8|(Z[2]&255)<<16|(Z[3]&255)<<24,Ie=Z[4]&255|(Z[5]&255)<<8|(Z[6]&255)<<16|(Z[7]&255)<<24,xe=Z[8]&255|(Z[9]&255)<<8|(Z[10]&255)<<16|(Z[11]&255)<<24,Ge=Z[12]&255|(Z[13]&255)<<8|(Z[14]&255)<<16|(Z[15]&255)<<24,ut=U[4]&255|(U[5]&255)<<8|(U[6]&255)<<16|(U[7]&255)<<24,nt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,Ct=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,st=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,mt=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,bt=U[8]&255|(U[9]&255)<<8|(U[10]&255)<<16|(U[11]&255)<<24,At=Z[16]&255|(Z[17]&255)<<8|(Z[18]&255)<<16|(Z[19]&255)<<24,Et=Z[20]&255|(Z[21]&255)<<8|(Z[22]&255)<<16|(Z[23]&255)<<24,vt=Z[24]&255|(Z[25]&255)<<8|(Z[26]&255)<<16|(Z[27]&255)<<24,wt=Z[28]&255|(Z[29]&255)<<8|(Z[30]&255)<<16|(Z[31]&255)<<24,_t=U[12]&255|(U[13]&255)<<8|(U[14]&255)<<16|(U[15]&255)<<24,ct=ae,ft=Ae,it=Ie,lt=xe,ht=Ge,ot=ut,Le=nt,Ke=Ct,Ye=st,ze=mt,We=bt,Ze=At,St=Et,xt=vt,Bt=wt,Ut=_t,we,jt=0;jt<20;jt+=2)we=ct+St|0,ht^=we<<7|we>>>32-7,we=ht+ct|0,Ye^=we<<9|we>>>32-9,we=Ye+ht|0,St^=we<<13|we>>>32-13,we=St+Ye|0,ct^=we<<18|we>>>32-18,we=ot+ft|0,ze^=we<<7|we>>>32-7,we=ze+ot|0,xt^=we<<9|we>>>32-9,we=xt+ze|0,ft^=we<<13|we>>>32-13,we=ft+xt|0,ot^=we<<18|we>>>32-18,we=We+Le|0,Bt^=we<<7|we>>>32-7,we=Bt+We|0,it^=we<<9|we>>>32-9,we=it+Bt|0,Le^=we<<13|we>>>32-13,we=Le+it|0,We^=we<<18|we>>>32-18,we=Ut+Ze|0,lt^=we<<7|we>>>32-7,we=lt+Ut|0,Ke^=we<<9|we>>>32-9,we=Ke+lt|0,Ze^=we<<13|we>>>32-13,we=Ze+Ke|0,Ut^=we<<18|we>>>32-18,we=ct+lt|0,ft^=we<<7|we>>>32-7,we=ft+ct|0,it^=we<<9|we>>>32-9,we=it+ft|0,lt^=we<<13|we>>>32-13,we=lt+it|0,ct^=we<<18|we>>>32-18,we=ot+ht|0,Le^=we<<7|we>>>32-7,we=Le+ot|0,Ke^=we<<9|we>>>32-9,we=Ke+Le|0,ht^=we<<13|we>>>32-13,we=ht+Ke|0,ot^=we<<18|we>>>32-18,we=We+ze|0,Ze^=we<<7|we>>>32-7,we=Ze+We|0,Ye^=we<<9|we>>>32-9,we=Ye+Ze|0,ze^=we<<13|we>>>32-13,we=ze+Ye|0,We^=we<<18|we>>>32-18,we=Ut+Bt|0,St^=we<<7|we>>>32-7,we=St+Ut|0,xt^=we<<9|we>>>32-9,we=xt+St|0,Bt^=we<<13|we>>>32-13,we=Bt+xt|0,Ut^=we<<18|we>>>32-18;$[0]=ct>>>0&255,$[1]=ct>>>8&255,$[2]=ct>>>16&255,$[3]=ct>>>24&255,$[4]=ot>>>0&255,$[5]=ot>>>8&255,$[6]=ot>>>16&255,$[7]=ot>>>24&255,$[8]=We>>>0&255,$[9]=We>>>8&255,$[10]=We>>>16&255,$[11]=We>>>24&255,$[12]=Ut>>>0&255,$[13]=Ut>>>8&255,$[14]=Ut>>>16&255,$[15]=Ut>>>24&255,$[16]=Le>>>0&255,$[17]=Le>>>8&255,$[18]=Le>>>16&255,$[19]=Le>>>24&255,$[20]=Ke>>>0&255,$[21]=Ke>>>8&255,$[22]=Ke>>>16&255,$[23]=Ke>>>24&255,$[24]=Ye>>>0&255,$[25]=Ye>>>8&255,$[26]=Ye>>>16&255,$[27]=Ye>>>24&255,$[28]=ze>>>0&255,$[29]=ze>>>8&255,$[30]=ze>>>16&255,$[31]=ze>>>24&255}function _($,Y,Z,U){v($,Y,Z,U)}function C($,Y,Z,U){E($,Y,Z,U)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D($,Y,Z,U,ae,Ae,Ie){var xe=new Uint8Array(16),Ge=new Uint8Array(64),ut,nt;for(nt=0;nt<16;nt++)xe[nt]=0;for(nt=0;nt<8;nt++)xe[nt]=Ae[nt];for(;ae>=64;){for(_(Ge,xe,Ie,k),nt=0;nt<64;nt++)$[Y+nt]=Z[U+nt]^Ge[nt];for(ut=1,nt=8;nt<16;nt++)ut=ut+(xe[nt]&255)|0,xe[nt]=ut&255,ut>>>=8;ae-=64,Y+=64,U+=64}if(ae>0)for(_(Ge,xe,Ie,k),nt=0;nt<ae;nt++)$[Y+nt]=Z[U+nt]^Ge[nt];return 0}function w($,Y,Z,U,ae){var Ae=new Uint8Array(16),Ie=new Uint8Array(64),xe,Ge;for(Ge=0;Ge<16;Ge++)Ae[Ge]=0;for(Ge=0;Ge<8;Ge++)Ae[Ge]=U[Ge];for(;Z>=64;){for(_(Ie,Ae,ae,k),Ge=0;Ge<64;Ge++)$[Y+Ge]=Ie[Ge];for(xe=1,Ge=8;Ge<16;Ge++)xe=xe+(Ae[Ge]&255)|0,Ae[Ge]=xe&255,xe>>>=8;Z-=64,Y+=64}if(Z>0)for(_(Ie,Ae,ae,k),Ge=0;Ge<Z;Ge++)$[Y+Ge]=Ie[Ge];return 0}function S($,Y,Z,U,ae){var Ae=new Uint8Array(32);C(Ae,U,ae,k);for(var Ie=new Uint8Array(8),xe=0;xe<8;xe++)Ie[xe]=U[xe+16];return w($,Y,Z,Ie,Ae)}function I($,Y,Z,U,ae,Ae,Ie){var xe=new Uint8Array(32);C(xe,Ae,Ie,k);for(var Ge=new Uint8Array(8),ut=0;ut<8;ut++)Ge[ut]=Ae[ut+16];return D($,Y,Z,U,ae,Ge,xe)}var T=function($){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var Y,Z,U,ae,Ae,Ie,xe,Ge;Y=$[0]&255|($[1]&255)<<8,this.r[0]=Y&8191,Z=$[2]&255|($[3]&255)<<8,this.r[1]=(Y>>>13|Z<<3)&8191,U=$[4]&255|($[5]&255)<<8,this.r[2]=(Z>>>10|U<<6)&7939,ae=$[6]&255|($[7]&255)<<8,this.r[3]=(U>>>7|ae<<9)&8191,Ae=$[8]&255|($[9]&255)<<8,this.r[4]=(ae>>>4|Ae<<12)&255,this.r[5]=Ae>>>1&8190,Ie=$[10]&255|($[11]&255)<<8,this.r[6]=(Ae>>>14|Ie<<2)&8191,xe=$[12]&255|($[13]&255)<<8,this.r[7]=(Ie>>>11|xe<<5)&8065,Ge=$[14]&255|($[15]&255)<<8,this.r[8]=(xe>>>8|Ge<<8)&8191,this.r[9]=Ge>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};T.prototype.blocks=function($,Y,Z){for(var U=this.fin?0:2048,ae,Ae,Ie,xe,Ge,ut,nt,Ct,st,mt,bt,At,Et,vt,wt,_t,ct,ft,it,lt=this.h[0],ht=this.h[1],ot=this.h[2],Le=this.h[3],Ke=this.h[4],Ye=this.h[5],ze=this.h[6],We=this.h[7],Ze=this.h[8],St=this.h[9],xt=this.r[0],Bt=this.r[1],Ut=this.r[2],we=this.r[3],jt=this.r[4],Wt=this.r[5],Yt=this.r[6],Kt=this.r[7],Gt=this.r[8],zt=this.r[9];Z>=16;)ae=$[Y+0]&255|($[Y+1]&255)<<8,lt+=ae&8191,Ae=$[Y+2]&255|($[Y+3]&255)<<8,ht+=(ae>>>13|Ae<<3)&8191,Ie=$[Y+4]&255|($[Y+5]&255)<<8,ot+=(Ae>>>10|Ie<<6)&8191,xe=$[Y+6]&255|($[Y+7]&255)<<8,Le+=(Ie>>>7|xe<<9)&8191,Ge=$[Y+8]&255|($[Y+9]&255)<<8,Ke+=(xe>>>4|Ge<<12)&8191,Ye+=Ge>>>1&8191,ut=$[Y+10]&255|($[Y+11]&255)<<8,ze+=(Ge>>>14|ut<<2)&8191,nt=$[Y+12]&255|($[Y+13]&255)<<8,We+=(ut>>>11|nt<<5)&8191,Ct=$[Y+14]&255|($[Y+15]&255)<<8,Ze+=(nt>>>8|Ct<<8)&8191,St+=Ct>>>5|U,st=0,mt=st,mt+=lt*xt,mt+=ht*(5*zt),mt+=ot*(5*Gt),mt+=Le*(5*Kt),mt+=Ke*(5*Yt),st=mt>>>13,mt&=8191,mt+=Ye*(5*Wt),mt+=ze*(5*jt),mt+=We*(5*we),mt+=Ze*(5*Ut),mt+=St*(5*Bt),st+=mt>>>13,mt&=8191,bt=st,bt+=lt*Bt,bt+=ht*xt,bt+=ot*(5*zt),bt+=Le*(5*Gt),bt+=Ke*(5*Kt),st=bt>>>13,bt&=8191,bt+=Ye*(5*Yt),bt+=ze*(5*Wt),bt+=We*(5*jt),bt+=Ze*(5*we),bt+=St*(5*Ut),st+=bt>>>13,bt&=8191,At=st,At+=lt*Ut,At+=ht*Bt,At+=ot*xt,At+=Le*(5*zt),At+=Ke*(5*Gt),st=At>>>13,At&=8191,At+=Ye*(5*Kt),At+=ze*(5*Yt),At+=We*(5*Wt),At+=Ze*(5*jt),At+=St*(5*we),st+=At>>>13,At&=8191,Et=st,Et+=lt*we,Et+=ht*Ut,Et+=ot*Bt,Et+=Le*xt,Et+=Ke*(5*zt),st=Et>>>13,Et&=8191,Et+=Ye*(5*Gt),Et+=ze*(5*Kt),Et+=We*(5*Yt),Et+=Ze*(5*Wt),Et+=St*(5*jt),st+=Et>>>13,Et&=8191,vt=st,vt+=lt*jt,vt+=ht*we,vt+=ot*Ut,vt+=Le*Bt,vt+=Ke*xt,st=vt>>>13,vt&=8191,vt+=Ye*(5*zt),vt+=ze*(5*Gt),vt+=We*(5*Kt),vt+=Ze*(5*Yt),vt+=St*(5*Wt),st+=vt>>>13,vt&=8191,wt=st,wt+=lt*Wt,wt+=ht*jt,wt+=ot*we,wt+=Le*Ut,wt+=Ke*Bt,st=wt>>>13,wt&=8191,wt+=Ye*xt,wt+=ze*(5*zt),wt+=We*(5*Gt),wt+=Ze*(5*Kt),wt+=St*(5*Yt),st+=wt>>>13,wt&=8191,_t=st,_t+=lt*Yt,_t+=ht*Wt,_t+=ot*jt,_t+=Le*we,_t+=Ke*Ut,st=_t>>>13,_t&=8191,_t+=Ye*Bt,_t+=ze*xt,_t+=We*(5*zt),_t+=Ze*(5*Gt),_t+=St*(5*Kt),st+=_t>>>13,_t&=8191,ct=st,ct+=lt*Kt,ct+=ht*Yt,ct+=ot*Wt,ct+=Le*jt,ct+=Ke*we,st=ct>>>13,ct&=8191,ct+=Ye*Ut,ct+=ze*Bt,ct+=We*xt,ct+=Ze*(5*zt),ct+=St*(5*Gt),st+=ct>>>13,ct&=8191,ft=st,ft+=lt*Gt,ft+=ht*Kt,ft+=ot*Yt,ft+=Le*Wt,ft+=Ke*jt,st=ft>>>13,ft&=8191,ft+=Ye*we,ft+=ze*Ut,ft+=We*Bt,ft+=Ze*xt,ft+=St*(5*zt),st+=ft>>>13,ft&=8191,it=st,it+=lt*zt,it+=ht*Gt,it+=ot*Kt,it+=Le*Yt,it+=Ke*Wt,st=it>>>13,it&=8191,it+=Ye*jt,it+=ze*we,it+=We*Ut,it+=Ze*Bt,it+=St*xt,st+=it>>>13,it&=8191,st=(st<<2)+st|0,st=st+mt|0,mt=st&8191,st=st>>>13,bt+=st,lt=mt,ht=bt,ot=At,Le=Et,Ke=vt,Ye=wt,ze=_t,We=ct,Ze=ft,St=it,Y+=16,Z-=16;this.h[0]=lt,this.h[1]=ht,this.h[2]=ot,this.h[3]=Le,this.h[4]=Ke,this.h[5]=Ye,this.h[6]=ze,this.h[7]=We,this.h[8]=Ze,this.h[9]=St},T.prototype.finish=function($,Y){var Z=new Uint16Array(10),U,ae,Ae,Ie;if(this.leftover){for(Ie=this.leftover,this.buffer[Ie++]=1;Ie<16;Ie++)this.buffer[Ie]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(U=this.h[1]>>>13,this.h[1]&=8191,Ie=2;Ie<10;Ie++)this.h[Ie]+=U,U=this.h[Ie]>>>13,this.h[Ie]&=8191;for(this.h[0]+=U*5,U=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=U,U=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=U,Z[0]=this.h[0]+5,U=Z[0]>>>13,Z[0]&=8191,Ie=1;Ie<10;Ie++)Z[Ie]=this.h[Ie]+U,U=Z[Ie]>>>13,Z[Ie]&=8191;for(Z[9]-=8192,ae=(U^1)-1,Ie=0;Ie<10;Ie++)Z[Ie]&=ae;for(ae=~ae,Ie=0;Ie<10;Ie++)this.h[Ie]=this.h[Ie]&ae|Z[Ie];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Ae=this.h[0]+this.pad[0],this.h[0]=Ae&65535,Ie=1;Ie<8;Ie++)Ae=(this.h[Ie]+this.pad[Ie]|0)+(Ae>>>16)|0,this.h[Ie]=Ae&65535;$[Y+0]=this.h[0]>>>0&255,$[Y+1]=this.h[0]>>>8&255,$[Y+2]=this.h[1]>>>0&255,$[Y+3]=this.h[1]>>>8&255,$[Y+4]=this.h[2]>>>0&255,$[Y+5]=this.h[2]>>>8&255,$[Y+6]=this.h[3]>>>0&255,$[Y+7]=this.h[3]>>>8&255,$[Y+8]=this.h[4]>>>0&255,$[Y+9]=this.h[4]>>>8&255,$[Y+10]=this.h[5]>>>0&255,$[Y+11]=this.h[5]>>>8&255,$[Y+12]=this.h[6]>>>0&255,$[Y+13]=this.h[6]>>>8&255,$[Y+14]=this.h[7]>>>0&255,$[Y+15]=this.h[7]>>>8&255},T.prototype.update=function($,Y,Z){var U,ae;if(this.leftover){for(ae=16-this.leftover,ae>Z&&(ae=Z),U=0;U<ae;U++)this.buffer[this.leftover+U]=$[Y+U];if(Z-=ae,Y+=ae,this.leftover+=ae,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(Z>=16&&(ae=Z-Z%16,this.blocks($,Y,ae),Y+=ae,Z-=ae),Z){for(U=0;U<Z;U++)this.buffer[this.leftover+U]=$[Y+U];this.leftover+=Z}};function g($,Y,Z,U,ae,Ae){var Ie=new T(Ae);return Ie.update(Z,U,ae),Ie.finish($,Y),0}function A($,Y,Z,U,ae,Ae){var Ie=new Uint8Array(16);return g(Ie,0,Z,U,ae,Ae),m($,Y,Ie,0)}function P($,Y,Z,U,ae){var Ae;if(Z<32)return-1;for(I($,0,Y,0,Z,U,ae),g($,16,$,32,Z-32,$),Ae=0;Ae<16;Ae++)$[Ae]=0;return 0}function O($,Y,Z,U,ae){var Ae,Ie=new Uint8Array(32);if(Z<32||(S(Ie,0,32,U,ae),A(Y,16,Y,32,Z-32,Ie)!==0))return-1;for(I($,0,Y,0,Z,U,ae),Ae=0;Ae<32;Ae++)$[Ae]=0;return 0}function N($,Y){var Z;for(Z=0;Z<16;Z++)$[Z]=Y[Z]|0}function M($){var Y,Z,U=1;for(Y=0;Y<16;Y++)Z=$[Y]+U+65535,U=Math.floor(Z/65536),$[Y]=Z-U*65536;$[0]+=U-1+37*(U-1)}function L($,Y,Z){for(var U,ae=~(Z-1),Ae=0;Ae<16;Ae++)U=ae&($[Ae]^Y[Ae]),$[Ae]^=U,Y[Ae]^=U}function x($,Y){var Z,U,ae,Ae=r(),Ie=r();for(Z=0;Z<16;Z++)Ie[Z]=Y[Z];for(M(Ie),M(Ie),M(Ie),U=0;U<2;U++){for(Ae[0]=Ie[0]-65517,Z=1;Z<15;Z++)Ae[Z]=Ie[Z]-65535-(Ae[Z-1]>>16&1),Ae[Z-1]&=65535;Ae[15]=Ie[15]-32767-(Ae[14]>>16&1),ae=Ae[15]>>16&1,Ae[14]&=65535,L(Ie,Ae,1-ae)}for(Z=0;Z<16;Z++)$[2*Z]=Ie[Z]&255,$[2*Z+1]=Ie[Z]>>8}function R($,Y){var Z=new Uint8Array(32),U=new Uint8Array(32);return x(Z,$),x(U,Y),b(Z,0,U,0)}function K($){var Y=new Uint8Array(32);return x(Y,$),Y[0]&1}function V($,Y){var Z;for(Z=0;Z<16;Z++)$[Z]=Y[2*Z]+(Y[2*Z+1]<<8);$[15]&=32767}function J($,Y,Z){for(var U=0;U<16;U++)$[U]=Y[U]+Z[U]}function se($,Y,Z){for(var U=0;U<16;U++)$[U]=Y[U]-Z[U]}function j($,Y,Z){var U,ae,Ae=0,Ie=0,xe=0,Ge=0,ut=0,nt=0,Ct=0,st=0,mt=0,bt=0,At=0,Et=0,vt=0,wt=0,_t=0,ct=0,ft=0,it=0,lt=0,ht=0,ot=0,Le=0,Ke=0,Ye=0,ze=0,We=0,Ze=0,St=0,xt=0,Bt=0,Ut=0,we=Z[0],jt=Z[1],Wt=Z[2],Yt=Z[3],Kt=Z[4],Gt=Z[5],zt=Z[6],wr=Z[7],Qt=Z[8],gr=Z[9],mr=Z[10],br=Z[11],Sr=Z[12],Gr=Z[13],zr=Z[14],Wr=Z[15];U=Y[0],Ae+=U*we,Ie+=U*jt,xe+=U*Wt,Ge+=U*Yt,ut+=U*Kt,nt+=U*Gt,Ct+=U*zt,st+=U*wr,mt+=U*Qt,bt+=U*gr,At+=U*mr,Et+=U*br,vt+=U*Sr,wt+=U*Gr,_t+=U*zr,ct+=U*Wr,U=Y[1],Ie+=U*we,xe+=U*jt,Ge+=U*Wt,ut+=U*Yt,nt+=U*Kt,Ct+=U*Gt,st+=U*zt,mt+=U*wr,bt+=U*Qt,At+=U*gr,Et+=U*mr,vt+=U*br,wt+=U*Sr,_t+=U*Gr,ct+=U*zr,ft+=U*Wr,U=Y[2],xe+=U*we,Ge+=U*jt,ut+=U*Wt,nt+=U*Yt,Ct+=U*Kt,st+=U*Gt,mt+=U*zt,bt+=U*wr,At+=U*Qt,Et+=U*gr,vt+=U*mr,wt+=U*br,_t+=U*Sr,ct+=U*Gr,ft+=U*zr,it+=U*Wr,U=Y[3],Ge+=U*we,ut+=U*jt,nt+=U*Wt,Ct+=U*Yt,st+=U*Kt,mt+=U*Gt,bt+=U*zt,At+=U*wr,Et+=U*Qt,vt+=U*gr,wt+=U*mr,_t+=U*br,ct+=U*Sr,ft+=U*Gr,it+=U*zr,lt+=U*Wr,U=Y[4],ut+=U*we,nt+=U*jt,Ct+=U*Wt,st+=U*Yt,mt+=U*Kt,bt+=U*Gt,At+=U*zt,Et+=U*wr,vt+=U*Qt,wt+=U*gr,_t+=U*mr,ct+=U*br,ft+=U*Sr,it+=U*Gr,lt+=U*zr,ht+=U*Wr,U=Y[5],nt+=U*we,Ct+=U*jt,st+=U*Wt,mt+=U*Yt,bt+=U*Kt,At+=U*Gt,Et+=U*zt,vt+=U*wr,wt+=U*Qt,_t+=U*gr,ct+=U*mr,ft+=U*br,it+=U*Sr,lt+=U*Gr,ht+=U*zr,ot+=U*Wr,U=Y[6],Ct+=U*we,st+=U*jt,mt+=U*Wt,bt+=U*Yt,At+=U*Kt,Et+=U*Gt,vt+=U*zt,wt+=U*wr,_t+=U*Qt,ct+=U*gr,ft+=U*mr,it+=U*br,lt+=U*Sr,ht+=U*Gr,ot+=U*zr,Le+=U*Wr,U=Y[7],st+=U*we,mt+=U*jt,bt+=U*Wt,At+=U*Yt,Et+=U*Kt,vt+=U*Gt,wt+=U*zt,_t+=U*wr,ct+=U*Qt,ft+=U*gr,it+=U*mr,lt+=U*br,ht+=U*Sr,ot+=U*Gr,Le+=U*zr,Ke+=U*Wr,U=Y[8],mt+=U*we,bt+=U*jt,At+=U*Wt,Et+=U*Yt,vt+=U*Kt,wt+=U*Gt,_t+=U*zt,ct+=U*wr,ft+=U*Qt,it+=U*gr,lt+=U*mr,ht+=U*br,ot+=U*Sr,Le+=U*Gr,Ke+=U*zr,Ye+=U*Wr,U=Y[9],bt+=U*we,At+=U*jt,Et+=U*Wt,vt+=U*Yt,wt+=U*Kt,_t+=U*Gt,ct+=U*zt,ft+=U*wr,it+=U*Qt,lt+=U*gr,ht+=U*mr,ot+=U*br,Le+=U*Sr,Ke+=U*Gr,Ye+=U*zr,ze+=U*Wr,U=Y[10],At+=U*we,Et+=U*jt,vt+=U*Wt,wt+=U*Yt,_t+=U*Kt,ct+=U*Gt,ft+=U*zt,it+=U*wr,lt+=U*Qt,ht+=U*gr,ot+=U*mr,Le+=U*br,Ke+=U*Sr,Ye+=U*Gr,ze+=U*zr,We+=U*Wr,U=Y[11],Et+=U*we,vt+=U*jt,wt+=U*Wt,_t+=U*Yt,ct+=U*Kt,ft+=U*Gt,it+=U*zt,lt+=U*wr,ht+=U*Qt,ot+=U*gr,Le+=U*mr,Ke+=U*br,Ye+=U*Sr,ze+=U*Gr,We+=U*zr,Ze+=U*Wr,U=Y[12],vt+=U*we,wt+=U*jt,_t+=U*Wt,ct+=U*Yt,ft+=U*Kt,it+=U*Gt,lt+=U*zt,ht+=U*wr,ot+=U*Qt,Le+=U*gr,Ke+=U*mr,Ye+=U*br,ze+=U*Sr,We+=U*Gr,Ze+=U*zr,St+=U*Wr,U=Y[13],wt+=U*we,_t+=U*jt,ct+=U*Wt,ft+=U*Yt,it+=U*Kt,lt+=U*Gt,ht+=U*zt,ot+=U*wr,Le+=U*Qt,Ke+=U*gr,Ye+=U*mr,ze+=U*br,We+=U*Sr,Ze+=U*Gr,St+=U*zr,xt+=U*Wr,U=Y[14],_t+=U*we,ct+=U*jt,ft+=U*Wt,it+=U*Yt,lt+=U*Kt,ht+=U*Gt,ot+=U*zt,Le+=U*wr,Ke+=U*Qt,Ye+=U*gr,ze+=U*mr,We+=U*br,Ze+=U*Sr,St+=U*Gr,xt+=U*zr,Bt+=U*Wr,U=Y[15],ct+=U*we,ft+=U*jt,it+=U*Wt,lt+=U*Yt,ht+=U*Kt,ot+=U*Gt,Le+=U*zt,Ke+=U*wr,Ye+=U*Qt,ze+=U*gr,We+=U*mr,Ze+=U*br,St+=U*Sr,xt+=U*Gr,Bt+=U*zr,Ut+=U*Wr,Ae+=38*ft,Ie+=38*it,xe+=38*lt,Ge+=38*ht,ut+=38*ot,nt+=38*Le,Ct+=38*Ke,st+=38*Ye,mt+=38*ze,bt+=38*We,At+=38*Ze,Et+=38*St,vt+=38*xt,wt+=38*Bt,_t+=38*Ut,ae=1,U=Ae+ae+65535,ae=Math.floor(U/65536),Ae=U-ae*65536,U=Ie+ae+65535,ae=Math.floor(U/65536),Ie=U-ae*65536,U=xe+ae+65535,ae=Math.floor(U/65536),xe=U-ae*65536,U=Ge+ae+65535,ae=Math.floor(U/65536),Ge=U-ae*65536,U=ut+ae+65535,ae=Math.floor(U/65536),ut=U-ae*65536,U=nt+ae+65535,ae=Math.floor(U/65536),nt=U-ae*65536,U=Ct+ae+65535,ae=Math.floor(U/65536),Ct=U-ae*65536,U=st+ae+65535,ae=Math.floor(U/65536),st=U-ae*65536,U=mt+ae+65535,ae=Math.floor(U/65536),mt=U-ae*65536,U=bt+ae+65535,ae=Math.floor(U/65536),bt=U-ae*65536,U=At+ae+65535,ae=Math.floor(U/65536),At=U-ae*65536,U=Et+ae+65535,ae=Math.floor(U/65536),Et=U-ae*65536,U=vt+ae+65535,ae=Math.floor(U/65536),vt=U-ae*65536,U=wt+ae+65535,ae=Math.floor(U/65536),wt=U-ae*65536,U=_t+ae+65535,ae=Math.floor(U/65536),_t=U-ae*65536,U=ct+ae+65535,ae=Math.floor(U/65536),ct=U-ae*65536,Ae+=ae-1+37*(ae-1),ae=1,U=Ae+ae+65535,ae=Math.floor(U/65536),Ae=U-ae*65536,U=Ie+ae+65535,ae=Math.floor(U/65536),Ie=U-ae*65536,U=xe+ae+65535,ae=Math.floor(U/65536),xe=U-ae*65536,U=Ge+ae+65535,ae=Math.floor(U/65536),Ge=U-ae*65536,U=ut+ae+65535,ae=Math.floor(U/65536),ut=U-ae*65536,U=nt+ae+65535,ae=Math.floor(U/65536),nt=U-ae*65536,U=Ct+ae+65535,ae=Math.floor(U/65536),Ct=U-ae*65536,U=st+ae+65535,ae=Math.floor(U/65536),st=U-ae*65536,U=mt+ae+65535,ae=Math.floor(U/65536),mt=U-ae*65536,U=bt+ae+65535,ae=Math.floor(U/65536),bt=U-ae*65536,U=At+ae+65535,ae=Math.floor(U/65536),At=U-ae*65536,U=Et+ae+65535,ae=Math.floor(U/65536),Et=U-ae*65536,U=vt+ae+65535,ae=Math.floor(U/65536),vt=U-ae*65536,U=wt+ae+65535,ae=Math.floor(U/65536),wt=U-ae*65536,U=_t+ae+65535,ae=Math.floor(U/65536),_t=U-ae*65536,U=ct+ae+65535,ae=Math.floor(U/65536),ct=U-ae*65536,Ae+=ae-1+37*(ae-1),$[0]=Ae,$[1]=Ie,$[2]=xe,$[3]=Ge,$[4]=ut,$[5]=nt,$[6]=Ct,$[7]=st,$[8]=mt,$[9]=bt,$[10]=At,$[11]=Et,$[12]=vt,$[13]=wt,$[14]=_t,$[15]=ct}function re($,Y){j($,Y,Y)}function G($,Y){var Z=r(),U;for(U=0;U<16;U++)Z[U]=Y[U];for(U=253;U>=0;U--)re(Z,Z),U!==2&&U!==4&&j(Z,Z,Y);for(U=0;U<16;U++)$[U]=Z[U]}function B($,Y){var Z=r(),U;for(U=0;U<16;U++)Z[U]=Y[U];for(U=250;U>=0;U--)re(Z,Z),U!==1&&j(Z,Z,Y);for(U=0;U<16;U++)$[U]=Z[U]}function X($,Y,Z){var U=new Uint8Array(32),ae=new Float64Array(80),Ae,Ie,xe=r(),Ge=r(),ut=r(),nt=r(),Ct=r(),st=r();for(Ie=0;Ie<31;Ie++)U[Ie]=Y[Ie];for(U[31]=Y[31]&127|64,U[0]&=248,V(ae,Z),Ie=0;Ie<16;Ie++)Ge[Ie]=ae[Ie],nt[Ie]=xe[Ie]=ut[Ie]=0;for(xe[0]=nt[0]=1,Ie=254;Ie>=0;--Ie)Ae=U[Ie>>>3]>>>(Ie&7)&1,L(xe,Ge,Ae),L(ut,nt,Ae),J(Ct,xe,ut),se(xe,xe,ut),J(ut,Ge,nt),se(Ge,Ge,nt),re(nt,Ct),re(st,xe),j(xe,ut,xe),j(ut,Ge,Ct),J(Ct,xe,ut),se(xe,xe,ut),re(Ge,xe),se(ut,nt,st),j(xe,ut,d),J(xe,xe,nt),j(ut,ut,xe),j(xe,nt,st),j(nt,Ge,ae),re(Ge,Ct),L(xe,Ge,Ae),L(ut,nt,Ae);for(Ie=0;Ie<16;Ie++)ae[Ie+16]=xe[Ie],ae[Ie+32]=ut[Ie],ae[Ie+48]=Ge[Ie],ae[Ie+64]=nt[Ie];var mt=ae.subarray(32),bt=ae.subarray(16);return G(mt,mt),j(bt,bt,mt),x($,bt),0}function ge($,Y){return X($,Y,i)}function _e($,Y){return n(Y,32),ge($,Y)}function Se($,Y,Z){var U=new Uint8Array(32);return X(U,Z,Y),C($,s,U,k)}var F=P,q=O;function z($,Y,Z,U,ae,Ae){var Ie=new Uint8Array(32);return Se(Ie,ae,Ae),F($,Y,Z,U,Ie)}function ee($,Y,Z,U,ae,Ae){var Ie=new Uint8Array(32);return Se(Ie,ae,Ae),q($,Y,Z,U,Ie)}var le=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ce($,Y,Z,U){for(var ae=new Int32Array(16),Ae=new Int32Array(16),Ie,xe,Ge,ut,nt,Ct,st,mt,bt,At,Et,vt,wt,_t,ct,ft,it,lt,ht,ot,Le,Ke,Ye,ze,We,Ze,St=$[0],xt=$[1],Bt=$[2],Ut=$[3],we=$[4],jt=$[5],Wt=$[6],Yt=$[7],Kt=Y[0],Gt=Y[1],zt=Y[2],wr=Y[3],Qt=Y[4],gr=Y[5],mr=Y[6],br=Y[7],Sr=0;U>=128;){for(ht=0;ht<16;ht++)ot=8*ht+Sr,ae[ht]=Z[ot+0]<<24|Z[ot+1]<<16|Z[ot+2]<<8|Z[ot+3],Ae[ht]=Z[ot+4]<<24|Z[ot+5]<<16|Z[ot+6]<<8|Z[ot+7];for(ht=0;ht<80;ht++)if(Ie=St,xe=xt,Ge=Bt,ut=Ut,nt=we,Ct=jt,st=Wt,mt=Yt,bt=Kt,At=Gt,Et=zt,vt=wr,wt=Qt,_t=gr,ct=mr,ft=br,Le=Yt,Ke=br,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=(we>>>14|Qt<<32-14)^(we>>>18|Qt<<32-18)^(Qt>>>41-32|we<<32-(41-32)),Ke=(Qt>>>14|we<<32-14)^(Qt>>>18|we<<32-18)^(we>>>41-32|Qt<<32-(41-32)),Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,Le=we&jt^~we&Wt,Ke=Qt&gr^~Qt&mr,Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,Le=le[ht*2],Ke=le[ht*2+1],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,Le=ae[ht%16],Ke=Ae[ht%16],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,it=We&65535|Ze<<16,lt=Ye&65535|ze<<16,Le=it,Ke=lt,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=(St>>>28|Kt<<32-28)^(Kt>>>34-32|St<<32-(34-32))^(Kt>>>39-32|St<<32-(39-32)),Ke=(Kt>>>28|St<<32-28)^(St>>>34-32|Kt<<32-(34-32))^(St>>>39-32|Kt<<32-(39-32)),Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,Le=St&xt^St&Bt^xt&Bt,Ke=Kt&Gt^Kt&zt^Gt&zt,Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,mt=We&65535|Ze<<16,ft=Ye&65535|ze<<16,Le=ut,Ke=vt,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=it,Ke=lt,Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,ut=We&65535|Ze<<16,vt=Ye&65535|ze<<16,xt=Ie,Bt=xe,Ut=Ge,we=ut,jt=nt,Wt=Ct,Yt=st,St=mt,Gt=bt,zt=At,wr=Et,Qt=vt,gr=wt,mr=_t,br=ct,Kt=ft,ht%16===15)for(ot=0;ot<16;ot++)Le=ae[ot],Ke=Ae[ot],Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=ae[(ot+9)%16],Ke=Ae[(ot+9)%16],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,it=ae[(ot+1)%16],lt=Ae[(ot+1)%16],Le=(it>>>1|lt<<32-1)^(it>>>8|lt<<32-8)^it>>>7,Ke=(lt>>>1|it<<32-1)^(lt>>>8|it<<32-8)^(lt>>>7|it<<32-7),Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,it=ae[(ot+14)%16],lt=Ae[(ot+14)%16],Le=(it>>>19|lt<<32-19)^(lt>>>61-32|it<<32-(61-32))^it>>>6,Ke=(lt>>>19|it<<32-19)^(it>>>61-32|lt<<32-(61-32))^(lt>>>6|it<<32-6),Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,ae[ot]=We&65535|Ze<<16,Ae[ot]=Ye&65535|ze<<16;Le=St,Ke=Kt,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[0],Ke=Y[0],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[0]=St=We&65535|Ze<<16,Y[0]=Kt=Ye&65535|ze<<16,Le=xt,Ke=Gt,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[1],Ke=Y[1],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[1]=xt=We&65535|Ze<<16,Y[1]=Gt=Ye&65535|ze<<16,Le=Bt,Ke=zt,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[2],Ke=Y[2],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[2]=Bt=We&65535|Ze<<16,Y[2]=zt=Ye&65535|ze<<16,Le=Ut,Ke=wr,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[3],Ke=Y[3],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[3]=Ut=We&65535|Ze<<16,Y[3]=wr=Ye&65535|ze<<16,Le=we,Ke=Qt,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[4],Ke=Y[4],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[4]=we=We&65535|Ze<<16,Y[4]=Qt=Ye&65535|ze<<16,Le=jt,Ke=gr,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[5],Ke=Y[5],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[5]=jt=We&65535|Ze<<16,Y[5]=gr=Ye&65535|ze<<16,Le=Wt,Ke=mr,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[6],Ke=Y[6],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[6]=Wt=We&65535|Ze<<16,Y[6]=mr=Ye&65535|ze<<16,Le=Yt,Ke=br,Ye=Ke&65535,ze=Ke>>>16,We=Le&65535,Ze=Le>>>16,Le=$[7],Ke=Y[7],Ye+=Ke&65535,ze+=Ke>>>16,We+=Le&65535,Ze+=Le>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,$[7]=Yt=We&65535|Ze<<16,Y[7]=br=Ye&65535|ze<<16,Sr+=128,U-=128}return U}function ne($,Y,Z){var U=new Int32Array(8),ae=new Int32Array(8),Ae=new Uint8Array(256),Ie,xe=Z;for(U[0]=1779033703,U[1]=3144134277,U[2]=1013904242,U[3]=2773480762,U[4]=1359893119,U[5]=2600822924,U[6]=528734635,U[7]=1541459225,ae[0]=4089235720,ae[1]=2227873595,ae[2]=4271175723,ae[3]=1595750129,ae[4]=2917565137,ae[5]=725511199,ae[6]=4215389547,ae[7]=327033209,ce(U,ae,Y,Z),Z%=128,Ie=0;Ie<Z;Ie++)Ae[Ie]=Y[xe-Z+Ie];for(Ae[Z]=128,Z=256-128*(Z<112?1:0),Ae[Z-9]=0,h(Ae,Z-8,xe/536870912|0,xe<<3),ce(U,ae,Ae,Z),Ie=0;Ie<8;Ie++)h($,8*Ie,U[Ie],ae[Ie]);return 0}function je($,Y){var Z=r(),U=r(),ae=r(),Ae=r(),Ie=r(),xe=r(),Ge=r(),ut=r(),nt=r();se(Z,$[1],$[0]),se(nt,Y[1],Y[0]),j(Z,Z,nt),J(U,$[0],$[1]),J(nt,Y[0],Y[1]),j(U,U,nt),j(ae,$[3],Y[3]),j(ae,ae,l),j(Ae,$[2],Y[2]),J(Ae,Ae,Ae),se(Ie,U,Z),se(xe,Ae,ae),J(Ge,Ae,ae),J(ut,U,Z),j($[0],Ie,xe),j($[1],ut,Ge),j($[2],Ge,xe),j($[3],Ie,ut)}function De($,Y,Z){var U;for(U=0;U<4;U++)L($[U],Y[U],Z)}function Fe($,Y){var Z=r(),U=r(),ae=r();G(ae,Y[2]),j(Z,Y[0],ae),j(U,Y[1],ae),x($,U),$[31]^=K(Z)<<7}function he($,Y,Z){var U,ae;for(N($[0],o),N($[1],a),N($[2],a),N($[3],o),ae=255;ae>=0;--ae)U=Z[ae/8|0]>>(ae&7)&1,De($,Y,U),je(Y,$),je($,$),De($,Y,U)}function ue($,Y){var Z=[r(),r(),r(),r()];N(Z[0],u),N(Z[1],p),N(Z[2],a),j(Z[3],u,p),he($,Z,Y)}function pe($,Y,Z){var U=new Uint8Array(64),ae=[r(),r(),r(),r()],Ae;for(Z||n(Y,32),ne(U,Y,32),U[0]&=248,U[31]&=127,U[31]|=64,ue(ae,U),Fe($,ae),Ae=0;Ae<32;Ae++)Y[Ae+32]=$[Ae];return 0}var de=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function fe($,Y){var Z,U,ae,Ae;for(U=63;U>=32;--U){for(Z=0,ae=U-32,Ae=U-12;ae<Ae;++ae)Y[ae]+=Z-16*Y[U]*de[ae-(U-32)],Z=Math.floor((Y[ae]+128)/256),Y[ae]-=Z*256;Y[ae]+=Z,Y[U]=0}for(Z=0,ae=0;ae<32;ae++)Y[ae]+=Z-(Y[31]>>4)*de[ae],Z=Y[ae]>>8,Y[ae]&=255;for(ae=0;ae<32;ae++)Y[ae]-=Z*de[ae];for(U=0;U<32;U++)Y[U+1]+=Y[U]>>8,$[U]=Y[U]&255}function ye($){var Y=new Float64Array(64),Z;for(Z=0;Z<64;Z++)Y[Z]=$[Z];for(Z=0;Z<64;Z++)$[Z]=0;fe($,Y)}function ie($,Y,Z,U){var ae=new Uint8Array(64),Ae=new Uint8Array(64),Ie=new Uint8Array(64),xe,Ge,ut=new Float64Array(64),nt=[r(),r(),r(),r()];ne(ae,U,32),ae[0]&=248,ae[31]&=127,ae[31]|=64;var Ct=Z+64;for(xe=0;xe<Z;xe++)$[64+xe]=Y[xe];for(xe=0;xe<32;xe++)$[32+xe]=ae[32+xe];for(ne(Ie,$.subarray(32),Z+32),ye(Ie),ue(nt,Ie),Fe($,nt),xe=32;xe<64;xe++)$[xe]=U[xe];for(ne(Ae,$,Z+64),ye(Ae),xe=0;xe<64;xe++)ut[xe]=0;for(xe=0;xe<32;xe++)ut[xe]=Ie[xe];for(xe=0;xe<32;xe++)for(Ge=0;Ge<32;Ge++)ut[xe+Ge]+=Ae[xe]*ae[Ge];return fe($.subarray(32),ut),Ct}function Q($,Y){var Z=r(),U=r(),ae=r(),Ae=r(),Ie=r(),xe=r(),Ge=r();return N($[2],a),V($[1],Y),re(ae,$[1]),j(Ae,ae,c),se(ae,ae,$[2]),J(Ae,$[2],Ae),re(Ie,Ae),re(xe,Ie),j(Ge,xe,Ie),j(Z,Ge,ae),j(Z,Z,Ae),B(Z,Z),j(Z,Z,ae),j(Z,Z,Ae),j(Z,Z,Ae),j($[0],Z,Ae),re(U,$[0]),j(U,U,Ae),R(U,ae)&&j($[0],$[0],f),re(U,$[0]),j(U,U,Ae),R(U,ae)?-1:(K($[0])===Y[31]>>7&&se($[0],o,$[0]),j($[3],$[0],$[1]),0)}function qe($,Y,Z,U){var ae,Ae=new Uint8Array(32),Ie=new Uint8Array(64),xe=[r(),r(),r(),r()],Ge=[r(),r(),r(),r()];if(Z<64||Q(Ge,U))return-1;for(ae=0;ae<Z;ae++)$[ae]=Y[ae];for(ae=0;ae<32;ae++)$[ae+32]=U[ae];if(ne(Ie,$,Z),ye(Ie),he(xe,Ge,Ie),ue(Ge,Y.subarray(32)),je(xe,Ge),Fe(Ae,xe),Z-=64,b(Y,0,Ae,0)){for(ae=0;ae<Z;ae++)$[ae]=0;return-1}for(ae=0;ae<Z;ae++)$[ae]=Y[ae+64];return Z}var He=32,Qe=24,dt=32,rt=16,be=32,W=32,oe=32,me=32,Te=32,Pe=Qe,ke=dt,Ne=rt,Ue=64,Re=32,Me=64,et=32,Ee=64;t.lowlevel={crypto_core_hsalsa20:C,crypto_stream_xor:I,crypto_stream:S,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:w,crypto_onetimeauth:g,crypto_onetimeauth_verify:A,crypto_verify_16:m,crypto_verify_32:b,crypto_secretbox:P,crypto_secretbox_open:O,crypto_scalarmult:X,crypto_scalarmult_base:ge,crypto_box_beforenm:Se,crypto_box_afternm:F,crypto_box:z,crypto_box_open:ee,crypto_box_keypair:_e,crypto_hash:ne,crypto_sign:ie,crypto_sign_keypair:pe,crypto_sign_open:qe,crypto_secretbox_KEYBYTES:He,crypto_secretbox_NONCEBYTES:Qe,crypto_secretbox_ZEROBYTES:dt,crypto_secretbox_BOXZEROBYTES:rt,crypto_scalarmult_BYTES:be,crypto_scalarmult_SCALARBYTES:W,crypto_box_PUBLICKEYBYTES:oe,crypto_box_SECRETKEYBYTES:me,crypto_box_BEFORENMBYTES:Te,crypto_box_NONCEBYTES:Pe,crypto_box_ZEROBYTES:ke,crypto_box_BOXZEROBYTES:Ne,crypto_sign_BYTES:Ue,crypto_sign_PUBLICKEYBYTES:Re,crypto_sign_SECRETKEYBYTES:Me,crypto_sign_SEEDBYTES:et,crypto_hash_BYTES:Ee,gf:r,D:c,L:de,pack25519:x,unpack25519:V,M:j,A:J,S:re,Z:se,pow2523:B,add:je,set25519:N,modL:fe,scalarmult:he,scalarbase:ue};function Ce($,Y){if($.length!==He)throw new Error("bad key size");if(Y.length!==Qe)throw new Error("bad nonce size")}function Oe($,Y){if($.length!==oe)throw new Error("bad public key size");if(Y.length!==me)throw new Error("bad secret key size")}function Be(){for(var $=0;$<arguments.length;$++)if(!(arguments[$]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ve($){for(var Y=0;Y<$.length;Y++)$[Y]=0}t.randomBytes=function($){var Y=new Uint8Array($);return n(Y,$),Y},t.secretbox=function($,Y,Z){Be($,Y,Z),Ce(Z,Y);for(var U=new Uint8Array(dt+$.length),ae=new Uint8Array(U.length),Ae=0;Ae<$.length;Ae++)U[Ae+dt]=$[Ae];return P(ae,U,U.length,Y,Z),ae.subarray(rt)},t.secretbox.open=function($,Y,Z){Be($,Y,Z),Ce(Z,Y);for(var U=new Uint8Array(rt+$.length),ae=new Uint8Array(U.length),Ae=0;Ae<$.length;Ae++)U[Ae+rt]=$[Ae];return U.length<32||O(ae,U,U.length,Y,Z)!==0?null:ae.subarray(dt)},t.secretbox.keyLength=He,t.secretbox.nonceLength=Qe,t.secretbox.overheadLength=rt,t.scalarMult=function($,Y){if(Be($,Y),$.length!==W)throw new Error("bad n size");if(Y.length!==be)throw new Error("bad p size");var Z=new Uint8Array(be);return X(Z,$,Y),Z},t.scalarMult.base=function($){if(Be($),$.length!==W)throw new Error("bad n size");var Y=new Uint8Array(be);return ge(Y,$),Y},t.scalarMult.scalarLength=W,t.scalarMult.groupElementLength=be,t.box=function($,Y,Z,U){var ae=t.box.before(Z,U);return t.secretbox($,Y,ae)},t.box.before=function($,Y){Be($,Y),Oe($,Y);var Z=new Uint8Array(Te);return Se(Z,$,Y),Z},t.box.after=t.secretbox,t.box.open=function($,Y,Z,U){var ae=t.box.before(Z,U);return t.secretbox.open($,Y,ae)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var $=new Uint8Array(oe),Y=new Uint8Array(me);return _e($,Y),{publicKey:$,secretKey:Y}},t.box.keyPair.fromSecretKey=function($){if(Be($),$.length!==me)throw new Error("bad secret key size");var Y=new Uint8Array(oe);return ge(Y,$),{publicKey:Y,secretKey:new Uint8Array($)}},t.box.publicKeyLength=oe,t.box.secretKeyLength=me,t.box.sharedKeyLength=Te,t.box.nonceLength=Pe,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function($,Y){if(Be($,Y),Y.length!==Me)throw new Error("bad secret key size");var Z=new Uint8Array(Ue+$.length);return ie(Z,$,$.length,Y),Z},t.sign.open=function($,Y){if(Be($,Y),Y.length!==Re)throw new Error("bad public key size");var Z=new Uint8Array($.length),U=qe(Z,$,$.length,Y);if(U<0)return null;for(var ae=new Uint8Array(U),Ae=0;Ae<ae.length;Ae++)ae[Ae]=Z[Ae];return ae},t.sign.detached=function($,Y){for(var Z=t.sign($,Y),U=new Uint8Array(Ue),ae=0;ae<U.length;ae++)U[ae]=Z[ae];return U},t.sign.detached.verify=function($,Y,Z){if(Be($,Y,Z),Y.length!==Ue)throw new Error("bad signature size");if(Z.length!==Re)throw new Error("bad public key size");var U=new Uint8Array(Ue+$.length),ae=new Uint8Array(Ue+$.length),Ae;for(Ae=0;Ae<Ue;Ae++)U[Ae]=Y[Ae];for(Ae=0;Ae<$.length;Ae++)U[Ae+Ue]=$[Ae];return qe(ae,U,U.length,Z)>=0},t.sign.keyPair=function(){var $=new Uint8Array(Re),Y=new Uint8Array(Me);return pe($,Y),{publicKey:$,secretKey:Y}},t.sign.keyPair.fromSecretKey=function($){if(Be($),$.length!==Me)throw new Error("bad secret key size");for(var Y=new Uint8Array(Re),Z=0;Z<Y.length;Z++)Y[Z]=$[32+Z];return{publicKey:Y,secretKey:new Uint8Array($)}},t.sign.keyPair.fromSeed=function($){if(Be($),$.length!==et)throw new Error("bad seed size");for(var Y=new Uint8Array(Re),Z=new Uint8Array(Me),U=0;U<32;U++)Z[U]=$[U];return pe(Y,Z,!0),{publicKey:Y,secretKey:Z}},t.sign.publicKeyLength=Re,t.sign.secretKeyLength=Me,t.sign.seedLength=et,t.sign.signatureLength=Ue,t.hash=function($){Be($);var Y=new Uint8Array(Ee);return ne(Y,$,$.length),Y},t.hash.hashLength=Ee,t.verify=function($,Y){return Be($,Y),$.length===0||Y.length===0||$.length!==Y.length?!1:y($,0,Y,0,$.length)===0},t.setPRNG=function($){n=$},function(){var $=typeof self<"u"?self.crypto||self.msCrypto:null;if($&&$.getRandomValues){var Y=65536;t.setPRNG(function(Z,U){var ae,Ae=new Uint8Array(U);for(ae=0;ae<U;ae+=Y)$.getRandomValues(Ae.subarray(ae,ae+Math.min(U-ae,Y)));for(ae=0;ae<U;ae++)Z[ae]=Ae[ae];Ve(Ae)})}else typeof uo<"u"&&($=ro,$&&$.randomBytes&&t.setPRNG(function(Z,U){var ae,Ae=$.randomBytes(U);for(ae=0;ae<U;ae++)Z[ae]=Ae[ae];Ve(Ae)}))}()})(e.exports?e.exports:self.nacl=self.nacl||{})}(j1)),j1.exports}var $1={exports:{}},Ov;function JR(){return Ov||(Ov=1,function(e){(function(t,r){e.exports?e.exports=r():(t.nacl||(t.nacl={}),t.nacl.util=r())})(Tt,function(){var t={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return t.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var s,i=unescape(encodeURIComponent(n)),o=new Uint8Array(i.length);for(s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o},t.encodeUTF8=function(n){var s,i=[];for(s=0;s<n.length;s++)i.push(String.fromCharCode(n[s]));return decodeURIComponent(escape(i.join("")))},typeof atob>"u"?typeof at.from<"u"?(t.encodeBase64=function(n){return at.from(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(at.from(n,"base64"),0))}):(t.encodeBase64=function(n){return new at(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new at(n,"base64"),0))}):(t.encodeBase64=function(n){var s,i=[],o=n.length;for(s=0;s<o;s++)i.push(String.fromCharCode(n[s]));return btoa(i.join(""))},t.decodeBase64=function(n){r(n);var s,i=atob(n),o=new Uint8Array(i.length);for(s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o}),t})}($1)),$1.exports}var Nv;function ZR(){if(Nv)return wn;Nv=1;var e=Tt&&Tt.__createBinding||(Object.create?function(p,f,h,y){y===void 0&&(y=h);var m=Object.getOwnPropertyDescriptor(f,h);(!m||("get"in m?!f.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return f[h]}}),Object.defineProperty(p,y,m)}:function(p,f,h,y){y===void 0&&(y=h),p[y]=f[h]}),t=Tt&&Tt.__setModuleDefault||(Object.create?function(p,f){Object.defineProperty(p,"default",{enumerable:!0,value:f})}:function(p,f){p.default=f}),r=Tt&&Tt.__importStar||function(p){if(p&&p.__esModule)return p;var f={};if(p!=null)for(var h in p)h!=="default"&&Object.prototype.hasOwnProperty.call(p,h)&&e(f,p,h);return t(f,p),f};Object.defineProperty(wn,"__esModule",{value:!0}),wn.getEncryptionPublicKey=wn.decryptSafely=wn.decrypt=wn.encryptSafely=wn.encrypt=void 0;const n=r(YR()),s=r(JR()),i=Zl();function o({publicKey:p,data:f,version:h}){if((0,i.isNullish)(p))throw new Error("Missing publicKey parameter");if((0,i.isNullish)(f))throw new Error("Missing data parameter");if((0,i.isNullish)(h))throw new Error("Missing version parameter");switch(h){case"x25519-xsalsa20-poly1305":{if(typeof f!="string")throw new Error("Message data must be given as a string");const y=n.box.keyPair();let m;try{m=s.decodeBase64(p)}catch{throw new Error("Bad public key")}const b=s.decodeUTF8(f),v=n.randomBytes(n.box.nonceLength),E=n.box(b,v,m,y.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:s.encodeBase64(v),ephemPublicKey:s.encodeBase64(y.publicKey),ciphertext:s.encodeBase64(E)}}default:throw new Error("Encryption type/version not supported")}}wn.encrypt=o;function a({publicKey:p,data:f,version:h}){if((0,i.isNullish)(p))throw new Error("Missing publicKey parameter");if((0,i.isNullish)(f))throw new Error("Missing data parameter");if((0,i.isNullish)(h))throw new Error("Missing version parameter");const y=2**11,m=16;if(typeof f=="object"&&f&&"toJSON"in f)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");const b={data:f,padding:""},E=at.byteLength(JSON.stringify(b),"utf-8")%y;let _=0;E>0&&(_=y-E-m),b.padding="0".repeat(_);const C=JSON.stringify(b);return o({publicKey:p,data:C,version:h})}wn.encryptSafely=a;function d({encryptedData:p,privateKey:f}){if((0,i.isNullish)(p))throw new Error("Missing encryptedData parameter");if((0,i.isNullish)(f))throw new Error("Missing privateKey parameter");switch(p.version){case"x25519-xsalsa20-poly1305":{const h=u(f),y=n.box.keyPair.fromSecretKey(h).secretKey,m=s.decodeBase64(p.nonce),b=s.decodeBase64(p.ciphertext),v=s.decodeBase64(p.ephemPublicKey),E=n.box.open(b,m,v,y);try{if(!E)throw new Error;const _=s.encodeUTF8(E);if(!_)throw new Error;return _}catch(_){throw _&&typeof _.message=="string"&&_.message.length?new Error(`Decryption failed: ${_.message}`):new Error("Decryption failed.")}}default:throw new Error("Encryption type/version not supported.")}}wn.decrypt=d;function c({encryptedData:p,privateKey:f}){if((0,i.isNullish)(p))throw new Error("Missing encryptedData parameter");if((0,i.isNullish)(f))throw new Error("Missing privateKey parameter");return JSON.parse(d({encryptedData:p,privateKey:f})).data}wn.decryptSafely=c;function l(p){const f=u(p),h=n.box.keyPair.fromSecretKey(f).publicKey;return s.encodeBase64(h)}wn.getEncryptionPublicKey=l;function u(p){const f=at.from(p,"hex").toString("base64");return s.decodeBase64(f)}return wn}var Dv;function Fy(){return Dv||(Dv=1,function(e){var t=Tt&&Tt.__createBinding||(Object.create?function(s,i,o,a){a===void 0&&(a=o);var d=Object.getOwnPropertyDescriptor(i,o);(!d||("get"in d?!i.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(s,a,d)}:function(s,i,o,a){a===void 0&&(a=o),s[a]=i[o]}),r=Tt&&Tt.__exportStar||function(s,i){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(VR(),e),r(WR(),e),r(ZR(),e);var n=Zl();Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(_1)),_1}var xv;function h9(){return xv||(xv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.verifyProfileSignature=e.getTypedData=e.getTypeInformation=e.getDomainInformation=void 0;const t=$e,r=Fy(),n=Aa,s=d=>({name:"PUSH CHAT ID",chainId:d,verifyingContract:"0x0000000000000000000000000000000000000000"});e.getDomainInformation=s;const i=()=>({Data:[{name:"data",type:"string"}]});e.getTypeInformation=i;const o=(d,c,l)=>{const u={data:d},p=(0,e.getTypeInformation)(),f=(0,e.getDomainInformation)(c),h="Data";let y,m={};return l==="V1"?y={EIP712Domain:[],Data:p.Data}:(y={EIP712Domain:[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Data:p.Data},m=f),{types:y,primaryType:h,domain:m,message:u}};e.getTypedData=o;const a=(d,c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const u="eip712v2",p="eip191",f="eip191v2";let h=null,y;const m=d.split(":")[0];if(m!==u&&m!==p&&m!==f||d.split(":").length>3)return!1;if(d.split(":").length===2?y=d.split(":")[1]:(h=parseInt(d.split(":")[1]),y=d.split(":")[2]),m===u)try{const b=(0,e.getTypedData)(c,h,"V2");return(0,r.recoverTypedSignature)({data:b,signature:y,version:r.SignTypedDataVersion.V4}).toLowerCase()===l.toLowerCase()}catch{const v=(0,e.getTypedData)(c,h,"V1");return(0,r.recoverTypedSignature)({data:v,signature:y,version:r.SignTypedDataVersion.V4}).toLowerCase()===l.toLowerCase()}else try{return(yield n.recoverAddress({hash:n.hashMessage(c),signature:y})).toLowerCase()===l.toLowerCase()}catch{return!1}});e.verifyProfileSignature=a}(v1)),v1}var V1={},Uv;function XR(){return Uv||(Uv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getEncryptedSecret=void 0;const t=$e,r=Ao(),n=Je(),s=tt(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{sessionKey:a,env:d=n.default.ENV.PROD}=o||{};try{if(a==null)throw new Error("sessionKey is required");const l=`${(0,s.getAPIBaseUrls)(d)}/v1/chat/encryptedsecret/sessionKey/${a}`;return r.default.get(l).then(u=>u.data.encryptedSecret).catch(u=>{var p,f;throw!((p=u==null?void 0:u.response)===null||p===void 0)&&p.data?new Error((f=u==null?void 0:u.response)===null||f===void 0?void 0:f.data):new Error(u)})}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.getEncryptedSecret.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.getEncryptedSecret.name} -: ${c}`)}});e.getEncryptedSecret=i}(V1)),V1}var F1={},Wn={},H1={},Bv;function QR(){return Bv||(Bv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HttpStatus=void 0,function(t){t[t.BadRequest=400]="BadRequest",t[t.NotFound=404]="NotFound",t[t.Forbidden=403]="Forbidden",t[t.InternalError=500]="InternalError"}(e.HttpStatus||(e.HttpStatus={}))}(H1)),H1}var Lv;function Xt(){if(Lv)return Wn;Lv=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.handleError=Wn.isErrorWithResponseV2=Wn.isErrorWithResponse=Wn.ValidationError=void 0;const e=QR();class t extends Error{constructor(o,a,d,c){super(d),this.name="ValidationError",this.status=o,this.errorCode=a,this.details=c}format(){return{status:this.status,errorCode:this.errorCode,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}Wn.ValidationError=t;function r(i){return typeof i=="object"&&i!==null&&"response"in i&&typeof i.response=="object"&&i.response!==null&&"status"in i.response&&"data"in i.response&&typeof i.response.data=="object"&&"status"in i.response.data&&"errorCode"in i.response.data&&"message"in i.response.data&&"details"in i.response.data&&"timestamp"in i.response.data}Wn.isErrorWithResponse=r;function n(i){return typeof i=="object"&&i!==null&&"response"in i&&typeof i.response=="object"&&i.response!==null&&"status"in i.response&&"data"in i.response&&typeof i.response.data=="object"&&"error"in i.response.data&&"message"in i.response.data&&"validation"in i.response.data}Wn.isErrorWithResponseV2=n;function s(i,o){var a,d,c;let l=e.HttpStatus.InternalError,u="00000000000",p="An unexpected error occurred. Please contact support or try again later.",f="";if(r(i)){if(l=((a=i.response)===null||a===void 0?void 0:a.status)||e.HttpStatus.InternalError,!((d=i.response)===null||d===void 0)&&d.data){const m=i.response.data;u=m.errorCode||u,p=m.message||p,f=m.details||JSON.stringify(m)}}else if(n(i)){l=((c=i.response)===null||c===void 0?void 0:c.status)||e.HttpStatus.InternalError;const m=i.response.data;p=m.message||p,f=m.validation||JSON.stringify(m)}else i instanceof Error&&(p=i.message,f=i.stack||"");const h=new t(l,u,p,f),y=`[Error - API ${o}]`;return console.error(`${y} ${JSON.stringify(h.format(),null,2)}`),h}return Wn.handleError=s,Wn}var Kv;function Xl(){return Kv||(Kv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroup=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,env:c=n.default.ENV.PROD}=a||{};try{if(d==null||d.length==0)throw new Error("chatId cannot be null or empty");const u=`${(0,r.getAPIBaseUrls)(c)}/v1/chat/groups/${d}`;return(yield(0,s.axiosGet)(u)).data}catch(l){throw(0,i.handleError)(l,e.getGroup.name)}});e.getGroup=o}(F1)),F1}var Qo={},ec={},qv;function ek(){var p,f,y,m,b,v,E,_,C,k,D,w,S,I,T,g,A,P,O,N,M,L,x,R,K,V,Hy,se,j,re,G,B,p9,ge,_e,Se,F,ws,z,Es,le,Gy,ne,je,mf,Fe,bf,ue,or,de,zy,ye,sl,Q,As,He,Wy;if(qv)return ec;qv=1,Object.defineProperty(ec,"__esModule",{value:!0}),ec.LRUCache=void 0;const e=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,t=new Set,r=typeof Mr=="object"&&Mr?Mr:{},n=(rt,be,W,oe)=>{typeof r.emitWarning=="function"?r.emitWarning(rt,be,W,oe):console.error(`[${W}] ${be}: ${rt}`)};let s=globalThis.AbortController,i=globalThis.AbortSignal;if(typeof s>"u"){i=class{constructor(){ur(this,"onabort");ur(this,"_onabort",[]);ur(this,"reason");ur(this,"aborted",!1)}addEventListener(oe,me){this._onabort.push(me)}},s=class{constructor(){ur(this,"signal",new i);be()}abort(oe){var me,Te;if(!this.signal.aborted){this.signal.reason=oe,this.signal.aborted=!0;for(const Pe of this.signal._onabort)Pe(oe);(Te=(me=this.signal).onabort)==null||Te.call(me,oe)}}};let rt=((p=r.env)==null?void 0:p.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const be=()=>{rt&&(rt=!1,n("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",be))}}const o=rt=>!t.has(rt),a=rt=>rt&&rt===Math.floor(rt)&&rt>0&&isFinite(rt),d=rt=>a(rt)?rt<=Math.pow(2,8)?Uint8Array:rt<=Math.pow(2,16)?Uint16Array:rt<=Math.pow(2,32)?Uint32Array:rt<=Number.MAX_SAFE_INTEGER?c:null:null;class c extends Array{constructor(be){super(be),this.fill(0)}}const h=class h{constructor(be,W){ur(this,"heap");ur(this,"length");if(!ve(h,f))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new W(be),this.length=0}static create(be){const W=d(be);if(!W)return[];Pt(h,f,!0);const oe=new h(be,W);return Pt(h,f,!1),oe}push(be){this.heap[this.length++]=be}pop(){return this.heap[--this.length]}};f=new WeakMap,Ot(h,f,!1);let l=h;const dt=class dt{constructor(be){Ot(this,V);Ot(this,B);Ot(this,F);Ot(this,z);Ot(this,le);Ot(this,je);Ot(this,Fe);Ot(this,ue);Ot(this,de);Ot(this,ye);Ot(this,Q);Ot(this,He);Ot(this,y,void 0);Ot(this,m,void 0);Ot(this,b,void 0);Ot(this,v,void 0);Ot(this,E,void 0);Ot(this,_,void 0);ur(this,"ttl");ur(this,"ttlResolution");ur(this,"ttlAutopurge");ur(this,"updateAgeOnGet");ur(this,"updateAgeOnHas");ur(this,"allowStale");ur(this,"noDisposeOnSet");ur(this,"noUpdateTTL");ur(this,"maxEntrySize");ur(this,"sizeCalculation");ur(this,"noDeleteOnFetchRejection");ur(this,"noDeleteOnStaleGet");ur(this,"allowStaleOnFetchAbort");ur(this,"allowStaleOnFetchRejection");ur(this,"ignoreFetchAbort");Ot(this,C,void 0);Ot(this,k,void 0);Ot(this,D,void 0);Ot(this,w,void 0);Ot(this,S,void 0);Ot(this,I,void 0);Ot(this,T,void 0);Ot(this,g,void 0);Ot(this,A,void 0);Ot(this,P,void 0);Ot(this,O,void 0);Ot(this,N,void 0);Ot(this,M,void 0);Ot(this,L,void 0);Ot(this,x,void 0);Ot(this,R,void 0);Ot(this,K,void 0);Ot(this,se,()=>{});Ot(this,j,()=>{});Ot(this,re,()=>{});Ot(this,G,()=>!1);Ot(this,ge,be=>{});Ot(this,_e,(be,W,oe)=>{});Ot(this,Se,(be,W,oe,me)=>{if(oe||me)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});ur(this,ne,"LRUCache");const{max:W=0,ttl:oe,ttlResolution:me=1,ttlAutopurge:Te,updateAgeOnGet:Pe,updateAgeOnHas:ke,allowStale:Ne,dispose:Ue,disposeAfter:Re,noDisposeOnSet:Me,noUpdateTTL:et,maxSize:Ee=0,maxEntrySize:Ce=0,sizeCalculation:Oe,fetchMethod:Be,memoMethod:Ve,noDeleteOnFetchRejection:$,noDeleteOnStaleGet:Y,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:U,ignoreFetchAbort:ae}=be;if(W!==0&&!a(W))throw new TypeError("max option must be a nonnegative integer");const Ae=W?d(W):Array;if(!Ae)throw new Error("invalid max value: "+W);if(Pt(this,y,W),Pt(this,m,Ee),this.maxEntrySize=Ce||ve(this,m),this.sizeCalculation=Oe,this.sizeCalculation){if(!ve(this,m)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(Ve!==void 0&&typeof Ve!="function")throw new TypeError("memoMethod must be a function if defined");if(Pt(this,_,Ve),Be!==void 0&&typeof Be!="function")throw new TypeError("fetchMethod must be a function if specified");if(Pt(this,E,Be),Pt(this,R,!!Be),Pt(this,D,new Map),Pt(this,w,new Array(W).fill(void 0)),Pt(this,S,new Array(W).fill(void 0)),Pt(this,I,new Ae(W)),Pt(this,T,new Ae(W)),Pt(this,g,0),Pt(this,A,0),Pt(this,P,l.create(W)),Pt(this,C,0),Pt(this,k,0),typeof Ue=="function"&&Pt(this,b,Ue),typeof Re=="function"?(Pt(this,v,Re),Pt(this,O,[])):(Pt(this,v,void 0),Pt(this,O,void 0)),Pt(this,x,!!ve(this,b)),Pt(this,K,!!ve(this,v)),this.noDisposeOnSet=!!Me,this.noUpdateTTL=!!et,this.noDeleteOnFetchRejection=!!$,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!ae,this.maxEntrySize!==0){if(ve(this,m)!==0&&!a(ve(this,m)))throw new TypeError("maxSize must be a positive integer if specified");if(!a(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");gt(this,B,p9).call(this)}if(this.allowStale=!!Ne,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!Pe,this.updateAgeOnHas=!!ke,this.ttlResolution=a(me)||me===0?me:1,this.ttlAutopurge=!!Te,this.ttl=oe||0,this.ttl){if(!a(this.ttl))throw new TypeError("ttl must be a positive integer if specified");gt(this,V,Hy).call(this)}if(ve(this,y)===0&&this.ttl===0&&ve(this,m)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!ve(this,y)&&!ve(this,m)){const Ie="LRU_CACHE_UNBOUNDED";o(Ie)&&(t.add(Ie),n("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ie,dt))}}static unsafeExposeInternals(be){return{starts:ve(be,M),ttls:ve(be,L),sizes:ve(be,N),keyMap:ve(be,D),keyList:ve(be,w),valList:ve(be,S),next:ve(be,I),prev:ve(be,T),get head(){return ve(be,g)},get tail(){return ve(be,A)},free:ve(be,P),isBackgroundFetch:W=>{var oe;return gt(oe=be,ue,or).call(oe,W)},backgroundFetch:(W,oe,me,Te)=>{var Pe;return gt(Pe=be,Fe,bf).call(Pe,W,oe,me,Te)},moveToTail:W=>{var oe;return gt(oe=be,ye,sl).call(oe,W)},indexes:W=>{var oe;return gt(oe=be,F,ws).call(oe,W)},rindexes:W=>{var oe;return gt(oe=be,z,Es).call(oe,W)},isStale:W=>{var oe;return ve(oe=be,G).call(oe,W)}}}get max(){return ve(this,y)}get maxSize(){return ve(this,m)}get calculatedSize(){return ve(this,k)}get size(){return ve(this,C)}get fetchMethod(){return ve(this,E)}get memoMethod(){return ve(this,_)}get dispose(){return ve(this,b)}get disposeAfter(){return ve(this,v)}getRemainingTTL(be){return ve(this,D).has(be)?1/0:0}*entries(){for(const be of gt(this,F,ws).call(this))ve(this,S)[be]!==void 0&&ve(this,w)[be]!==void 0&&!gt(this,ue,or).call(this,ve(this,S)[be])&&(yield[ve(this,w)[be],ve(this,S)[be]])}*rentries(){for(const be of gt(this,z,Es).call(this))ve(this,S)[be]!==void 0&&ve(this,w)[be]!==void 0&&!gt(this,ue,or).call(this,ve(this,S)[be])&&(yield[ve(this,w)[be],ve(this,S)[be]])}*keys(){for(const be of gt(this,F,ws).call(this)){const W=ve(this,w)[be];W!==void 0&&!gt(this,ue,or).call(this,ve(this,S)[be])&&(yield W)}}*rkeys(){for(const be of gt(this,z,Es).call(this)){const W=ve(this,w)[be];W!==void 0&&!gt(this,ue,or).call(this,ve(this,S)[be])&&(yield W)}}*values(){for(const be of gt(this,F,ws).call(this))ve(this,S)[be]!==void 0&&!gt(this,ue,or).call(this,ve(this,S)[be])&&(yield ve(this,S)[be])}*rvalues(){for(const be of gt(this,z,Es).call(this))ve(this,S)[be]!==void 0&&!gt(this,ue,or).call(this,ve(this,S)[be])&&(yield ve(this,S)[be])}[Symbol.iterator](){return this.entries()}find(be,W={}){for(const oe of gt(this,F,ws).call(this)){const me=ve(this,S)[oe],Te=gt(this,ue,or).call(this,me)?me.__staleWhileFetching:me;if(Te!==void 0&&be(Te,ve(this,w)[oe],this))return this.get(ve(this,w)[oe],W)}}forEach(be,W=this){for(const oe of gt(this,F,ws).call(this)){const me=ve(this,S)[oe],Te=gt(this,ue,or).call(this,me)?me.__staleWhileFetching:me;Te!==void 0&&be.call(W,Te,ve(this,w)[oe],this)}}rforEach(be,W=this){for(const oe of gt(this,z,Es).call(this)){const me=ve(this,S)[oe],Te=gt(this,ue,or).call(this,me)?me.__staleWhileFetching:me;Te!==void 0&&be.call(W,Te,ve(this,w)[oe],this)}}purgeStale(){let be=!1;for(const W of gt(this,z,Es).call(this,{allowStale:!0}))ve(this,G).call(this,W)&&(gt(this,Q,As).call(this,ve(this,w)[W],"expire"),be=!0);return be}info(be){const W=ve(this,D).get(be);if(W===void 0)return;const oe=ve(this,S)[W],me=gt(this,ue,or).call(this,oe)?oe.__staleWhileFetching:oe;if(me===void 0)return;const Te={value:me};if(ve(this,L)&&ve(this,M)){const Pe=ve(this,L)[W],ke=ve(this,M)[W];if(Pe&&ke){const Ne=Pe-(e.now()-ke);Te.ttl=Ne,Te.start=Date.now()}}return ve(this,N)&&(Te.size=ve(this,N)[W]),Te}dump(){const be=[];for(const W of gt(this,F,ws).call(this,{allowStale:!0})){const oe=ve(this,w)[W],me=ve(this,S)[W],Te=gt(this,ue,or).call(this,me)?me.__staleWhileFetching:me;if(Te===void 0||oe===void 0)continue;const Pe={value:Te};if(ve(this,L)&&ve(this,M)){Pe.ttl=ve(this,L)[W];const ke=e.now()-ve(this,M)[W];Pe.start=Math.floor(Date.now()-ke)}ve(this,N)&&(Pe.size=ve(this,N)[W]),be.unshift([oe,Pe])}return be}load(be){this.clear();for(const[W,oe]of be){if(oe.start){const me=Date.now()-oe.start;oe.start=e.now()-me}this.set(W,oe.value,oe)}}set(be,W,oe={}){var et,Ee,Ce,Oe,Be;if(W===void 0)return this.delete(be),this;const{ttl:me=this.ttl,start:Te,noDisposeOnSet:Pe=this.noDisposeOnSet,sizeCalculation:ke=this.sizeCalculation,status:Ne}=oe;let{noUpdateTTL:Ue=this.noUpdateTTL}=oe;const Re=ve(this,Se).call(this,be,W,oe.size||0,ke);if(this.maxEntrySize&&Re>this.maxEntrySize)return Ne&&(Ne.set="miss",Ne.maxEntrySizeExceeded=!0),gt(this,Q,As).call(this,be,"set"),this;let Me=ve(this,C)===0?void 0:ve(this,D).get(be);if(Me===void 0)Me=ve(this,C)===0?ve(this,A):ve(this,P).length!==0?ve(this,P).pop():ve(this,C)===ve(this,y)?gt(this,je,mf).call(this,!1):ve(this,C),ve(this,w)[Me]=be,ve(this,S)[Me]=W,ve(this,D).set(be,Me),ve(this,I)[ve(this,A)]=Me,ve(this,T)[Me]=ve(this,A),Pt(this,A,Me),ad(this,C)._++,ve(this,_e).call(this,Me,Re,Ne),Ne&&(Ne.set="add"),Ue=!1;else{gt(this,ye,sl).call(this,Me);const Ve=ve(this,S)[Me];if(W!==Ve){if(ve(this,R)&>(this,ue,or).call(this,Ve)){Ve.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:$}=Ve;$!==void 0&&!Pe&&(ve(this,x)&&((et=ve(this,b))==null||et.call(this,$,be,"set")),ve(this,K)&&((Ee=ve(this,O))==null||Ee.push([$,be,"set"])))}else Pe||(ve(this,x)&&((Ce=ve(this,b))==null||Ce.call(this,Ve,be,"set")),ve(this,K)&&((Oe=ve(this,O))==null||Oe.push([Ve,be,"set"])));if(ve(this,ge).call(this,Me),ve(this,_e).call(this,Me,Re,Ne),ve(this,S)[Me]=W,Ne){Ne.set="replace";const $=Ve&>(this,ue,or).call(this,Ve)?Ve.__staleWhileFetching:Ve;$!==void 0&&(Ne.oldValue=$)}}else Ne&&(Ne.set="update")}if(me!==0&&!ve(this,L)&>(this,V,Hy).call(this),ve(this,L)&&(Ue||ve(this,re).call(this,Me,me,Te),Ne&&ve(this,j).call(this,Ne,Me)),!Pe&&ve(this,K)&&ve(this,O)){const Ve=ve(this,O);let $;for(;$=Ve==null?void 0:Ve.shift();)(Be=ve(this,v))==null||Be.call(this,...$)}return this}pop(){var be;try{for(;ve(this,C);){const W=ve(this,S)[ve(this,g)];if(gt(this,je,mf).call(this,!0),gt(this,ue,or).call(this,W)){if(W.__staleWhileFetching)return W.__staleWhileFetching}else if(W!==void 0)return W}}finally{if(ve(this,K)&&ve(this,O)){const W=ve(this,O);let oe;for(;oe=W==null?void 0:W.shift();)(be=ve(this,v))==null||be.call(this,...oe)}}}has(be,W={}){const{updateAgeOnHas:oe=this.updateAgeOnHas,status:me}=W,Te=ve(this,D).get(be);if(Te!==void 0){const Pe=ve(this,S)[Te];if(gt(this,ue,or).call(this,Pe)&&Pe.__staleWhileFetching===void 0)return!1;if(ve(this,G).call(this,Te))me&&(me.has="stale",ve(this,j).call(this,me,Te));else return oe&&ve(this,se).call(this,Te),me&&(me.has="hit",ve(this,j).call(this,me,Te)),!0}else me&&(me.has="miss");return!1}peek(be,W={}){const{allowStale:oe=this.allowStale}=W,me=ve(this,D).get(be);if(me===void 0||!oe&&ve(this,G).call(this,me))return;const Te=ve(this,S)[me];return gt(this,ue,or).call(this,Te)?Te.__staleWhileFetching:Te}async fetch(be,W={}){const{allowStale:oe=this.allowStale,updateAgeOnGet:me=this.updateAgeOnGet,noDeleteOnStaleGet:Te=this.noDeleteOnStaleGet,ttl:Pe=this.ttl,noDisposeOnSet:ke=this.noDisposeOnSet,size:Ne=0,sizeCalculation:Ue=this.sizeCalculation,noUpdateTTL:Re=this.noUpdateTTL,noDeleteOnFetchRejection:Me=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:et=this.allowStaleOnFetchRejection,ignoreFetchAbort:Ee=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ce=this.allowStaleOnFetchAbort,context:Oe,forceRefresh:Be=!1,status:Ve,signal:$}=W;if(!ve(this,R))return Ve&&(Ve.fetch="get"),this.get(be,{allowStale:oe,updateAgeOnGet:me,noDeleteOnStaleGet:Te,status:Ve});const Y={allowStale:oe,updateAgeOnGet:me,noDeleteOnStaleGet:Te,ttl:Pe,noDisposeOnSet:ke,size:Ne,sizeCalculation:Ue,noUpdateTTL:Re,noDeleteOnFetchRejection:Me,allowStaleOnFetchRejection:et,allowStaleOnFetchAbort:Ce,ignoreFetchAbort:Ee,status:Ve,signal:$};let Z=ve(this,D).get(be);if(Z===void 0){Ve&&(Ve.fetch="miss");const U=gt(this,Fe,bf).call(this,be,Z,Y,Oe);return U.__returned=U}else{const U=ve(this,S)[Z];if(gt(this,ue,or).call(this,U)){const Ge=oe&&U.__staleWhileFetching!==void 0;return Ve&&(Ve.fetch="inflight",Ge&&(Ve.returnedStale=!0)),Ge?U.__staleWhileFetching:U.__returned=U}const ae=ve(this,G).call(this,Z);if(!Be&&!ae)return Ve&&(Ve.fetch="hit"),gt(this,ye,sl).call(this,Z),me&&ve(this,se).call(this,Z),Ve&&ve(this,j).call(this,Ve,Z),U;const Ae=gt(this,Fe,bf).call(this,be,Z,Y,Oe),xe=Ae.__staleWhileFetching!==void 0&&oe;return Ve&&(Ve.fetch=ae?"stale":"refresh",xe&&ae&&(Ve.returnedStale=!0)),xe?Ae.__staleWhileFetching:Ae.__returned=Ae}}async forceFetch(be,W={}){const oe=await this.fetch(be,W);if(oe===void 0)throw new Error("fetch() returned undefined");return oe}memo(be,W={}){const oe=ve(this,_);if(!oe)throw new Error("no memoMethod provided to constructor");const{context:me,forceRefresh:Te,...Pe}=W,ke=this.get(be,Pe);if(!Te&&ke!==void 0)return ke;const Ne=oe(be,ke,{options:Pe,context:me});return this.set(be,Ne,Pe),Ne}get(be,W={}){const{allowStale:oe=this.allowStale,updateAgeOnGet:me=this.updateAgeOnGet,noDeleteOnStaleGet:Te=this.noDeleteOnStaleGet,status:Pe}=W,ke=ve(this,D).get(be);if(ke!==void 0){const Ne=ve(this,S)[ke],Ue=gt(this,ue,or).call(this,Ne);return Pe&&ve(this,j).call(this,Pe,ke),ve(this,G).call(this,ke)?(Pe&&(Pe.get="stale"),Ue?(Pe&&oe&&Ne.__staleWhileFetching!==void 0&&(Pe.returnedStale=!0),oe?Ne.__staleWhileFetching:void 0):(Te||gt(this,Q,As).call(this,be,"expire"),Pe&&oe&&(Pe.returnedStale=!0),oe?Ne:void 0)):(Pe&&(Pe.get="hit"),Ue?Ne.__staleWhileFetching:(gt(this,ye,sl).call(this,ke),me&&ve(this,se).call(this,ke),Ne))}else Pe&&(Pe.get="miss")}delete(be){return gt(this,Q,As).call(this,be,"delete")}clear(){return gt(this,He,Wy).call(this,"delete")}};ne=Symbol.toStringTag,y=new WeakMap,m=new WeakMap,b=new WeakMap,v=new WeakMap,E=new WeakMap,_=new WeakMap,C=new WeakMap,k=new WeakMap,D=new WeakMap,w=new WeakMap,S=new WeakMap,I=new WeakMap,T=new WeakMap,g=new WeakMap,A=new WeakMap,P=new WeakMap,O=new WeakMap,N=new WeakMap,M=new WeakMap,L=new WeakMap,x=new WeakMap,R=new WeakMap,K=new WeakMap,V=new WeakSet,Hy=function(){const be=new c(ve(this,y)),W=new c(ve(this,y));Pt(this,L,be),Pt(this,M,W),Pt(this,re,(Te,Pe,ke=e.now())=>{if(W[Te]=Pe!==0?ke:0,be[Te]=Pe,Pe!==0&&this.ttlAutopurge){const Ne=setTimeout(()=>{ve(this,G).call(this,Te)&>(this,Q,As).call(this,ve(this,w)[Te],"expire")},Pe+1);Ne.unref&&Ne.unref()}}),Pt(this,se,Te=>{W[Te]=be[Te]!==0?e.now():0}),Pt(this,j,(Te,Pe)=>{if(be[Pe]){const ke=be[Pe],Ne=W[Pe];if(!ke||!Ne)return;Te.ttl=ke,Te.start=Ne,Te.now=oe||me();const Ue=Te.now-Ne;Te.remainingTTL=ke-Ue}});let oe=0;const me=()=>{const Te=e.now();if(this.ttlResolution>0){oe=Te;const Pe=setTimeout(()=>oe=0,this.ttlResolution);Pe.unref&&Pe.unref()}return Te};this.getRemainingTTL=Te=>{const Pe=ve(this,D).get(Te);if(Pe===void 0)return 0;const ke=be[Pe],Ne=W[Pe];if(!ke||!Ne)return 1/0;const Ue=(oe||me())-Ne;return ke-Ue},Pt(this,G,Te=>{const Pe=W[Te],ke=be[Te];return!!ke&&!!Pe&&(oe||me())-Pe>ke})},se=new WeakMap,j=new WeakMap,re=new WeakMap,G=new WeakMap,B=new WeakSet,p9=function(){const be=new c(ve(this,y));Pt(this,k,0),Pt(this,N,be),Pt(this,ge,W=>{Pt(this,k,ve(this,k)-be[W]),be[W]=0}),Pt(this,Se,(W,oe,me,Te)=>{if(gt(this,ue,or).call(this,oe))return 0;if(!a(me))if(Te){if(typeof Te!="function")throw new TypeError("sizeCalculation must be a function");if(me=Te(oe,W),!a(me))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return me}),Pt(this,_e,(W,oe,me)=>{if(be[W]=oe,ve(this,m)){const Te=ve(this,m)-be[W];for(;ve(this,k)>Te;)gt(this,je,mf).call(this,!0)}Pt(this,k,ve(this,k)+be[W]),me&&(me.entrySize=oe,me.totalCalculatedSize=ve(this,k))})},ge=new WeakMap,_e=new WeakMap,Se=new WeakMap,F=new WeakSet,ws=function*({allowStale:be=this.allowStale}={}){if(ve(this,C))for(let W=ve(this,A);!(!gt(this,le,Gy).call(this,W)||((be||!ve(this,G).call(this,W))&&(yield W),W===ve(this,g)));)W=ve(this,T)[W]},z=new WeakSet,Es=function*({allowStale:be=this.allowStale}={}){if(ve(this,C))for(let W=ve(this,g);!(!gt(this,le,Gy).call(this,W)||((be||!ve(this,G).call(this,W))&&(yield W),W===ve(this,A)));)W=ve(this,I)[W]},le=new WeakSet,Gy=function(be){return be!==void 0&&ve(this,D).get(ve(this,w)[be])===be},je=new WeakSet,mf=function(be){var Te,Pe;const W=ve(this,g),oe=ve(this,w)[W],me=ve(this,S)[W];return ve(this,R)&>(this,ue,or).call(this,me)?me.__abortController.abort(new Error("evicted")):(ve(this,x)||ve(this,K))&&(ve(this,x)&&((Te=ve(this,b))==null||Te.call(this,me,oe,"evict")),ve(this,K)&&((Pe=ve(this,O))==null||Pe.push([me,oe,"evict"]))),ve(this,ge).call(this,W),be&&(ve(this,w)[W]=void 0,ve(this,S)[W]=void 0,ve(this,P).push(W)),ve(this,C)===1?(Pt(this,g,Pt(this,A,0)),ve(this,P).length=0):Pt(this,g,ve(this,I)[W]),ve(this,D).delete(oe),ad(this,C)._--,W},Fe=new WeakSet,bf=function(be,W,oe,me){const Te=W===void 0?void 0:ve(this,S)[W];if(gt(this,ue,or).call(this,Te))return Te;const Pe=new s,{signal:ke}=oe;ke==null||ke.addEventListener("abort",()=>Pe.abort(ke.reason),{signal:Pe.signal});const Ne={signal:Pe.signal,options:oe,context:me},Ue=(Oe,Be=!1)=>{const{aborted:Ve}=Pe.signal,$=oe.ignoreFetchAbort&&Oe!==void 0;if(oe.status&&(Ve&&!Be?(oe.status.fetchAborted=!0,oe.status.fetchError=Pe.signal.reason,$&&(oe.status.fetchAbortIgnored=!0)):oe.status.fetchResolved=!0),Ve&&!$&&!Be)return Me(Pe.signal.reason);const Y=Ee;return ve(this,S)[W]===Ee&&(Oe===void 0?Y.__staleWhileFetching?ve(this,S)[W]=Y.__staleWhileFetching:gt(this,Q,As).call(this,be,"fetch"):(oe.status&&(oe.status.fetchUpdated=!0),this.set(be,Oe,Ne.options))),Oe},Re=Oe=>(oe.status&&(oe.status.fetchRejected=!0,oe.status.fetchError=Oe),Me(Oe)),Me=Oe=>{const{aborted:Be}=Pe.signal,Ve=Be&&oe.allowStaleOnFetchAbort,$=Ve||oe.allowStaleOnFetchRejection,Y=$||oe.noDeleteOnFetchRejection,Z=Ee;if(ve(this,S)[W]===Ee&&(!Y||Z.__staleWhileFetching===void 0?gt(this,Q,As).call(this,be,"fetch"):Ve||(ve(this,S)[W]=Z.__staleWhileFetching)),$)return oe.status&&Z.__staleWhileFetching!==void 0&&(oe.status.returnedStale=!0),Z.__staleWhileFetching;if(Z.__returned===Z)throw Oe},et=(Oe,Be)=>{var $;const Ve=($=ve(this,E))==null?void 0:$.call(this,be,Te,Ne);Ve&&Ve instanceof Promise&&Ve.then(Y=>Oe(Y===void 0?void 0:Y),Be),Pe.signal.addEventListener("abort",()=>{(!oe.ignoreFetchAbort||oe.allowStaleOnFetchAbort)&&(Oe(void 0),oe.allowStaleOnFetchAbort&&(Oe=Y=>Ue(Y,!0)))})};oe.status&&(oe.status.fetchDispatched=!0);const Ee=new Promise(et).then(Ue,Re),Ce=Object.assign(Ee,{__abortController:Pe,__staleWhileFetching:Te,__returned:void 0});return W===void 0?(this.set(be,Ce,{...Ne.options,status:void 0}),W=ve(this,D).get(be)):ve(this,S)[W]=Ce,Ce},ue=new WeakSet,or=function(be){if(!ve(this,R))return!1;const W=be;return!!W&&W instanceof Promise&&W.hasOwnProperty("__staleWhileFetching")&&W.__abortController instanceof s},de=new WeakSet,zy=function(be,W){ve(this,T)[W]=be,ve(this,I)[be]=W},ye=new WeakSet,sl=function(be){be!==ve(this,A)&&(be===ve(this,g)?Pt(this,g,ve(this,I)[be]):gt(this,de,zy).call(this,ve(this,T)[be],ve(this,I)[be]),gt(this,de,zy).call(this,ve(this,A),be),Pt(this,A,be))},Q=new WeakSet,As=function(be,W){var me,Te,Pe,ke;let oe=!1;if(ve(this,C)!==0){const Ne=ve(this,D).get(be);if(Ne!==void 0)if(oe=!0,ve(this,C)===1)gt(this,He,Wy).call(this,W);else{ve(this,ge).call(this,Ne);const Ue=ve(this,S)[Ne];if(gt(this,ue,or).call(this,Ue)?Ue.__abortController.abort(new Error("deleted")):(ve(this,x)||ve(this,K))&&(ve(this,x)&&((me=ve(this,b))==null||me.call(this,Ue,be,W)),ve(this,K)&&((Te=ve(this,O))==null||Te.push([Ue,be,W]))),ve(this,D).delete(be),ve(this,w)[Ne]=void 0,ve(this,S)[Ne]=void 0,Ne===ve(this,A))Pt(this,A,ve(this,T)[Ne]);else if(Ne===ve(this,g))Pt(this,g,ve(this,I)[Ne]);else{const Re=ve(this,T)[Ne];ve(this,I)[Re]=ve(this,I)[Ne];const Me=ve(this,I)[Ne];ve(this,T)[Me]=ve(this,T)[Ne]}ad(this,C)._--,ve(this,P).push(Ne)}}if(ve(this,K)&&((Pe=ve(this,O))!=null&&Pe.length)){const Ne=ve(this,O);let Ue;for(;Ue=Ne==null?void 0:Ne.shift();)(ke=ve(this,v))==null||ke.call(this,...Ue)}return oe},He=new WeakSet,Wy=function(be){var W,oe,me;for(const Te of gt(this,z,Es).call(this,{allowStale:!0})){const Pe=ve(this,S)[Te];if(gt(this,ue,or).call(this,Pe))Pe.__abortController.abort(new Error("deleted"));else{const ke=ve(this,w)[Te];ve(this,x)&&((W=ve(this,b))==null||W.call(this,Pe,ke,be)),ve(this,K)&&((oe=ve(this,O))==null||oe.push([Pe,ke,be]))}}if(ve(this,D).clear(),ve(this,S).fill(void 0),ve(this,w).fill(void 0),ve(this,L)&&ve(this,M)&&(ve(this,L).fill(0),ve(this,M).fill(0)),ve(this,N)&&ve(this,N).fill(0),Pt(this,g,0),Pt(this,A,0),ve(this,P).length=0,Pt(this,k,0),Pt(this,C,0),ve(this,K)&&ve(this,O)){const Te=ve(this,O);let Pe;for(;Pe=Te==null?void 0:Te.shift();)(me=ve(this,v))==null||me.call(this,...Pe)}};let u=dt;return ec.LRUCache=u,ec}var jv;function Q2(){if(jv)return Qo;jv=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.cache=void 0;const e=ek();return Qo.cache=new e.LRUCache({max:200,maxSize:500*1024,sizeCalculation:(t,r)=>typeof t=="string"?t.length:new TextEncoder().encode(JSON.stringify(t)).length,ttl:1e3*60*5,allowStale:!1}),Qo}var tc={},$v;function y9(){if($v)return tc;$v=1,Object.defineProperty(tc,"__esModule",{value:!0}),tc.getCID=void 0;const e=$e,t=Je(),r=Xt(),n=tt(),s=It();function i(o,a){return e.__awaiter(this,void 0,void 0,function*(){const{env:d=t.default.ENV.PROD}=a||{},l=`${(0,n.getAPIBaseUrls)(d)}/v1/ipfs/${o}`;try{return(yield(0,s.axiosGet)(l)).data}catch(u){throw(0,r.handleError)(u,i.name)}})}return tc.getCID=i,tc}var Vv;function xh(){return Vv||(Vv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptAndVerifyMessage=e.getDecryptedPrivateKey=e.getEip712Signature=e.getEip191Signature=e.getEncryptedRequestCore=e.getEncryptedRequest=e.decryptFeeds=e.signMessageWithPGPCore=e.signMessageWithPGP=e.encryptAndSignCore=e.encryptAndSign=void 0;const t=$e,r=kh(),n=Sa(),s=Fr,i=kn(),o=tt(),a=kn(),d=i9(),c=Je(),l=h9(),u=Sa(),p=XR(),f=Xl(),h=Q2(),y=y9(),m="eip712v2",b=({plainText:g,keys:A,privateKeyArmored:P,secretKey:O})=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.encryptAndSignCore)({plainText:g,keys:A,privateKeyArmored:P,secretKey:O,pgpHelper:r.PGPHelper})});e.encryptAndSign=b;const v=({plainText:g,keys:A,privateKeyArmored:P,secretKey:O,pgpHelper:N})=>t.__awaiter(void 0,void 0,void 0,function*(){const M=n.aesEncrypt({plainText:g,secretKey:O}),L=yield N.pgpEncrypt({plainText:O,keys:A}),x=yield N.sign({message:M,signingKey:P});return{cipherText:M,encryptedSecret:L,signature:x,sigType:"pgp",encType:"pgp"}});e.encryptAndSignCore=v;const E=({message:g,privateKeyArmored:A})=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.signMessageWithPGPCore)({message:g,privateKeyArmored:A,pgpHelper:r.PGPHelper})});e.signMessageWithPGP=E;const _=({message:g,privateKeyArmored:A,pgpHelper:P})=>t.__awaiter(void 0,void 0,void 0,function*(){return{signature:yield P.sign({message:g,signingKey:A}),sigType:"pgp"}});e.signMessageWithPGPCore=_;const C=({feeds:g,connectedUser:A,pgpPrivateKey:P,env:O=c.default.ENV.PROD,pgpHelper:N})=>t.__awaiter(void 0,void 0,void 0,function*(){const M=L=>t.__awaiter(void 0,void 0,void 0,function*(){if(!P)throw new Error("Decrypted private key is necessary");if(L.msg.encType!=="PlainText"){const x=L.msg.fromCAIP10,R=x===A.wallets.split(",")[0];let K;if(R)K=A.publicKey;else{const V=`pgpPubKey-${x}`;if(h.cache.has(V))K=h.cache.get(V);else{const J=yield(0,a.get)({account:x,env:O});h.cache.set(V,J.publicKey),K=J.publicKey}}L.msg=yield(0,e.decryptAndVerifyMessage)(L.msg,K,P,O,N)}});for(const L of g)yield M(L);return g});e.decryptFeeds=C;const k=(g,A,P,O,N,M,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.getEncryptedRequestCore)(g,A,P,O,N,M,L,r.PGPHelper)});e.getEncryptedRequest=k;const D=(g,A,P,O,N,M,L,x)=>t.__awaiter(void 0,void 0,void 0,function*(){if(O)if(M)if(M.isPublic){const{signature:R}=yield(0,e.signMessageWithPGPCore)({message:P,privateKeyArmored:A.privateKey,pgpHelper:x});return{message:P,encryptionType:"PlainText",aesEncryptedSecret:"",signature:R}}else if(M.sessionKey&&M.encryptedSecret){const R=n.aesEncrypt({plainText:P,secretKey:L}),K=yield x.sign({message:R,signingKey:A.privateKey});return{message:R,encryptionType:"pgpv1:group",aesEncryptedSecret:null,signature:K}}else{const K=(yield(0,f.getGroup)({chatId:M.chatId,env:N})).members.map(j=>j.publicKey),{cipherText:V,encryptedSecret:J,signature:se}=yield(0,e.encryptAndSignCore)({plainText:P,keys:K,privateKeyArmored:A.privateKey,secretKey:L,pgpHelper:x});return{message:V,encryptionType:"pgp",aesEncryptedSecret:J,signature:se}}else throw new Error("Unable to find Group Data");else{const R=yield(0,i.get)({account:g,env:N});if(R!=null&&R.publicKey)if(R.publicKey.includes("-----BEGIN PGP PUBLIC KEY BLOCK-----")){const{cipherText:K,encryptedSecret:V,signature:J}=yield(0,e.encryptAndSignCore)({plainText:P,keys:[R.publicKey,A.publicKey],privateKeyArmored:A.privateKey,secretKey:L,pgpHelper:x});return{message:K,encryptionType:"pgp",aesEncryptedSecret:V,signature:J}}else{const{signature:K}=yield(0,e.signMessageWithPGPCore)({message:P,privateKeyArmored:A.privateKey,pgpHelper:x});return{message:P,encryptionType:"PlainText",aesEncryptedSecret:"",signature:K}}else{if(!(0,o.isValidPushCAIP)(g))throw new Error("Invalid receiver address!");yield(0,d.createUserService)({user:g,publicKey:"",encryptedPrivateKey:"",env:N});const{signature:K}=yield(0,e.signMessageWithPGPCore)({message:P,privateKeyArmored:A.privateKey,pgpHelper:x});return{message:P,encryptionType:"PlainText",aesEncryptedSecret:"",signature:K}}}});e.getEncryptedRequestCore=D;const w=(g,A,P="v1")=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(g!=null&&g.signer))return console.warn("This method is deprecated. Provide signer in the function"),{signature:"xyz",sigType:"a"};const O=g==null?void 0:g.signer,M=yield new o.Signer(O).signMessage(A);return{verificationProof:`${P==="v1"?"eip191":"eip191v2"}:${M}`}});e.getEip191Signature=w;const S=(g,A,P)=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(g!=null&&g.signer))return console.warn("This method is deprecated. Provide signer in the function"),{signature:"xyz",sigType:"a"};const O=(0,l.getTypeInformation)(),N=g==null?void 0:g.signer,M=new o.Signer(N);let L;try{L=yield M.getChainId()}catch{L=1}const x=(0,l.getDomainInformation)(L),R=yield M.signTypedData(P?{}:x,O,{data:A},"Data");return{verificationProof:P?`${m}:${R}`:`${m}:${L}:${R}`}});e.getEip712Signature=S;function I(g,A,P,O){return t.__awaiter(this,void 0,void 0,function*(){let N;return g.signer?N=yield(0,o.decryptPGPKey)({signer:g.signer,encryptedPGPPrivateKey:A.encryptedPrivateKey,env:O}):N=yield(0,o.decryptWithWalletRPCMethod)(A.encryptedPrivateKey,P),N})}e.getDecryptedPrivateKey=I;const T=(g,A,P,O,N=r.PGPHelper)=>t.__awaiter(void 0,void 0,void 0,function*(){if(g.verificationProof&&g.verificationProof.split(":")[0]==="pgpv2"){const L={fromDID:g.fromDID,toDID:g.fromDID,fromCAIP10:g.fromCAIP10,toCAIP10:g.toCAIP10,messageObj:g.messageObj,messageType:g.messageType,encType:g.encType,encryptedSecret:g.encryptedSecret},x=s.SHA256(JSON.stringify(L)).toString(),R=g.verificationProof.split(":")[1];yield N.verifySignature({messageContent:x,signatureArmored:R,publicKeyArmored:A})}else if(g.verificationProof&&g.verificationProof.split(":")[0]==="pgpv3"){const L={fromDID:g.fromDID,toDID:g.fromDID,fromCAIP10:g.fromCAIP10,toCAIP10:g.toCAIP10,messageObj:g.messageObj,messageType:g.messageType,encType:g.encType,sessionKey:g.sessionKey,encryptedSecret:g.encryptedSecret},x=s.SHA256(JSON.stringify(L)).toString(),R=g.verificationProof.split(":")[1];yield N.verifySignature({messageContent:x,signatureArmored:R,publicKeyArmored:A})}else if(g.link==null){const L={fromDID:g.fromDID,toDID:g.toDID,messageContent:g.messageContent,messageType:g.messageType},x=s.SHA256(JSON.stringify(L)).toString();try{yield N.verifySignature({messageContent:x,signatureArmored:g.signature,publicKeyArmored:A})}catch{yield N.verifySignature({messageContent:g.messageContent,signatureArmored:g.signature,publicKeyArmored:A})}}else yield N.verifySignature({messageContent:g.messageContent,signatureArmored:g.signature,publicKeyArmored:A});const M=Object.assign({},g);try{let L;if(g.encType==="pgpv1:group"){const x=`sessionKey-${g.sessionKey}`;if(h.cache.has(x))L=h.cache.get(x);else{const R=yield(0,p.getEncryptedSecret)({sessionKey:g.sessionKey,env:O});L=yield N.pgpDecrypt({cipherText:R,toPrivateKeyArmored:P}),h.cache.set(x,L)}}else L=yield N.pgpDecrypt({cipherText:g.encryptedSecret,toPrivateKeyArmored:P});if(M.messageContent=(0,u.aesDecrypt)({cipherText:g.messageContent,secretKey:L}),g.messageObj){const x=(0,u.aesDecrypt)({cipherText:g.messageObj,secretKey:L});try{M.messageObj=JSON.parse(x)}catch{M.messageObj=x}try{if(M.messageObj.reference){const R=M.messageObj.reference;if(R&&R.split(":").length===1){const K=yield(0,y.getCID)(R,{env:O});M.messageObj.reference=K.cid}}}catch{}}}catch{M.messageContent=M.messageObj="Unable to Decrypt Message"}return M});e.decryptAndVerifyMessage=T}(j0)),j0}var on={},Fv;function tk(){if(Fv)return on;Fv=1,Object.defineProperty(on,"__esModule",{value:!0}),on.addDeprecatedInfoToMessages=on.addDeprecatedInfo=on.decryptConversation=on.getTrendingSpaceInboxLists=on.getSpaceInboxLists=on.getInboxLists=void 0;const e=$e,t=kh(),r=Je(),n=tt(),s=kn(),i=y9(),o=xh(),a=Q2(),d=(p,f=t.PGPHelper)=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:h,user:y,toDecrypt:m,pgpPrivateKey:b,env:v=r.default.ENV.PROD}=p||{};if(m){const E=yield(0,s.get)({account:(0,n.pCAIP10ToWallet)(y),env:v});return(0,o.decryptFeeds)({feeds:h,connectedUser:E,pgpPrivateKey:b,pgpHelper:f,env:v})}return h});on.getInboxLists=d;const c=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:f,user:h,toDecrypt:y,pgpPrivateKey:m,env:b=r.default.ENV.PROD}=p||{},v=yield(0,s.get)({account:(0,n.pCAIP10ToWallet)(h),env:b}),E=[];for(const _ of f){let C;_.threadhash!==null?C=yield(0,i.getCID)(_.threadhash,{env:b}):C={encType:"PlainText",encryptedSecret:"",fromCAIP10:"",fromDID:"",link:"",messageContent:"",messageType:"",sigType:"",signature:"",toCAIP10:"",toDID:""},E.push(Object.assign(Object.assign({},_),{msg:C,spaceInformation:_.spaceInformation}))}return y?(0,o.decryptFeeds)({feeds:E,connectedUser:v,pgpPrivateKey:m,pgpHelper:t.PGPHelper,env:b}):E});on.getSpaceInboxLists=c;const l=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:f,env:h=r.default.ENV.PROD}=p||{},y=[];for(const m of f){let b;m.threadhash!==null?b=yield(0,i.getCID)(m.threadhash,{env:h}):b={encType:"PlainText",encryptedSecret:"",fromCAIP10:"",fromDID:"",link:"",messageContent:"",messageType:"",sigType:"",signature:"",toCAIP10:"",toDID:""},y.push(Object.assign(Object.assign({},m),{msg:b,spaceInformation:m.spaceInformation}))}return y});on.getTrendingSpaceInboxLists=l;const u=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{messages:f,connectedUser:h,pgpPrivateKey:y,pgpHelper:m=t.PGPHelper,env:b=r.default.ENV.PROD}=p||{};let v;for(let E=0;E<f.length;E++){const _=f[E];if(_.encType!=="PlainText"&&(_.messageObj===void 0||typeof _.messageObj=="string")){if(!y)throw Error("Decrypted private key is necessary");if(_.fromCAIP10!==h.wallets.split(",")[0]){const C=`pgpPubKey-${_.fromCAIP10}`;if(a.cache.has(C))v=a.cache.get(C);else{const k=yield(0,s.get)({account:_.fromCAIP10,env:b});a.cache.set(C,k.publicKey),v=k.publicKey}}else v=h.publicKey;f[E]=yield(0,o.decryptAndVerifyMessage)(_,v,y,b,m)}}return f});return on.decryptConversation=u,on.addDeprecatedInfo=(()=>{const p={};return f=>(f.forEach(h=>{if((0,n.isValidNFTCAIP)(h.did)){const y=h.did.split(":").slice(0,5).join(":"),m=h.did.split(":")[5];(!p[y]||m>p[y].split(":")[5])&&(p[y]=h.did)}}),f.forEach(h=>{if((0,n.isValidNFTCAIP)(h.did)){const y=h.did.split(":").slice(0,5).join(":");p[y]!==h.did&&(h.deprecated=!0,h.deprecatedCode="NFT Owner Changed")}}),f)})(),on.addDeprecatedInfoToMessages=(()=>{const p={};return f=>(f.forEach(h=>{if((0,n.isValidNFTCAIP)(h.fromDID)){const y=h.fromDID.split(":").slice(0,5).join(":"),m=h.fromDID.split(":")[5];(!p[y]||m>p[y].split(":")[5])&&(p[y]=h.fromDID)}}),f.forEach(h=>{if((0,n.isValidNFTCAIP)(h.fromDID)){const y=h.fromDID.split(":").slice(0,5).join(":");p[y]!==h.fromDID&&(h.deprecated=!0,h.deprecatedCode="NFT Owner Changed")}}),f)})(),on}var G1={},rc={},z1={},Hv;function g9(){return Hv||(Hv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMembers=void 0;const t=$e,r=Ao(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,page:c=1,limit:l=20,env:u=s.default.ENV.PROD,pending:p,role:f}=a;try{if(!d)throw new Error("Chat ID is required.");let y=`${(0,n.getAPIBaseUrls)(u)}/v1/chat/groups/${d}/members?pageNumber=${c}&pageSize=${l}`;return p!==void 0&&(y+=`&pending=${p}`),f&&(y+=`&role=${encodeURIComponent(f)}`),(yield r.default.get(y)).data.members}catch(h){throw(0,i.handleError)(h,e.getGroupMembers.name)}});e.getGroupMembers=o}(z1)),z1}var W1={},Gv;function eg(){return Gv||(Gv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMemberCount=void 0;const t=$e,r=Ao(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,env:c=s.default.ENV.PROD}=a;try{if(!d)throw new Error("Chat ID is required.");const u=`${(0,n.getAPIBaseUrls)(c)}/v1/chat/groups/${d}/members/count`,p=yield r.default.get(u),{totalMembersCount:f}=p.data;return f}catch(l){throw(0,i.handleError)(l,e.getGroupMemberCount.name)}});e.getGroupMemberCount=o}(W1)),W1}var zv;function rk(){if(zv)return rc;zv=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.getAllGroupMembers=void 0;const e=$e,t=g9(),r=eg(),n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{chatId:i,env:o}=s,d=(yield(0,r.getGroupMemberCount)({chatId:i,env:o})).overallCount,c=5e3,l=Math.ceil(d/c),u=Array.from({length:l},(y,m)=>m+1),p=[],f=u.map(y=>(0,t.getGroupMembers)({chatId:i,env:o,page:y,limit:c}));return(yield Promise.all(f)).forEach(y=>{y.length>0&&p.push(...y)}),p});return rc.getAllGroupMembers=n,rc}var Y1={},Wv;function Ql(){return Wv||(Wv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SpaceListType=e.ChatListType=void 0,function(t){t.CHATS="CHATS",t.REQUESTS="REQUESTS"}(e.ChatListType||(e.ChatListType={})),function(t){t.SPACES="SPACES",t.REQUESTS="REQUESTS"}(e.SpaceListType||(e.SpaceListType={}))}(Y1)),Y1}var Yv;function m9(){return Yv||(Yv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSpacesMembersList=e.getMembersList=e.convertToWalletAddressList=e.getSpaceAdminsList=e.getAdminsList=e.updateGroupPayload=e.groupAccessToSpaceAccess=e.convertRulesToSpaceRules=e.convertSpaceRulesToRules=e.mapSpaceListTypeToChatListType=e.spaceDtoToSpaceInfoDto=e.groupInfoDtoToSpaceInfoDto=e.groupDtoToSpaceDtoV2=e.groupDtoToSpaceDto=e.createGroupPayload=e.rejectRequestPayload=e.sendMessagePayloadCore=e.sendMessagePayload=void 0;const t=$e,r=tt(),n=xh(),s=Je(),i=kh(),o=Sa(),a=Fr,d=rk(),c=Ql(),l=(g,A,P,O,N,M,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.sendMessagePayloadCore)(g,A,P,O,N,M,L,i.PGPHelper)});e.sendMessagePayload=l;const u=(g,A,P,O,N,M,L,x)=>t.__awaiter(void 0,void 0,void 0,function*(){const R=M!==null;let K;R&&(M!=null&&M.encryptedSecret)&&M.sessionKey?K=yield(0,i.pgpDecrypt)({cipherText:M.encryptedSecret,toPrivateKeyArmored:A.privateKey}):K=o.generateRandomSecret(15);const{message:V,signature:J}=yield(0,n.getEncryptedRequestCore)(g,A,O,R,L,M,K,x),{message:se,encryptionType:j,aesEncryptedSecret:re}=yield(0,n.getEncryptedRequestCore)(g,A,JSON.stringify(P),R,L,M,K,x),G={fromDID:(0,r.walletToPCAIP10)(A.wallets.split(",")[0]),toDID:R?g:(0,r.walletToPCAIP10)(g),fromCAIP10:(0,r.walletToPCAIP10)(A.wallets.split(",")[0]),toCAIP10:R?g:(0,r.walletToPCAIP10)(g),messageType:N,messageObj:j==="PlainText"?P:se,encType:j,sessionKey:M&&!M.isPublic&&j==="pgpv1:group"?M.sessionKey:null,encryptedSecret:re,messageContent:V,signature:J,sigType:"pgpv3"},B={fromDID:G.fromDID,toDID:G.fromDID,fromCAIP10:G.fromCAIP10,toCAIP10:G.toCAIP10,messageObj:G.messageObj,messageType:G.messageType,encType:G.encType,sessionKey:G.sessionKey,encryptedSecret:G.encryptedSecret},X=a.SHA256(JSON.stringify(B)).toString(),ge=yield x.sign({message:X,signingKey:A.privateKey});return G.verificationProof=`pgpv3:${ge}`,G});e.sendMessagePayloadCore=u;const p=(g,A,P,O)=>({fromDID:g,toDID:A,verificationProof:P+":"+O});e.rejectRequestPayload=p;const f=(g,A,P,O,N,M,L,x,R,K,V,J,se,j,re,G,B)=>({groupName:g,groupDescription:L,members:A,groupImage:x,admins:P,isPublic:O,contractAddressNFT:R,numberOfNFTs:K,contractAddressERC20:V,numberOfERC20:J,groupCreator:N,verificationProof:M,meta:se,groupType:j,scheduleAt:re,scheduleEnd:G,rules:B});e.createGroupPayload=f;const h=g=>{var A;const P={members:g.members.map(O=>({wallet:O.wallet,publicKey:O.publicKey,isSpeaker:O.isAdmin,image:O.image})),pendingMembers:g.pendingMembers.map(O=>({wallet:O.wallet,publicKey:O.publicKey,isSpeaker:O.isAdmin,image:O.image})),contractAddressERC20:g.contractAddressERC20,numberOfERC20:g.numberOfERC20,contractAddressNFT:g.contractAddressNFT,numberOfNFTTokens:g.numberOfNFTTokens,verificationProof:g.verificationProof,spaceImage:g.groupImage,spaceName:g.groupName,isPublic:g.isPublic,spaceDescription:g.groupDescription,spaceCreator:g.groupCreator,spaceId:g.chatId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:(A=g.status)!==null&&A!==void 0?A:null,meta:g.meta};return g.rules&&(P.rules={entry:g.rules.entry}),P};e.groupDtoToSpaceDto=h;const y=(g,A=s.ENV.PROD)=>t.__awaiter(void 0,void 0,void 0,function*(){var P;const O=yield(0,d.getAllGroupMembers)({chatId:g.chatId,env:A}),N={members:O.filter(M=>M.intent).map(M=>{var L,x;return{wallet:M.address,publicKey:(L=M.userInfo.publicKey)!==null&&L!==void 0?L:"",isSpeaker:M.role==="admin",image:(x=M.userInfo.profile.picture)!==null&&x!==void 0?x:""}}),pendingMembers:O.filter(M=>!M.intent).map(M=>{var L,x;return{wallet:M.address,publicKey:(L=M.userInfo.publicKey)!==null&&L!==void 0?L:"",isSpeaker:M.role==="admin",image:(x=M.userInfo.profile.picture)!==null&&x!==void 0?x:""}}),contractAddressERC20:null,numberOfERC20:0,contractAddressNFT:null,numberOfNFTTokens:0,verificationProof:"a",spaceImage:g.groupImage,spaceName:g.groupName,isPublic:g.isPublic,spaceDescription:g.groupDescription,spaceCreator:g.groupCreator,spaceId:g.chatId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:(P=g.status)!==null&&P!==void 0?P:null,meta:g.meta};return g.rules&&(N.rules={entry:g.rules.entry}),N});e.groupDtoToSpaceDtoV2=y;const m=g=>{var A,P,O,N,M;return{spaceName:g.groupName,spaceImage:g.groupImage,spaceDescription:g.groupDescription,isPublic:g.isPublic,spaceCreator:g.groupCreator,spaceId:g.chatId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:(A=g.status)!==null&&A!==void 0?A:null,rules:(P=g.rules)!==null&&P!==void 0?P:null,meta:(O=g.meta)!==null&&O!==void 0?O:null,sessionKey:(N=g.sessionKey)!==null&&N!==void 0?N:null,encryptedSecret:(M=g.encryptedSecret)!==null&&M!==void 0?M:null}};e.groupInfoDtoToSpaceInfoDto=m;const b=g=>({spaceName:g.spaceName,spaceImage:g.spaceImage,spaceDescription:g.spaceDescription,isPublic:g.isPublic,spaceCreator:g.spaceCreator,spaceId:g.spaceId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:g.status,rules:g.rules,meta:g.meta,sessionKey:null,encryptedSecret:null,inviteeDetails:g.inviteeDetails});e.spaceDtoToSpaceInfoDto=b;const v=g=>{switch(g){case c.SpaceListType.SPACES:return c.ChatListType.CHATS;case c.SpaceListType.REQUESTS:return c.ChatListType.REQUESTS;default:throw new Error(`Unsupported SpaceListType: ${g}`)}};e.mapSpaceListTypeToChatListType=v;const E=g=>({entry:g.entry,chat:void 0});e.convertSpaceRulesToRules=E;const _=g=>({entry:g.entry});e.convertRulesToSpaceRules=_;const C=g=>{const A={entry:g.entry};return g.rules&&(A.rules=(0,e.convertRulesToSpaceRules)(g.rules)),A};e.groupAccessToSpaceAccess=C;const k=(g,A,P,O,N,M,L,x,R,K,V,J,se)=>Object.assign(Object.assign({groupName:g,groupImage:x,groupDescription:L,members:A,admins:P,address:O,verificationProof:N,encryptedSecret:M,scheduleAt:R,scheduleEnd:K,status:V},J!==void 0&&{meta:J}),se!==void 0&&{rules:se});e.updateGroupPayload=k;const D=(g,A)=>{const P=g?(0,e.convertToWalletAddressList)(g.filter(M=>M.isAdmin)):[],O=A?(0,e.convertToWalletAddressList)(A.filter(M=>M.isAdmin)):[];return[...P,...O]};e.getAdminsList=D;const w=(g,A)=>{const P=g?(0,e.convertToWalletAddressList)(g.filter(M=>M.isSpeaker)):[],O=A?(0,e.convertToWalletAddressList)(A.filter(M=>M.isSpeaker)):[];return[...P,...O]};e.getSpaceAdminsList=w;const S=g=>g?g.map(A=>A.wallet):[];e.convertToWalletAddressList=S;const I=(g,A)=>{const P=[...g||[],...A||[]];return(0,e.convertToWalletAddressList)(P)};e.getMembersList=I;const T=(g,A)=>{const P=[...g||[],...A||[]];return(0,e.convertToWalletAddressList)(P)};e.getSpacesMembersList=T}(G1)),G1}var En={},Jv;function nk(){if(Jv)return En;Jv=1,Object.defineProperty(En,"__esModule",{value:!0}),En.validateGroupMemberUpdateOptions=En.updateGroupRequestValidator=En.validateScheduleDates=En.createSpaceRequestValidator=En.createGroupRequestValidator=void 0;const e=tt(),t=(o,a,d,c,l,u,p,f)=>{if(o==null||o.length==0)throw new Error("groupName cannot be null or empty");if(o.length>50)throw new Error("groupName cannot be more than 50 characters");if(c&&c.length>150)throw new Error("groupDescription cannot be more than 150 characters");if(a==null)throw new Error("members cannot be null");for(let h=0;h<a.length;h++)if(a[h]&&!(0,e.isValidPushCAIP)(a[h]))throw new Error("Invalid member address!");if(d==null)throw new Error("admins cannot be null");for(let h=0;h<d.length;h++)if(!(0,e.isValidPushCAIP)(d[h]))throw new Error("Invalid admin address!");if(l!=null&&(l==null?void 0:l.length)>0&&!(0,e.isValidFullCAIP10)(l))throw new Error("Invalid contractAddressNFT address!");if(u!=null&&u<0)throw new Error("numberOfNFTs cannot be negative number");if(p!=null&&(p==null?void 0:p.length)>0&&!(0,e.isValidFullCAIP10)(p))throw new Error("Invalid contractAddressERC20 address!");if(f!=null&&f<0)throw new Error("numberOfERC20 cannot be negative number")};En.createGroupRequestValidator=t;const r=(o,a,d,c,l,u,p,f)=>{if(o==null||o.length==0)throw new Error("spaceName cannot be null or empty");if(o.length>50)throw new Error("groupName cannot be more than 50 characters");if(a&&a.length>150)throw new Error("spaceDescription cannot be more than 150 characters");if(d==null)throw new Error("members cannot be null");for(let h=0;h<d.length;h++)if(d[h]&&!(0,e.isValidPushCAIP)(d[h]))throw new Error("Invalid member address!");if(c==null)throw new Error("admins cannot be null");for(let h=0;h<c.length;h++)if(!(0,e.isValidPushCAIP)(c[h]))throw new Error("Invalid admin address!");if(l!=null&&(l==null?void 0:l.length)>0&&!(0,e.isValidFullCAIP10)(l))throw new Error("Invalid contractAddressNFT address!");if(u!=null&&u<0)throw new Error("numberOfNFTs cannot be negative number");if(p!=null&&(p==null?void 0:p.length)>0&&!(0,e.isValidFullCAIP10)(p))throw new Error("Invalid contractAddressERC20 address!");if(f!=null&&f<0)throw new Error("numberOfERC20 cannot be negative number")};En.createSpaceRequestValidator=r;const n=(o,a)=>{if(o){const d=new Date(o),c=new Date;if(d<c)throw new Error("Schedule start time must be in the future.");if(a){const l=new Date(a);if(l<c)throw new Error("Schedule end time must be in the future.");if(d>=l)throw new Error("Schedule start time must be earlier than end time.")}}};En.validateScheduleDates=n;const s=(o,a,d,c,l,u)=>{if(o==null||o.length==0)throw new Error("chatId cannot be null or empty");if(a==null||a.length==0)throw new Error("groupName cannot be null or empty");if(a!=null&&a.length>50)throw new Error("groupName cannot be more than 50 characters");if(u&&u!=null&&u.length>150)throw new Error("groupDescription cannot be more than 150 characters");if(d!=null&&d.length>0){for(let p=0;p<d.length;p++)if(!(0,e.isValidPushCAIP)(d[p]))throw new Error("Invalid member address in members list!")}if(c!=null&&c.length>0){for(let p=0;p<c.length;p++)if(!(0,e.isValidPushCAIP)(c[p]))throw new Error("Invalid member address in admins list!")}if(l!=null&&!(0,e.isValidPushCAIP)(l))throw new Error("Invalid address field!")};En.updateGroupRequestValidator=s;const i=o=>{const{chatId:a,upsert:d,remove:c}=o;if(!a||a.trim().length===0)throw new Error("Chat ID cannot be null or empty.");const l=["members","admins"];if(Object.keys(d).forEach(u=>{if(!l.includes(u))throw new Error(`Invalid role: ${u}. Allowed roles are ${l.join(", ")}.`);if(d[u]&&d[u].length>1e3)throw new Error(`${u} array cannot have more than 1000 addresses.`);d[u].forEach(p=>{if(!(0,e.isValidPushCAIP)(p))throw new Error(`Invalid address found in ${u} list.`)})}),c&&c.length>1e3)throw new Error("Remove array cannot have more than 1000 addresses.");c.forEach(u=>{if(!(0,e.isValidPushCAIP)(u))throw new Error("Invalid address found in remove list.")})};return En.validateGroupMemberUpdateOptions=i,En}var nc={},Zv;function ik(){if(Zv)return nc;Zv=1,Object.defineProperty(nc,"__esModule",{value:!0}),nc.getGroup=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=(i,o)=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:a=r.default.ENV.PROD}=i||{},c=`${(0,t.getAPIBaseUrls)(a)}/v1/chat/groups/${o}`;return(0,n.axiosGet)(c).then(l=>l.data).catch(l=>{throw console.error(`[Push SDK] - API ${c}: `,l),Error(`[Push SDK] - API ${c}: ${l}`)})});return nc.getGroup=s,nc}var Xv;function Mt(){return Xv||(Xv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$e;t.__exportStar(Sa(),e),t.__exportStar(kh(),e),t.__exportStar(eR(),e),t.__exportStar(xh(),e),t.__exportStar(i9(),e),t.__exportStar(tk(),e),t.__exportStar(m9(),e),t.__exportStar(nk(),e),t.__exportStar(ik(),e),t.__exportStar(Y7(),e)}(n0)),n0}var Ud={},Qv;function Da(){if(Qv)return Ud;Qv=1,Object.defineProperty(Ud,"__esModule",{value:!0});const e={"PUSH-CREATE-01":{progressId:"PUSH-CREATE-01",progressTitle:"Generating Secure Profile Signature",progressInfo:"This step is only done for first time users and might take a few seconds. PGP keys are getting generated to provide you with secure yet seamless web3 communication",level:"INFO"},"PUSH-CREATE-02":{progressId:"PUSH-CREATE-02",progressTitle:"Signing Generated Profile",progressInfo:"This step is only done for first time users. Please sign the message to continue.",level:"INFO"},"PUSH-CREATE-03":{progressId:"PUSH-CREATE-03",progressTitle:"Encrypting Generated Profile",progressInfo:"Encrypting your keys. Please sign the message to continue.",level:"INFO"},"PUSH-CREATE-04":{progressId:"PUSH-CREATE-04",progressTitle:"Syncing Generated Profile",progressInfo:"Please sign the message to continue. Great job! You are almost fully onboarded to Push Protocol!",level:"INFO"},"PUSH-CREATE-05":{progressId:"PUSH-CREATE-05",progressTitle:"Setup Complete",progressInfo:"",level:"SUCCESS"},"PUSH-UPGRADE-01":{progressId:"PUSH-UPGRADE-01",progressTitle:"Generating New Profile Signature",progressInfo:"Trying to Upgrade Push Keys to latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-02":{progressId:"PUSH-UPGRADE-02",progressTitle:"Decrypting Old Profile",progressInfo:"Trying to Upgrade Push Keys to latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-03":{progressId:"PUSH-UPGRADE-03",progressTitle:"Generating Encrypted New Profile",progressInfo:"Trying to Upgrade Push Keys to latest version. Encrypting Push Keys with latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-04":{progressId:"PUSH-UPGRADE-04",progressTitle:"Syncing New Profile",progressInfo:"Please sign the message to continue. Upgraded keys are almost ready!",level:"INFO"},"PUSH-UPGRADE-05":{progressId:"PUSH-UPGRADE-05",progressTitle:"Upgrade Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-DECRYPT-01":{progressId:"PUSH-DECRYPT-01",progressTitle:"Decrypting Profile",progressInfo:"Please sign the transaction to decrypt profile",level:"INFO"},"PUSH-DECRYPT-02":{progressId:"PUSH-DECRYPT-02",progressTitle:"Push Profile Unlocked",progressInfo:"Unlocking push profile",level:"SUCCESS"},"PUSH-AUTH-UPDATE-01":t=>({progressId:"PUSH-AUTH-UPDATE-01",progressTitle:"Generating New Profile Signature",progressInfo:`Trying to Update Push Keys to ${t} version. Please sign the message to continue.`,level:"INFO"}),"PUSH-AUTH-UPDATE-02":t=>({progressId:"PUSH-AUTH-UPDATE-02",progressTitle:"Generating New Encrypted Profile",progressInfo:`Encrypting Push Keys with ${t} version. Please sign the message to continue.`,level:"INFO"}),"PUSH-AUTH-UPDATE-03":{progressId:"PUSH-AUTH-UPDATE-03",progressTitle:"Syncing Updated Profile",progressInfo:"Please sign the message to continue. Updated keys are almost ready!",level:"INFO"},"PUSH-AUTH-UPDATE-04":{progressId:"PUSH-AUTH-UPDATE-04",progressTitle:"Update Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-AUTH-UPDATE-05":{progressId:"PUSH-AUTH-UPDATE-05",progressTitle:"Generating New Profile Signature",progressInfo:"Trying to Update Push Profile creds. Please sign the message to continue.",level:"INFO"},"PUSH-AUTH-UPDATE-06":{progressId:"PUSH-AUTH-UPDATE-06",progressTitle:"Generating New Profile Signature",progressInfo:"Encrypting Push Keys with new creds. Please sign the message to continue.",level:"INFO"},"PUSH-DECRYPT-AUTH-01":{progressId:"PUSH-DECRYPT-AUTH-01",progressTitle:"Decrypting Profile Creds",progressInfo:"Please sign the transaction to decrypt profile creds.",level:"INFO"},"PUSH-DECRYPT-AUTH-02":{progressId:"PUSH-DECRYPT-AUTH-02",progressTitle:"Push Profile Creds Unlocked",progressInfo:"Unlocking push profile creds.",level:"SUCCESS"},"PUSH-PROFILE-UPDATE-01":{progressId:"PUSH-PROFILE-UPDATE-01",progressTitle:"Syncing Updated Profile",progressInfo:"Steady lads, your profile is getting a new look!",level:"INFO"},"PUSH-PROFILE-UPDATE-02":{progressId:"PUSH-PROFILE-UPDATE-02",progressTitle:"Profile Update Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-CHANNEL-CREATE-01":{progressId:"PUSH-CHANNEL-CREATE-01",progressTitle:"Uploading data to IPFS",progressInfo:"The channel’s data is getting uploaded to IPFS",level:"INFO"},"PUSH-CHANNEL-CREATE-02":{progressId:"PUSH-CHANNEL-CREATE-02",progressTitle:"Approving PUSH tokens",progressInfo:"Gives approval to Push Core contract to spend 50 PUSH",level:"INFO"},"PUSH-CHANNEL-CREATE-03":{progressId:"PUSH-CHANNEL-CREATE-03",progressTitle:"Channel is getting created",progressInfo:"Calls Push Core contract to create your channel",level:"INFO"},"PUSH-CHANNEL-CREATE-04":{progressId:"PUSH-CHANNEL-CREATE-04",progressTitle:"Channel creation is done, Welcome to Push Ecosystem",progressInfo:"Channel creation is completed",level:"SUCCESS"},"PUSH-CHANNEL-UPDATE-01":{progressId:"PUSH-CHANNEL-UPDATE-01",progressTitle:"Uploading new data to IPFS",progressInfo:"The channel’s new data is getting uploaded to IPFS",level:"INFO"},"PUSH-CHANNEL-UPDATE-02":{progressId:"PUSH-CHANNEL-UPDATE-02",progressTitle:"Approving PUSH tokens",progressInfo:"Gives approval to Push Core contract to spend 50 PUSH",level:"INFO"},"PUSH-CHANNEL-UPDATE-03":{progressId:"PUSH-CHANNEL-UPDATE-03",progressTitle:"Channel is getting updated",progressInfo:"Calls Push Core contract to update your channel details",level:"INFO"},"PUSH-CHANNEL-UPDATE-04":{progressId:"PUSH-CHANNEL-UPDATE-04",progressTitle:"Channel is updated with new data",progressInfo:"Channel is successfully updated",level:"SUCCESS"},"PUSH-ERROR-00":(t,r)=>({progressId:"PUSH-ERROR-00",progressTitle:"Non Specific Error",progressInfo:`[Push SDK] - API - Error - API ${t}() -: ${r}`,level:"ERROR"}),"PUSH-ERROR-01":t=>({progressId:"PUSH-ERROR-01",progressTitle:"Upgrade Profile Failed",progressInfo:`[Push SDK] - API - Error - API decryptPgpKey() -: ${t}`,level:"WARN"}),"PUSH-ERROR-02":(t,r)=>({progressId:"PUSH-ERROR-02",progressTitle:"Transaction failed",progressInfo:`[Push SDK] - Contract - Error - ${t} -: ${r}`,level:"ERROR"})};return Ud.default=e,Ud}var ic={},e5;function Uh(){if(e5)return ic;e5=1,Object.defineProperty(ic,"__esModule",{value:!0}),ic.get=void 0;const e=$e,t=Bh(),r=tt(),n=Je(),s=Mh(),i=It(),o=a=>e.__awaiter(void 0,void 0,void 0,function*(){const{account:d,env:c=n.default.ENV.PROD}=a||{};if(!(0,t.isValidPushCAIP)(d))throw new Error("Invalid address!");const l=(0,t.walletToPCAIP10)(d),p=`${(0,r.getAPIBaseUrls)(c)}/v2/users/?caip10=${l}`;return(0,i.axiosGet)(p).then(f=>e.__awaiter(void 0,void 0,void 0,function*(){return f.data&&(f.data.publicKey=yield(0,r.verifyProfileKeys)(f.data.encryptedPrivateKey,f.data.publicKey,f.data.did,f.data.wallets,f.data.verificationProof)),(0,s.populateDeprecatedUser)(f.data)})).catch(f=>{throw console.error(`[Push SDK] - API ${p}: `,f),Error(`[Push SDK] - API ${p}: ${f}`)})});return ic.get=o,ic}var t5;function b9(){return t5||(t5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.authUpdate=void 0;const t=$e,r=Mt(),n=Je(),s=tt(),i=Da(),o=Uh();var a;(function(c){c["x25519-xsalsa20-poly1305"]="PGP_V1",c.aes256GcmHkdfSha256="PGP_V2",c["eip191-aes256-gcm-hkdf-sha256"]="PGP_V3",c["pgpv1:nft"]="NFTPGP_V1",c["pgpv1:scw"]="SCWPGP_V1"})(a||(a={}));const d=c=>t.__awaiter(void 0,void 0,void 0,function*(){var l,u;const{pgpPrivateKey:p,pgpEncryptionVersion:f,signer:h,pgpPublicKey:y,account:m=null,env:b=n.default.ENV.PROD,additionalMeta:v,progressHook:E}=c||{};try{const _=(0,r.getWallet)({account:m,signer:h}),C=yield(0,r.getAccountAddress)(_),k=f===n.default.ENCRYPTION_TYPE.NFTPGP_V1||f===n.default.ENCRYPTION_TYPE.SCWPGP_V1;if(!(0,s.isValidPushCAIP)(C))throw new Error("Invalid address!");const D=(0,s.walletToPCAIP10)(C),w=yield(0,o.get)({account:D,env:b});if(!w||!w.encryptedPrivateKey)throw new Error("User not Found!");k?E==null||E(i.default["PUSH-AUTH-UPDATE-05"]):E==null||E(i.default["PUSH-AUTH-UPDATE-01"](a[f]));const S=yield(0,s.preparePGPPublicKey)(f,y,_);k?E==null||E(i.default["PUSH-AUTH-UPDATE-06"]):E==null||E(i.default["PUSH-AUTH-UPDATE-02"](a[f]));const I=yield(0,s.encryptPGPKey)(f,p,_,v);if(f===n.ENCRYPTION_TYPE.NFTPGP_V1){const A=yield(0,s.encryptPGPKey)(n.ENCRYPTION_TYPE.PGP_V3,(l=v==null?void 0:v.NFTPGP_V1)===null||l===void 0?void 0:l.password,_,v);I.encryptedPassword=A}else if(f===n.ENCRYPTION_TYPE.SCWPGP_V1){const A=yield(0,s.encryptPGPKey)(n.ENCRYPTION_TYPE.PGP_V3,(u=v==null?void 0:v.SCWPGP_V1)===null||u===void 0?void 0:u.password,_,v);I.encryptedPassword=A}E==null||E(i.default["PUSH-AUTH-UPDATE-03"]);const T={user:w.did,wallet:_,publicKey:S,encryptedPrivateKey:JSON.stringify(I),env:b},g=yield(0,r.authUpdateUserService)(T);return E==null||E(i.default["PUSH-AUTH-UPDATE-04"]),g}catch(_){const C=i.default["PUSH-ERROR-00"];throw E==null||E(C(e.authUpdate.name,_)),Error(`[Push SDK] - API - Error - API ${e.authUpdate.name} -: ${_}`)}});e.authUpdate=d}(r0)),r0}var J1={},r5;function v9(){return r5||(r5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.profileUpdateCore=e.profileUpdate=void 0;const t=$e,r=Fr,n=Mt(),s=Je(),i=tt(),o=Uh(),a=Mh(),d=Da(),c=It(),l=p=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,e.profileUpdateCore)(p,n.PGPHelper)});e.profileUpdate=l;const u=(p,f)=>t.__awaiter(void 0,void 0,void 0,function*(){const{pgpPrivateKey:h,account:y,profile:m,env:b=s.default.ENV.PROD,progressHook:v}=p||{};try{if(!(0,i.isValidPushCAIP)(y))throw new Error("Invalid account!");const E=yield(0,o.get)({account:y,env:b});if(!E||!E.did)throw new Error("User not Found!");let _=null;if(m.blockedUsersList){for(const O of m.blockedUsersList)if(!(0,i.isValidPushCAIP)(O))throw new Error("Invalid address in the blockedUsersList: "+O);const P=m.blockedUsersList.map(O=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,i.convertToValidDID)(O,b)}));_=yield Promise.all(P),_=Array.from(new Set(_))}const C={name:m.name?m.name:E.profile.name,desc:m.desc?m.desc:E.profile.desc,picture:m.picture?m.picture:E.profile.picture,blockedUsersList:m.blockedUsersList?_:[]},k=r.SHA256(JSON.stringify(C)).toString(),S=`pgpv2:${yield f.sign({message:k,signingKey:h})}`,I=Object.assign(Object.assign({},C),{verificationProof:S}),g=`${(0,i.getAPIBaseUrls)(b)}/v2/users/${E.did}/profile`;v==null||v(d.default["PUSH-PROFILE-UPDATE-01"]);const A=yield(0,c.axiosPut)(g,I);return A.data&&(A.data.publicKey=yield(0,i.verifyProfileKeys)(A.data.encryptedPrivateKey,A.data.publicKey,A.data.did,A.data.wallets,A.data.verificationProof)),v==null||v(d.default["PUSH-PROFILE-UPDATE-02"]),(0,a.populateDeprecatedUser)(A.data)}catch(E){const _=d.default["PUSH-ERROR-00"];throw v==null||v(_(e.profileUpdate.name,E)),Error(`[Push SDK] - API - Error - API ${e.profileUpdate.name} -: ${E}`)}});e.profileUpdateCore=u}(J1)),J1}var Z1={},n5;function _9(){return n5||(n5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createUserCore=e.create=void 0;const t=$e,r=Mt(),n=Je(),s=tt(),i=Da(),o=d=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createUserCore)(d,r.PGPHelper)});e.create=o;const a=(d,c)=>t.__awaiter(void 0,void 0,void 0,function*(){var l,u,p,f;const h="$0Pc",{env:y=n.default.ENV.PROD,account:m=null,signer:b=null,version:v=n.default.ENC_TYPE_V3,additionalMeta:E={NFTPGP_V1:{password:h+(0,r.generateRandomSecret)(10)},SCWPGP_V1:{password:h+(0,r.generateRandomSecret)(10)}},progressHook:_,origin:C}=d||{};try{if(m==null&&b==null)throw new Error("At least one from account or signer is necessary!");const k=(0,r.getWallet)({account:m,signer:b}),D=yield(0,r.getAccountAddress)(k);if(!(0,s.isValidPushCAIP)(D))throw new Error("Invalid address!");!((l=E==null?void 0:E.NFTPGP_V1)===null||l===void 0)&&l.password&&(0,s.validatePssword)(E.NFTPGP_V1.password),!((u=E==null?void 0:E.SCWPGP_V1)===null||u===void 0)&&u.password&&(0,s.validatePssword)(E.SCWPGP_V1.password);const w=(0,s.walletToPCAIP10)(D);let S=v;(0,s.isValidNFTCAIP)(w)?S=n.default.ENC_TYPE_V4:(0,s.isValidSCWCAIP)(w)?S=n.default.ENC_TYPE_V5:b||(S=n.default.ENC_TYPE_V1),_==null||_(i.default["PUSH-CREATE-01"]);const I=yield c.generateKeyPair();_==null||_(i.default["PUSH-CREATE-02"]);const T=yield(0,s.preparePGPPublicKey)(S,I.publicKeyArmored,k);_==null||_(i.default["PUSH-CREATE-03"]);const g=yield(0,s.encryptPGPKey)(S,I.privateKeyArmored,k,E);if(S===n.default.ENC_TYPE_V4||S===n.default.ENC_TYPE_V5){const O=((p=E.NFTPGP_V1)===null||p===void 0?void 0:p.password)||((f=E.SCWPGP_V1)===null||f===void 0?void 0:f.password),N=yield(0,s.encryptPGPKey)(n.default.ENC_TYPE_V3,O,k,E);g.encryptedPassword=N}_==null||_(i.default["PUSH-CREATE-04"]);const A={user:w,wallet:k,publicKey:T,encryptedPrivateKey:JSON.stringify(g),env:y,origin:C},P=yield(0,r.createUserService)(A);return _==null||_(i.default["PUSH-CREATE-05"]),P.decryptedPrivateKey=I.privateKeyArmored,P}catch(k){const D=i.default["PUSH-ERROR-00"];throw _==null||_(D(e.create.name,k)),Error(`[Push SDK] - API - Error - API ${e.create.name} -: ${k}`)}});e.createUserCore=a}(Z1)),Z1}var sc={},X1={},ac={},i5;function sk(){if(i5)return ac;i5=1,Object.defineProperty(ac,"__esModule",{value:!0}),ac.parseApiResponse=void 0;function e(t){return t.map(r=>{const{payload:{data:{acta:n="",amsg:s="",asub:i="",icon:o="",url:a="",sid:d="",app:c="",aimg:l="",secret:u=""},notification:p},source:f}=r;return{cta:n,title:i||"",message:s||p.body||"",icon:o,url:a,sid:d,app:c,image:l,blockchain:f,notification:p,secret:u}})}return ac.parseApiResponse=e,ac}var s5;function tg(){return s5||(s5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),$e.__exportStar(sk(),e)}(X1)),X1}var a5;function ak(){if(a5)return sc;a5=1,Object.defineProperty(sc,"__esModule",{value:!0}),sc.getFeeds=void 0;const e=$e,t=tt(),r=Je(),n=tg(),s=It(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:d=r.default.ENV.PROD,page:c=r.default.PAGINATION.INITIAL_PAGE,limit:l=r.default.PAGINATION.LIMIT,spam:u=!1,raw:p=!1}=o||{},f=yield(0,t.getCAIPAddress)(d,a,"User"),y=`${(0,t.getAPIBaseUrls)(d)}/v1/users/${f}/feeds`,m={page:c,limit:(0,t.getLimit)(l),spam:u},b=`${y}?${(0,t.getQueryParams)(m)}`;return(0,s.axiosGet)(b).then(v=>{var E,_;return p?((E=v==null?void 0:v.data)===null||E===void 0?void 0:E.feeds)||[]:(0,n.parseApiResponse)((_=v==null?void 0:v.data)===null||_===void 0?void 0:_.feeds)||[]}).catch(v=>{console.error(`[Push SDK] - API ${b}: `,v)})});return sc.getFeeds=i,sc}var oc={},cc={},uc={},o5;function rg(){if(o5)return uc;o5=1,Object.defineProperty(uc,"__esModule",{value:!0}),uc.parseSettings=void 0;const e=t=>{var r,n;let s;try{s=JSON.parse(t)}catch{s=t}const i=[];for(let o=0;o<s.length;o++){const a=s[o];a.type==1?i.push(Object.assign({type:a.type,description:a.description},a.user?{userPreferance:{value:a.user,enabled:a.user}}:{default:a.default})):a.type==2?i.push(Object.assign({type:a.type,description:a.description,data:{upper:a.upperLimit,lower:a.lowerLimit,ticker:(r=a.ticker)!==null&&r!==void 0?r:1}},a.user?{userPreferance:{value:a.user,enabled:a.enabled}}:{default:a.default})):a.type==3&&i.push(Object.assign({type:a.type,description:a.description,data:{upper:a.upperLimit,lower:a.lowerLimit,ticker:(n=a.ticker)!==null&&n!==void 0?n:1}},a.user?{userPreferance:{value:a.user,enabled:a.enabled}}:{default:a.default}))}return i};return uc.parseSettings=e,uc}var c5;function ok(){if(c5)return cc;c5=1,Object.defineProperty(cc,"__esModule",{value:!0}),cc.parseSubscriptionsApiResponse=void 0;const e=rg();function t(r){return r.map(n=>({channel:n.channel,user_settings:n.user_settings?(0,e.parseSettings)(n.user_settings):null}))}return cc.parseSubscriptionsApiResponse=t,cc}var u5;function ck(){if(u5)return oc;u5=1,Object.defineProperty(oc,"__esModule",{value:!0}),oc.getSubscriptions=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=ok(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:d=r.default.ENV.PROD,channel:c=null,raw:l=!0}=o||{},u=yield(0,t.getCAIPAddress)(d,a,"User"),f=`${(0,t.getAPIBaseUrls)(d)}/v1/users/${u}/subscriptions`,h=c?(0,t.getQueryParams)({channel:c}):"",y=`${f}?${h}`;return(0,n.axiosGet)(y).then(m=>{var b,v;return l?((b=m.data)===null||b===void 0?void 0:b.subscriptions)||[]:(0,s.parseSubscriptionsApiResponse)(((v=m.data)===null||v===void 0?void 0:v.subscriptions)||[])}).catch(m=>{console.error(`[Push SDK] - API ${y}: `,m)})});return oc.getSubscriptions=i,oc}var lc={},l5;function uk(){if(l5)return lc;l5=1,Object.defineProperty(lc,"__esModule",{value:!0}),lc.getDelegations=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:o,env:a=r.default.ENV.PROD}=i||{},d=yield(0,t.getCAIPAddress)(a,o,"User"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/users/${d}/delegations`}`;return(0,n.axiosGet)(u).then(p=>{var f;return((f=p.data)===null||f===void 0?void 0:f.delegations)||[]}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return lc.getDelegations=s,lc}var dc={},d5;function lk(){if(d5)return dc;d5=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.getBatch=void 0;const e=$e,t=Bh(),r=tt(),n=Je(),s=Mh(),i=It(),o=a=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:d=n.default.ENV.PROD,userIds:c}=a||{},u=`${(0,r.getAPIBaseUrls)(d)}/v2/users/batch`,p=100;if(c.length>p)throw new Error(`Too many user IDs. Maximum allowed: ${p}`);for(let y=0;y<c.length;y++)if(!(0,t.isValidPushCAIP)(c[y]))throw new Error("Invalid user address!");const h={userIds:c.map(t.walletToPCAIP10)};return(0,i.axiosPost)(u,h).then(y=>(y.data.users.forEach((m,b)=>e.__awaiter(void 0,void 0,void 0,function*(){y.data.users[b].publicKey=yield(0,r.verifyProfileKeys)(m.encryptedPrivateKey,m.publicKey,m.did,m.caip10,m.verificationProof),y.data.users[b]=(0,s.populateDeprecatedUser)(y.data.users[b])})),y.data)).catch(y=>{throw console.error(`[Push SDK] - API ${u}: `,y),Error(`[Push SDK] - API ${u}: ${y}`)})});return dc.getBatch=o,dc}var Q1={},f5;function w9(){return f5||(f5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.upgrade=void 0;const t=$e,r=Mt(),n=Je(),s=tt(),i=b9(),o=Uh(),a=Da(),d=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{env:l=n.default.ENV.PROD,account:u=null,signer:p,additionalMeta:f,progressHook:h}=c||{};try{const y=(0,r.getWallet)({account:u,signer:p}),m=yield(0,r.getAccountAddress)(y);if(!(0,s.isValidPushCAIP)(m))throw new Error("Invalid address!");const b=yield(0,o.get)({account:m,env:l});if(!b||!b.encryptedPrivateKey)throw new Error("User Not Found!");const v=n.default.ENCRYPTION_TYPE.PGP_V3,{version:E}=JSON.parse(b.encryptedPrivateKey);if(E===v||E===n.default.ENCRYPTION_TYPE.NFTPGP_V1||E===n.default.ENCRYPTION_TYPE.SCWPGP_V1)return b;h==null||h(a.default["PUSH-UPGRADE-02"]);const _=yield(0,s.decryptPGPKey)({encryptedPGPPrivateKey:b.encryptedPrivateKey,signer:p,env:l,toUpgrade:!1,additionalMeta:f}),C=yield(0,i.authUpdate)({pgpPrivateKey:_,pgpEncryptionVersion:v,signer:p,pgpPublicKey:b.publicKey,account:b.did,env:l,additionalMeta:f,progressHook:h});return h==null||h(a.default["PUSH-UPGRADE-05"]),C}catch(y){const m=a.default["PUSH-ERROR-00"];throw h==null||h(m(e.upgrade.name,y)),Error(`[Push SDK] - API - Error - API ${e.upgrade.name} -: ${y}`)}});e.upgrade=d}(Q1)),Q1}var ep={},h5;function dk(){return h5||(h5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptAuth=void 0;const t=$e,r=Je(),n=tt(),s=Da(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){var a,d;const{account:c,signer:l,env:u=r.default.ENV.PROD,additionalMeta:p,progressHook:f}=o||{};try{if(!(0,n.isValidNFTCAIP)(c)&&!(0,n.isValidSCWCAIP)(c))return null;f==null||f(s.default["PUSH-DECRYPT-AUTH-01"]);const h=((a=p==null?void 0:p.NFTPGP_V1)===null||a===void 0?void 0:a.encryptedPassword)||((d=p==null?void 0:p.SCWPGP_V1)===null||d===void 0?void 0:d.encryptedPassword);if(!h)throw new Error("encryptedPassword is required!");const y=yield(0,n.decryptPGPKey)({encryptedPGPPrivateKey:h,signer:l,account:c,env:u});return f==null||f(s.default["PUSH-DECRYPT-AUTH-02"]),y}catch(h){throw f==null||f(s.default["PUSH-ERROR-00"](e.decryptAuth.name,h)),Error(`[Push SDK] - API - Error - API ${e.decryptAuth.name} -: ${h}`)}});e.decryptAuth=i}(ep)),ep}var fc={},p5;function fk(){if(p5)return fc;p5=1,Object.defineProperty(fc,"__esModule",{value:!0}),fc.createUserWithProfile=void 0;const e=$e,t=_9(),r=v9(),n=tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){try{let o=yield(0,t.create)(i);if(i.profile){const a=yield(0,n.decryptPGPKey)({account:o.did,encryptedPGPPrivateKey:o.encryptedPrivateKey,env:i.env,signer:i.signer});o=yield(0,r.profileUpdate)({account:o.did,env:i.env,pgpPrivateKey:a,profile:i.profile})}return o}catch(o){throw new Error(`[Push SDK] - Error in createUserWithProfile -: ${o}`)}});return fc.createUserWithProfile=s,fc}var hc={},y5;function hk(){if(y5)return hc;y5=1,Object.defineProperty(hc,"__esModule",{value:!0}),hc.getFeedsPerChannel=void 0;const e=$e,t=tt(),r=Je(),n=tg(),s=It(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:d=r.default.ENV.PROD,page:c=r.default.PAGINATION.INITIAL_PAGE,limit:l=r.default.PAGINATION.LIMIT,spam:u=!1,raw:p=!1,channels:f=[]}=o||{},h=yield(0,t.getCAIPAddress)(d,a,"User"),y=(0,t.getAPIBaseUrls)(d);if(f.length==0)throw new Error("channels cannot be empty");const m=yield(0,t.getCAIPAddress)(d,f[0],"Channel"),b=`${y}/v1/users/${h}/channels/${m}/feeds`,v={page:c,limit:(0,t.getLimit)(l),spam:u},E=`${b}?${(0,t.getQueryParams)(v)}`;return(0,s.axiosGet)(E).then(_=>{var C,k;return p?((C=_==null?void 0:_.data)===null||C===void 0?void 0:C.feeds)||[]:(0,n.parseApiResponse)((k=_==null?void 0:_.data)===null||k===void 0?void 0:k.feeds)||[]}).catch(_=>{console.error(`[Push SDK] - API ${E}: `,_)})});return hc.getFeedsPerChannel=i,hc}var g5;function kn(){return g5||(g5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.profile=e.auth=void 0;const t=$e,r=b9(),n=v9();t.__exportStar(_9(),e),t.__exportStar(ak(),e),t.__exportStar(ck(),e),t.__exportStar(Uh(),e),t.__exportStar(uk(),e),t.__exportStar(lk(),e),t.__exportStar(w9(),e),t.__exportStar(dk(),e),t.__exportStar(fk(),e),t.__exportStar(hk(),e),e.auth={update:r.authUpdate},e.profile={update:n.profileUpdate,updateCore:n.profileUpdateCore}}(t0)),t0}var m5;function Bh(){return m5||(m5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pCAIP10ToWallet=e.walletToPCAIP10=e.getCAIPWithChainId=e.getCAIPAddress=e.getFallbackETHCAIPAddress=e.getCAIPDetails=e.validateCAIP=e.isValidFullCAIP10=e.convertToValidDID=e.isValidPushCAIP=e.isValidEOACAIP=e.isValidNFTCAIP=e.isValidSCWCAIP=void 0;const t=$e,r=Aa,n=Je(),s=kn(),i=E=>{try{const _=E.split(":");return _.length===4&&_[0]==="scw"&&_[1]==="eip155"&&!isNaN(Number(_[2]))&&Number(_[2])>0&&r.isAddress(_[3])}catch{return!1}};e.isValidSCWCAIP=i;const o=E=>{try{const _=E.split(":");return(_.length===5||_.length===6)&&_[0].toLowerCase()==="nft"&&!isNaN(Number(_[4]))&&Number(_[4])>0&&!isNaN(Number(_[2]))&&Number(_[2])>0&&r.isAddress(_[3])&&_[1]==="eip155"}catch{return!1}};e.isValidNFTCAIP=o;const a=E=>{try{const _=E.split(":");return _.length===3?_[0]==="eip155"&&!isNaN(Number(_[1]))&&Number(_[1])>0&&r.isAddress(_[2]):_.length===2?_[0]==="eip155"&&r.isAddress(_[1]):!1}catch{return!1}};e.isValidEOACAIP=a;const d=E=>(0,e.isValidEOACAIP)(E)||(0,e.isValidSCWCAIP)(E)||(0,e.isValidNFTCAIP)(E)||r.isAddress(E);e.isValidPushCAIP=d;const c=(E,_=n.ENV.STAGING,C,k)=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(0,e.isValidPushCAIP)(E)||(0,e.isValidEOACAIP)(E)||(0,e.isValidSCWCAIP)(E)||(0,e.isValidNFTCAIP)(E)&&E.split(":").length===6)return E;if((0,e.isValidNFTCAIP)(E)){const D=yield(0,s.get)({account:E,env:_});if(D&&D.did)return D.did;const w=Math.floor(Date.now()/1e3);return`${E}:${w}`}return C?`eip155:${C}:${E}`:`eip155:${E}`});e.convertToValidDID=c;const l=E=>{const _=E.split(":");return isNaN(Number(_[1]))?!1:_[0]==="eip155"&&!isNaN(Number(_[1]))&&Number(_[1])>0&&r.isAddress(_[2])};e.isValidFullCAIP10=l;const u={eip155:({address:E})=>(0,e.isValidPushCAIP)(E)};function p(E){const[_,C,k]=E.split(":");if(!_||!C||!k)return!1;if((0,e.isValidNFTCAIP)(E))return!0;const D=u[_];return D({address:k})}e.validateCAIP=p;function f(E){if(p(E)){const[_,C,k]=E.split(":");return{blockchain:_,networkId:C,address:k}}return null}e.getCAIPDetails=f;function h(E,_){let C=1;return(E===n.default.ENV.DEV||E===n.default.ENV.STAGING||E===n.default.ENV.LOCAL)&&(C=11155111),`eip155:${C}:${_}`}e.getFallbackETHCAIPAddress=h;function y(E,_,C){return t.__awaiter(this,void 0,void 0,function*(){if((0,e.isValidNFTCAIP)(_)||(0,e.isValidSCWCAIP)(_))return yield(0,e.convertToValidDID)(_,E);if(p(_))return _;if((0,e.isValidPushCAIP)(_))return h(E,_);throw Error(`Invalid Address! ${C}
|
|
64
|
-
Address: ${_}`)})}e.getCAIPAddress=y;const m=(E,_,C)=>{if((0,e.isValidPushCAIP)(E))return E.includes("eip155:")?E:`eip155:${_}:${E}`;throw Error(`Invalid Address! ${C}
|
|
65
|
-
Address: ${E}`)};e.getCAIPWithChainId=m;const b=E=>(0,e.isValidNFTCAIP)(E)||(0,e.isValidSCWCAIP)(E)||E.includes("eip155:")?E:"eip155:"+E;e.walletToPCAIP10=b;const v=E=>((0,e.isValidNFTCAIP)(E)||(0,e.isValidSCWCAIP)(E)||(E=E.replace("eip155:","")),E);e.pCAIP10ToWallet=v}(e0)),e0}var ra={},b5;function pk(){if(b5)return ra;b5=1,Object.defineProperty(ra,"__esModule",{value:!0}),ra.getLimit=ra.getQueryParams=void 0;const e=Je();function t(n){return Object.keys(n).map(s=>`${s}=${encodeURIComponent(n[s])}`).join("&")}ra.getQueryParams=t;function r(n){return n||e.default.PAGINATION.LIMIT}return ra.getLimit=r,ra}var tp={},pc={},v5;function E9(){if(v5)return pc;v5=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.Signer=void 0;const e=$e;class t{constructor(n){this.signer=n}isViemSigner(n){return typeof n.signTypedData=="function"&&typeof n.getChainId=="function"&&n.signMessage.length===1&&n.signTypedData.length===1}signMessage(n){return e.__awaiter(this,void 0,void 0,function*(){if("signMessage"in this.signer&&typeof this.signer.signMessage=="function")return this.isViemSigner(this.signer)?this.signer.signMessage({message:n,account:this.signer.account}):this.signer.signMessage(n);throw new Error("Signer does not support signMessage")})}signTypedData(n,s,i,o){return e.__awaiter(this,void 0,void 0,function*(){if(this.isViemSigner(this.signer))return this.signer.signTypedData({domain:n,types:s,primaryType:o,message:i,account:this.signer.account});if("_signTypedData"in this.signer)return this.signer._signTypedData(n,s,i);if("signTypedData"in this.signer)return this.signer.signTypedData(n,s,i);throw new Error("Signer does not support signTypedData")})}getAddress(){var n;return e.__awaiter(this,void 0,void 0,function*(){return this.isViemSigner(this.signer)?(n=this.signer.account.address)!==null&&n!==void 0?n:"":yield this.signer.getAddress()})}getChainId(){return e.__awaiter(this,void 0,void 0,function*(){if(this.isViemSigner(this.signer))return this.signer.getChainId();if("provider"in this.signer&&this.signer.provider){const n=yield this.signer.provider.getNetwork();return Number(n.chainId)}else return 1})}}return pc.Signer=t,pc}var _5;function Yy(){return _5||(_5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validatePssword=e.verifyProfileKeys=e.preparePGPPublicKey=e.encryptPGPKey=e.decryptV2=e.encryptV2=e.stringToHex=e.hexToBytes=e.generateHash=e.decryptPGPKey=e.decryptWithWalletRPCMethod=e.encryptV1=e.getPublicKey=void 0;const t=$e,r=Fy(),n=Fy(),s=Fr,i=Mt(),o=Je(),a=Bh(),d=h9(),c=w9(),l=Da(),u=E9(),p=Aa,f=R8,h=32,y=12;let m;if(typeof window<"u"&&window.crypto)m=window.crypto;else if(typeof uo<"u")try{m=ro.webcrypto}catch{throw new Error("Unable To load crypto")}const b=M=>t.__awaiter(void 0,void 0,void 0,function*(){var L;const{account:x,signer:R}=M||{},K=R?new u.Signer(R):void 0,V=x||(yield K==null?void 0:K.getAddress())||"",J=p.createWalletClient({chain:f.mainnet,transport:p.custom(window.ethereum)});return yield(((L=R==null?void 0:R.provider)===null||L===void 0?void 0:L.provider)||J).request({method:"eth_getEncryptionPublicKey",params:[V]})});e.getPublicKey=b;const v=(M,L,x)=>r.encrypt({publicKey:L,data:M,version:x});e.encryptV1=v;const E=(M,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return console.warn("decryptWithWalletRPCMethod method is DEPRECATED. Use decryptPGPKey method with signer!"),yield(0,e.decryptPGPKey)({encryptedPGPPrivateKey:M,account:L})});e.decryptWithWalletRPCMethod=E;const _=M=>t.__awaiter(void 0,void 0,void 0,function*(){var L,x,R,K,V;const{encryptedPGPPrivateKey:J,account:se=null,signer:j=null,env:re=o.default.ENV.PROD,toUpgrade:G=!0,additionalMeta:B=null,progressHook:X}=M||{};try{if(se==null&&j==null)throw new Error("At least one from account or signer is necessary!");const ge=(0,i.getWallet)({account:se,signer:j}),_e=yield(0,i.getAccountAddress)(ge);if(!(0,a.isValidPushCAIP)(_e))throw new Error("Invalid address!");const{version:Se}=JSON.parse(J);let F;switch(X==null||X(l.default["PUSH-DECRYPT-01"]),Se){case o.default.ENC_TYPE_V1:{if(!((L=ge==null?void 0:ge.signer)===null||L===void 0)&&L.privateKey)F=(0,n.decrypt)({encryptedData:JSON.parse(J),privateKey:(x=ge==null?void 0:ge.signer)===null||x===void 0?void 0:x.privateKey.substring(2)});else{const q=p.createWalletClient({chain:f.mainnet,transport:p.custom(window.ethereum)});F=yield(((R=j==null?void 0:j.provider)===null||R===void 0?void 0:R.provider)||q).request({method:"eth_decrypt",params:[J,_e]})}break}case o.default.ENC_TYPE_V2:{if(!(ge!=null&&ge.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{preKey:q}=JSON.parse(J),z=`Enable Push Chat Profile
|
|
66
|
-
`+q;let ee;try{const{verificationProof:ce}=yield(0,i.getEip712Signature)(ge,z,!0);ee=yield(0,e.decryptV2)(JSON.parse(J),(0,e.hexToBytes)(ce||""))}catch{const{verificationProof:ne}=yield(0,i.getEip712Signature)(ge,z,!1);ee=yield(0,e.decryptV2)(JSON.parse(J),(0,e.hexToBytes)(ne||""))}F=new TextDecoder().decode(ee);break}case o.default.ENC_TYPE_V3:{if(!(ge!=null&&ge.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{preKey:q}=JSON.parse(J),z=`Enable Push Profile
|
|
67
|
-
`+q,{verificationProof:ee}=yield(0,i.getEip191Signature)(ge,z),le=yield(0,e.decryptV2)(JSON.parse(J),(0,e.hexToBytes)(ee||""));F=new TextDecoder().decode(le);break}case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{let q=null;if(!((K=B==null?void 0:B.NFTPGP_V1)===null||K===void 0)&&K.password)q=B.NFTPGP_V1.password;else if(!((V=B==null?void 0:B.SCWPGP_V1)===null||V===void 0)&&V.password)q=B.SCWPGP_V1.password;else{if(!(ge!=null&&ge.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{encryptedPassword:le}=JSON.parse(J);q=yield(0,e.decryptPGPKey)({encryptedPGPPrivateKey:JSON.stringify(le),signer:j,env:re})}const z=yield(0,e.decryptV2)(JSON.parse(J),(0,e.hexToBytes)((0,e.stringToHex)(q)));F=new TextDecoder().decode(z);break}default:throw new Error("Invalid Encryption Type")}if(j&&G&&Se!==o.default.ENC_TYPE_V4&&Se!==o.default.ENC_TYPE_V5)try{yield(0,c.upgrade)({env:re,account:_e,signer:j,progressHook:X})}catch(q){const z=l.default["PUSH-ERROR-01"];X==null||X(z(q))}return X==null||X(l.default["PUSH-DECRYPT-02"]),F}catch(ge){const _e=l.default["PUSH-ERROR-00"];throw X==null||X(_e(e.decryptPGPKey.name,ge)),Error(`[Push SDK] - API - Error - API ${e.decryptPGPKey.name} -: ${ge}`)}});e.decryptPGPKey=_;const C=M=>s.SHA256(JSON.stringify(M)).toString(s.enc.Hex);e.generateHash=C;const k=M=>t.__awaiter(void 0,void 0,void 0,function*(){return m.getRandomValues(M)}),D=M=>M.reduce((L,x)=>L+x.toString(16).padStart(2,"0"),""),w=M=>{const L=new Uint8Array(M.length/2);for(let x=0;x<M.length;x+=2)L[x/2]=parseInt(M.slice(x,x+2),16);return L};e.hexToBytes=w;const S=M=>{let L="";for(let x=0;x<M.length;x++)L+=M.charCodeAt(x).toString(16).padStart(2,"0");return L};e.stringToHex=S;const I=(M,L)=>t.__awaiter(void 0,void 0,void 0,function*(){const x=yield m.subtle.importKey("raw",M,"HKDF",!1,["deriveKey"]);return m.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:L,info:new ArrayBuffer(0)},x,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}),T=(M,L,x)=>t.__awaiter(void 0,void 0,void 0,function*(){const R=m.getRandomValues(new Uint8Array(h)),K=m.getRandomValues(new Uint8Array(y)),V=yield I(L,R),J={name:"AES-GCM",iv:K};x&&(J.additionalData=x);const se=yield m.subtle.encrypt(J,V,M);return{ciphertext:D(new Uint8Array(se)),salt:D(R),nonce:D(K)}});e.encryptV2=T;const g=(M,L,x)=>t.__awaiter(void 0,void 0,void 0,function*(){const R=yield I(L,(0,e.hexToBytes)(M.salt)),K={name:"AES-GCM",iv:(0,e.hexToBytes)(M.nonce)};x&&(K.additionalData=x);const V=yield m.subtle.decrypt(K,R,(0,e.hexToBytes)(M.ciphertext));return new Uint8Array(V)});e.decryptV2=g;const A=(M,L,x,R)=>t.__awaiter(void 0,void 0,void 0,function*(){var K,V,J,se,j,re;let G;switch(M){case o.default.ENC_TYPE_V1:{let B;!((K=x==null?void 0:x.signer)===null||K===void 0)&&K.privateKey?B=(0,n.getEncryptionPublicKey)((V=x==null?void 0:x.signer)===null||V===void 0?void 0:V.privateKey.substring(2)):B=yield(0,e.getPublicKey)(x),G=(0,e.encryptV1)(L,B,M);break}case o.default.ENC_TYPE_V2:{const B=D(yield k(new Uint8Array(32))),X=`Enable Push Chat Profile
|
|
68
|
-
`+B,{verificationProof:ge}=yield(0,i.getEip712Signature)(x,X,!0),Se=new TextEncoder().encode(L);G=yield(0,e.encryptV2)(Se,(0,e.hexToBytes)(ge||"")),G.version=o.default.ENC_TYPE_V2,G.preKey=B;break}case o.default.ENC_TYPE_V3:{const B=D(yield k(new Uint8Array(32))),X=`Enable Push Profile
|
|
69
|
-
`+B,{verificationProof:ge}=yield(0,i.getEip191Signature)(x,X),Se=new TextEncoder().encode(L);G=yield(0,e.encryptV2)(Se,(0,e.hexToBytes)(ge||"")),G.version=o.default.ENC_TYPE_V3,G.preKey=B;break}case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{if(!(!((J=R==null?void 0:R.NFTPGP_V1)===null||J===void 0)&&J.password)&&!(!((se=R==null?void 0:R.SCWPGP_V1)===null||se===void 0)&&se.password))throw new Error("Password is required!");const X=new TextEncoder().encode(L),ge=((j=R==null?void 0:R.NFTPGP_V1)===null||j===void 0?void 0:j.password)||((re=R==null?void 0:R.SCWPGP_V1)===null||re===void 0?void 0:re.password);G=yield(0,e.encryptV2)(X,(0,e.hexToBytes)((0,e.stringToHex)(ge))),G.version=M,G.preKey="";break}default:throw new Error("Invalid Encryption Type")}return G});e.encryptPGPKey=A;const P=(M,L,x)=>t.__awaiter(void 0,void 0,void 0,function*(){let R;switch(M){case o.default.ENC_TYPE_V1:{R=L;break}case o.default.ENC_TYPE_V2:case o.default.ENC_TYPE_V3:case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{R=JSON.stringify({key:L,signature:"DEPRECATED"});break}default:throw new Error("Invalid Encryption Type")}return R});e.preparePGPPublicKey=P;const O=(M,L,x,R,K)=>t.__awaiter(void 0,void 0,void 0,function*(){let V;try{if(V=JSON.parse(L).key,V===void 0)throw new Error("Invalid Public Key")}catch{V=L}try{if(L&&L.length>0&&K&&K.split(":")[0]==="eip191v2"){const J={caip10:R,did:x,publicKey:L,encryptedPrivateKey:M};if((0,a.isValidNFTCAIP)(x)){const re="owner",G=JSON.parse(M);re in G&&delete G[re],J.encryptedPrivateKey=JSON.stringify(G)}const se=(0,e.generateHash)(J);if(yield(0,d.verifyProfileSignature)(K,se,(0,a.isValidNFTCAIP)(x)?(0,a.pCAIP10ToWallet)(JSON.parse(M).owner):(0,a.pCAIP10ToWallet)(x)))return V;throw new Error("Invalid Signature")}return V}catch{return console.warn(`Cannot Verify keys for DID : ${x} !!!`),V}});e.verifyProfileKeys=O;const N=M=>{if(M.length<8)throw new Error("Password must be at least 8 characters long!");if(!/[A-Z]/.test(M))throw new Error("Password must contain at least one uppercase letter!");if(!/[a-z]/.test(M))throw new Error("Password must contain at least one lowercase letter!");if(!/\d/.test(M))throw new Error("Password must contain at least one digit!");if(!/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(M))throw new Error("Password must contain at least one special character!")};e.validatePssword=N}(tp)),tp}var w5;function tt(){return w5||(w5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$e;t.__exportStar(ZS(),e),t.__exportStar(Bh(),e),t.__exportStar(pk(),e),t.__exportStar(Yy(),e),t.__exportStar(E9(),e)}(Zh)),Zh}var E5;function yk(){if(E5)return No;E5=1,Object.defineProperty(No,"__esModule",{value:!0}),No.getAliasInfo=void 0;const e=$e,t=tt(),r=Je(),n=nn(),s=It(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{alias:a,aliasChain:d,env:c=r.default.ENV.PROD}=o||{},l=n.ALIAS_CHAIN_ID[d][c],u=(0,t.getCAIPWithChainId)(a,l,"Alias"),h=`${`${(0,t.getAPIBaseUrls)(c)}/v1/alias`}/${u}/channel`;return yield(0,s.axiosGet)(h).then(y=>y.data).catch(y=>{console.error(`[EPNS-SDK] - API ${h}: `,y)})});return No.getAliasInfo=i,No}var A5;function A9(){return A5||(A5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),$e.__exportStar(yk(),e)}(Jh)),Jh}var rp={},yc={},S5;function gk(){if(S5)return yc;S5=1,Object.defineProperty(yc,"__esModule",{value:!0}),yc._getSubscribers=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=`
|
|
70
|
-
[Push SDK]: _getSubscribers() Deprecation Warning!
|
|
71
|
-
This method has been deprecated, please use the below alternatives
|
|
72
|
-
if you need to,
|
|
73
|
-
* to check if user is subscribed or not: user.getSubscriptions()
|
|
74
|
-
* get channels count: channels.getChannels()
|
|
75
|
-
`,i=o=>e.__awaiter(void 0,void 0,void 0,function*(){console.warn(s);const{channel:a,env:d=r.default.ENV.PROD}=o||{},c=yield(0,t.getCAIPAddress)(d,a,"Channel"),l=(0,t.getCAIPDetails)(c);if(!l)throw Error("Invalid Channel CAIP!");const u=l.networkId,h=`${`${(0,t.getAPIBaseUrls)(d)}/channels/_get_subscribers`}`,y={channel:l.address,blockchain:u,op:"read"};return(yield(0,n.axiosPost)(h,y)).data.subscribers});return yc._getSubscribers=i,yc}var gc={},P5;function mk(){if(P5)return gc;P5=1,Object.defineProperty(gc,"__esModule",{value:!0}),gc.getChannel=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=rg(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:a,env:d=r.default.ENV.PROD,raw:c=!0}=o||{},l=yield(0,t.getCAIPAddress)(d,a,"Channel"),f=`${`${(0,t.getAPIBaseUrls)(d)}/v1/channels`}/${l}`;return yield(0,n.axiosGet)(f).then(h=>(c||(h.data.channel_settings=h.data.channel_settings?(0,s.parseSettings)(h.data.channel_settings):null),h.data))});return gc.getChannel=i,gc}var mc={},T5;function bk(){if(T5)return mc;T5=1,Object.defineProperty(mc,"__esModule",{value:!0}),mc.getChannelNotifications=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD,page:d=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT,filter:l=null,raw:u=!0}=i||{},p=yield(0,t.getCAIPAddress)(a,o,"Channel"),h=`${(0,t.getAPIBaseUrls)(a)}/v2/channels`,y=(0,t.getQueryParams)(l?{page:d,limit:c,notificationType:l,raw:u}:{page:d,limit:c,raw:u}),m=`${h}/${p}/notifications?${y}`;return yield(0,n.axiosGet)(m).then(b=>b.data)});return mc.getChannelNotifications=s,mc}var bc={},Bd={},np={},I5;function Lh(){return I5||(I5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ChannelListOrderType=e.ChannelListSortType=e.ChannelListType=e.FeedType=void 0,function(t){t.INBOX="INBOX",t.SPAM="SPAM"}(e.FeedType||(e.FeedType={})),function(t){t.ALL="all",t.VERIFIED="verified",t.UNVERIFIED="unverified"}(e.ChannelListType||(e.ChannelListType={})),function(t){t.SUBSCRIBER="subscribers"}(e.ChannelListSortType||(e.ChannelListSortType={})),function(t){t.ASCENDING="asc",t.DESCENDING="desc"}(e.ChannelListOrderType||(e.ChannelListOrderType={}))}(np)),np}var ip={},C5;function Kh(){return C5||(C5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EVENTS=e.NOTIFICATION=e.ProposedEventNames=e.VideoEventType=e.SpaceEventType=e.GroupEventType=e.MessageEventType=e.MessageOrigin=e.NotificationEventType=e.STREAM=void 0,function(t){t.PROFILE="STREAM.PROFILE",t.ENCRYPTION="STREAM.ENCRYPTION",t.NOTIF="STREAM.NOTIF",t.NOTIF_OPS="STREAM.NOTIF_OPS",t.CHAT="STREAM.CHAT",t.CHAT_OPS="STREAM.CHAT_OPS",t.SPACE="STREAM.SPACE",t.SPACE_OPS="STREAM.SPACE_OPS",t.VIDEO="STREAM.VIDEO",t.CONNECT="STREAM.CONNECT",t.DISCONNECT="STREAM.DISCONNECT"}(e.STREAM||(e.STREAM={})),function(t){t.INBOX="notification.inbox",t.SPAM="notification.spam"}(e.NotificationEventType||(e.NotificationEventType={})),function(t){t.Other="other",t.Self="self"}(e.MessageOrigin||(e.MessageOrigin={})),function(t){t.Message="message",t.Request="request",t.Accept="accept",t.Reject="reject"}(e.MessageEventType||(e.MessageEventType={})),function(t){t.CreateGroup="createGroup",t.UpdateGroup="updateGroup",t.JoinGroup="joinGroup",t.LeaveGroup="leaveGroup",t.Remove="remove",t.RoleChange="roleChange"}(e.GroupEventType||(e.GroupEventType={})),function(t){t.CreateSpace="createSpace",t.UpdateSpace="updateSpace",t.Join="joinSpace",t.Leave="leaveSpace",t.Remove="remove",t.Stop="stop",t.Start="start"}(e.SpaceEventType||(e.SpaceEventType={})),function(t){t.REQUEST="video.request",t.APPROVE="video.approve",t.DENY="video.deny",t.CONNECT="video.connect",t.DISCONNECT="video.disconnect",t.RETRY_REQUEST="video.retry.request",t.RETRY_APPROVE="video.retry.approve"}(e.VideoEventType||(e.VideoEventType={})),function(t){t.Message="chat.message",t.Request="chat.request",t.Accept="chat.accept",t.Reject="chat.reject",t.LeaveGroup="chat.group.participant.leave",t.JoinGroup="chat.group.participant.join",t.CreateGroup="chat.group.create",t.UpdateGroup="chat.group.update",t.Remove="chat.group.participant.remove",t.RoleChange="chat.group.participant.role",t.CreateSpace="space.create",t.UpdateSpace="space.update",t.SpaceRequest="space.request",t.SpaceAccept="space.accept",t.SpaceReject="space.reject",t.LeaveSpace="space.participant.leave",t.JoinSpace="space.participant.join",t.SpaceRemove="space.participant.remove",t.StartSpace="space.start",t.StopSpace="space.stop"}(e.ProposedEventNames||(e.ProposedEventNames={})),e.NOTIFICATION={TYPE:{BROADCAST:1,TARGETTED:3,SUBSET:4}},function(t){t.CONNECT="connect",t.DISCONNECT="disconnect",t.USER_FEEDS="userFeeds",t.USER_SPAM_FEEDS="userSpamFeeds",t.CHAT_RECEIVED_MESSAGE="CHATS",t.CHAT_GROUPS="CHAT_GROUPS"}(e.EVENTS||(e.EVENTS={}))}(ip)),ip}var sp={},Ld={},R5;function ng(){if(R5)return Ld;R5=1,Object.defineProperty(Ld,"__esModule",{value:!0});const e=t=>t.replace("eip155:","");return Ld.default=e,Ld}var ap={},k5;function vk(){return k5||(k5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.spaces=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=It(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:d,pgpPrivateKey:c,env:l=n.default.ENV.PROD,page:u=1,limit:p=10}=a||{};if(!(0,r.isValidPushCAIP)(d))throw new Error("Invalid address!");const f=yield(0,r.convertToValidDID)(d,l),m=`${`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${f}/spaces?page=${u}&limit=${p}`}`;try{const E=(yield(0,i.axiosGet)(m)).data.spaces;return yield(0,s.getSpaceInboxLists)({lists:E,user:f,toDecrypt:!1,pgpPrivateKey:c,env:l})}catch(b){throw console.error(`[Push SDK] - API ${e.spaces.name}: `,b),Error(`[Push SDK] - API ${e.spaces.name}: ${b}`)}});e.spaces=o}(ap)),ap}var op={},M5;function _k(){return M5||(M5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.trending=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=It(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{env:d=n.default.ENV.PROD,page:c=1,limit:l=10}=a||{},p=`${(0,r.getAPIBaseUrls)(d)}/v1/spaces/trending?page=${c}&limit=${l}`;try{const h=(yield(0,i.axiosGet)(p)).data.spaces;return yield(0,s.getTrendingSpaceInboxLists)({lists:h,env:d})}catch(f){throw console.error(`[Push SDK] - API ${e.trending.name}: `,f),Error(`[Push SDK] - API ${e.trending.name}: ${f}`)}});e.trending=o}(op)),op}var cp={},O5;function Fs(){return O5||(O5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.get=void 0;const t=$e,r=Je(),n=Mt(),s=Xl(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,env:d=r.default.ENV.PROD}=o||{};try{if(a==null||a.length==0)throw new Error("spaceId cannot be null or empty");const c=yield(0,s.getGroup)({chatId:a,env:d});return(0,n.groupDtoToSpaceDto)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.get.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.get.name} -: ${c}`)}});e.get=i}(cp)),cp}var up={},N5;function wk(){return N5||(N5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.info=void 0;const t=$e,r=Mt(),n=Xl(),s=Je(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,env:d=s.default.ENV.PROD}=o||{};try{if(a==null||a.length==0)throw new Error("spaceId cannot be null or empty");const c=yield(0,n.getGroup)({chatId:a,env:d});return(0,r.groupDtoToSpaceDto)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.info.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.info.name} -: ${c}`)}});e.info=i}(up)),up}var vc={},lp={},D5;function S9(){return D5||(D5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createGroupCore=e.createGroup=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=It(),a=Xt(),d=l=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createGroupCore)(l,s.PGPHelper)});e.createGroup=d;const c=(l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:p=null,signer:f=null,groupName:h,groupDescription:y,members:m,groupImage:b,admins:v,isPublic:E,contractAddressNFT:_,numberOfNFTs:C,contractAddressERC20:k,numberOfERC20:D,env:w=n.default.ENV.PROD,pgpPrivateKey:S=null,meta:I,groupType:T,scheduleAt:g,scheduleEnd:A,rules:P}=l||{};try{if(p==null&&f==null)throw new Error("At least one from account or signer is necessary!");(0,s.validateScheduleDates)(g,A);const O=(0,s.getWallet)({account:p,signer:f});(0,s.createGroupRequestValidator)(h,m,v,y,_,C,k,D);const N=m.map(ge=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(ge,w)})),M=v.map(ge=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(ge,w)})),L=yield Promise.all(N),x=yield Promise.all(M),R=yield(0,s.getConnectedUserV2Core)(O,S,w,u),K={groupName:h,groupDescription:y??null,members:L,groupImage:b??null,admins:x,isPublic:E,contractAddressNFT:_??null,numberOfNFTs:C??0,contractAddressERC20:k??null,numberOfERC20:D??0,groupCreator:R.did},V=i.SHA256(JSON.stringify(K)).toString(),J=yield u.sign({message:V,signingKey:R.privateKey}),j="pgp"+":"+J,G=`${(0,r.getAPIBaseUrls)(w)}/v1/chat/groups`,B=(0,s.createGroupPayload)(h,L,x,E,R.did,j,y,b,_,C,k,D,I,T,g,A,P);return(yield(0,o.axiosPost)(G,B)).data}catch(O){throw(0,a.handleError)(O,e.createGroup.name)}});e.createGroupCore=c}(lp)),lp}var x5;function Ek(){if(x5)return vc;x5=1,Object.defineProperty(vc,"__esModule",{value:!0}),vc.create=void 0;const e=$e,t=Je(),r=Mt(),n=S9();function s(i){return e.__awaiter(this,void 0,void 0,function*(){const{signer:o,spaceName:a,spaceDescription:d,listeners:c,spaceImage:l,speakers:u,isPublic:p,contractAddressNFT:f,numberOfNFTs:h,contractAddressERC20:y,numberOfERC20:m,env:b=t.default.ENV.PROD,pgpPrivateKey:v=null,scheduleAt:E,scheduleEnd:_,rules:C}=i||{},k=C?(0,r.convertSpaceRulesToRules)(C):null;try{const D=yield(0,n.createGroup)({signer:o,groupName:a,groupDescription:d,members:c,groupImage:l,admins:u,isPublic:p,contractAddressNFT:f,numberOfNFTs:h,contractAddressERC20:y,numberOfERC20:m,env:b,pgpPrivateKey:v,groupType:"spaces",scheduleAt:E,scheduleEnd:_,rules:k});return(0,r.groupDtoToSpaceDto)(D)}catch(D){throw console.error(`[Push SDK] - API - Error - API ${s.name} -: `,D),Error(`[Push SDK] - API - Error - API ${s.name} -: ${D}`)}})}return vc.create=s,vc}var dp={},fp={},_c={},U5;function xa(){return U5||(U5=1,Object.defineProperty(_c,"__esModule",{value:!0}),_c.CHAT=void 0,_c.CHAT={META:{GROUP:{CREATE:"CREATE_GROUP",MEMBER:{ADD:"ADD_MEMBER",REMOVE:"REMOVE_MEMBER",PRIVILEGE:"ASSIGN_MEMBER_PRIVILEGE"},ADMIN:{PRVILEGE:"ASSIGN_ADMIN_PRIVILEGE"},UPDATE:"UPDATE_GROUP",PROFILE:{UPDATE:"UPDATE_GROUP_PROFILE"},META:{UPDATE:"UPDATE_GROUP_META"},USER:{INTERACTION:"USER_INTERACTION"}},SPACE:{CREATE:"CREATE_SPACE",LISTENER:{ADD:"ADD_LISTENER",REMOVE:"REMOVE_LISTENER",PRVILEGE:"ASSIGN_LISTENER_PRIVILEGE"},SPEAKER:{PRVILEGE:"ASSIGN_SPEAKER_PRIVILEGE"},COHOST:{PRVILEGE:"ASSIGN_COHOST_PRIVILEGE"}}},REACTION:{THUMBSUP:"👍",THUMBSDOWN:"👎",HEART:"❤️",CLAP:"👏",LAUGH:"😂",SAD:"😢",ANGRY:"😡",SUPRISE:"😲",FIRE:"🔥"},RECEIPT:{READ:"READ_RECEIPT"},UA:{LISTENER:{JOIN:"LISTENER_JOIN",LEAVE:"LISTENER_LEAVE",MICREQUEST:"LISTENER_REQUEST_MIC"},SPEAKER:{MIC_ON:"SPEAKER_MIC_ON",MIC_OFF:"SPEAKER_MIC_OFF"}},INTENT:{ACCEPT:"ACCEPT_INTENT",REJECT:"REJECT_INTENT",JOIN:"JOIN_GROUP",LEAVE:"LEAVE_GROUP"}}),_c}var hp={},B5;function Ak(){return B5||(B5=1,Object.defineProperty(hp,"__esModule",{value:!0})),hp}var L5;function pn(){return L5||(L5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NotifictaionType=e.VideoCallStatus=e.GROUP_INVITER_ROLE=e.GROUP_RULES_PERMISSION=e.GROUP_RULES_SUB_CATEGORY=e.GROUP_RULES_CATEGORY=e.ConditionType=e.ChatStatus=void 0;const t=$e;t.__exportStar(xa(),e),t.__exportStar(Ak(),e),function(r){r.ACTIVE="ACTIVE",r.PENDING="PENDING",r.ENDED="ENDED"}(e.ChatStatus||(e.ChatStatus={})),function(r){r.PUSH="PUSH",r.GUILD="GUILD"}(e.ConditionType||(e.ConditionType={})),function(r){r.PUSH="PUSH",r.GUILD="GUILD",r.ERC721="ERC721",r.ERC20="ERC20",r.CUSTOM_ENDPOINT="CustomEndpoint",r.INVITE="INVITE"}(e.GROUP_RULES_CATEGORY||(e.GROUP_RULES_CATEGORY={})),function(r){r.DEFAULT="DEFAULT",r.HOLDER="holder",r.GET="GET"}(e.GROUP_RULES_SUB_CATEGORY||(e.GROUP_RULES_SUB_CATEGORY={})),function(r){r.ENTRY="Entry",r.CHAT="Chat"}(e.GROUP_RULES_PERMISSION||(e.GROUP_RULES_PERMISSION={})),function(r){r.ADMIN="ADMIN",r.OWNER="OWNER"}(e.GROUP_INVITER_ROLE||(e.GROUP_INVITER_ROLE={})),function(r){r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.INITIALIZED=1]="INITIALIZED",r[r.RECEIVED=2]="RECEIVED",r[r.CONNECTED=3]="CONNECTED",r[r.DISCONNECTED=4]="DISCONNECTED",r[r.ENDED=5]="ENDED",r[r.RETRY_INITIALIZED=6]="RETRY_INITIALIZED",r[r.RETRY_RECEIVED=7]="RETRY_RECEIVED"}(e.VideoCallStatus||(e.VideoCallStatus={})),function(r){r[r.BROADCAT=1]="BROADCAT",r[r.TARGETTED=3]="TARGETTED",r[r.SUBSET=4]="SUBSET"}(e.NotifictaionType||(e.NotifictaionType={}))}(fp)),fp}var pp={},yp={},K5;function ig(){return K5||(K5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMemberStatus=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,did:c,env:l=n.default.ENV.PROD}=a||{};try{if(d==null||d.length===0)throw new Error("chatId cannot be null or empty");if(c==null||c.length===0)throw new Error("did cannot be null or empty");const u=yield(0,r.convertToValidDID)(c,l),f=`${(0,r.getAPIBaseUrls)(l)}/v1/chat/groups/${d}/members/${u}/status`;return(yield(0,s.axiosGet)(f)).data}catch(u){throw(0,i.handleError)(u,e.getGroupMemberStatus.name)}});e.getGroupMemberStatus=o}(yp)),yp}var q5;function ed(){return q5||(q5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupCore=e.updateGroup=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=It(),a=Xl(),d=Sa(),c=ig(),l=Xt(),u=f=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.updateGroupCore)(f,s.PGPHelper)});e.updateGroup=u;const p=(f,h)=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:y,groupName:m,groupImage:b,groupDescription:v,members:E,admins:_,account:C=null,signer:k=null,env:D=n.default.ENV.PROD,pgpPrivateKey:w=null,scheduleAt:S,scheduleEnd:I,status:T,meta:g,rules:A}=f||{};try{if(C==null&&k==null)throw new Error("At least one from account or signer is necessary!");const P=(0,s.getWallet)({account:C,signer:k}),O=yield(0,s.getAccountAddress)(P);(0,s.updateGroupRequestValidator)(y,m,E,_,O,v);const N=yield(0,s.getConnectedUserV2Core)(P,w,D,h),M=E.map(z=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(z,D)})),L=_.map(z=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(z,D)})),x=yield Promise.all(M),R=yield Promise.all(L),K=yield(0,a.getGroup)({chatId:y,env:D}),V=new Set(x.map(z=>z.toLowerCase())),J=yield(0,c.getGroupMemberStatus)({chatId:y,did:N.did,env:D});let se=!0;K.members.map(z=>{V.has(z.wallet.toLowerCase())||(se=!1)});let j=null;if((!se||!J.isMember)&&!K.isPublic){const z=d.generateRandomSecret(15),ee=[];K.members.map(le=>{V.has(le.wallet.toLowerCase())&&ee.push(le.publicKey)}),J.isMember||ee.push(N.publicKey),j=yield h.pgpEncrypt({plainText:z,keys:ee})}const re={groupName:m,groupDescription:v??null,groupImage:b??null,members:x,admins:R,chatId:y},G=i.SHA256(JSON.stringify(re)).toString(),B=yield h.sign({message:G,signingKey:N.privateKey}),ge="pgp"+":"+B+":"+C,Se=`${(0,r.getAPIBaseUrls)(D)}/v1/chat/groups/${y}`,F=(0,s.updateGroupPayload)(m,x,R,N.did,ge,j,v,b,S,I,T,g,A);return(yield(0,o.axiosPut)(Se,F)).data}catch(P){throw(0,l.handleError)(P,e.updateGroup.name)}});e.updateGroupCore=p}(pp)),pp}var j5;function Sk(){return j5||(j5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.update=void 0;const t=$e,r=Je(),n=pn(),s=Mt(),i=ed(),o=Fs(),a=d=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:c,spaceName:l,spaceImage:u,spaceDescription:p,listeners:f,speakers:h,signer:y,env:m=r.default.ENV.PROD,pgpPrivateKey:b=null,scheduleAt:v,scheduleEnd:E,status:_}=d||{};try{const C=yield(0,o.get)({spaceId:c,env:m});if(C.status===n.ChatStatus.ACTIVE&&v)throw new Error("Unable change the start date/time of an active space");if(C.status===n.ChatStatus.ENDED&&E)throw new Error("Unable change the end date/time of an ended space");const k=yield(0,i.updateGroup)({chatId:c,groupName:l,groupImage:u,groupDescription:p,members:f,admins:h,signer:y,env:m,pgpPrivateKey:b,scheduleAt:v,scheduleEnd:E,status:_});return(0,s.groupDtoToSpaceDto)(k)}catch(C){throw console.error(`[Push SDK] - API - Error - API ${e.update.name} -: `,C),Error(`[Push SDK] - API - Error - API ${e.update.name} -: ${C}`)}});e.update=a}(dp)),dp}var wc={},gp={},mp={},bp={},$5;function td(){return $5||($5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupInfo=void 0;const t=$e,r=Ao(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,env:c=s.default.ENV.PROD}=a||{};try{if(d==null||d.length==0)throw new Error("chatId cannot be null or empty");const u=`${(0,n.getAPIBaseUrls)(c)}/v2/chat/groups/${d}`;return r.default.get(u).then(p=>p.data).catch(p=>{var f,h;throw!((f=p==null?void 0:p.response)===null||f===void 0)&&f.data?new Error((h=p==null?void 0:p.response)===null||h===void 0?void 0:h.data):new Error(p)})}catch(l){throw(0,i.handleError)(l,e.getGroupInfo.name)}});e.getGroupInfo=o}(bp)),bp}var Ec={},vp={},V5;function P9(){return V5||(V5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMembersPublicKeys=void 0;const t=$e,r=Ao(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,page:c=1,limit:l=20,env:u=s.default.ENV.PROD}=a;try{if(!d)throw new Error("Chat ID is required.");const f=`${(0,n.getAPIBaseUrls)(u)}/v1/chat/groups/${d}/members/publicKeys?pageNumber=${c}&pageSize=${l}`;return(yield r.default.get(f)).data}catch(p){throw(0,i.handleError)(p,e.getGroupMembersPublicKeys.name)}});e.getGroupMembersPublicKeys=o}(vp)),vp}var F5;function T9(){if(F5)return Ec;F5=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.getAllGroupMembersPublicKeys=void 0;const e=$e,t=eg(),r=P9(),n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{chatId:i,env:o}=s,d=(yield(0,t.getGroupMemberCount)({chatId:i,env:o})).approvedCount,c=5e3,l=Math.ceil(d/c),u=Array.from({length:l},(y,m)=>m+1),p=[],f=u.map(y=>(0,r.getGroupMembersPublicKeys)({chatId:i,env:o,page:y,limit:c}));return(yield Promise.all(f)).forEach(y=>{y.members.length>0&&p.push(...y.members)}),p});return Ec.getAllGroupMembersPublicKeys=n,Ec}var H5;function rd(){return H5||(H5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupMembers=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=td(),a=ig(),d=Sa(),c=T9(),l=nn(),u=It(),p=Xt(),f=h=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:y,upsert:m,remove:b,account:v=null,signer:E=null,env:_=n.default.ENV.PROD,pgpPrivateKey:C=null,overrideSecretKeyGeneration:k=!l.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=h;try{(0,s.validateGroupMemberUpdateOptions)(h);const D=(0,s.getWallet)({account:v,signer:E}),w=yield(0,s.getConnectedUserV2Core)(D,C,_,s.PGPHelper),S=Object.entries(m).map(([J,se])=>t.__awaiter(void 0,void 0,void 0,function*(){const j=yield Promise.all(se.map(re=>(0,r.convertToValidDID)(re,_)));return[J,j]})),I=Object.fromEntries(yield Promise.all(S)),T=yield Promise.all(b.map(J=>(0,r.convertToValidDID)(J,_)));let g=null;const A=yield(0,o.getGroupInfo)({chatId:y,env:_});if(!A)throw new Error("Group not found");if(!A.isPublic&&(A.encryptedSecret||!k)){const{isMember:J}=yield(0,a.getGroupMemberStatus)({chatId:y,did:w.did,env:_}),se=yield(0,c.getAllGroupMembersPublicKeys)({chatId:y,env:_}),j=new Set(T.map(G=>G.toLowerCase()));let re=!0;if(se.map(G=>{j.has(G.did.toLowerCase())&&(re=!1)}),!re||!J){const G=d.generateRandomSecret(15),B=[];se.map(X=>{j.has(X.did.toLowerCase())||B.push(X.publicKey)}),J||B.push(w.publicKey),g=yield(0,s.pgpEncrypt)({plainText:G,keys:B})}}const P={upsert:I,remove:T,encryptedSecret:g},O=i.SHA256(JSON.stringify(P)).toString(),L=`pgpv2:${yield s.PGPHelper.sign({message:O,signingKey:w.privateKey})}:${w.did}`,R=`${(0,r.getAPIBaseUrls)(_)}/v1/chat/groups/${y}/members`,K={upsert:I,remove:T,encryptedSecret:g,deltaVerificationProof:L};return(yield(0,u.axiosPut)(R,K)).data}catch(D){throw(0,p.handleError)(D,e.updateGroupMembers.name)}});e.updateGroupMembers=f}(mp)),mp}var G5;function I9(){return G5||(G5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addAdmins=void 0;const t=$e,r=nn(),n=Je(),s=Xt(),i=rd(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,admins:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:f=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Admin address array cannot be empty!");const m={chatId:d,upsert:{members:[],admins:c},remove:[],account:l,signer:u,pgpPrivateKey:f,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(m)}catch(y){throw(0,s.handleError)(y,e.addAdmins.name)}});e.addAdmins=o}(gp)),gp}var z5;function sg(){if(z5)return wc;z5=1,Object.defineProperty(wc,"__esModule",{value:!0}),wc.addSpeakers=void 0;const e=$e,t=Je(),r=Mt(),n=I9(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){var o,a;const{spaceId:d,speakers:c,signer:l=null,env:u=(o=i==null?void 0:i.env)!==null&&o!==void 0?o:t.default.ENV.PROD,pgpPrivateKey:p=(a=i==null?void 0:i.pgpPrivateKey)!==null&&a!==void 0?a:null}=i,f=yield(0,n.addAdmins)({chatId:d,admins:c,signer:l,env:u,pgpPrivateKey:p});return(0,r.groupDtoToSpaceDtoV2)(f,u)});return wc.addSpeakers=s,wc}var _p={},wp={},W5;function C9(){return W5||(W5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeAdmins=void 0;const t=$e,r=nn(),n=Je(),s=Xt(),i=rd(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,admins:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:f=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Admin address array cannot be empty!");const y={chatId:d,upsert:{members:[],admins:[]},remove:c,account:l,signer:u,pgpPrivateKey:f,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(y)}catch(y){throw(0,s.handleError)(y,e.removeAdmins.name)}});e.removeAdmins=o}(wp)),wp}var Y5;function Pk(){return Y5||(Y5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeSpeakers=void 0;const t=$e,r=Je(),n=Mt(),s=C9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,speakers:d,signer:c=null,env:l=r.default.ENV.PROD,pgpPrivateKey:u=null}=o||{};try{const p=yield(0,s.removeAdmins)({chatId:a,admins:d,signer:c,env:l,pgpPrivateKey:u});return(0,n.groupDtoToSpaceDtoV2)(p,l)}catch(p){throw console.error(`[Push SDK] - API - Error - API ${e.removeSpeakers.name} -: `,p),Error(`[Push SDK] - API - Error - API ${e.removeSpeakers.name} -: ${p}`)}});e.removeSpeakers=i}(_p)),_p}var Ep={},Ap={},J5;function R9(){return J5||(J5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addMembers=void 0;const t=$e,r=nn(),n=Je(),s=Xt(),i=rd(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,members:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:f=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Member address array cannot be empty!");const m={chatId:d,upsert:{members:c,admins:[]},remove:[],account:l,signer:u,pgpPrivateKey:f,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(m)}catch(y){throw(0,s.handleError)(y,e.addMembers.name)}});e.addMembers=o}(Ap)),Ap}var Z5;function Tk(){return Z5||(Z5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addListeners=void 0;const t=$e,r=Je(),n=Mt(),s=R9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,listeners:d,account:c=null,signer:l=null,env:u=r.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{const f=yield(0,s.addMembers)({chatId:a,members:d,account:c,signer:l,env:u,pgpPrivateKey:p});return(0,n.groupDtoToSpaceDtoV2)(f,u)}catch(f){throw console.error(`[Push SDK] - API - Error - API ${e.addListeners.name} -: `,f),Error(`[Push SDK] - API - Error - API ${e.addListeners.name} -: ${f}`)}});e.addListeners=i}(Ep)),Ep}var Sp={},Pp={},X5;function k9(){return X5||(X5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeMembers=void 0;const t=$e,r=nn(),n=Je(),s=Xt(),i=rd(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,members:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:f=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Member address array cannot be empty!");const y={chatId:d,upsert:{members:[],admins:[]},remove:c,account:l,signer:u,pgpPrivateKey:f,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(y)}catch(y){throw(0,s.handleError)(y,e.removeMembers.name)}});e.removeMembers=o}(Pp)),Pp}var Q5;function Ik(){return Q5||(Q5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeListeners=void 0;const t=$e,r=Je(),n=Mt(),s=k9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,listeners:d,account:c=null,signer:l=null,env:u=r.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{const f=yield(0,s.removeMembers)({chatId:a,members:d,account:c,signer:l,env:u,pgpPrivateKey:p});return(0,n.groupDtoToSpaceDtoV2)(f,u)}catch(f){throw console.error(`[Push SDK] - API - Error - API ${e.removeListeners.name} -: `,f),Error(`[Push SDK] - API - Error - API ${e.removeListeners.name} -: ${f}`)}});e.removeListeners=i}(Sp)),Sp}var Tp={},Ip={},e6;function M9(){return e6||(e6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.approveCore=e.approve=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=It(),a=Sa(),d=td(),c=T9(),l=nn(),u=Xt(),p=h=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.approveCore)(h,s.PGPHelper)});e.approve=p;const f=(h,y)=>t.__awaiter(void 0,void 0,void 0,function*(){const{status:m="Approved",account:b=null,signer:v=null,senderAddress:E,env:_=n.default.ENV.PROD,pgpPrivateKey:C=null,overrideSecretKeyGeneration:k=!l.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=h||{};if(b==null&&v==null)throw new Error("At least one from account or signer is necessary!");const D=(0,s.getWallet)({account:b,signer:v}),w=yield(0,s.getAccountAddress)(D),S=!(0,r.isValidPushCAIP)(E),I=yield(0,s.getConnectedUserV2Core)(D,C,_,y),T=S?yield(0,r.convertToValidDID)(w,_):yield(0,r.convertToValidDID)(E,_),g=S?yield(0,r.convertToValidDID)(E,_):yield(0,r.convertToValidDID)(w,_);let A=null,P="pgp";if(S){const V=yield(0,d.getGroupInfo)({chatId:E,env:_});if(V&&!V.isPublic&&(V.encryptedSecret||!k)){P="pgpv2";const J=a.generateRandomSecret(15),j=(yield(0,c.getAllGroupMembersPublicKeys)({chatId:V.chatId,env:_})).map(re=>re.publicKey);j.push(I.publicKey),A=yield y.pgpEncrypt({plainText:J,keys:j})}}let O;switch(P){case"pgp":{O={fromDID:T,toDID:g,status:m};break}case"pgpv2":{O={fromDID:T,toDID:g,status:m,encryptedSecret:A};break}}const N=i.SHA256(JSON.stringify(O)).toString(),M=yield y.sign({message:N,signingKey:I.privateKey}),L=`${P}:${M}`,x={fromDID:T,toDID:g,signature:M,status:m,sigType:P,verificationProof:L,encryptedSecret:A},K=`${(0,r.getAPIBaseUrls)(_)}/v1/chat/request/accept`;return(0,o.axiosPut)(K,x).then(V=>V.data).catch(V=>{throw(0,u.handleError)(V,e.approve.name)})});e.approveCore=f}(Ip)),Ip}var t6;function O9(){return t6||(t6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.approve=void 0;const t=$e,r=tt(),n=Je(),s=M9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{status:a="Approved",account:d=null,signer:c=null,senderAddress:l,env:u=n.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{if(d==null&&c==null)throw new Error("At least one from account or signer is necessary!");if(!(0,r.isValidPushCAIP)(l)&&!l.startsWith("spaces:"))throw new Error("Not a valid spaceId or ETH address");return yield(0,s.approve)({status:a,account:d,signer:c,senderAddress:l,env:u,pgpPrivateKey:p})}catch(f){throw console.error(`[Push SDK] - API - Error - API ${e.approve.name} -: `,f),Error(`[Push SDK] - API - Error - API ${e.approve.name} -: ${f}`)}});e.approve=i}(Tp)),Tp}var Cp={},r6;function Ck(){return r6||(r6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.requests=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=It(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:d,pgpPrivateKey:c,env:l=n.default.ENV.PROD,toDecrypt:u=!1,page:p=1,limit:f=10}=a||{},h=yield(0,r.convertToValidDID)(d,l),m=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${h}/requests?page=${p}&limit=${f}`;try{if(!(0,r.isValidPushCAIP)(h))throw new Error("Invalid address!");const v=(yield(0,i.axiosGet)(m)).data.requests;return yield(0,s.getSpaceInboxLists)({lists:v,user:h,toDecrypt:u,pgpPrivateKey:c,env:l})}catch(b){throw console.error(`[Push SDK] - API ${e.requests.name}: `,b),Error(`[Push SDK] - API ${e.requests.name}: ${b}`)}});e.requests=o}(Cp)),Cp}var Rp={},kp={},Mp={},n6;function Rk(){return n6||(n6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.chatsCore=e.chats=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=It(),o=Xt(),a=c=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.chatsCore)(c,s.PGPHelper)});e.chats=a;const d=(c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:u,pgpPrivateKey:p,env:f=n.default.ENV.PROD,toDecrypt:h=!1,page:y=1,limit:m=10}=c||{};if(!(0,r.isValidPushCAIP)(u))throw new Error("Invalid address!");const b=yield(0,r.convertToValidDID)(u,f),_=`${`${(0,r.getAPIBaseUrls)(f)}/v1/chat/users/${b}/chats?page=${y}&limit=${m}`}`;try{const k=(yield(0,i.axiosGet)(_)).data.chats,D=(0,s.addDeprecatedInfo)(k);return yield(0,s.getInboxLists)({lists:D,user:b,toDecrypt:h,pgpPrivateKey:p,env:f},l)}catch(C){throw(0,o.handleError)(C,e.chats.name)}});e.chatsCore=d}(Mp)),Mp}var Op={},i6;function kk(){return i6||(i6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.chat=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=Mt(),o=Xt(),a=d=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:c,pgpPrivateKey:l,env:u=n.default.ENV.PROD,toDecrypt:p=!1,recipient:f}=d||{},h=yield(0,r.convertToValidDID)(c,u),y=yield(0,r.convertToValidDID)(f,u);if(!(0,r.isValidPushCAIP)(h))throw new Error(`Invalid address ${h}`);const b=`${(0,r.getAPIBaseUrls)(u)}/v1/chat/users/${h}/chat/${y}`;try{const E=(yield(0,s.axiosGet)(b)).data;if(Object.keys(E).length!==0){const _=(0,i.addDeprecatedInfo)([E]),[C]=yield(0,i.getInboxLists)({lists:_,user:h,toDecrypt:p,pgpPrivateKey:l,env:u},i.PGPHelper);return C}else return E}catch(v){throw(0,o.handleError)(v,e.chat.name)}});e.chat=a}(Op)),Op}var Np={},s6;function Mk(){return s6||(s6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.requestsCore=e.requests=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=Mt(),o=Xt(),a=c=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.requestsCore)(c,i.PGPHelper)});e.requests=a;const d=(c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:u,pgpPrivateKey:p,env:f=n.default.ENV.PROD,toDecrypt:h=!1,page:y=1,limit:m=10}=c||{},b=yield(0,r.convertToValidDID)(u,f),E=`${(0,r.getAPIBaseUrls)(f)}/v1/chat/users/${b}/requests?page=${y}&limit=${m}`;try{if(!(0,r.isValidPushCAIP)(b))throw new Error("Invalid address!");const C=(yield(0,s.axiosGet)(E)).data.requests,k=(0,i.addDeprecatedInfo)(C);return yield(0,i.getInboxLists)({lists:k,user:b,toDecrypt:h,pgpPrivateKey:p,env:f},l)}catch(_){throw(0,o.handleError)(_,e.requests.name)}});e.requestsCore=d}(Np)),Np}var Dp={},xp={},a6;function N9(){return a6||(a6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.conversationHash=void 0;const t=$e,r=Je(),n=Xt(),s=tt(),i=Mt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{conversationId:d,account:c,env:l=r.default.ENV.PROD}=a||{};try{if(!(0,s.isValidPushCAIP)(c))throw new Error("Invalid address!");const u=yield(0,s.convertToValidDID)(d,l),p=yield(0,s.convertToValidDID)(c,l);return yield(0,i.getConversationHashService)({conversationId:u,account:p,env:l})}catch(u){throw(0,n.handleError)(u,e.conversationHash.name)}});e.conversationHash=o}(xp)),xp}var Ac={},Up={exports:{}},o6;function Ok(){return o6||(o6=1,function(e,t){(function(r,n){e.exports=n()})(self,()=>{return r={7629:(s,i,o)=>{const a=o(375),d=o(8571),c=o(9474),l=o(1687),u=o(8652),p=o(8160),f=o(3292),h=o(6354),y=o(8901),m=o(9708),b=o(6914),v=o(2294),E=o(6133),_=o(1152),C=o(8863),k=o(2036),D={Base:class{constructor(w){this.type=w,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new v.Ids,this._preferences=null,this._refs=new E.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return a(typeof m.describe=="function","Manifest functionality disabled"),m.describe(this)}allow(...w){return p.verifyFlat(w,"allow"),this._values(w,"_valids")}alter(w){a(w&&typeof w=="object"&&!Array.isArray(w),"Invalid targets argument"),a(!this._inRuleset(),"Cannot set alterations inside a ruleset");const S=this.clone();S.$_terms.alterations=S.$_terms.alterations||[];for(const I in w){const T=w[I];a(typeof T=="function","Alteration adjuster for",I,"must be a function"),S.$_terms.alterations.push({target:I,adjuster:T})}return S.$_temp.ruleset=!1,S}artifact(w){return a(w!==void 0,"Artifact cannot be undefined"),a(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",w)}cast(w){return a(w===!1||typeof w=="string","Invalid to value"),a(w===!1||this._definition.cast[w],"Type",this.type,"does not support casting to",w),this.$_setFlag("cast",w===!1?void 0:w)}default(w,S){return this._default("default",w,S)}description(w){return a(w&&typeof w=="string","Description must be a non-empty string"),this.$_setFlag("description",w)}empty(w){const S=this.clone();return w!==void 0&&(w=S.$_compile(w,{override:!1})),S.$_setFlag("empty",w,{clone:!1})}error(w){return a(w,"Missing error"),a(w instanceof Error||typeof w=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",w)}example(w,S={}){return a(w!==void 0,"Missing example"),p.assertOptions(S,["override"]),this._inner("examples",w,{single:!0,override:S.override})}external(w,S){return typeof w=="object"&&(a(!S,"Cannot combine options with description"),S=w.description,w=w.method),a(typeof w=="function","Method must be a function"),a(S===void 0||S&&typeof S=="string","Description must be a non-empty string"),this._inner("externals",{method:w,description:S},{single:!0})}failover(w,S){return this._default("failover",w,S)}forbidden(){return this.presence("forbidden")}id(w){return w?(a(typeof w=="string","id must be a non-empty string"),a(/^[^\.]+$/.test(w),"id cannot contain period character"),this.$_setFlag("id",w)):this.$_setFlag("id",void 0)}invalid(...w){return this._values(w,"_invalids")}label(w){return a(w&&typeof w=="string","Label name must be a non-empty string"),this.$_setFlag("label",w)}meta(w){return a(w!==void 0,"Meta cannot be undefined"),this._inner("metas",w,{single:!0})}note(...w){a(w.length,"Missing notes");for(const S of w)a(S&&typeof S=="string","Notes must be non-empty strings");return this._inner("notes",w)}only(w=!0){return a(typeof w=="boolean","Invalid mode:",w),this.$_setFlag("only",w)}optional(){return this.presence("optional")}prefs(w){a(w,"Missing preferences"),a(w.context===void 0,"Cannot override context"),a(w.externals===void 0,"Cannot override externals"),a(w.warnings===void 0,"Cannot override warnings"),a(w.debug===void 0,"Cannot override debug"),p.checkPreferences(w);const S=this.clone();return S._preferences=p.preferences(S._preferences,w),S}presence(w){return a(["optional","required","forbidden"].includes(w),"Unknown presence mode",w),this.$_setFlag("presence",w)}raw(w=!0){return this.$_setFlag("result",w?"raw":void 0)}result(w){return a(["raw","strip"].includes(w),"Unknown result mode",w),this.$_setFlag("result",w)}required(){return this.presence("required")}strict(w){const S=this.clone(),I=w!==void 0&&!w;return S._preferences=p.preferences(S._preferences,{convert:I}),S}strip(w=!0){return this.$_setFlag("result",w?"strip":void 0)}tag(...w){a(w.length,"Missing tags");for(const S of w)a(S&&typeof S=="string","Tags must be non-empty strings");return this._inner("tags",w)}unit(w){return a(w&&typeof w=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",w)}valid(...w){p.verifyFlat(w,"valid");const S=this.allow(...w);return S.$_setFlag("only",!!S._valids,{clone:!1}),S}when(w,S){const I=this.clone();I.$_terms.whens||(I.$_terms.whens=[]);const T=f.when(I,w,S);if(!["any","link"].includes(I.type)){const g=T.is?[T]:T.switch;for(const A of g)a(!A.then||A.then.type==="any"||A.then.type===I.type,"Cannot combine",I.type,"with",A.then&&A.then.type),a(!A.otherwise||A.otherwise.type==="any"||A.otherwise.type===I.type,"Cannot combine",I.type,"with",A.otherwise&&A.otherwise.type)}return I.$_terms.whens.push(T),I.$_mutateRebuild()}cache(w){a(!this._inRuleset(),"Cannot set caching inside a ruleset"),a(!this._cache,"Cannot override schema cache"),a(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const S=this.clone();return S._cache=w||u.provider.provision(),S.$_temp.ruleset=!1,S}clone(){const w=Object.create(Object.getPrototypeOf(this));return this._assign(w)}concat(w){a(p.isSchema(w),"Invalid schema object"),a(this.type==="any"||w.type==="any"||w.type===this.type,"Cannot merge type",this.type,"with another type:",w.type),a(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),a(!w._inRuleset(),"Cannot concatenate a schema with open ruleset");let S=this.clone();if(this.type==="any"&&w.type!=="any"){const I=w.clone();for(const T of Object.keys(S))T!=="type"&&(I[T]=S[T]);S=I}S._ids.concat(w._ids),S._refs.register(w,E.toSibling),S._preferences=S._preferences?p.preferences(S._preferences,w._preferences):w._preferences,S._valids=k.merge(S._valids,w._valids,w._invalids),S._invalids=k.merge(S._invalids,w._invalids,w._valids);for(const I of w._singleRules.keys())S._singleRules.has(I)&&(S._rules=S._rules.filter(T=>T.keep||T.name!==I),S._singleRules.delete(I));for(const I of w._rules)w._definition.rules[I.method].multi||S._singleRules.set(I.name,I),S._rules.push(I);if(S._flags.empty&&w._flags.empty){S._flags.empty=S._flags.empty.concat(w._flags.empty);const I=Object.assign({},w._flags);delete I.empty,l(S._flags,I)}else if(w._flags.empty){S._flags.empty=w._flags.empty;const I=Object.assign({},w._flags);delete I.empty,l(S._flags,I)}else l(S._flags,w._flags);for(const I in w.$_terms){const T=w.$_terms[I];T?S.$_terms[I]?S.$_terms[I]=S.$_terms[I].concat(T):S.$_terms[I]=T.slice():S.$_terms[I]||(S.$_terms[I]=T)}return this.$_root._tracer&&this.$_root._tracer._combine(S,[this,w]),S.$_mutateRebuild()}extend(w){return a(!w.base,"Cannot extend type with another base"),y.type(this,w)}extract(w){return w=Array.isArray(w)?w:w.split("."),this._ids.reach(w)}fork(w,S){a(!this._inRuleset(),"Cannot fork inside a ruleset");let I=this;for(let T of[].concat(w))T=Array.isArray(T)?T:T.split("."),I=I._ids.fork(T,S,I);return I.$_temp.ruleset=!1,I}rule(w){const S=this._definition;p.assertOptions(w,Object.keys(S.modifiers)),a(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const I=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;a(I>=0&&I<this._rules.length,"Cannot apply rules to empty ruleset");const T=this.clone();for(let g=I;g<T._rules.length;++g){const A=T._rules[g],P=d(A);for(const O in w)S.modifiers[O](P,w[O]),a(P.name===A.name,"Cannot change rule name");T._rules[g]=P,T._singleRules.get(P.name)===A&&T._singleRules.set(P.name,P)}return T.$_temp.ruleset=!1,T.$_mutateRebuild()}get ruleset(){a(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const w=this.clone();return w.$_temp.ruleset=w._rules.length,w}get $(){return this.ruleset}tailor(w){w=[].concat(w),a(!this._inRuleset(),"Cannot tailor inside a ruleset");let S=this;if(this.$_terms.alterations)for(const{target:I,adjuster:T}of this.$_terms.alterations)w.includes(I)&&(S=T(S),a(p.isSchema(S),"Alteration adjuster for",I,"failed to return a schema object"));return S=S.$_modify({each:I=>I.tailor(w),ref:!1}),S.$_temp.ruleset=!1,S.$_mutateRebuild()}tracer(){return _.location?_.location(this):this}validate(w,S){return C.entry(w,this,S)}validateAsync(w,S){return C.entryAsync(w,this,S)}$_addRule(w){typeof w=="string"&&(w={name:w}),a(w&&typeof w=="object","Invalid options"),a(w.name&&typeof w.name=="string","Invalid rule name");for(const A in w)a(A[0]!=="_","Cannot set private rule properties");const S=Object.assign({},w);S._resolve=[],S.method=S.method||S.name;const I=this._definition.rules[S.method],T=S.args;a(I,"Unknown rule",S.method);const g=this.clone();if(T){a(Object.keys(T).length===1||Object.keys(T).length===this._definition.rules[S.name].args.length,"Invalid rule definition for",this.type,S.name);for(const A in T){let P=T[A];if(I.argsByName){const O=I.argsByName.get(A);if(O.ref&&p.isResolvable(P))S._resolve.push(A),g.$_mutateRegister(P);else if(O.normalize&&(P=O.normalize(P),T[A]=P),O.assert){const N=p.validateArg(P,A,O);a(!N,N,"or reference")}}P!==void 0?T[A]=P:delete T[A]}}return I.multi||(g._ruleRemove(S.name,{clone:!1}),g._singleRules.set(S.name,S)),g.$_temp.ruleset===!1&&(g.$_temp.ruleset=null),I.priority?g._rules.unshift(S):g._rules.push(S),g}$_compile(w,S){return f.schema(this.$_root,w,S)}$_createError(w,S,I,T,g,A={}){const P=A.flags!==!1?this._flags:{},O=A.messages?b.merge(this._definition.messages,A.messages):this._definition.messages;return new h.Report(w,S,I,P,O,T,g)}$_getFlag(w){return this._flags[w]}$_getRule(w){return this._singleRules.get(w)}$_mapLabels(w){return w=Array.isArray(w)?w:w.split("."),this._ids.labels(w)}$_match(w,S,I,T){(I=Object.assign({},I)).abortEarly=!0,I._externals=!1,S.snapshot();const g=!C.validate(w,this,S,I,T).errors;return S.restore(),g}$_modify(w){return p.assertOptions(w,["each","once","ref","schema"]),v.schema(this,w)||this}$_mutateRebuild(){return a(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(w,{source:S,name:I,path:T,key:g})=>{const A=this._definition[S][I]&&this._definition[S][I].register;A!==!1&&this.$_mutateRegister(w,{family:A,key:g})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(w,{family:S,key:I}={}){this._refs.register(w,S),this._ids.register(w,{key:I})}$_property(w){return this._definition.properties[w]}$_reach(w){return this._ids.reach(w)}$_rootReferences(){return this._refs.roots()}$_setFlag(w,S,I={}){a(w[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const T=this._definition.flags[w]||{};if(c(S,T.default)&&(S=void 0),c(S,this._flags[w]))return this;const g=I.clone!==!1?this.clone():this;return S!==void 0?(g._flags[w]=S,g.$_mutateRegister(S)):delete g._flags[w],w[0]!=="_"&&(g.$_temp.ruleset=!1),g}$_parent(w,...S){return this[w][p.symbols.parent].call(this,...S)}$_validate(w,S,I){return C.validate(w,this,S,I)}_assign(w){w.type=this.type,w.$_root=this.$_root,w.$_temp=Object.assign({},this.$_temp),w.$_temp.whens={},w._ids=this._ids.clone(),w._preferences=this._preferences,w._valids=this._valids&&this._valids.clone(),w._invalids=this._invalids&&this._invalids.clone(),w._rules=this._rules.slice(),w._singleRules=d(this._singleRules,{shallow:!0}),w._refs=this._refs.clone(),w._flags=Object.assign({},this._flags),w._cache=null,w.$_terms={};for(const S in this.$_terms)w.$_terms[S]=this.$_terms[S]?this.$_terms[S].slice():null;w.$_super={};for(const S in this.$_super)w.$_super[S]=this._super[S].bind(w);return w}_bare(){const w=this.clone();w._reset();const S=w._definition.terms;for(const I in S){const T=S[I];w.$_terms[I]=T.init}return w.$_mutateRebuild()}_default(w,S,I={}){return p.assertOptions(I,"literal"),a(S!==void 0,"Missing",w,"value"),a(typeof S=="function"||!I.literal,"Only function value supports literal option"),typeof S=="function"&&I.literal&&(S={[p.symbols.literal]:!0,literal:S}),this.$_setFlag(w,S)}_generate(w,S,I){if(!this.$_terms.whens)return{schema:this};const T=[],g=[];for(let O=0;O<this.$_terms.whens.length;++O){const N=this.$_terms.whens[O];if(N.concat){T.push(N.concat),g.push(`${O}.concat`);continue}const M=N.ref?N.ref.resolve(w,S,I):w,L=N.is?[N]:N.switch,x=g.length;for(let R=0;R<L.length;++R){const{is:K,then:V,otherwise:J}=L[R],se=`${O}${N.switch?"."+R:""}`;if(K.$_match(M,S.nest(K,`${se}.is`),I)){if(V){const j=S.localize([...S.path,`${se}.then`],S.ancestors,S.schemas),{schema:re,id:G}=V._generate(w,j,I);T.push(re),g.push(`${se}.then${G?`(${G})`:""}`);break}}else if(J){const j=S.localize([...S.path,`${se}.otherwise`],S.ancestors,S.schemas),{schema:re,id:G}=J._generate(w,j,I);T.push(re),g.push(`${se}.otherwise${G?`(${G})`:""}`);break}}if(N.break&&g.length>x)break}const A=g.join(", ");if(S.mainstay.tracer.debug(S,"rule","when",A),!A)return{schema:this};if(!S.mainstay.tracer.active&&this.$_temp.whens[A])return{schema:this.$_temp.whens[A],id:A};let P=this;this._definition.generate&&(P=this._definition.generate(this,w,S,I));for(const O of T)P=P.concat(O);return this.$_root._tracer&&this.$_root._tracer._combine(P,[this,...T]),this.$_temp.whens[A]=P,{schema:P,id:A}}_inner(w,S,I={}){a(!this._inRuleset(),`Cannot set ${w} inside a ruleset`);const T=this.clone();return T.$_terms[w]&&!I.override||(T.$_terms[w]=[]),I.single?T.$_terms[w].push(S):T.$_terms[w].push(...S),T.$_temp.ruleset=!1,T}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(w,S={}){if(!this._singleRules.has(w))return this;const I=S.clone!==!1?this.clone():this;I._singleRules.delete(w);const T=[];for(let g=0;g<I._rules.length;++g){const A=I._rules[g];A.name!==w||A.keep?T.push(A):I._inRuleset()&&g<I.$_temp.ruleset&&--I.$_temp.ruleset}return I._rules=T,I}_values(w,S){p.verifyFlat(w,S.slice(1,-1));const I=this.clone(),T=w[0]===p.symbols.override;if(T&&(w=w.slice(1)),!I[S]&&w.length?I[S]=new k:T&&(I[S]=w.length?new k:null,I.$_mutateRebuild()),!I[S])return I;T&&I[S].override();for(const g of w){a(g!==void 0,"Cannot call allow/valid/invalid with undefined"),a(g!==p.symbols.override,"Override must be the first value");const A=S==="_invalids"?"_valids":"_invalids";I[A]&&(I[A].remove(g),I[A].length||(a(S==="_valids"||!I._flags.only,"Setting invalid value",g,"leaves schema rejecting all values due to previous valid rule"),I[A]=null)),I[S].add(g,I._refs)}return I}}};D.Base.prototype[p.symbols.any]={version:p.version,compile:f.compile,root:"$_root"},D.Base.prototype.isImmutable=!0,D.Base.prototype.deny=D.Base.prototype.invalid,D.Base.prototype.disallow=D.Base.prototype.invalid,D.Base.prototype.equal=D.Base.prototype.valid,D.Base.prototype.exist=D.Base.prototype.required,D.Base.prototype.not=D.Base.prototype.invalid,D.Base.prototype.options=D.Base.prototype.prefs,D.Base.prototype.preferences=D.Base.prototype.prefs,s.exports=new D.Base},8652:(s,i,o)=>{const a=o(375),d=o(8571),c=o(8160),l={max:1e3,supported:new Set(["undefined","boolean","number","string"])};i.provider={provision:u=>new l.Cache(u)},l.Cache=class{constructor(u={}){c.assertOptions(u,["max"]),a(u.max===void 0||u.max&&u.max>0&&isFinite(u.max),"Invalid max cache size"),this._max=u.max||l.max,this._map=new Map,this._list=new l.List}get length(){return this._map.size}set(u,p){if(u!==null&&!l.supported.has(typeof u))return;let f=this._map.get(u);if(f)return f.value=p,void this._list.first(f);f=this._list.unshift({key:u,value:p}),this._map.set(u,f),this._compact()}get(u){const p=this._map.get(u);if(p)return this._list.first(p),d(p.value)}_compact(){if(this._map.size>this._max){const u=this._list.pop();this._map.delete(u.key)}}},l.List=class{constructor(){this.tail=null,this.head=null}unshift(u){return u.next=null,u.prev=this.head,this.head&&(this.head.next=u),this.head=u,this.tail||(this.tail=u),u}first(u){u!==this.head&&(this._remove(u),this.unshift(u))}pop(){return this._remove(this.tail)}_remove(u){const{next:p,prev:f}=u;return p.prev=f,f&&(f.next=p),u===this.tail&&(this.tail=p),u.prev=null,u.next=null,u}}},8160:(s,i,o)=>{const a=o(375),d=o(7916),c=o(5934);let l,u;const p={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};i.version=c.version,i.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},i.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},i.assertOptions=function(f,h,y="Options"){a(f&&typeof f=="object"&&!Array.isArray(f),"Options must be of type object");const m=Object.keys(f).filter(b=>!h.includes(b));a(m.length===0,`${y} contain unknown keys: ${m}`)},i.checkPreferences=function(f){u=u||o(3378);const h=u.preferences.validate(f);if(h.error)throw new d([h.error.details[0].message])},i.compare=function(f,h,y){switch(y){case"=":return f===h;case">":return f>h;case"<":return f<h;case">=":return f>=h;case"<=":return f<=h}},i.default=function(f,h){return f===void 0?h:f},i.isIsoDate=function(f){return p.isoDate.test(f)},i.isNumber=function(f){return typeof f=="number"&&!isNaN(f)},i.isResolvable=function(f){return!!f&&(f[i.symbols.ref]||f[i.symbols.template])},i.isSchema=function(f,h={}){const y=f&&f[i.symbols.any];return!!y&&(a(h.legacy||y.version===i.version,"Cannot mix different versions of joi schemas"),!0)},i.isValues=function(f){return f[i.symbols.values]},i.limit=function(f){return Number.isSafeInteger(f)&&f>=0},i.preferences=function(f,h){l=l||o(6914),f=f||{},h=h||{};const y=Object.assign({},f,h);return h.errors&&f.errors&&(y.errors=Object.assign({},f.errors,h.errors),y.errors.wrap=Object.assign({},f.errors.wrap,h.errors.wrap)),h.messages&&(y.messages=l.compile(h.messages,f.messages)),delete y[i.symbols.prefs],y},i.tryWithPath=function(f,h,y={}){try{return f()}catch(m){throw m.path!==void 0?m.path=h+"."+m.path:m.path=h,y.append&&(m.message=`${m.message} (${m.path})`),m}},i.validateArg=function(f,h,{assert:y,message:m}){if(i.isSchema(y)){const b=y.validate(f);return b.error?b.error.message:void 0}if(!y(f))return h?`${h} ${m}`:m},i.verifyFlat=function(f,h){for(const y of f)a(!Array.isArray(y),"Method no longer accepts array arguments:",h)}},3292:(s,i,o)=>{const a=o(375),d=o(8160),c=o(6133),l={};i.schema=function(u,p,f={}){d.assertOptions(f,["appendPath","override"]);try{return l.schema(u,p,f)}catch(h){throw f.appendPath&&h.path!==void 0&&(h.message=`${h.message} (${h.path})`),h}},l.schema=function(u,p,f){a(p!==void 0,"Invalid undefined schema"),Array.isArray(p)&&(a(p.length,"Invalid empty array schema"),p.length===1&&(p=p[0]));const h=(y,...m)=>f.override!==!1?y.valid(u.override,...m):y.valid(...m);if(l.simple(p))return h(u,p);if(typeof p=="function")return u.custom(p);if(a(typeof p=="object","Invalid schema content:",typeof p),d.isResolvable(p))return h(u,p);if(d.isSchema(p))return p;if(Array.isArray(p)){for(const y of p)if(!l.simple(y))return u.alternatives().try(...p);return h(u,...p)}return p instanceof RegExp?u.string().regex(p):p instanceof Date?h(u.date(),p):(a(Object.getPrototypeOf(p)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),u.object().keys(p))},i.ref=function(u,p){return c.isRef(u)?u:c.create(u,p)},i.compile=function(u,p,f={}){d.assertOptions(f,["legacy"]);const h=p&&p[d.symbols.any];if(h)return a(f.legacy||h.version===d.version,"Cannot mix different versions of joi schemas:",h.version,d.version),p;if(typeof p!="object"||!f.legacy)return i.schema(u,p,{appendPath:!0});const y=l.walk(p);return y?y.compile(y.root,p):i.schema(u,p,{appendPath:!0})},l.walk=function(u){if(typeof u!="object")return null;if(Array.isArray(u)){for(const f of u){const h=l.walk(f);if(h)return h}return null}const p=u[d.symbols.any];if(p)return{root:u[p.root],compile:p.compile};a(Object.getPrototypeOf(u)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const f in u){const h=l.walk(u[f]);if(h)return h}return null},l.simple=function(u){return u===null||["boolean","string","number"].includes(typeof u)},i.when=function(u,p,f){if(f===void 0&&(a(p&&typeof p=="object","Missing options"),f=p,p=c.create(".")),Array.isArray(f)&&(f={switch:f}),d.assertOptions(f,["is","not","then","otherwise","switch","break"]),d.isSchema(p))return a(f.is===void 0,'"is" can not be used with a schema condition'),a(f.not===void 0,'"not" can not be used with a schema condition'),a(f.switch===void 0,'"switch" can not be used with a schema condition'),l.condition(u,{is:p,then:f.then,otherwise:f.otherwise,break:f.break});if(a(c.isRef(p)||typeof p=="string","Invalid condition:",p),a(f.not===void 0||f.is===void 0,'Cannot combine "is" with "not"'),f.switch===void 0){let y=f;f.not!==void 0&&(y={is:f.not,then:f.otherwise,otherwise:f.then,break:f.break});let m=y.is!==void 0?u.$_compile(y.is):u.$_root.invalid(null,!1,0,"").required();return a(y.then!==void 0||y.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),a(y.break===void 0||y.then===void 0||y.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),f.is===void 0||c.isRef(f.is)||d.isSchema(f.is)||(m=m.required()),l.condition(u,{ref:i.ref(p),is:m,then:y.then,otherwise:y.otherwise,break:y.break})}a(Array.isArray(f.switch),'"switch" must be an array'),a(f.is===void 0,'Cannot combine "switch" with "is"'),a(f.not===void 0,'Cannot combine "switch" with "not"'),a(f.then===void 0,'Cannot combine "switch" with "then"');const h={ref:i.ref(p),switch:[],break:f.break};for(let y=0;y<f.switch.length;++y){const m=f.switch[y],b=y===f.switch.length-1;d.assertOptions(m,b?["is","then","otherwise"]:["is","then"]),a(m.is!==void 0,'Switch statement missing "is"'),a(m.then!==void 0,'Switch statement missing "then"');const v={is:u.$_compile(m.is),then:u.$_compile(m.then)};if(c.isRef(m.is)||d.isSchema(m.is)||(v.is=v.is.required()),b){a(f.otherwise===void 0||m.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const E=f.otherwise!==void 0?f.otherwise:m.otherwise;E!==void 0&&(a(h.break===void 0,"Cannot specify both otherwise and break"),v.otherwise=u.$_compile(E))}h.switch.push(v)}return h},l.condition=function(u,p){for(const f of["then","otherwise"])p[f]===void 0?delete p[f]:p[f]=u.$_compile(p[f]);return p}},6354:(s,i,o)=>{const a=o(5688),d=o(8160),c=o(3328);i.Report=class{constructor(l,u,p,f,h,y,m){if(this.code=l,this.flags=f,this.messages=h,this.path=y.path,this.prefs=m,this.state=y,this.value=u,this.message=null,this.template=null,this.local=p||{},this.local.label=i.label(this.flags,this.state,this.prefs,this.messages),this.value===void 0||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const b=this.path[this.path.length-1];typeof b!="object"&&(this.local.key=b)}}_setTemplate(l){if(this.template=l,!this.flags.label&&this.path.length===0){const u=this._template(this.template,"root");u&&(this.local.label=u)}}toString(){if(this.message)return this.message;const l=this.code;if(!this.prefs.errors.render)return this.code;const u=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return u===void 0?`Error code "${l}" is not defined, your custom type is missing the correct messages definition`:(this.message=u.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(l,u){return i.template(this.value,l,u||this.code,this.state,this.prefs)}},i.path=function(l){let u="";for(const p of l)typeof p!="object"&&(typeof p=="string"?(u&&(u+="."),u+=p):u+=`[${p}]`);return u},i.template=function(l,u,p,f,h){if(!u)return;if(c.isTemplate(u))return p!=="root"?u:null;let y=h.errors.language;if(d.isResolvable(y)&&(y=y.resolve(l,f,h)),y&&u[y]){if(u[y][p]!==void 0)return u[y][p];if(u[y]["*"]!==void 0)return u[y]["*"]}return u[p]?u[p]:u["*"]},i.label=function(l,u,p,f){if(!p.errors.label)return"";if(l.label)return l.label;let h=u.path;return p.errors.label==="key"&&u.path.length>1&&(h=u.path.slice(-1)),i.path(h)||i.template(null,p.messages,"root",u,p)||f&&i.template(null,f,"root",u,p)||"value"},i.process=function(l,u,p){if(!l)return null;const{override:f,message:h,details:y}=i.details(l);if(f)return f;if(p.errors.stack)return new i.ValidationError(h,y,u);const m=Error.stackTraceLimit;Error.stackTraceLimit=0;const b=new i.ValidationError(h,y,u);return Error.stackTraceLimit=m,b},i.details=function(l,u={}){let p=[];const f=[];for(const h of l){if(h instanceof Error){if(u.override!==!1)return{override:h};const m=h.toString();p.push(m),f.push({message:m,type:"override",context:{error:h}});continue}const y=h.toString();p.push(y),f.push({message:y,path:h.path.filter(m=>typeof m!="object"),type:h.code,context:h.local})}return p.length>1&&(p=[...new Set(p)]),{message:p.join(". "),details:f}},i.ValidationError=class extends Error{constructor(l,u,p){super(l),this._original=p,this.details=u}static isError(l){return l instanceof i.ValidationError}},i.ValidationError.prototype.isJoi=!0,i.ValidationError.prototype.name="ValidationError",i.ValidationError.prototype.annotate=a.error},8901:(s,i,o)=>{const a=o(375),d=o(8571),c=o(8160),l=o(6914),u={};i.type=function(p,f){const h=Object.getPrototypeOf(p),y=d(h),m=p._assign(Object.create(y)),b=Object.assign({},f);delete b.base,y._definition=b;const v=h._definition||{};b.messages=l.merge(v.messages,b.messages),b.properties=Object.assign({},v.properties,b.properties),m.type=b.type,b.flags=Object.assign({},v.flags,b.flags);const E=Object.assign({},v.terms);if(b.terms)for(const D in b.terms){const w=b.terms[D];a(m.$_terms[D]===void 0,"Invalid term override for",b.type,D),m.$_terms[D]=w.init,E[D]=w}b.terms=E,b.args||(b.args=v.args),b.prepare=u.prepare(b.prepare,v.prepare),b.coerce&&(typeof b.coerce=="function"&&(b.coerce={method:b.coerce}),b.coerce.from&&!Array.isArray(b.coerce.from)&&(b.coerce={method:b.coerce.method,from:[].concat(b.coerce.from)})),b.coerce=u.coerce(b.coerce,v.coerce),b.validate=u.validate(b.validate,v.validate);const _=Object.assign({},v.rules);if(b.rules)for(const D in b.rules){const w=b.rules[D];a(typeof w=="object","Invalid rule definition for",b.type,D);let S=w.method;if(S===void 0&&(S=function(){return this.$_addRule(D)}),S&&(a(!y[D],"Rule conflict in",b.type,D),y[D]=S),a(!_[D],"Rule conflict in",b.type,D),_[D]=w,w.alias){const I=[].concat(w.alias);for(const T of I)y[T]=w.method}w.args&&(w.argsByName=new Map,w.args=w.args.map(I=>(typeof I=="string"&&(I={name:I}),a(!w.argsByName.has(I.name),"Duplicated argument name",I.name),c.isSchema(I.assert)&&(I.assert=I.assert.strict().label(I.name)),w.argsByName.set(I.name,I),I)))}b.rules=_;const C=Object.assign({},v.modifiers);if(b.modifiers)for(const D in b.modifiers){a(!y[D],"Rule conflict in",b.type,D);const w=b.modifiers[D];a(typeof w=="function","Invalid modifier definition for",b.type,D);const S=function(I){return this.rule({[D]:I})};y[D]=S,C[D]=w}if(b.modifiers=C,b.overrides){y._super=h,m.$_super={};for(const D in b.overrides)a(h[D],"Cannot override missing",D),b.overrides[D][c.symbols.parent]=h[D],m.$_super[D]=h[D].bind(m);Object.assign(y,b.overrides)}b.cast=Object.assign({},v.cast,b.cast);const k=Object.assign({},v.manifest,b.manifest);return k.build=u.build(b.manifest&&b.manifest.build,v.manifest&&v.manifest.build),b.manifest=k,b.rebuild=u.rebuild(b.rebuild,v.rebuild),m},u.build=function(p,f){return p&&f?function(h,y){return f(p(h,y),y)}:p||f},u.coerce=function(p,f){return p&&f?{from:p.from&&f.from?[...new Set([...p.from,...f.from])]:null,method(h,y){let m;if((!f.from||f.from.includes(typeof h))&&(m=f.method(h,y),m)){if(m.errors||m.value===void 0)return m;h=m.value}if(!p.from||p.from.includes(typeof h)){const b=p.method(h,y);if(b)return b}return m}}:p||f},u.prepare=function(p,f){return p&&f?function(h,y){const m=p(h,y);if(m){if(m.errors||m.value===void 0)return m;h=m.value}return f(h,y)||m}:p||f},u.rebuild=function(p,f){return p&&f?function(h){f(h),p(h)}:p||f},u.validate=function(p,f){return p&&f?function(h,y){const m=f(h,y);if(m){if(m.errors&&(!Array.isArray(m.errors)||m.errors.length))return m;h=m.value}return p(h,y)||m}:p||f}},5107:(s,i,o)=>{const a=o(375),d=o(8571),c=o(8652),l=o(8160),u=o(3292),p=o(6354),f=o(8901),h=o(9708),y=o(6133),m=o(3328),b=o(1152);let v;const E={types:{alternatives:o(4946),any:o(8068),array:o(546),boolean:o(4937),date:o(7500),function:o(390),link:o(8785),number:o(3832),object:o(8966),string:o(7417),symbol:o(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const _={_types:new Set(Object.keys(E.types))};for(const C of _._types)_[C]=function(...k){return a(!k.length||["alternatives","link","object"].includes(C),"The",C,"type does not allow arguments"),E.generate(this,E.types[C],k)};for(const C of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])_[C]=function(...k){return this.any()[C](...k)};Object.assign(_,E.methods);for(const C in E.aliases){const k=E.aliases[C];_[C]=_[k]}return _.x=_.expression,b.setup&&b.setup(_),_}};E.methods={ValidationError:p.ValidationError,version:l.version,cache:c.provider,assert(_,C,...k){E.assert(_,C,!0,k)},attempt:(_,C,...k)=>E.assert(_,C,!1,k),build(_){return a(typeof h.build=="function","Manifest functionality disabled"),h.build(this,_)},checkPreferences(_){l.checkPreferences(_)},compile(_,C){return u.compile(this,_,C)},defaults(_){a(typeof _=="function","modifier must be a function");const C=Object.assign({},this);for(const k of C._types){const D=_(C[k]());a(l.isSchema(D),"modifier must return a valid schema object"),C[k]=function(...w){return E.generate(this,D,w)}}return C},expression:(..._)=>new m(..._),extend(..._){l.verifyFlat(_,"extend"),v=v||o(3378),a(_.length,"You need to provide at least one extension"),this.assert(_,v.extensions);const C=Object.assign({},this);C._types=new Set(C._types);for(let k of _){typeof k=="function"&&(k=k(C)),this.assert(k,v.extension);const D=E.expandExtension(k,C);for(const w of D){a(C[w.type]===void 0||C._types.has(w.type),"Cannot override name",w.type);const S=w.base||this.any(),I=f.type(S,w);C._types.add(w.type),C[w.type]=function(...T){return E.generate(this,I,T)}}}return C},isError:p.ValidationError.isError,isExpression:m.isTemplate,isRef:y.isRef,isSchema:l.isSchema,in:(..._)=>y.in(..._),override:l.symbols.override,ref:(..._)=>y.create(..._),types(){const _={};for(const C of this._types)_[C]=this[C]();for(const C in E.aliases)_[C]=this[C]();return _}},E.assert=function(_,C,k,D){const w=D[0]instanceof Error||typeof D[0]=="string"?D[0]:null,S=w!==null?D[1]:D[0],I=C.validate(_,l.preferences({errors:{stack:!0}},S||{}));let T=I.error;if(!T)return I.value;if(w instanceof Error)throw w;const g=k&&typeof T.annotate=="function"?T.annotate():T.message;throw T instanceof p.ValidationError==0&&(T=d(T)),T.message=w?`${w} ${g}`:g,T},E.generate=function(_,C,k){return a(_,"Must be invoked on a Joi instance."),C.$_root=_,C._definition.args&&k.length?C._definition.args(C,...k):C},E.expandExtension=function(_,C){if(typeof _.type=="string")return[_];const k=[];for(const D of C._types)if(_.type.test(D)){const w=Object.assign({},_);w.type=D,w.base=C[D](),k.push(w)}return k},s.exports=E.root()},6914:(s,i,o)=>{const a=o(375),d=o(8571),c=o(3328);i.compile=function(l,u){if(typeof l=="string")return a(!u,"Cannot set single message string"),new c(l);if(c.isTemplate(l))return a(!u,"Cannot set single message template"),l;a(typeof l=="object"&&!Array.isArray(l),"Invalid message options"),u=u?d(u):{};for(let p in l){const f=l[p];if(p==="root"||c.isTemplate(f)){u[p]=f;continue}if(typeof f=="string"){u[p]=new c(f);continue}a(typeof f=="object"&&!Array.isArray(f),"Invalid message for",p);const h=p;for(p in u[h]=u[h]||{},f){const y=f[p];p==="root"||c.isTemplate(y)?u[h][p]=y:(a(typeof y=="string","Invalid message for",p,"in",h),u[h][p]=new c(y))}}return u},i.decompile=function(l){const u={};for(let p in l){const f=l[p];if(p==="root"){u.root=f;continue}if(c.isTemplate(f)){u[p]=f.describe({compact:!0});continue}const h=p;for(p in u[h]={},f){const y=f[p];p!=="root"?u[h][p]=y.describe({compact:!0}):u[h].root=y}}return u},i.merge=function(l,u){if(!l)return i.compile(u);if(!u)return l;if(typeof u=="string")return new c(u);if(c.isTemplate(u))return u;const p=d(l);for(let f in u){const h=u[f];if(f==="root"||c.isTemplate(h)){p[f]=h;continue}if(typeof h=="string"){p[f]=new c(h);continue}a(typeof h=="object"&&!Array.isArray(h),"Invalid message for",f);const y=f;for(f in p[y]=p[y]||{},h){const m=h[f];f==="root"||c.isTemplate(m)?p[y][f]=m:(a(typeof m=="string","Invalid message for",f,"in",y),p[y][f]=new c(m))}}return p}},2294:(s,i,o)=>{const a=o(375),d=o(8160),c=o(6133),l={};i.Ids=l.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const u=new l.Ids;return u._byId=new Map(this._byId),u._byKey=new Map(this._byKey),u._schemaChain=this._schemaChain,u}concat(u){u._schemaChain&&(this._schemaChain=!0);for(const[p,f]of u._byId.entries())a(!this._byKey.has(p),"Schema id conflicts with existing key:",p),this._byId.set(p,f);for(const[p,f]of u._byKey.entries())a(!this._byId.has(p),"Schema key conflicts with existing id:",p),this._byKey.set(p,f)}fork(u,p,f){const h=this._collect(u);h.push({schema:f});const y=h.shift();let m={id:y.id,schema:p(y.schema)};a(d.isSchema(m.schema),"adjuster function failed to return a joi schema type");for(const b of h)m={id:b.id,schema:l.fork(b.schema,m.id,m.schema)};return m.schema}labels(u,p=[]){const f=u[0],h=this._get(f);if(!h)return[...p,...u].join(".");const y=u.slice(1);return p=[...p,h.schema._flags.label||f],y.length?h.schema._ids.labels(y,p):p.join(".")}reach(u,p=[]){const f=u[0],h=this._get(f);a(h,"Schema does not contain path",[...p,...u].join("."));const y=u.slice(1);return y.length?h.schema._ids.reach(y,[...p,f]):h.schema}register(u,{key:p}={}){if(!u||!d.isSchema(u))return;(u.$_property("schemaChain")||u._ids._schemaChain)&&(this._schemaChain=!0);const f=u._flags.id;if(f){const h=this._byId.get(f);a(!h||h.schema===u,"Cannot add different schemas with the same id:",f),a(!this._byKey.has(f),"Schema id conflicts with existing key:",f),this._byId.set(f,{schema:u,id:f})}p&&(a(!this._byKey.has(p),"Schema already contains key:",p),a(!this._byId.has(p),"Schema key conflicts with existing id:",p),this._byKey.set(p,{schema:u,id:p}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(u,p=[],f=[]){const h=u[0],y=this._get(h);a(y,"Schema does not contain path",[...p,...u].join(".")),f=[y,...f];const m=u.slice(1);return m.length?y.schema._ids._collect(m,[...p,h],f):f}_get(u){return this._byId.get(u)||this._byKey.get(u)}},l.fork=function(u,p,f){const h=i.schema(u,{each:(y,{key:m})=>{if(p===(y._flags.id||m))return f},ref:!1});return h?h.$_mutateRebuild():u},i.schema=function(u,p){let f;for(const h in u._flags){if(h[0]==="_")continue;const y=l.scan(u._flags[h],{source:"flags",name:h},p);y!==void 0&&(f=f||u.clone(),f._flags[h]=y)}for(let h=0;h<u._rules.length;++h){const y=u._rules[h],m=l.scan(y.args,{source:"rules",name:y.name},p);if(m!==void 0){f=f||u.clone();const b=Object.assign({},y);b.args=m,f._rules[h]=b,f._singleRules.get(y.name)===y&&f._singleRules.set(y.name,b)}}for(const h in u.$_terms){if(h[0]==="_")continue;const y=l.scan(u.$_terms[h],{source:"terms",name:h},p);y!==void 0&&(f=f||u.clone(),f.$_terms[h]=y)}return f},l.scan=function(u,p,f,h,y){const m=h||[];if(u===null||typeof u!="object")return;let b;if(Array.isArray(u)){for(let v=0;v<u.length;++v){const E=p.source==="terms"&&p.name==="keys"&&u[v].key,_=l.scan(u[v],p,f,[v,...m],E);_!==void 0&&(b=b||u.slice(),b[v]=_)}return b}if(f.schema!==!1&&d.isSchema(u)||f.ref!==!1&&c.isRef(u)){const v=f.each(u,{...p,path:m,key:y});return v===u?void 0:v}for(const v in u){if(v[0]==="_")continue;const E=l.scan(u[v],p,f,[v,...m],y);E!==void 0&&(b=b||Object.assign({},u),b[v]=E)}return b}},6133:(s,i,o)=>{const a=o(375),d=o(8571),c=o(9621),l=o(8160);let u;const p={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};i.create=function(f,h={}){a(typeof f=="string","Invalid reference key:",f),l.assertOptions(h,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),a(!h.prefix||typeof h.prefix=="object","options.prefix must be of type object");const y=Object.assign({},p.defaults,h);delete y.prefix;const m=y.separator,b=p.context(f,m,h.prefix);if(y.type=b.type,f=b.key,y.type==="value")if(b.root&&(a(!m||f[0]!==m,"Cannot specify relative path with root prefix"),y.ancestor="root",f||(f=null)),m&&m===f)f=null,y.ancestor=0;else if(y.ancestor!==void 0)a(!m||!f||f[0]!==m,"Cannot combine prefix with ancestor option");else{const[v,E]=p.ancestor(f,m);E&&(f=f.slice(E))===""&&(f=null),y.ancestor=v}return y.path=m?f===null?[]:f.split(m):[f],new p.Ref(y)},i.in=function(f,h={}){return i.create(f,{...h,in:!0})},i.isRef=function(f){return!!f&&!!f[l.symbols.ref]},p.Ref=class{constructor(f){a(typeof f=="object","Invalid reference construction"),l.assertOptions(f,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),a([!1,void 0].includes(f.separator)||typeof f.separator=="string"&&f.separator.length===1,"Invalid separator"),a(!f.adjust||typeof f.adjust=="function","options.adjust must be a function"),a(!f.map||Array.isArray(f.map),"options.map must be an array"),a(!f.map||!f.adjust,"Cannot set both map and adjust options"),Object.assign(this,p.defaults,f),a(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(f,h,y,m,b={}){return a(!this.in||b.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(y.context,h,b):this.type==="local"?this._resolve(m,h,b):this.ancestor?this.ancestor==="root"?this._resolve(h.ancestors[h.ancestors.length-1],h,b):(a(this.ancestor<=h.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(h.ancestors[this.ancestor-1],h,b)):this._resolve(f,h,b)}_resolve(f,h,y){let m;if(this.type==="value"&&h.mainstay.shadow&&y.shadow!==!1&&(m=h.mainstay.shadow.get(this.absolute(h))),m===void 0&&(m=c(f,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(m=this.adjust(m)),this.map){const b=this.map.get(m);b!==void 0&&(m=b)}return h.mainstay&&h.mainstay.tracer.resolve(h,this,m),m}toString(){return this.display}absolute(f){return[...f.path.slice(0,-this.ancestor),...this.path]}clone(){return new p.Ref(this)}describe(){const f={path:this.path};this.type!=="value"&&(f.type=this.type),this.separator!=="."&&(f.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(f.ancestor=this.ancestor),this.map&&(f.map=[...this.map]);for(const h of["adjust","iterables","render"])this[h]!==null&&this[h]!==void 0&&(f[h]=this[h]);return this.in!==!1&&(f.in=!0),{ref:f}}updateDisplay(){const f=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${f}`);if(!this.separator)return void(this.display=`ref:${f}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${f}`);if(this.ancestor==="root")return void(this.display=`ref:root:${f}`);if(this.ancestor===1)return void(this.display=`ref:${f||".."}`);const h=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${h}${f||""}`}},p.Ref.prototype[l.symbols.ref]=!0,i.build=function(f){return(f=Object.assign({},p.defaults,f)).type==="value"&&f.ancestor===void 0&&(f.ancestor=1),new p.Ref(f)},p.context=function(f,h,y={}){if(f=f.trim(),y){const m=y.global===void 0?"$":y.global;if(m!==h&&f.startsWith(m))return{key:f.slice(m.length),type:"global"};const b=y.local===void 0?"#":y.local;if(b!==h&&f.startsWith(b))return{key:f.slice(b.length),type:"local"};const v=y.root===void 0?"/":y.root;if(v!==h&&f.startsWith(v))return{key:f.slice(v.length),type:"value",root:!0}}return{key:f,type:"value"}},p.ancestor=function(f,h){if(!h)return[1,0];if(f[0]!==h)return[1,0];if(f[1]!==h)return[0,1];let y=2;for(;f[y]===h;)++y;return[y-1,y]},i.toSibling=0,i.toParent=1,i.Manager=class{constructor(){this.refs=[]}register(f,h){if(f)if(h=h===void 0?i.toParent:h,Array.isArray(f))for(const y of f)this.register(y,h);else if(l.isSchema(f))for(const y of f._refs.refs)y.ancestor-h>=0&&this.refs.push({ancestor:y.ancestor-h,root:y.root});else i.isRef(f)&&f.type==="value"&&f.ancestor-h>=0&&this.refs.push({ancestor:f.ancestor-h,root:f.root}),u=u||o(3328),u.isTemplate(f)&&this.register(f.refs(),h)}get length(){return this.refs.length}clone(){const f=new i.Manager;return f.refs=d(this.refs),f}reset(){this.refs=[]}roots(){return this.refs.filter(f=>!f.ancestor).map(f=>f.root)}}},3378:(s,i,o)=>{const a=o(5107),d={};d.wrap=a.string().min(1).max(2).allow(!1),i.preferences=a.object({allowUnknown:a.boolean(),abortEarly:a.boolean(),artifacts:a.boolean(),cache:a.boolean(),context:a.object(),convert:a.boolean(),dateFormat:a.valid("date","iso","string","time","utc"),debug:a.boolean(),errors:{escapeHtml:a.boolean(),label:a.valid("path","key",!1),language:[a.string(),a.object().ref()],render:a.boolean(),stack:a.boolean(),wrap:{label:d.wrap,array:d.wrap,string:d.wrap}},externals:a.boolean(),messages:a.object(),noDefaults:a.boolean(),nonEnumerables:a.boolean(),presence:a.valid("required","optional","forbidden"),skipFunctions:a.boolean(),stripUnknown:a.object({arrays:a.boolean(),objects:a.boolean()}).or("arrays","objects").allow(!0,!1),warnings:a.boolean()}).strict(),d.nameRx=/^[a-zA-Z0-9]\w*$/,d.rule=a.object({alias:a.array().items(a.string().pattern(d.nameRx)).single(),args:a.array().items(a.string(),a.object({name:a.string().pattern(d.nameRx).required(),ref:a.boolean(),assert:a.alternatives([a.function(),a.object().schema()]).conditional("ref",{is:!0,then:a.required()}),normalize:a.function(),message:a.string().when("assert",{is:a.function(),then:a.required()})})),convert:a.boolean(),manifest:a.boolean(),method:a.function().allow(!1),multi:a.boolean(),validate:a.function()}),i.extension=a.object({type:a.alternatives([a.string(),a.object().regex()]).required(),args:a.function(),cast:a.object().pattern(d.nameRx,a.object({from:a.function().maxArity(1).required(),to:a.function().minArity(1).maxArity(2).required()})),base:a.object().schema().when("type",{is:a.object().regex(),then:a.forbidden()}),coerce:[a.function().maxArity(3),a.object({method:a.function().maxArity(3).required(),from:a.array().items(a.string()).single()})],flags:a.object().pattern(d.nameRx,a.object({setter:a.string(),default:a.any()})),manifest:{build:a.function().arity(2)},messages:[a.object(),a.string()],modifiers:a.object().pattern(d.nameRx,a.function().minArity(1).maxArity(2)),overrides:a.object().pattern(d.nameRx,a.function()),prepare:a.function().maxArity(3),rebuild:a.function().arity(1),rules:a.object().pattern(d.nameRx,d.rule),terms:a.object().pattern(d.nameRx,a.object({init:a.array().allow(null).required(),manifest:a.object().pattern(/.+/,[a.valid("schema","single"),a.object({mapped:a.object({from:a.string().required(),to:a.string().required()}).required()})])})),validate:a.function().maxArity(3)}).strict(),i.extensions=a.array().items(a.object(),a.function().arity(1)).strict(),d.desc={buffer:a.object({buffer:a.string()}),func:a.object({function:a.function().required(),options:{literal:!0}}),override:a.object({override:!0}),ref:a.object({ref:a.object({type:a.valid("value","global","local"),path:a.array().required(),separator:a.string().length(1).allow(!1),ancestor:a.number().min(0).integer().allow("root"),map:a.array().items(a.array().length(2)).min(1),adjust:a.function(),iterables:a.boolean(),in:a.boolean(),render:a.boolean()}).required()}),regex:a.object({regex:a.string().min(3)}),special:a.object({special:a.valid("deep").required()}),template:a.object({template:a.string().required(),options:a.object()}),value:a.object({value:a.alternatives([a.object(),a.array()]).required()})},d.desc.entity=a.alternatives([a.array().items(a.link("...")),a.boolean(),a.function(),a.number(),a.string(),d.desc.buffer,d.desc.func,d.desc.ref,d.desc.regex,d.desc.special,d.desc.template,d.desc.value,a.link("/")]),d.desc.values=a.array().items(null,a.boolean(),a.function(),a.number().allow(1/0,-1/0),a.string().allow(""),a.symbol(),d.desc.buffer,d.desc.func,d.desc.override,d.desc.ref,d.desc.regex,d.desc.template,d.desc.value),d.desc.messages=a.object().pattern(/.+/,[a.string(),d.desc.template,a.object().pattern(/.+/,[a.string(),d.desc.template])]),i.description=a.object({type:a.string().required(),flags:a.object({cast:a.string(),default:a.any(),description:a.string(),empty:a.link("/"),failover:d.desc.entity,id:a.string(),label:a.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:a.boolean(),unit:a.string()}).unknown(),preferences:{allowUnknown:a.boolean(),abortEarly:a.boolean(),artifacts:a.boolean(),cache:a.boolean(),convert:a.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:a.boolean(),label:["path","key"],language:[a.string(),d.desc.ref],wrap:{label:d.wrap,array:d.wrap}},externals:a.boolean(),messages:d.desc.messages,noDefaults:a.boolean(),nonEnumerables:a.boolean(),presence:["required","optional","forbidden"],skipFunctions:a.boolean(),stripUnknown:a.object({arrays:a.boolean(),objects:a.boolean()}).or("arrays","objects").allow(!0,!1),warnings:a.boolean()},allow:d.desc.values,invalid:d.desc.values,rules:a.array().min(1).items({name:a.string().required(),args:a.object().min(1),keep:a.boolean(),message:[a.string(),d.desc.messages],warn:a.boolean()}),keys:a.object().pattern(/.*/,a.link("/")),link:d.desc.ref}).pattern(/^[a-z]\w*$/,a.any())},493:(s,i,o)=>{const a=o(8571),d=o(9621),c=o(8160),l={value:Symbol("value")};s.exports=l.State=class{constructor(u,p,f){this.path=u,this.ancestors=p,this.mainstay=f.mainstay,this.schemas=f.schemas,this.debug=null}localize(u,p=null,f=null){const h=new l.State(u,p,this);return f&&h.schemas&&(h.schemas=[l.schemas(f),...h.schemas]),h}nest(u,p){const f=new l.State(this.path,this.ancestors,this);return f.schemas=f.schemas&&[l.schemas(u),...f.schemas],f.debug=p,f}shadow(u,p){this.mainstay.shadow=this.mainstay.shadow||new l.Shadow,this.mainstay.shadow.set(this.path,u,p)}snapshot(){this.mainstay.shadow&&(this._snapshot=a(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},l.schemas=function(u){return c.isSchema(u)?{schema:u}:u},l.Shadow=class{constructor(){this._values=null}set(u,p,f){if(!u.length||f==="strip"&&typeof u[u.length-1]=="number")return;this._values=this._values||new Map;let h=this._values;for(let y=0;y<u.length;++y){const m=u[y];let b=h.get(m);b||(b=new Map,h.set(m,b)),h=b}h[l.value]=p}get(u){const p=this.node(u);if(p)return p[l.value]}node(u){if(this._values)return d(this._values,u,{iterables:!0})}override(u,p){if(!this._values)return;const f=u.slice(0,-1),h=u[u.length-1],y=d(this._values,f,{iterables:!0});p?y.set(h,p):y&&y.delete(h)}}},3328:(s,i,o)=>{const a=o(375),d=o(8571),c=o(5277),l=o(1447),u=o(8160),p=o(6354),f=o(6133),h={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};s.exports=h.Template=class{constructor(y,m){if(a(typeof y=="string","Template source must be a string"),a(!y.includes("\0")&&!y.includes(""),"Template source cannot contain reserved control characters"),this.source=y,this.rendered=y,this._template=null,m){const{functions:b,...v}=m;this._settings=Object.keys(v).length?d(v):void 0,this._functions=b,this._functions&&(a(Object.keys(this._functions).every(E=>typeof E=="string"),"Functions keys must be strings"),a(Object.values(this._functions).every(E=>typeof E=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const y=h.encode(this.source),m=h.split(y);let b=!1;const v=[],E=m.shift();E&&v.push(E);for(const _ of m){const C=_[0]!=="{",k=C?"}":"}}",D=_.indexOf(k);if(D===-1||_[1]==="{"){v.push(`{${h.decode(_)}`);continue}let w=_.slice(C?0:1,D);const S=w[0]===":";S&&(w=w.slice(1));const I=this._ref(h.decode(w),{raw:C,wrapped:S});v.push(I),typeof I!="string"&&(b=!0);const T=_.slice(D+k.length);T&&v.push(h.decode(T))}b?this._template=v:this.rendered=v.join("")}static date(y,m){return h.dateFormat[m.dateFormat].call(y)}describe(y={}){if(!this._settings&&y.compact)return this.source;const m={template:this.source};return this._settings&&(m.options=this._settings),this._functions&&(m.functions=this._functions),m}static build(y){return new h.Template(y.template,y.options||y.functions?{...y.options,functions:y.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(y){return!!y&&!!y[u.symbols.template]}refs(){if(!this._template)return;const y=[];for(const m of this._template)typeof m!="string"&&y.push(...m.refs);return y}resolve(y,m,b,v){return this._template&&this._template.length===1?this._part(this._template[0],y,m,b,v,{}):this.render(y,m,b,v)}_part(y,...m){return y.ref?y.ref.resolve(...m):y.formula.evaluate(m)}render(y,m,b,v,E={}){if(!this.isDynamic())return this.rendered;const _=[];for(const C of this._template)if(typeof C=="string")_.push(C);else{const k=this._part(C,y,m,b,v,E),D=h.stringify(k,y,m,b,v,E);if(D!==void 0){const w=C.raw||(E.errors&&E.errors.escapeHtml)===!1?D:c(D);_.push(h.wrap(w,C.wrapped&&b.errors.wrap.label))}}return _.join("")}_ref(y,{raw:m,wrapped:b}){const v=[],E=C=>{const k=f.create(C,this._settings);return v.push(k),D=>{const w=k.resolve(...D);return w!==void 0?w:null}};try{const C=this._functions?{...h.functions,...this._functions}:h.functions;var _=new l.Parser(y,{reference:E,functions:C,constants:h.constants})}catch(C){throw C.message=`Invalid template variable "${y}" fails due to: ${C.message}`,C}if(_.single){if(_.single.type==="reference"){const C=v[0];return{ref:C,raw:m,refs:v,wrapped:b||C.type==="local"&&C.key==="label"}}return h.stringify(_.single.value)}return{formula:_,raw:m,refs:v}}toString(){return this.source}},h.Template.prototype[u.symbols.template]=!0,h.Template.prototype.isImmutable=!0,h.encode=function(y){return y.replace(/\\(\{+)/g,(m,b)=>h.opens.slice(0,b.length)).replace(/\\(\}+)/g,(m,b)=>h.closes.slice(0,b.length))},h.decode=function(y){return y.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},h.split=function(y){const m=[];let b="";for(let v=0;v<y.length;++v){const E=y[v];if(E==="{"){let _="";for(;v+1<y.length&&y[v+1]==="{";)_+="{",++v;m.push(b),b=_}else b+=E}return m.push(b),m},h.wrap=function(y,m){return m?m.length===1?`${m}${y}${m}`:`${m[0]}${y}${m[1]}`:y},h.stringify=function(y,m,b,v,E,_={}){const C=typeof y,k=v&&v.errors&&v.errors.wrap||{};let D=!1;if(f.isRef(y)&&y.render&&(D=y.in,y=y.resolve(m,b,v,E,{in:y.in,..._})),y===null)return"null";if(C==="string")return h.wrap(y,_.arrayItems&&k.string);if(C==="number"||C==="function"||C==="symbol")return y.toString();if(C!=="object")return JSON.stringify(y);if(y instanceof Date)return h.Template.date(y,v);if(y instanceof Map){const S=[];for(const[I,T]of y.entries())S.push(`${I.toString()} -> ${T.toString()}`);y=S}if(!Array.isArray(y))return y.toString();const w=[];for(const S of y)w.push(h.stringify(S,m,b,v,E,{arrayItems:!0,..._}));return h.wrap(w.join(", "),!D&&k.array)},h.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},h.functions={if:(y,m,b)=>y?m:b,length:y=>typeof y=="string"?y.length:y&&typeof y=="object"?Array.isArray(y)?y.length:Object.keys(y).length:null,msg(y){const[m,b,v,E,_]=this,C=_.messages;if(!C)return"";const k=p.template(m,C[0],y,b,v)||p.template(m,C[1],y,b,v);return k?k.render(m,b,v,E,_):""},number:y=>typeof y=="number"?y:typeof y=="string"?parseFloat(y):typeof y=="boolean"?y?1:0:y instanceof Date?y.getTime():null}},4946:(s,i,o)=>{const a=o(375),d=o(1687),c=o(8068),l=o(8160),u=o(3292),p=o(6354),f=o(6133),h={};s.exports=c.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:f.toSibling}},args:(y,...m)=>m.length===1&&Array.isArray(m[0])?y.try(...m[0]):y.try(...m),validate(y,m){const{schema:b,error:v,state:E,prefs:_}=m;if(b._flags.match){const k=[],D=[];for(let S=0;S<b.$_terms.matches.length;++S){const I=b.$_terms.matches[S],T=E.nest(I.schema,`match.${S}`);T.snapshot();const g=I.schema.$_validate(y,T,_);g.errors?(D.push(g.errors),T.restore()):(k.push(g.value),T.commit())}if(k.length===0)return{errors:v("alternatives.any",{details:D.map(S=>p.details(S,{override:!1}))})};if(b._flags.match==="one")return k.length===1?{value:k[0]}:{errors:v("alternatives.one")};if(k.length!==b.$_terms.matches.length)return{errors:v("alternatives.all",{details:D.map(S=>p.details(S,{override:!1}))})};const w=S=>S.$_terms.matches.some(I=>I.schema.type==="object"||I.schema.type==="alternatives"&&w(I.schema));return w(b)?{value:k.reduce((S,I)=>d(S,I,{mergeArrays:!1}))}:{value:k[k.length-1]}}const C=[];for(let k=0;k<b.$_terms.matches.length;++k){const D=b.$_terms.matches[k];if(D.schema){const I=E.nest(D.schema,`match.${k}`);I.snapshot();const T=D.schema.$_validate(y,I,_);if(!T.errors)return I.commit(),T;I.restore(),C.push({schema:D.schema,reports:T.errors});continue}const w=D.ref?D.ref.resolve(y,E,_):y,S=D.is?[D]:D.switch;for(let I=0;I<S.length;++I){const T=S[I],{is:g,then:A,otherwise:P}=T,O=`match.${k}${D.switch?"."+I:""}`;if(g.$_match(w,E.nest(g,`${O}.is`),_)){if(A)return A.$_validate(y,E.nest(A,`${O}.then`),_)}else if(P)return P.$_validate(y,E.nest(P,`${O}.otherwise`),_)}}return h.errors(C,m)},rules:{conditional:{method(y,m){a(!this._flags._endedSwitch,"Unreachable condition"),a(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),a(m.break===void 0,"Cannot use break option with alternatives conditional");const b=this.clone(),v=u.when(b,y,m),E=v.is?[v]:v.switch;for(const _ of E)if(_.then&&_.otherwise){b.$_setFlag("_endedSwitch",!0,{clone:!1});break}return b.$_terms.matches.push(v),b.$_mutateRebuild()}},match:{method(y){if(a(["any","one","all"].includes(y),"Invalid alternatives match mode",y),y!=="any")for(const m of this.$_terms.matches)a(m.schema,"Cannot combine match mode",y,"with conditional rules");return this.$_setFlag("match",y)}},try:{method(...y){a(y.length,"Missing alternative schemas"),l.verifyFlat(y,"try"),a(!this._flags._endedSwitch,"Unreachable condition");const m=this.clone();for(const b of y)m.$_terms.matches.push({schema:m.$_compile(b)});return m.$_mutateRebuild()}}},overrides:{label(y){return this.$_parent("label",y).$_modify({each:(m,b)=>b.path[0]!=="is"&&typeof m._flags.label!="string"?m.label(y):void 0,ref:!1})}},rebuild(y){y.$_modify({each:m=>{l.isSchema(m)&&m.type==="array"&&y.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(y,m){if(m.matches)for(const b of m.matches){const{schema:v,ref:E,is:_,not:C,then:k,otherwise:D}=b;y=v?y.try(v):E?y.conditional(E,{is:_,then:k,not:C,otherwise:D,switch:b.switch}):y.conditional(_,{then:k,otherwise:D})}return y}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),h.errors=function(y,{error:m,state:b}){if(!y.length)return{errors:m("alternatives.any")};if(y.length===1)return{errors:y[0].reports};const v=new Set,E=[];for(const{reports:_,schema:C}of y){if(_.length>1)return h.unmatched(y,m);const k=_[0];if(k instanceof p.Report==0)return h.unmatched(y,m);if(k.state.path.length!==b.path.length){E.push({type:C.type,report:k});continue}if(k.code==="any.only"){for(const S of k.local.valids)v.add(S);continue}const[D,w]=k.code.split(".");w!=="base"?E.push({type:C.type,report:k}):k.code==="object.base"?v.add(k.local.type):v.add(D)}return E.length?E.length===1?{errors:E[0].report}:h.unmatched(y,m):{errors:m("alternatives.types",{types:[...v]})}},h.unmatched=function(y,m){const b=[];for(const v of y)b.push(...v.reports);return{errors:m("alternatives.match",p.details(b,{override:!1}))}}},8068:(s,i,o)=>{const a=o(375),d=o(7629),c=o(8160),l=o(6914);s.exports=d.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(u,p){return a(typeof u=="function","Method must be a function"),a(p===void 0||p&&typeof p=="string","Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:u,description:p}})},validate(u,p,{method:f}){try{return f(u,p)}catch(h){return p.error("any.custom",{error:h})}},args:["method","description"],multi:!0},messages:{method(u){return this.prefs({messages:u})}},shared:{method(u){a(c.isSchema(u)&&u._flags.id,"Schema must be a schema with an id");const p=this.clone();return p.$_terms.shared=p.$_terms.shared||[],p.$_terms.shared.push(u),p.$_mutateRegister(u),p}},warning:{method(u,p){return a(u&&typeof u=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:u,local:p},warn:!0})},validate:(u,p,{code:f,local:h})=>p.error(f,h),args:["code","local"],multi:!0}},modifiers:{keep(u,p=!0){u.keep=p},message(u,p){u.message=l.compile(p)},warn(u,p=!0){u.warn=p}},manifest:{build(u,p){for(const f in p){const h=p[f];if(["examples","externals","metas","notes","tags"].includes(f))for(const y of h)u=u[f.slice(0,-1)](y);else if(f!=="alterations")if(f!=="whens"){if(f==="shared")for(const y of h)u=u.shared(y)}else for(const y of h){const{ref:m,is:b,not:v,then:E,otherwise:_,concat:C}=y;u=C?u.concat(C):m?u.when(m,{is:b,not:v,then:E,otherwise:_,switch:y.switch,break:y.break}):u.when(b,{then:E,otherwise:_,break:y.break})}else{const y={};for(const{target:m,adjuster:b}of h)y[m]=b;u=u.alter(y)}}return u}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(s,i,o)=>{const a=o(375),d=o(9474),c=o(9621),l=o(8068),u=o(8160),p=o(3292),f={};s.exports=l.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(h,{schema:y,state:m,prefs:b}){if(!Array.isArray(h))return;const v=y.$_getRule("sort");return v?f.sort(y,h,v.args.options,m,b):void 0}},validate(h,{schema:y,error:m}){if(!Array.isArray(h)){if(y._flags.single){const b=[h];return b[u.symbols.arraySingle]=!0,{value:b}}return{errors:m("array.base")}}if(y.$_getRule("items")||y.$_terms.externals)return{value:h.slice()}},rules:{has:{method(h){h=this.$_compile(h,{appendPath:!0});const y=this.$_addRule({name:"has",args:{schema:h}});return y.$_mutateRegister(h),y},validate(h,{state:y,prefs:m,error:b},{schema:v}){const E=[h,...y.ancestors];for(let C=0;C<h.length;++C){const k=y.localize([...y.path,C],E,v);if(v.$_match(h[C],k,m))return h}const _=v._flags.label;return _?b("array.hasKnown",{patternLabel:_}):b("array.hasUnknown",null)},multi:!0},items:{method(...h){u.verifyFlat(h,"items");const y=this.$_addRule("items");for(let m=0;m<h.length;++m){const b=u.tryWithPath(()=>this.$_compile(h[m]),m,{append:!0});y.$_terms.items.push(b)}return y.$_mutateRebuild()},validate(h,{schema:y,error:m,state:b,prefs:v,errorsArray:E}){const _=y.$_terms._requireds.slice(),C=y.$_terms.ordered.slice(),k=[...y.$_terms._inclusions,..._],D=!h[u.symbols.arraySingle];delete h[u.symbols.arraySingle];const w=E();let S=h.length;for(let I=0;I<S;++I){const T=h[I];let g=!1,A=!1;const P=D?I:new Number(I),O=[...b.path,P];if(!y._flags.sparse&&T===void 0){if(w.push(m("array.sparse",{key:P,path:O,pos:I,value:void 0},b.localize(O))),v.abortEarly)return w;C.shift();continue}const N=[h,...b.ancestors];for(const R of y.$_terms._exclusions)if(R.$_match(T,b.localize(O,N,R),v,{presence:"ignore"})){if(w.push(m("array.excludes",{pos:I,value:T},b.localize(O))),v.abortEarly)return w;g=!0,C.shift();break}if(g)continue;if(y.$_terms.ordered.length){if(C.length){const R=C.shift(),K=R.$_validate(T,b.localize(O,N,R),v);if(K.errors){if(w.push(...K.errors),v.abortEarly)return w}else if(R._flags.result==="strip")f.fastSplice(h,I),--I,--S;else{if(!y._flags.sparse&&K.value===void 0){if(w.push(m("array.sparse",{key:P,path:O,pos:I,value:void 0},b.localize(O))),v.abortEarly)return w;continue}h[I]=K.value}continue}if(!y.$_terms.items.length){if(w.push(m("array.orderedLength",{pos:I,limit:y.$_terms.ordered.length})),v.abortEarly)return w;break}}const M=[];let L=_.length;for(let R=0;R<L;++R){const K=b.localize(O,N,_[R]);K.snapshot();const V=_[R].$_validate(T,K,v);if(M[R]=V,!V.errors){if(K.commit(),h[I]=V.value,A=!0,f.fastSplice(_,R),--R,--L,!y._flags.sparse&&V.value===void 0&&(w.push(m("array.sparse",{key:P,path:O,pos:I,value:void 0},b.localize(O))),v.abortEarly))return w;break}K.restore()}if(A)continue;const x=v.stripUnknown&&!!v.stripUnknown.arrays||!1;L=k.length;for(const R of k){let K;const V=_.indexOf(R);if(V!==-1)K=M[V];else{const J=b.localize(O,N,R);if(J.snapshot(),K=R.$_validate(T,J,v),!K.errors){J.commit(),R._flags.result==="strip"?(f.fastSplice(h,I),--I,--S):y._flags.sparse||K.value!==void 0?h[I]=K.value:(w.push(m("array.sparse",{key:P,path:O,pos:I,value:void 0},b.localize(O))),g=!0),A=!0;break}J.restore()}if(L===1){if(x){f.fastSplice(h,I),--I,--S,A=!0;break}if(w.push(...K.errors),v.abortEarly)return w;g=!0;break}}if(!g&&(y.$_terms._inclusions.length||y.$_terms._requireds.length)&&!A){if(x){f.fastSplice(h,I),--I,--S;continue}if(w.push(m("array.includes",{pos:I,value:T},b.localize(O))),v.abortEarly)return w}}return _.length&&f.fillMissedErrors(y,w,_,h,b,v),C.length&&(f.fillOrderedErrors(y,w,C,h,b,v),w.length||f.fillDefault(C,h,b,v)),w.length?w:h},priority:!0,manifest:!1},length:{method(h){return this.$_addRule({name:"length",args:{limit:h},operator:"="})},validate:(h,y,{limit:m},{name:b,operator:v,args:E})=>u.compare(h.length,m,v)?h:y.error("array."+b,{limit:E.limit,value:h}),args:[{name:"limit",ref:!0,assert:u.limit,message:"must be a positive integer"}]},max:{method(h){return this.$_addRule({name:"max",method:"length",args:{limit:h},operator:"<="})}},min:{method(h){return this.$_addRule({name:"min",method:"length",args:{limit:h},operator:">="})}},ordered:{method(...h){u.verifyFlat(h,"ordered");const y=this.$_addRule("items");for(let m=0;m<h.length;++m){const b=u.tryWithPath(()=>this.$_compile(h[m]),m,{append:!0});f.validateSingle(b,y),y.$_mutateRegister(b),y.$_terms.ordered.push(b)}return y.$_mutateRebuild()}},single:{method(h){const y=h===void 0||!!h;return a(!y||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",y)}},sort:{method(h={}){u.assertOptions(h,["by","order"]);const y={order:h.order||"ascending"};return h.by&&(y.by=p.ref(h.by,{ancestor:0}),a(!y.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:y}})},validate(h,{error:y,state:m,prefs:b,schema:v},{options:E}){const{value:_,errors:C}=f.sort(v,h,E,m,b);if(C)return C;for(let k=0;k<h.length;++k)if(h[k]!==_[k])return y("array.sort",{order:E.order,by:E.by?E.by.key:"value"});return h},convert:!0},sparse:{method(h){const y=h===void 0||!!h;return this._flags.sparse===y?this:(y?this.clone():this.$_addRule("items")).$_setFlag("sparse",y,{clone:!1})}},unique:{method(h,y={}){a(!h||typeof h=="function"||typeof h=="string","comparator must be a function or a string"),u.assertOptions(y,["ignoreUndefined","separator"]);const m={name:"unique",args:{options:y,comparator:h}};if(h)if(typeof h=="string"){const b=u.default(y.separator,".");m.path=b?h.split(b):[h]}else m.comparator=h;return this.$_addRule(m)},validate(h,{state:y,error:m,schema:b},{comparator:v,options:E},{comparator:_,path:C}){const k={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},D=_||d,w=E.ignoreUndefined;for(let S=0;S<h.length;++S){const I=C?c(h[S],C):h[S],T=_?k.custom:k[typeof I];if(a(T,"Failed to find unique map container for type",typeof I),T instanceof Map){const g=T.entries();let A;for(;!(A=g.next()).done;)if(D(A.value[0],I)){const P=y.localize([...y.path,S],[h,...y.ancestors]),O={pos:S,value:h[S],dupePos:A.value[1],dupeValue:h[A.value[1]]};return C&&(O.path=v),m("array.unique",O,P)}T.set(I,S)}else{if((!w||I!==void 0)&&T[I]!==void 0){const g={pos:S,value:h[S],dupePos:T[I],dupeValue:h[T[I]]};return C&&(g.path=v),m("array.unique",g,y.localize([...y.path,S],[h,...y.ancestors]))}T[I]=S}}return h},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(h,y)=>new Set(h)}},rebuild(h){h.$_terms._inclusions=[],h.$_terms._exclusions=[],h.$_terms._requireds=[];for(const y of h.$_terms.items)f.validateSingle(y,h),y._flags.presence==="required"?h.$_terms._requireds.push(y):y._flags.presence==="forbidden"?h.$_terms._exclusions.push(y):h.$_terms._inclusions.push(y);for(const y of h.$_terms.ordered)f.validateSingle(y,h)},manifest:{build:(h,y)=>(y.items&&(h=h.items(...y.items)),y.ordered&&(h=h.ordered(...y.ordered)),h)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),f.fillMissedErrors=function(h,y,m,b,v,E){const _=[];let C=0;for(const k of m){const D=k._flags.label;D?_.push(D):++C}_.length?C?y.push(h.$_createError("array.includesRequiredBoth",b,{knownMisses:_,unknownMisses:C},v,E)):y.push(h.$_createError("array.includesRequiredKnowns",b,{knownMisses:_},v,E)):y.push(h.$_createError("array.includesRequiredUnknowns",b,{unknownMisses:C},v,E))},f.fillOrderedErrors=function(h,y,m,b,v,E){const _=[];for(const C of m)C._flags.presence==="required"&&_.push(C);_.length&&f.fillMissedErrors(h,y,_,b,v,E)},f.fillDefault=function(h,y,m,b){const v=[];let E=!0;for(let _=h.length-1;_>=0;--_){const C=h[_],k=[y,...m.ancestors],D=C.$_validate(void 0,m.localize(m.path,k,C),b).value;if(E){if(D===void 0)continue;E=!1}v.unshift(D)}v.length&&y.push(...v)},f.fastSplice=function(h,y){let m=y;for(;m<h.length;)h[m++]=h[m];--h.length},f.validateSingle=function(h,y){(h.type==="array"||h._flags._arrayItems)&&(a(!y._flags.single,"Cannot specify array item with single rule enabled"),y.$_setFlag("_arrayItems",!0,{clone:!1}))},f.sort=function(h,y,m,b,v){const E=m.order==="ascending"?1:-1,_=-1*E,C=E,k=(D,w)=>{let S=f.compare(D,w,_,C);if(S!==null||(m.by&&(D=m.by.resolve(D,b,v),w=m.by.resolve(w,b,v)),S=f.compare(D,w,_,C),S!==null))return S;const I=typeof D;if(I!==typeof w)throw h.$_createError("array.sort.mismatching",y,null,b,v);if(I!=="number"&&I!=="string")throw h.$_createError("array.sort.unsupported",y,{type:I},b,v);return I==="number"?(D-w)*E:D<w?_:C};try{return{value:y.slice().sort(k)}}catch(D){return{errors:D}}},f.compare=function(h,y,m,b){return h===y?0:h===void 0?1:y===void 0?-1:h===null?b:y===null?m:null}},4937:(s,i,o)=>{const a=o(375),d=o(8068),c=o(8160),l=o(2036),u={isBool:function(p){return typeof p=="boolean"}};s.exports=d.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(p,{schema:f}){if(typeof p!="boolean"){if(typeof p=="string"){const h=f._flags.sensitive?p:p.toLowerCase();p=h==="true"||h!=="false"&&p}return typeof p!="boolean"&&(p=f.$_terms.truthy&&f.$_terms.truthy.has(p,null,null,!f._flags.sensitive)||(!f.$_terms.falsy||!f.$_terms.falsy.has(p,null,null,!f._flags.sensitive))&&p),{value:p}}},validate(p,{error:f}){if(typeof p!="boolean")return{value:p,errors:f("boolean.base")}},rules:{truthy:{method(...p){c.verifyFlat(p,"truthy");const f=this.clone();f.$_terms.truthy=f.$_terms.truthy||new l;for(let h=0;h<p.length;++h){const y=p[h];a(y!==void 0,"Cannot call truthy with undefined"),f.$_terms.truthy.add(y)}return f}},falsy:{method(...p){c.verifyFlat(p,"falsy");const f=this.clone();f.$_terms.falsy=f.$_terms.falsy||new l;for(let h=0;h<p.length;++h){const y=p[h];a(y!==void 0,"Cannot call falsy with undefined"),f.$_terms.falsy.add(y)}return f}},sensitive:{method(p=!0){return this.$_setFlag("sensitive",p)}}},cast:{number:{from:u.isBool,to:(p,f)=>p?1:0},string:{from:u.isBool,to:(p,f)=>p?"true":"false"}},manifest:{build:(p,f)=>(f.truthy&&(p=p.truthy(...f.truthy)),f.falsy&&(p=p.falsy(...f.falsy)),p)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(s,i,o)=>{const a=o(375),d=o(8068),c=o(8160),l=o(3328),u={isDate:function(p){return p instanceof Date}};s.exports=d.extend({type:"date",coerce:{from:["number","string"],method:(p,{schema:f})=>({value:u.parse(p,f._flags.format)||p})},validate(p,{schema:f,error:h,prefs:y}){if(p instanceof Date&&!isNaN(p.getTime()))return;const m=f._flags.format;return y.convert&&m&&typeof p=="string"?{value:p,errors:h("date.format",{format:m})}:{value:p,errors:h("date.base")}},rules:{compare:{method:!1,validate(p,f,{date:h},{name:y,operator:m,args:b}){const v=h==="now"?Date.now():h.getTime();return c.compare(p.getTime(),v,m)?p:f.error("date."+y,{limit:b.date,value:p})},args:[{name:"date",ref:!0,normalize:p=>p==="now"?p:u.parse(p),assert:p=>p!==null,message:"must have a valid date format"}]},format:{method(p){return a(["iso","javascript","unix"].includes(p),"Unknown date format",p),this.$_setFlag("format",p)}},greater:{method(p){return this.$_addRule({name:"greater",method:"compare",args:{date:p},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(p){return this.$_addRule({name:"less",method:"compare",args:{date:p},operator:"<"})}},max:{method(p){return this.$_addRule({name:"max",method:"compare",args:{date:p},operator:"<="})}},min:{method(p){return this.$_addRule({name:"min",method:"compare",args:{date:p},operator:">="})}},timestamp:{method(p="javascript"){return a(["javascript","unix"].includes(p),'"type" must be one of "javascript, unix"'),this.format(p)}}},cast:{number:{from:u.isDate,to:(p,f)=>p.getTime()},string:{from:u.isDate,to:(p,{prefs:f})=>l.date(p,f)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),u.parse=function(p,f){if(p instanceof Date)return p;if(typeof p!="string"&&(isNaN(p)||!isFinite(p))||/^\s*$/.test(p))return null;if(f==="iso")return c.isIsoDate(p)?u.date(p.toString()):null;const h=p;if(typeof p=="string"&&/^[+-]?\d+(\.\d+)?$/.test(p)&&(p=parseFloat(p)),f){if(f==="javascript")return u.date(1*p);if(f==="unix")return u.date(1e3*p);if(typeof h=="string")return null}return u.date(p)},u.date=function(p){const f=new Date(p);return isNaN(f.getTime())?null:f}},390:(s,i,o)=>{const a=o(375),d=o(7824);s.exports=d.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(c){return a(Number.isSafeInteger(c)&&c>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:c}})},validate:(c,l,{n:u})=>c.length===u?c:l.error("function.arity",{n:u})},class:{method(){return this.$_addRule("class")},validate:(c,l)=>/^\s*class\s/.test(c.toString())?c:l.error("function.class",{value:c})},minArity:{method(c){return a(Number.isSafeInteger(c)&&c>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:c}})},validate:(c,l,{n:u})=>c.length>=u?c:l.error("function.minArity",{n:u})},maxArity:{method(c){return a(Number.isSafeInteger(c)&&c>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:c}})},validate:(c,l,{n:u})=>c.length<=u?c:l.error("function.maxArity",{n:u})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(s,i,o)=>{const a=o(978),d=o(375),c=o(8571),l=o(3652),u=o(8068),p=o(8160),f=o(3292),h=o(6354),y=o(6133),m=o(3328),b={renameDefaults:{alias:!1,multiple:!1,override:!1}};s.exports=u.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(v,E)=>v.keys(E),validate(v,{schema:E,error:_,state:C,prefs:k}){if(!v||typeof v!==E.$_property("typeof")||Array.isArray(v))return{value:v,errors:_("object.base",{type:E.$_property("typeof")})};if(!(E.$_terms.renames||E.$_terms.dependencies||E.$_terms.keys||E.$_terms.patterns||E.$_terms.externals))return;v=b.clone(v,k);const D=[];if(E.$_terms.renames&&!b.rename(E,v,C,k,D))return{value:v,errors:D};if(!E.$_terms.keys&&!E.$_terms.patterns&&!E.$_terms.dependencies)return{value:v,errors:D};const w=new Set(Object.keys(v));if(E.$_terms.keys){const S=[v,...C.ancestors];for(const I of E.$_terms.keys){const T=I.key,g=v[T];w.delete(T);const A=C.localize([...C.path,T],S,I),P=I.schema.$_validate(g,A,k);if(P.errors){if(k.abortEarly)return{value:v,errors:P.errors};P.value!==void 0&&(v[T]=P.value),D.push(...P.errors)}else I.schema._flags.result==="strip"||P.value===void 0&&g!==void 0?delete v[T]:P.value!==void 0&&(v[T]=P.value)}}if(w.size||E._flags._hasPatternMatch){const S=b.unknown(E,v,w,D,C,k);if(S)return S}if(E.$_terms.dependencies)for(const S of E.$_terms.dependencies){if(S.key!==null&&b.isPresent(S.options)(S.key.resolve(v,C,k,null,{shadow:!1}))===!1)continue;const I=b.dependencies[S.rel](E,S,v,C,k);if(I){const T=E.$_createError(I.code,v,I.context,C,k);if(k.abortEarly)return{value:v,errors:T};D.push(T)}}return{value:v,errors:D}},rules:{and:{method(...v){return p.verifyFlat(v,"and"),b.dependency(this,"and",null,v)}},append:{method(v){return v==null||Object.keys(v).length===0?this:this.keys(v)}},assert:{method(v,E,_){m.isTemplate(v)||(v=f.ref(v)),d(_===void 0||typeof _=="string","Message must be a string"),E=this.$_compile(E,{appendPath:!0});const C=this.$_addRule({name:"assert",args:{subject:v,schema:E,message:_}});return C.$_mutateRegister(v),C.$_mutateRegister(E),C},validate(v,{error:E,prefs:_,state:C},{subject:k,schema:D,message:w}){const S=k.resolve(v,C,_),I=y.isRef(k)?k.absolute(C):[];return D.$_match(S,C.localize(I,[v,...C.ancestors],D),_)?v:E("object.assert",{subject:k,message:w})},args:["subject","schema","message"],multi:!0},instance:{method(v,E){return d(typeof v=="function","constructor must be a function"),E=E||v.name,this.$_addRule({name:"instance",args:{constructor:v,name:E}})},validate:(v,E,{constructor:_,name:C})=>v instanceof _?v:E.error("object.instance",{type:C,value:v}),args:["constructor","name"]},keys:{method(v){d(v===void 0||typeof v=="object","Object schema must be a valid object"),d(!p.isSchema(v),"Object schema cannot be a joi schema");const E=this.clone();if(v)if(Object.keys(v).length){E.$_terms.keys=E.$_terms.keys?E.$_terms.keys.filter(_=>!v.hasOwnProperty(_.key)):new b.Keys;for(const _ in v)p.tryWithPath(()=>E.$_terms.keys.push({key:_,schema:this.$_compile(v[_])}),_)}else E.$_terms.keys=new b.Keys;else E.$_terms.keys=null;return E.$_mutateRebuild()}},length:{method(v){return this.$_addRule({name:"length",args:{limit:v},operator:"="})},validate:(v,E,{limit:_},{name:C,operator:k,args:D})=>p.compare(Object.keys(v).length,_,k)?v:E.error("object."+C,{limit:D.limit,value:v}),args:[{name:"limit",ref:!0,assert:p.limit,message:"must be a positive integer"}]},max:{method(v){return this.$_addRule({name:"max",method:"length",args:{limit:v},operator:"<="})}},min:{method(v){return this.$_addRule({name:"min",method:"length",args:{limit:v},operator:">="})}},nand:{method(...v){return p.verifyFlat(v,"nand"),b.dependency(this,"nand",null,v)}},or:{method(...v){return p.verifyFlat(v,"or"),b.dependency(this,"or",null,v)}},oxor:{method(...v){return b.dependency(this,"oxor",null,v)}},pattern:{method(v,E,_={}){const C=v instanceof RegExp;C||(v=this.$_compile(v,{appendPath:!0})),d(E!==void 0,"Invalid rule"),p.assertOptions(_,["fallthrough","matches"]),C&&d(!v.flags.includes("g")&&!v.flags.includes("y"),"pattern should not use global or sticky mode"),E=this.$_compile(E,{appendPath:!0});const k=this.clone();k.$_terms.patterns=k.$_terms.patterns||[];const D={[C?"regex":"schema"]:v,rule:E};return _.matches&&(D.matches=this.$_compile(_.matches),D.matches.type!=="array"&&(D.matches=D.matches.$_root.array().items(D.matches)),k.$_mutateRegister(D.matches),k.$_setFlag("_hasPatternMatch",!0,{clone:!1})),_.fallthrough&&(D.fallthrough=!0),k.$_terms.patterns.push(D),k.$_mutateRegister(E),k}},ref:{method(){return this.$_addRule("ref")},validate:(v,E)=>y.isRef(v)?v:E.error("object.refType",{value:v})},regex:{method(){return this.$_addRule("regex")},validate:(v,E)=>v instanceof RegExp?v:E.error("object.regex",{value:v})},rename:{method(v,E,_={}){d(typeof v=="string"||v instanceof RegExp,"Rename missing the from argument"),d(typeof E=="string"||E instanceof m,"Invalid rename to argument"),d(E!==v,"Cannot rename key to same name:",v),p.assertOptions(_,["alias","ignoreUndefined","override","multiple"]);const C=this.clone();C.$_terms.renames=C.$_terms.renames||[];for(const k of C.$_terms.renames)d(k.from!==v,"Cannot rename the same key multiple times");return E instanceof m&&C.$_mutateRegister(E),C.$_terms.renames.push({from:v,to:E,options:a(b.renameDefaults,_)}),C}},schema:{method(v="any"){return this.$_addRule({name:"schema",args:{type:v}})},validate:(v,E,{type:_})=>!p.isSchema(v)||_!=="any"&&v.type!==_?E.error("object.schema",{type:_}):v},unknown:{method(v){return this.$_setFlag("unknown",v!==!1)}},with:{method(v,E,_={}){return b.dependency(this,"with",v,E,_)}},without:{method(v,E,_={}){return b.dependency(this,"without",v,E,_)}},xor:{method(...v){return p.verifyFlat(v,"xor"),b.dependency(this,"xor",null,v)}}},overrides:{default(v,E){return v===void 0&&(v=p.symbols.deepDefault),this.$_parent("default",v,E)}},rebuild(v){if(v.$_terms.keys){const E=new l.Sorter;for(const _ of v.$_terms.keys)p.tryWithPath(()=>E.add(_,{after:_.schema.$_rootReferences(),group:_.key}),_.key);v.$_terms.keys=new b.Keys(...E.nodes)}},manifest:{build(v,E){if(E.keys&&(v=v.keys(E.keys)),E.dependencies)for(const{rel:_,key:C=null,peers:k,options:D}of E.dependencies)v=b.dependency(v,_,C,k,D);if(E.patterns)for(const{regex:_,schema:C,rule:k,fallthrough:D,matches:w}of E.patterns)v=v.pattern(_||C,k,{fallthrough:D,matches:w});if(E.renames)for(const{from:_,to:C,options:k}of E.renames)v=v.rename(_,C,k);return v}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),b.clone=function(v,E){if(typeof v=="object"){if(E.nonEnumerables)return c(v,{shallow:!0});const C=Object.create(Object.getPrototypeOf(v));return Object.assign(C,v),C}const _=function(...C){return v.apply(this,C)};return _.prototype=c(v.prototype),Object.defineProperty(_,"name",{value:v.name,writable:!1}),Object.defineProperty(_,"length",{value:v.length,writable:!1}),Object.assign(_,v),_},b.dependency=function(v,E,_,C,k){d(_===null||typeof _=="string",E,"key must be a strings"),k||(k=C.length>1&&typeof C[C.length-1]=="object"?C.pop():{}),p.assertOptions(k,["separator","isPresent"]),C=[].concat(C);const D=p.default(k.separator,"."),w=[];for(const I of C)d(typeof I=="string",E,"peers must be strings"),w.push(f.ref(I,{separator:D,ancestor:0,prefix:!1}));_!==null&&(_=f.ref(_,{separator:D,ancestor:0,prefix:!1}));const S=v.clone();return S.$_terms.dependencies=S.$_terms.dependencies||[],S.$_terms.dependencies.push(new b.Dependency(E,_,w,C,k)),S},b.dependencies={and(v,E,_,C,k){const D=[],w=[],S=E.peers.length,I=b.isPresent(E.options);for(const T of E.peers)I(T.resolve(_,C,k,null,{shadow:!1}))===!1?D.push(T.key):w.push(T.key);if(D.length!==S&&w.length!==S)return{code:"object.and",context:{present:w,presentWithLabels:b.keysToLabels(v,w),missing:D,missingWithLabels:b.keysToLabels(v,D)}}},nand(v,E,_,C,k){const D=[],w=b.isPresent(E.options);for(const T of E.peers)w(T.resolve(_,C,k,null,{shadow:!1}))&&D.push(T.key);if(D.length!==E.peers.length)return;const S=E.paths[0],I=E.paths.slice(1);return{code:"object.nand",context:{main:S,mainWithLabel:b.keysToLabels(v,S),peers:I,peersWithLabels:b.keysToLabels(v,I)}}},or(v,E,_,C,k){const D=b.isPresent(E.options);for(const w of E.peers)if(D(w.resolve(_,C,k,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:E.paths,peersWithLabels:b.keysToLabels(v,E.paths)}}},oxor(v,E,_,C,k){const D=[],w=b.isPresent(E.options);for(const I of E.peers)w(I.resolve(_,C,k,null,{shadow:!1}))&&D.push(I.key);if(!D.length||D.length===1)return;const S={peers:E.paths,peersWithLabels:b.keysToLabels(v,E.paths)};return S.present=D,S.presentWithLabels=b.keysToLabels(v,D),{code:"object.oxor",context:S}},with(v,E,_,C,k){const D=b.isPresent(E.options);for(const w of E.peers)if(D(w.resolve(_,C,k,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:E.key.key,mainWithLabel:b.keysToLabels(v,E.key.key),peer:w.key,peerWithLabel:b.keysToLabels(v,w.key)}}},without(v,E,_,C,k){const D=b.isPresent(E.options);for(const w of E.peers)if(D(w.resolve(_,C,k,null,{shadow:!1})))return{code:"object.without",context:{main:E.key.key,mainWithLabel:b.keysToLabels(v,E.key.key),peer:w.key,peerWithLabel:b.keysToLabels(v,w.key)}}},xor(v,E,_,C,k){const D=[],w=b.isPresent(E.options);for(const I of E.peers)w(I.resolve(_,C,k,null,{shadow:!1}))&&D.push(I.key);if(D.length===1)return;const S={peers:E.paths,peersWithLabels:b.keysToLabels(v,E.paths)};return D.length===0?{code:"object.missing",context:S}:(S.present=D,S.presentWithLabels=b.keysToLabels(v,D),{code:"object.xor",context:S})}},b.keysToLabels=function(v,E){return Array.isArray(E)?E.map(_=>v.$_mapLabels(_)):v.$_mapLabels(E)},b.isPresent=function(v){return typeof v.isPresent=="function"?v.isPresent:E=>E!==void 0},b.rename=function(v,E,_,C,k){const D={};for(const w of v.$_terms.renames){const S=[],I=typeof w.from!="string";if(I)for(const T in E){if(E[T]===void 0&&w.options.ignoreUndefined||T===w.to)continue;const g=w.from.exec(T);g&&S.push({from:T,to:w.to,match:g})}else!Object.prototype.hasOwnProperty.call(E,w.from)||E[w.from]===void 0&&w.options.ignoreUndefined||S.push(w);for(const T of S){const g=T.from;let A=T.to;if(A instanceof m&&(A=A.render(E,_,C,T.match)),g!==A){if(!w.options.multiple&&D[A]&&(k.push(v.$_createError("object.rename.multiple",E,{from:g,to:A,pattern:I},_,C)),C.abortEarly)||Object.prototype.hasOwnProperty.call(E,A)&&!w.options.override&&!D[A]&&(k.push(v.$_createError("object.rename.override",E,{from:g,to:A,pattern:I},_,C)),C.abortEarly))return!1;E[g]===void 0?delete E[A]:E[A]=E[g],D[A]=!0,w.options.alias||delete E[g]}}}return!0},b.unknown=function(v,E,_,C,k,D){if(v.$_terms.patterns){let w=!1;const S=v.$_terms.patterns.map(T=>{if(T.matches)return w=!0,[]}),I=[E,...k.ancestors];for(const T of _){const g=E[T],A=[...k.path,T];for(let P=0;P<v.$_terms.patterns.length;++P){const O=v.$_terms.patterns[P];if(O.regex){const L=O.regex.test(T);if(k.mainstay.tracer.debug(k,"rule",`pattern.${P}`,L?"pass":"error"),!L)continue}else if(!O.schema.$_match(T,k.nest(O.schema,`pattern.${P}`),D))continue;_.delete(T);const N=k.localize(A,I,{schema:O.rule,key:T}),M=O.rule.$_validate(g,N,D);if(M.errors){if(D.abortEarly)return{value:E,errors:M.errors};C.push(...M.errors)}if(O.matches&&S[P].push(T),E[T]=M.value,!O.fallthrough)break}}if(w)for(let T=0;T<S.length;++T){const g=S[T];if(!g)continue;const A=v.$_terms.patterns[T].matches,P=k.localize(k.path,I,A),O=A.$_validate(g,P,D);if(O.errors){const N=h.details(O.errors,{override:!1});N.matches=g;const M=v.$_createError("object.pattern.match",E,N,k,D);if(D.abortEarly)return{value:E,errors:M};C.push(M)}}}if(_.size&&(v.$_terms.keys||v.$_terms.patterns)){if(D.stripUnknown&&v._flags.unknown===void 0||D.skipFunctions){const w=!(!D.stripUnknown||D.stripUnknown!==!0&&!D.stripUnknown.objects);for(const S of _)w?(delete E[S],_.delete(S)):typeof E[S]=="function"&&_.delete(S)}if(!p.default(v._flags.unknown,D.allowUnknown))for(const w of _){const S=k.localize([...k.path,w],[]),I=v.$_createError("object.unknown",E[w],{child:w},S,D,{flags:!1});if(D.abortEarly)return{value:E,errors:I};C.push(I)}}},b.Dependency=class{constructor(v,E,_,C,k){this.rel=v,this.key=E,this.peers=_,this.paths=C,this.options=k}describe(){const v={rel:this.rel,peers:this.paths};return this.key!==null&&(v.key=this.key.key),this.peers[0].separator!=="."&&(v.options={...v.options,separator:this.peers[0].separator}),this.options.isPresent&&(v.options={...v.options,isPresent:this.options.isPresent}),v}},b.Keys=class extends Array{concat(v){const E=this.slice(),_=new Map;for(let C=0;C<E.length;++C)_.set(E[C].key,C);for(const C of v){const k=C.key,D=_.get(k);D!==void 0?E[D]={key:k,schema:E[D].schema.concat(C.schema)}:E.push(C)}return E}}},8785:(s,i,o)=>{const a=o(375),d=o(8068),c=o(8160),l=o(3292),u=o(6354),p={};s.exports=d.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(f,h)=>f.ref(h),validate(f,{schema:h,state:y,prefs:m}){a(h.$_terms.link,"Uninitialized link schema");const b=p.generate(h,f,y,m),v=h.$_terms.link[0].ref;return b.$_validate(f,y.nest(b,`link:${v.display}:${b.type}`),m)},generate:(f,h,y,m)=>p.generate(f,h,y,m),rules:{ref:{method(f){a(!this.$_terms.link,"Cannot reinitialize schema"),f=l.ref(f),a(f.type==="value"||f.type==="local","Invalid reference type:",f.type),a(f.type==="local"||f.ancestor==="root"||f.ancestor>0,"Link cannot reference itself");const h=this.clone();return h.$_terms.link=[{ref:f}],h}},relative:{method(f=!0){return this.$_setFlag("relative",f)}}},overrides:{concat(f){a(this.$_terms.link,"Uninitialized link schema"),a(c.isSchema(f),"Invalid schema object"),a(f.type!=="link","Cannot merge type link with another link");const h=this.clone();return h.$_terms.whens||(h.$_terms.whens=[]),h.$_terms.whens.push({concat:f}),h.$_mutateRebuild()}},manifest:{build:(f,h)=>(a(h.link,"Invalid link description missing link"),f.ref(h.link))}}),p.generate=function(f,h,y,m){let b=y.mainstay.links.get(f);if(b)return b._generate(h,y,m).schema;const v=f.$_terms.link[0].ref,{perspective:E,path:_}=p.perspective(v,y);p.assert(E,"which is outside of schema boundaries",v,f,y,m);try{b=_.length?E.$_reach(_):E}catch{p.assert(!1,"to non-existing schema",v,f,y,m)}return p.assert(b.type!=="link","which is another link",v,f,y,m),f._flags.relative||y.mainstay.links.set(f,b),b._generate(h,y,m).schema},p.perspective=function(f,h){if(f.type==="local"){for(const{schema:y,key:m}of h.schemas){if((y._flags.id||m)===f.path[0])return{perspective:y,path:f.path.slice(1)};if(y.$_terms.shared){for(const b of y.$_terms.shared)if(b._flags.id===f.path[0])return{perspective:b,path:f.path.slice(1)}}}return{perspective:null,path:null}}return f.ancestor==="root"?{perspective:h.schemas[h.schemas.length-1].schema,path:f.path}:{perspective:h.schemas[f.ancestor]&&h.schemas[f.ancestor].schema,path:f.path}},p.assert=function(f,h,y,m,b,v){f||a(!1,`"${u.label(m._flags,b,v)}" contains link reference "${y.display}" ${h}`)}},3832:(s,i,o)=>{const a=o(375),d=o(8068),c=o(8160),l={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(u){const p=u.toString(),f=p.indexOf("."),h=p.indexOf("e");return(f<0?0:(h<0?p.length:h)-f-1)+(h<0?0:Math.max(0,-parseInt(p.slice(h+1))))}};s.exports=d.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(u,{schema:p,error:f}){if(!u.match(l.numberRx))return;u=u.trim();const h={value:parseFloat(u)};if(h.value===0&&(h.value=0),!p._flags.unsafe)if(u.match(/e/i)){if(l.extractSignificantDigits(u)!==l.extractSignificantDigits(String(h.value)))return h.errors=f("number.unsafe"),h}else{const y=h.value.toString();if(y.match(/e/i))return h;if(y!==l.normalizeDecimal(u))return h.errors=f("number.unsafe"),h}return h}},validate(u,{schema:p,error:f,prefs:h}){if(u===1/0||u===-1/0)return{value:u,errors:f("number.infinity")};if(!c.isNumber(u))return{value:u,errors:f("number.base")};const y={value:u};if(h.convert){const m=p.$_getRule("precision");if(m){const b=Math.pow(10,m.args.limit);y.value=Math.round(y.value*b)/b}}return y.value===0&&(y.value=0),!p._flags.unsafe&&(u>Number.MAX_SAFE_INTEGER||u<Number.MIN_SAFE_INTEGER)&&(y.errors=f("number.unsafe")),y},rules:{compare:{method:!1,validate:(u,p,{limit:f},{name:h,operator:y,args:m})=>c.compare(u,f,y)?u:p.error("number."+h,{limit:m.limit,value:u}),args:[{name:"limit",ref:!0,assert:c.isNumber,message:"must be a number"}]},greater:{method(u){return this.$_addRule({name:"greater",method:"compare",args:{limit:u},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(u,p)=>Math.trunc(u)-u==0?u:p.error("number.integer")},less:{method(u){return this.$_addRule({name:"less",method:"compare",args:{limit:u},operator:"<"})}},max:{method(u){return this.$_addRule({name:"max",method:"compare",args:{limit:u},operator:"<="})}},min:{method(u){return this.$_addRule({name:"min",method:"compare",args:{limit:u},operator:">="})}},multiple:{method(u){const p=typeof u=="number"?l.decimalPlaces(u):null,f=Math.pow(10,p);return this.$_addRule({name:"multiple",args:{base:u,baseDecimalPlace:p,pfactor:f}})},validate:(u,p,{base:f,baseDecimalPlace:h,pfactor:y},m)=>l.decimalPlaces(u)>h?p.error("number.multiple",{multiple:m.args.base,value:u}):Math.round(y*u)%Math.round(y*f)==0?u:p.error("number.multiple",{multiple:m.args.base,value:u}),args:[{name:"base",ref:!0,assert:u=>typeof u=="number"&&isFinite(u)&&u>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(u,p)=>Number.isSafeInteger(u)&&u>=0&&u<=65535?u:p.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(u){return a(Number.isSafeInteger(u),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:u}})},validate(u,p,{limit:f}){const h=u.toString().match(l.precisionRx);return Math.max((h[1]?h[1].length:0)-(h[2]?parseInt(h[2],10):0),0)<=f?u:p.error("number.precision",{limit:f,value:u})},convert:!0},sign:{method(u){return a(["negative","positive"].includes(u),"Invalid sign",u),this.$_addRule({name:"sign",args:{sign:u}})},validate:(u,p,{sign:f})=>f==="negative"&&u<0||f==="positive"&&u>0?u:p.error(`number.${f}`)},unsafe:{method(u=!0){return a(typeof u=="boolean","enabled must be a boolean"),this.$_setFlag("unsafe",u)}}},cast:{string:{from:u=>typeof u=="number",to:(u,p)=>u.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),l.extractSignificantDigits=function(u){return u.replace(l.exponentialPartRegex,"").replace(l.dotRegex,"").replace(l.trailingZerosRegex,"").replace(l.leadingSignAndZerosRegex,"")},l.normalizeDecimal=function(u){return(u=u.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&u.endsWith("0")&&(u=u.replace(/0+$/,"")),u==="-0"?"0":u}},8966:(s,i,o)=>{const a=o(7824);s.exports=a.extend({type:"object",cast:{map:{from:d=>d&&typeof d=="object",to:(d,c)=>new Map(Object.entries(d))}}})},7417:(s,i,o)=>{const a=o(375),d=o(5380),c=o(1745),l=o(9959),u=o(6064),p=o(9926),f=o(5752),h=o(8068),y=o(8160),m={tlds:p instanceof Set&&{tlds:{allow:p,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:l.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};s.exports=h.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(b,{schema:v,state:E,prefs:_}){const C=v.$_getRule("normalize");C&&(b=b.normalize(C.args.form));const k=v.$_getRule("case");k&&(b=k.args.direction==="upper"?b.toLocaleUpperCase():b.toLocaleLowerCase());const D=v.$_getRule("trim");if(D&&D.args.enabled&&(b=b.trim()),v.$_terms.replacements)for(const S of v.$_terms.replacements)b=b.replace(S.pattern,S.replacement);const w=v.$_getRule("hex");if(w&&w.args.options.byteAligned&&b.length%2!=0&&(b=`0${b}`),v.$_getRule("isoDate")){const S=m.isoDate(b);S&&(b=S)}if(v._flags.truncate){const S=v.$_getRule("max");if(S){let I=S.args.limit;if(y.isResolvable(I)&&(I=I.resolve(b,E,_),!y.limit(I)))return{value:b,errors:v.$_createError("any.ref",I,{ref:S.args.limit,arg:"limit",reason:"must be a positive integer"},E,_)};b=b.slice(0,I)}}return{value:b}}},validate(b,{schema:v,error:E}){if(typeof b!="string")return{value:b,errors:E("string.base")};if(b===""){const _=v.$_getRule("min");return _&&_.args.limit===0?void 0:{value:b,errors:E("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(b,v)=>/^[a-zA-Z0-9]+$/.test(b)?b:v.error("string.alphanum")},base64:{method(b={}){return y.assertOptions(b,["paddingRequired","urlSafe"]),b={urlSafe:!1,paddingRequired:!0,...b},a(typeof b.paddingRequired=="boolean","paddingRequired must be boolean"),a(typeof b.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:b}})},validate:(b,v,{options:E})=>m.base64Regex[E.paddingRequired][E.urlSafe].test(b)?b:v.error("string.base64")},case:{method(b){return a(["lower","upper"].includes(b),"Invalid case:",b),this.$_addRule({name:"case",args:{direction:b}})},validate:(b,v,{direction:E})=>E==="lower"&&b===b.toLocaleLowerCase()||E==="upper"&&b===b.toLocaleUpperCase()?b:v.error(`string.${E}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(b,v){let E=b.length,_=0,C=1;for(;E--;){const k=b.charAt(E)*C;_+=k-9*(k>9),C^=3}return _>0&&_%10==0?b:v.error("string.creditCard")}},dataUri:{method(b={}){return y.assertOptions(b,["paddingRequired"]),b={paddingRequired:!0,...b},a(typeof b.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:b}})},validate(b,v,{options:E}){const _=b.match(m.dataUriRegex);return _&&(!_[2]||_[2]!=="base64"||m.base64Regex[E.paddingRequired].false.test(_[3]))?b:v.error("string.dataUri")}},domain:{method(b){b&&y.assertOptions(b,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const v=m.addressOptions(b);return this.$_addRule({name:"domain",args:{options:b},address:v})},validate:(b,v,E,{address:_})=>d.isValid(b,_)?b:v.error("string.domain")},email:{method(b={}){y.assertOptions(b,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),a(b.multiple===void 0||typeof b.multiple=="boolean","multiple option must be an boolean");const v=m.addressOptions(b),E=new RegExp(`\\s*[${b.separator?u(b.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:b},regex:E,address:v})},validate(b,v,{options:E},{regex:_,address:C}){const k=E.multiple?b.split(_):[b],D=[];for(const w of k)c.isValid(w,C)||D.push(w);return D.length?v.error("string.email",{value:b,invalids:D}):b}},guid:{alias:"uuid",method(b={}){y.assertOptions(b,["version","separator"]);let v="";if(b.version){const C=[].concat(b.version);a(C.length>=1,"version must have at least 1 valid version specified");const k=new Set;for(let D=0;D<C.length;++D){const w=C[D];a(typeof w=="string","version at position "+D+" must be a string");const S=m.guidVersions[w.toLowerCase()];a(S,"version at position "+D+" must be one of "+Object.keys(m.guidVersions).join(", ")),a(!k.has(S),"version at position "+D+" must not be a duplicate"),v+=S,k.add(S)}}a(m.guidSeparators.has(b.separator),'separator must be one of true, false, "-", or ":"');const E=b.separator===void 0?"[:-]?":b.separator===!0?"[:-]":b.separator===!1?"[]?":`\\${b.separator}`,_=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${E})[0-9A-F]{4}\\2?[${v||"0-9A-F"}][0-9A-F]{3}\\2?[${v?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:b},regex:_})},validate(b,v,E,{regex:_}){const C=_.exec(b);return C?m.guidBrackets[C[1]]!==C[C.length-1]?v.error("string.guid"):b:v.error("string.guid")}},hex:{method(b={}){return y.assertOptions(b,["byteAligned","prefix"]),b={byteAligned:!1,prefix:!1,...b},a(typeof b.byteAligned=="boolean","byteAligned must be boolean"),a(typeof b.prefix=="boolean"||b.prefix==="optional",'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:b}})},validate:(b,v,{options:E})=>(E.prefix==="optional"?m.hexRegex.withOptionalPrefix:E.prefix===!0?m.hexRegex.withPrefix:m.hexRegex.withoutPrefix).test(b)?E.byteAligned&&b.length%2!=0?v.error("string.hexAlign"):b:v.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(b,v)=>d.isValid(b,{minDomainSegments:1})||m.ipRegex.test(b)?b:v.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(b={}){y.assertOptions(b,["cidr","version"]);const{cidr:v,versions:E,regex:_}=l.regex(b),C=b.version?E:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:v,version:C}},regex:_})},validate:(b,v,{options:E},{regex:_})=>_.test(b)?b:E.version?v.error("string.ipVersion",{value:b,cidr:E.cidr,version:E.version}):v.error("string.ip",{value:b,cidr:E.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(b,{error:v})=>m.isoDate(b)?b:v("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(b,v)=>m.isoDurationRegex.test(b)?b:v.error("string.isoDuration")},length:{method(b,v){return m.length(this,"length",b,"=",v)},validate(b,v,{limit:E,encoding:_},{name:C,operator:k,args:D}){const w=!_&&b.length;return y.compare(w,E,k)?b:v.error("string."+C,{limit:D.limit,value:b,encoding:_})},args:[{name:"limit",ref:!0,assert:y.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(b,v){return m.length(this,"max",b,"<=",v)},args:["limit","encoding"]},min:{method(b,v){return m.length(this,"min",b,">=",v)},args:["limit","encoding"]},normalize:{method(b="NFC"){return a(m.normalizationForms.includes(b),"normalization form must be one of "+m.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:b}})},validate:(b,{error:v},{form:E})=>b===b.normalize(E)?b:v("string.normalize",{value:b,form:E}),convert:!0},pattern:{alias:"regex",method(b,v={}){a(b instanceof RegExp,"regex must be a RegExp"),a(!b.flags.includes("g")&&!b.flags.includes("y"),"regex should not use global or sticky mode"),typeof v=="string"&&(v={name:v}),y.assertOptions(v,["invert","name"]);const E=["string.pattern",v.invert?".invert":"",v.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:b,options:v},errorCode:E})},validate:(b,v,{regex:E,options:_},{errorCode:C})=>E.test(b)^_.invert?b:v.error(C,{name:_.name,regex:E,value:b}),args:["regex","options"],multi:!0},replace:{method(b,v){typeof b=="string"&&(b=new RegExp(u(b),"g")),a(b instanceof RegExp,"pattern must be a RegExp"),a(typeof v=="string","replacement must be a String");const E=this.clone();return E.$_terms.replacements||(E.$_terms.replacements=[]),E.$_terms.replacements.push({pattern:b,replacement:v}),E}},token:{method(){return this.$_addRule("token")},validate:(b,v)=>/^\w+$/.test(b)?b:v.error("string.token")},trim:{method(b=!0){return a(typeof b=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:b}})},validate:(b,v,{enabled:E})=>E&&b!==b.trim()?v.error("string.trim"):b,convert:!0},truncate:{method(b=!0){return a(typeof b=="boolean","enabled must be a boolean"),this.$_setFlag("truncate",b)}},uppercase:{method(){return this.case("upper")}},uri:{method(b={}){y.assertOptions(b,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),b.domain&&y.assertOptions(b.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:v,scheme:E}=f.regex(b),_=b.domain?m.addressOptions(b.domain):null;return this.$_addRule({name:"uri",args:{options:b},regex:v,domain:_,scheme:E})},validate(b,v,{options:E},{regex:_,domain:C,scheme:k}){if(["http:/","https:/"].includes(b))return v.error("string.uri");let D=_.exec(b);if(!D&&v.prefs.convert&&E.encodeUri){const w=encodeURI(b);D=_.exec(w),D&&(b=w)}if(D){const w=D[1]||D[2];return!C||E.allowRelative&&!w||d.isValid(w,C)?b:v.error("string.domain",{value:w})}return E.relativeOnly?v.error("string.uriRelativeOnly"):E.scheme?v.error("string.uriCustomScheme",{scheme:k,value:b}):v.error("string.uri")}}},manifest:{build(b,v){if(v.replacements)for(const{pattern:E,replacement:_}of v.replacements)b=b.replace(E,_);return b}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),m.addressOptions=function(b){if(!b)return m.tlds||b;if(a(b.minDomainSegments===void 0||Number.isSafeInteger(b.minDomainSegments)&&b.minDomainSegments>0,"minDomainSegments must be a positive integer"),a(b.maxDomainSegments===void 0||Number.isSafeInteger(b.maxDomainSegments)&&b.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),b.tlds===!1)return b;if(b.tlds===!0||b.tlds===void 0)return a(m.tlds,"Built-in TLD list disabled"),Object.assign({},b,m.tlds);a(typeof b.tlds=="object","tlds must be true, false, or an object");const v=b.tlds.deny;if(v)return Array.isArray(v)&&(b=Object.assign({},b,{tlds:{deny:new Set(v)}})),a(b.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),a(!b.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),m.validateTlds(b.tlds.deny,"tlds.deny"),b;const E=b.tlds.allow;return E?E===!0?(a(m.tlds,"Built-in TLD list disabled"),Object.assign({},b,m.tlds)):(Array.isArray(E)&&(b=Object.assign({},b,{tlds:{allow:new Set(E)}})),a(b.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),m.validateTlds(b.tlds.allow,"tlds.allow"),b):b},m.validateTlds=function(b,v){for(const E of b)a(d.isValid(E,{minDomainSegments:1,maxDomainSegments:1}),`${v} must contain valid top level domain names`)},m.isoDate=function(b){if(!y.isIsoDate(b))return null;/.*T.*[+-]\d\d$/.test(b)&&(b+="00");const v=new Date(b);return isNaN(v.getTime())?null:v.toISOString()},m.length=function(b,v,E,_,C){return a(!C||!1,"Invalid encoding:",C),b.$_addRule({name:v,method:"length",args:{limit:E,encoding:C},operator:_})}},8826:(s,i,o)=>{const a=o(375),d=o(8068),c={};c.Map=class extends Map{slice(){return new c.Map(this)}},s.exports=d.extend({type:"symbol",terms:{map:{init:new c.Map}},coerce:{method(l,{schema:u,error:p}){const f=u.$_terms.map.get(l);return f&&(l=f),u._flags.only&&typeof l!="symbol"?{value:l,errors:p("symbol.map",{map:u.$_terms.map})}:{value:l}}},validate(l,{error:u}){if(typeof l!="symbol")return{value:l,errors:u("symbol.base")}},rules:{map:{method(l){l&&!l[Symbol.iterator]&&typeof l=="object"&&(l=Object.entries(l)),a(l&&l[Symbol.iterator],"Iterable must be an iterable or object");const u=this.clone(),p=[];for(const f of l){a(f&&f[Symbol.iterator],"Entry must be an iterable");const[h,y]=f;a(typeof h!="object"&&typeof h!="function"&&typeof h!="symbol","Key must not be of type object, function, or Symbol"),a(typeof y=="symbol","Value must be a Symbol"),u.$_terms.map.set(h,y),p.push(y)}return u.valid(...p)}}},manifest:{build:(l,u)=>(u.map&&(l=l.map(u.map)),l)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(s,i,o)=>{const a=o(375),d=o(8571),c=o(738),l=o(9621),u=o(8160),p=o(6354),f=o(493),h={result:Symbol("result")};i.entry=function(y,m,b){let v=u.defaults;b&&(a(b.warnings===void 0,"Cannot override warnings preference in synchronous validation"),a(b.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),v=u.preferences(u.defaults,b));const E=h.entry(y,m,v);a(!E.mainstay.externals.length,"Schema with external rules must use validateAsync()");const _={value:E.value};return E.error&&(_.error=E.error),E.mainstay.warnings.length&&(_.warning=p.details(E.mainstay.warnings)),E.mainstay.debug&&(_.debug=E.mainstay.debug),E.mainstay.artifacts&&(_.artifacts=E.mainstay.artifacts),_},i.entryAsync=async function(y,m,b){let v=u.defaults;b&&(v=u.preferences(u.defaults,b));const E=h.entry(y,m,v),_=E.mainstay;if(E.error)throw _.debug&&(E.error.debug=_.debug),E.error;if(_.externals.length){let k=E.value;const D=[];for(const w of _.externals){const S=w.state.path,I=w.schema.type==="link"?_.links.get(w.schema):null;let T,g,A=k;const P=S.length?[k]:[],O=S.length?l(y,S):y;if(S.length){T=S[S.length-1];let N=k;for(const M of S.slice(0,-1))N=N[M],P.unshift(N);g=P[0],A=g[T]}try{const N=(L,x)=>(I||w.schema).$_createError(L,A,x,w.state,v),M=await w.method(A,{schema:w.schema,linked:I,state:w.state,prefs:b,original:O,error:N,errorsArray:h.errorsArray,warn:(L,x)=>_.warnings.push((I||w.schema).$_createError(L,A,x,w.state,v)),message:(L,x)=>(I||w.schema).$_createError("external",A,x,w.state,v,{messages:L})});if(M===void 0||M===A)continue;if(M instanceof p.Report){if(_.tracer.log(w.schema,w.state,"rule","external","error"),D.push(M),v.abortEarly)break;continue}if(Array.isArray(M)&&M[u.symbols.errors]){if(_.tracer.log(w.schema,w.state,"rule","external","error"),D.push(...M),v.abortEarly)break;continue}g?(_.tracer.value(w.state,"rule",A,M,"external"),g[T]=M):(_.tracer.value(w.state,"rule",k,M,"external"),k=M)}catch(N){throw v.errors.label&&(N.message+=` (${w.label})`),N}}if(E.value=k,D.length)throw E.error=p.process(D,y,v),_.debug&&(E.error.debug=_.debug),E.error}if(!v.warnings&&!v.debug&&!v.artifacts)return E.value;const C={value:E.value};return _.warnings.length&&(C.warning=p.details(_.warnings)),_.debug&&(C.debug=_.debug),_.artifacts&&(C.artifacts=_.artifacts),C},h.Mainstay=class{constructor(y,m,b){this.externals=[],this.warnings=[],this.tracer=y,this.debug=m,this.links=b,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const y=this._snapshots.pop();this.externals=y.externals,this.warnings=y.warnings}commit(){this._snapshots.pop()}},h.entry=function(y,m,b){const{tracer:v,cleanup:E}=h.tracer(m,b),_=b.debug?[]:null,C=m._ids._schemaChain?new Map:null,k=new h.Mainstay(v,_,C),D=m._ids._schemaChain?[{schema:m}]:null,w=new f([],[],{mainstay:k,schemas:D}),S=i.validate(y,m,w,b);E&&m.$_root.untrace();const I=p.process(S.errors,y,b);return{value:S.value,error:I,mainstay:k}},h.tracer=function(y,m){return y.$_root._tracer?{tracer:y.$_root._tracer._register(y)}:m.debug?(a(y.$_root.trace,"Debug mode not supported"),{tracer:y.$_root.trace()._register(y),cleanup:!0}):{tracer:h.ignore}},i.validate=function(y,m,b,v,E={}){if(m.$_terms.whens&&(m=m._generate(y,b,v).schema),m._preferences&&(v=h.prefs(m,v)),m._cache&&v.cache){const I=m._cache.get(y);if(b.mainstay.tracer.debug(b,"validate","cached",!!I),I)return I}const _=(I,T,g)=>m.$_createError(I,y,T,g||b,v),C={original:y,prefs:v,schema:m,state:b,error:_,errorsArray:h.errorsArray,warn:(I,T,g)=>b.mainstay.warnings.push(_(I,T,g)),message:(I,T)=>m.$_createError("custom",y,T,b,v,{messages:I})};b.mainstay.tracer.entry(m,b);const k=m._definition;if(k.prepare&&y!==void 0&&v.convert){const I=k.prepare(y,C);if(I){if(b.mainstay.tracer.value(b,"prepare",y,I.value),I.errors)return h.finalize(I.value,[].concat(I.errors),C);y=I.value}}if(k.coerce&&y!==void 0&&v.convert&&(!k.coerce.from||k.coerce.from.includes(typeof y))){const I=k.coerce.method(y,C);if(I){if(b.mainstay.tracer.value(b,"coerced",y,I.value),I.errors)return h.finalize(I.value,[].concat(I.errors),C);y=I.value}}const D=m._flags.empty;D&&D.$_match(h.trim(y,m),b.nest(D),u.defaults)&&(b.mainstay.tracer.value(b,"empty",y,void 0),y=void 0);const w=E.presence||m._flags.presence||(m._flags._endedSwitch?null:v.presence);if(y===void 0){if(w==="forbidden")return h.finalize(y,null,C);if(w==="required")return h.finalize(y,[m.$_createError("any.required",y,null,b,v)],C);if(w==="optional"){if(m._flags.default!==u.symbols.deepDefault)return h.finalize(y,null,C);b.mainstay.tracer.value(b,"default",y,{}),y={}}}else if(w==="forbidden")return h.finalize(y,[m.$_createError("any.unknown",y,null,b,v)],C);const S=[];if(m._valids){const I=m._valids.get(y,b,v,m._flags.insensitive);if(I)return v.convert&&(b.mainstay.tracer.value(b,"valids",y,I.value),y=I.value),b.mainstay.tracer.filter(m,b,"valid",I),h.finalize(y,null,C);if(m._flags.only){const T=m.$_createError("any.only",y,{valids:m._valids.values({display:!0})},b,v);if(v.abortEarly)return h.finalize(y,[T],C);S.push(T)}}if(m._invalids){const I=m._invalids.get(y,b,v,m._flags.insensitive);if(I){b.mainstay.tracer.filter(m,b,"invalid",I);const T=m.$_createError("any.invalid",y,{invalids:m._invalids.values({display:!0})},b,v);if(v.abortEarly)return h.finalize(y,[T],C);S.push(T)}}if(k.validate){const I=k.validate(y,C);if(I&&(b.mainstay.tracer.value(b,"base",y,I.value),y=I.value,I.errors)){if(!Array.isArray(I.errors))return S.push(I.errors),h.finalize(y,S,C);if(I.errors.length)return S.push(...I.errors),h.finalize(y,S,C)}}return m._rules.length?h.rules(y,S,C):h.finalize(y,S,C)},h.rules=function(y,m,b){const{schema:v,state:E,prefs:_}=b;for(const C of v._rules){const k=v._definition.rules[C.method];if(k.convert&&_.convert){E.mainstay.tracer.log(v,E,"rule",C.name,"full");continue}let D,w=C.args;if(C._resolve.length){w=Object.assign({},w);for(const I of C._resolve){const T=k.argsByName.get(I),g=w[I].resolve(y,E,_),A=T.normalize?T.normalize(g):g,P=u.validateArg(A,null,T);if(P){D=v.$_createError("any.ref",g,{arg:I,ref:w[I],reason:P},E,_);break}w[I]=A}}D=D||k.validate(y,b,w,C);const S=h.rule(D,C);if(S.errors){if(E.mainstay.tracer.log(v,E,"rule",C.name,"error"),C.warn){E.mainstay.warnings.push(...S.errors);continue}if(_.abortEarly)return h.finalize(y,S.errors,b);m.push(...S.errors)}else E.mainstay.tracer.log(v,E,"rule",C.name,"pass"),E.mainstay.tracer.value(E,"rule",y,S.value,C.name),y=S.value}return h.finalize(y,m,b)},h.rule=function(y,m){return y instanceof p.Report?(h.error(y,m),{errors:[y],value:null}):Array.isArray(y)&&y[u.symbols.errors]?(y.forEach(b=>h.error(b,m)),{errors:y,value:null}):{errors:null,value:y}},h.error=function(y,m){return m.message&&y._setTemplate(m.message),y},h.finalize=function(y,m,b){m=m||[];const{schema:v,state:E,prefs:_}=b;if(m.length){const k=h.default("failover",void 0,m,b);k!==void 0&&(E.mainstay.tracer.value(E,"failover",y,k),y=k,m=[])}if(m.length&&v._flags.error)if(typeof v._flags.error=="function"){m=v._flags.error(m),Array.isArray(m)||(m=[m]);for(const k of m)a(k instanceof Error||k instanceof p.Report,"error() must return an Error object")}else m=[v._flags.error];if(y===void 0){const k=h.default("default",y,m,b);E.mainstay.tracer.value(E,"default",y,k),y=k}if(v._flags.cast&&y!==void 0){const k=v._definition.cast[v._flags.cast];if(k.from(y)){const D=k.to(y,b);E.mainstay.tracer.value(E,"cast",y,D,v._flags.cast),y=D}}if(v.$_terms.externals&&_.externals&&_._externals!==!1)for(const{method:k}of v.$_terms.externals)E.mainstay.externals.push({method:k,schema:v,state:E,label:p.label(v._flags,E,_)});const C={value:y,errors:m.length?m:null};return v._flags.result&&(C.value=v._flags.result==="strip"?void 0:b.original,E.mainstay.tracer.value(E,v._flags.result,y,C.value),E.shadow(y,v._flags.result)),v._cache&&_.cache!==!1&&!v._refs.length&&v._cache.set(b.original,C),y===void 0||C.errors||v._flags.artifact===void 0||(E.mainstay.artifacts=E.mainstay.artifacts||new Map,E.mainstay.artifacts.has(v._flags.artifact)||E.mainstay.artifacts.set(v._flags.artifact,[]),E.mainstay.artifacts.get(v._flags.artifact).push(E.path)),C},h.prefs=function(y,m){const b=m===u.defaults;return b&&y._preferences[u.symbols.prefs]?y._preferences[u.symbols.prefs]:(m=u.preferences(m,y._preferences),b&&(y._preferences[u.symbols.prefs]=m),m)},h.default=function(y,m,b,v){const{schema:E,state:_,prefs:C}=v,k=E._flags[y];if(C.noDefaults||k===void 0)return m;if(_.mainstay.tracer.log(E,_,"rule",y,"full"),!k)return k;if(typeof k=="function"){const D=k.length?[d(_.ancestors[0]),v]:[];try{return k(...D)}catch(w){return void b.push(E.$_createError(`any.${y}`,null,{error:w},_,C))}}return typeof k!="object"?k:k[u.symbols.literal]?k.literal:u.isResolvable(k)?k.resolve(m,_,C):d(k)},h.trim=function(y,m){if(typeof y!="string")return y;const b=m.$_getRule("trim");return b&&b.args.enabled?y.trim():y},h.ignore={active:!1,debug:c,entry:c,filter:c,log:c,resolve:c,value:c},h.errorsArray=function(){const y=[];return y[u.symbols.errors]=!0,y}},2036:(s,i,o)=>{const a=o(375),d=o(9474),c=o(8160),l={};s.exports=l.Values=class{constructor(u,p){this._values=new Set(u),this._refs=new Set(p),this._lowercase=l.lowercases(u),this._override=!1}get length(){return this._values.size+this._refs.size}add(u,p){c.isResolvable(u)?this._refs.has(u)||(this._refs.add(u),p&&p.register(u)):this.has(u,null,null,!1)||(this._values.add(u),typeof u=="string"&&this._lowercase.set(u.toLowerCase(),u))}static merge(u,p,f){if(u=u||new l.Values,p){if(p._override)return p.clone();for(const h of[...p._values,...p._refs])u.add(h)}if(f)for(const h of[...f._values,...f._refs])u.remove(h);return u.length?u:null}remove(u){c.isResolvable(u)?this._refs.delete(u):(this._values.delete(u),typeof u=="string"&&this._lowercase.delete(u.toLowerCase()))}has(u,p,f,h){return!!this.get(u,p,f,h)}get(u,p,f,h){if(!this.length)return!1;if(this._values.has(u))return{value:u};if(typeof u=="string"&&u&&h){const y=this._lowercase.get(u.toLowerCase());if(y)return{value:y}}if(!this._refs.size&&typeof u!="object")return!1;if(typeof u=="object"){for(const y of this._values)if(d(y,u))return{value:y}}if(p)for(const y of this._refs){const m=y.resolve(u,p,f,null,{in:!0});if(m===void 0)continue;const b=y.in&&typeof m=="object"?Array.isArray(m)?m:Object.keys(m):[m];for(const v of b)if(typeof v==typeof u){if(h&&u&&typeof u=="string"){if(v.toLowerCase()===u.toLowerCase())return{value:v,ref:y}}else if(d(v,u))return{value:v,ref:y}}}return!1}override(){this._override=!0}values(u){if(u&&u.display){const p=[];for(const f of[...this._values,...this._refs])f!==void 0&&p.push(f);return p}return Array.from([...this._values,...this._refs])}clone(){const u=new l.Values(this._values,this._refs);return u._override=this._override,u}concat(u){a(!u._override,"Cannot concat override set of values");const p=new l.Values([...this._values,...u._values],[...this._refs,...u._refs]);return p._override=this._override,p}describe(){const u=[];this._override&&u.push({override:!0});for(const p of this._values.values())u.push(p&&typeof p=="object"?{value:p}:p);for(const p of this._refs.values())u.push(p.describe());return u}},l.Values.prototype[c.symbols.values]=!0,l.Values.prototype.slice=l.Values.prototype.clone,l.lowercases=function(u){const p=new Map;if(u)for(const f of u)typeof f=="string"&&p.set(f.toLowerCase(),f);return p}},978:(s,i,o)=>{const a=o(375),d=o(8571),c=o(1687),l=o(9621),u={};s.exports=function(p,f,h={}){if(a(p&&typeof p=="object","Invalid defaults value: must be an object"),a(!f||f===!0||typeof f=="object","Invalid source value: must be true, falsy or an object"),a(typeof h=="object","Invalid options: must be an object"),!f)return null;if(h.shallow)return u.applyToDefaultsWithShallow(p,f,h);const y=d(p);if(f===!0)return y;const m=h.nullOverride!==void 0&&h.nullOverride;return c(y,f,{nullOverride:m,mergeArrays:!1})},u.applyToDefaultsWithShallow=function(p,f,h){const y=h.shallow;a(Array.isArray(y),"Invalid keys");const m=new Map,b=f===!0?null:new Set;for(let _ of y){_=Array.isArray(_)?_:_.split(".");const C=l(p,_);C&&typeof C=="object"?m.set(C,b&&l(f,_)||C):b&&b.add(_)}const v=d(p,{},m);if(!b)return v;for(const _ of b)u.reachCopy(v,f,_);const E=h.nullOverride!==void 0&&h.nullOverride;return c(v,f,{nullOverride:E,mergeArrays:!1})},u.reachCopy=function(p,f,h){for(const b of h){if(!(b in f))return;const v=f[b];if(typeof v!="object"||v===null)return;f=v}const y=f;let m=p;for(let b=0;b<h.length-1;++b){const v=h[b];typeof m[v]!="object"&&(m[v]={}),m=m[v]}m[h[h.length-1]]=y}},375:(s,i,o)=>{const a=o(7916);s.exports=function(d,...c){if(!d)throw c.length===1&&c[0]instanceof Error?c[0]:new a(c)}},8571:(s,i,o)=>{const a=o(9621),d=o(4277),c=o(7043),l={needsProtoHack:new Set([d.set,d.map,d.weakSet,d.weakMap])};s.exports=l.clone=function(u,p={},f=null){if(typeof u!="object"||u===null)return u;let h=l.clone,y=f;if(p.shallow){if(p.shallow!==!0)return l.cloneWithShallow(u,p);h=E=>E}else if(y){const E=y.get(u);if(E)return E}else y=new Map;const m=d.getInternalProto(u);if(m===d.buffer)return!1;if(m===d.date)return new Date(u.getTime());if(m===d.regex)return new RegExp(u);const b=l.base(u,m,p);if(b===u)return u;if(y&&y.set(u,b),m===d.set)for(const E of u)b.add(h(E,p,y));else if(m===d.map)for(const[E,_]of u)b.set(E,h(_,p,y));const v=c.keys(u,p);for(const E of v){if(E==="__proto__")continue;if(m===d.array&&E==="length"){b.length=u.length;continue}const _=Object.getOwnPropertyDescriptor(u,E);_?_.get||_.set?Object.defineProperty(b,E,_):_.enumerable?b[E]=h(u[E],p,y):Object.defineProperty(b,E,{enumerable:!1,writable:!0,configurable:!0,value:h(u[E],p,y)}):Object.defineProperty(b,E,{enumerable:!0,writable:!0,configurable:!0,value:h(u[E],p,y)})}return b},l.cloneWithShallow=function(u,p){const f=p.shallow;(p=Object.assign({},p)).shallow=!1;const h=new Map;for(const y of f){const m=a(u,y);typeof m!="object"&&typeof m!="function"||h.set(m,m)}return l.clone(u,p,h)},l.base=function(u,p,f){if(f.prototype===!1)return l.needsProtoHack.has(p)?new p.constructor:p===d.array?[]:{};const h=Object.getPrototypeOf(u);if(h&&h.isImmutable)return u;if(p===d.array){const y=[];return h!==p&&Object.setPrototypeOf(y,h),y}if(l.needsProtoHack.has(p)){const y=new h.constructor;return h!==p&&Object.setPrototypeOf(y,h),y}return Object.create(h)}},9474:(s,i,o)=>{const a=o(4277),d={mismatched:null};s.exports=function(c,l,u){return u=Object.assign({prototype:!0},u),!!d.isDeepEqual(c,l,u,[])},d.isDeepEqual=function(c,l,u,p){if(c===l)return c!==0||1/c==1/l;const f=typeof c;if(f!==typeof l||c===null||l===null)return!1;if(f==="function"){if(!u.deepFunction||c.toString()!==l.toString())return!1}else if(f!=="object")return c!=c&&l!=l;const h=d.getSharedType(c,l,!!u.prototype);switch(h){case a.buffer:return!1;case a.promise:return c===l;case a.regex:return c.toString()===l.toString();case d.mismatched:return!1}for(let y=p.length-1;y>=0;--y)if(p[y].isSame(c,l))return!0;p.push(new d.SeenEntry(c,l));try{return!!d.isDeepEqualObj(h,c,l,u,p)}finally{p.pop()}},d.getSharedType=function(c,l,u){if(u)return Object.getPrototypeOf(c)!==Object.getPrototypeOf(l)?d.mismatched:a.getInternalProto(c);const p=a.getInternalProto(c);return p!==a.getInternalProto(l)?d.mismatched:p},d.valueOf=function(c){const l=c.valueOf;if(l===void 0)return c;try{return l.call(c)}catch(u){return u}},d.hasOwnEnumerableProperty=function(c,l){return Object.prototype.propertyIsEnumerable.call(c,l)},d.isSetSimpleEqual=function(c,l){for(const u of Set.prototype.values.call(c))if(!Set.prototype.has.call(l,u))return!1;return!0},d.isDeepEqualObj=function(c,l,u,p,f){const{isDeepEqual:h,valueOf:y,hasOwnEnumerableProperty:m}=d,{keys:b,getOwnPropertySymbols:v}=Object;if(c===a.array){if(!p.part){if(l.length!==u.length)return!1;for(let D=0;D<l.length;++D)if(!h(l[D],u[D],p,f))return!1;return!0}for(const D of l)for(const w of u)if(h(D,w,p,f))return!0}else if(c===a.set){if(l.size!==u.size)return!1;if(!d.isSetSimpleEqual(l,u)){const D=new Set(Set.prototype.values.call(u));for(const w of Set.prototype.values.call(l)){if(D.delete(w))continue;let S=!1;for(const I of D)if(h(w,I,p,f)){D.delete(I),S=!0;break}if(!S)return!1}}}else if(c===a.map){if(l.size!==u.size)return!1;for(const[D,w]of Map.prototype.entries.call(l))if(w===void 0&&!Map.prototype.has.call(u,D)||!h(w,Map.prototype.get.call(u,D),p,f))return!1}else if(c===a.error&&(l.name!==u.name||l.message!==u.message))return!1;const E=y(l),_=y(u);if((l!==E||u!==_)&&!h(E,_,p,f))return!1;const C=b(l);if(!p.part&&C.length!==b(u).length&&!p.skip)return!1;let k=0;for(const D of C)if(p.skip&&p.skip.includes(D))u[D]===void 0&&++k;else if(!m(u,D)||!h(l[D],u[D],p,f))return!1;if(!p.part&&C.length-k!==b(u).length)return!1;if(p.symbols!==!1){const D=v(l),w=new Set(v(u));for(const S of D){if(!p.skip||!p.skip.includes(S)){if(m(l,S)){if(!m(u,S)||!h(l[S],u[S],p,f))return!1}else if(m(u,S))return!1}w.delete(S)}for(const S of w)if(m(u,S))return!1}return!0},d.SeenEntry=class{constructor(c,l){this.obj=c,this.ref=l}isSame(c,l){return this.obj===c&&this.ref===l}}},7916:(s,i,o)=>{const a=o(8761);s.exports=class extends Error{constructor(d){super(d.filter(c=>c!=="").map(c=>typeof c=="string"?c:c instanceof Error?c.message:a(c)).join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i.assert)}}},5277:s=>{const i={};s.exports=function(o){if(!o)return"";let a="";for(let d=0;d<o.length;++d){const c=o.charCodeAt(d);i.isSafe(c)?a+=o[d]:a+=i.escapeHtmlChar(c)}return a},i.escapeHtmlChar=function(o){return i.namedHtml.get(o)||(o>=256?"&#"+o+";":`&#x${o.toString(16).padStart(2,"0")};`)},i.isSafe=function(o){return i.safeCharCodes.has(o)},i.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),i.safeCharCodes=function(){const o=new Set;for(let a=32;a<123;++a)(a>=97||a>=65&&a<=90||a>=48&&a<=57||a===32||a===46||a===44||a===45||a===58||a===95)&&o.add(a);return o}()},6064:s=>{s.exports=function(i){return i.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:s=>{s.exports=function(){}},1687:(s,i,o)=>{const a=o(375),d=o(8571),c=o(7043),l={};s.exports=l.merge=function(u,p,f){if(a(u&&typeof u=="object","Invalid target value: must be an object"),a(p==null||typeof p=="object","Invalid source value: must be null, undefined, or an object"),!p)return u;if(f=Object.assign({nullOverride:!0,mergeArrays:!0},f),Array.isArray(p)){a(Array.isArray(u),"Cannot merge array onto an object"),f.mergeArrays||(u.length=0);for(let y=0;y<p.length;++y)u.push(d(p[y],{symbols:f.symbols}));return u}const h=c.keys(p,f);for(let y=0;y<h.length;++y){const m=h[y];if(m==="__proto__"||!Object.prototype.propertyIsEnumerable.call(p,m))continue;const b=p[m];if(b&&typeof b=="object"){if(u[m]===b)continue;!u[m]||typeof u[m]!="object"||Array.isArray(u[m])!==Array.isArray(b)||b instanceof Date||b instanceof RegExp?u[m]=d(b,{symbols:f.symbols}):l.merge(u[m],b,f)}else(b!=null||f.nullOverride)&&(u[m]=b)}return u}},9621:(s,i,o)=>{const a=o(375),d={};s.exports=function(c,l,u){if(l===!1||l==null)return c;typeof(u=u||{})=="string"&&(u={separator:u});const p=Array.isArray(l);a(!p||!u.separator,"Separator option is not valid for array-based chain");const f=p?l:l.split(u.separator||".");let h=c;for(let y=0;y<f.length;++y){let m=f[y];const b=u.iterables&&d.iterables(h);if(Array.isArray(h)||b==="set"){const v=Number(m);Number.isInteger(v)&&(m=v<0?h.length+v:v)}if(!h||typeof h=="function"&&u.functions===!1||!b&&h[m]===void 0){a(!u.strict||y+1===f.length,"Missing segment",m,"in reach path ",l),a(typeof h=="object"||u.functions===!0||typeof h!="function","Invalid segment",m,"in reach path ",l),h=u.default;break}h=b?b==="set"?[...h][m]:h.get(m):h[m]}return h},d.iterables=function(c){return c instanceof Set?"set":c instanceof Map?"map":void 0}},8761:s=>{s.exports=function(...i){try{return JSON.stringify(...i)}catch(o){return"[Cannot display object: "+o.message+"]"}}},4277:(s,i)=>{const o={};i=s.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},o.typeMap=new Map([["[object Error]",i.error],["[object Map]",i.map],["[object Promise]",i.promise],["[object Set]",i.set],["[object WeakMap]",i.weakMap],["[object WeakSet]",i.weakSet]]),i.getInternalProto=function(a){if(Array.isArray(a))return i.array;if(a instanceof Date)return i.date;if(a instanceof RegExp)return i.regex;if(a instanceof Error)return i.error;const d=Object.prototype.toString.call(a);return o.typeMap.get(d)||i.generic}},7043:(s,i)=>{i.keys=function(o,a={}){return a.symbols!==!1?Reflect.ownKeys(o):Object.getOwnPropertyNames(o)}},3652:(s,i,o)=>{const a=o(375),d={};i.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(c,l){const u=[].concat((l=l||{}).before||[]),p=[].concat(l.after||[]),f=l.group||"?",h=l.sort||0;a(!u.includes(f),`Item cannot come before itself: ${f}`),a(!u.includes("?"),"Item cannot come before unassociated items"),a(!p.includes(f),`Item cannot come after itself: ${f}`),a(!p.includes("?"),"Item cannot come after unassociated items"),Array.isArray(c)||(c=[c]);for(const y of c){const m={seq:this._items.length,sort:h,before:u,after:p,group:f,node:y};this._items.push(m)}if(!l.manual){const y=this._sort();a(y,"item",f!=="?"?`added into group ${f}`:"","created a dependencies error")}return this.nodes}merge(c){Array.isArray(c)||(c=[c]);for(const u of c)if(u)for(const p of u._items)this._items.push(Object.assign({},p));this._items.sort(d.mergeSort);for(let u=0;u<this._items.length;++u)this._items[u].seq=u;const l=this._sort();return a(l,"merge created a dependencies error"),this.nodes}sort(){const c=this._sort();return a(c,"sort created a dependencies error"),this.nodes}_sort(){const c={},l=Object.create(null),u=Object.create(null);for(const m of this._items){const b=m.seq,v=m.group;u[v]=u[v]||[],u[v].push(b),c[b]=m.before;for(const E of m.after)l[E]=l[E]||[],l[E].push(b)}for(const m in c){const b=[];for(const v in c[m]){const E=c[m][v];u[E]=u[E]||[],b.push(...u[E])}c[m]=b}for(const m in l)if(u[m])for(const b of u[m])c[b].push(...l[m]);const p={};for(const m in c){const b=c[m];for(const v of b)p[v]=p[v]||[],p[v].push(m)}const f={},h=[];for(let m=0;m<this._items.length;++m){let b=m;if(p[m]){b=null;for(let v=0;v<this._items.length;++v){if(f[v]===!0)continue;p[v]||(p[v]=[]);const E=p[v].length;let _=0;for(let C=0;C<E;++C)f[p[v][C]]&&++_;if(_===E){b=v;break}}}b!==null&&(f[b]=!0,h.push(b))}if(h.length!==this._items.length)return!1;const y={};for(const m of this._items)y[m.seq]=m;this._items=[],this.nodes=[];for(const m of h){const b=y[m];this.nodes.push(b.node),this._items.push(b)}return!0}},d.mergeSort=(c,l)=>c.sort===l.sort?0:c.sort<l.sort?-1:1},5380:(s,i,o)=>{const a=o(443),d=o(2178),c={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:a.URL||URL};i.analyze=function(l,u={}){if(!l)return d.code("DOMAIN_NON_EMPTY_STRING");if(typeof l!="string")throw new Error("Invalid input: domain must be a string");if(l.length>256)return d.code("DOMAIN_TOO_LONG");if(c.nonAsciiRx.test(l)){if(u.allowUnicode===!1)return d.code("DOMAIN_INVALID_UNICODE_CHARS");l=l.normalize("NFC")}if(c.domainControlRx.test(l))return d.code("DOMAIN_INVALID_CHARS");l=c.punycode(l),u.allowFullyQualified&&l[l.length-1]==="."&&(l=l.slice(0,-1));const p=u.minDomainSegments||c.minDomainSegments,f=l.split(".");if(f.length<p)return d.code("DOMAIN_SEGMENTS_COUNT");if(u.maxDomainSegments&&f.length>u.maxDomainSegments)return d.code("DOMAIN_SEGMENTS_COUNT_MAX");const h=u.tlds;if(h){const y=f[f.length-1].toLowerCase();if(h.deny&&h.deny.has(y)||h.allow&&!h.allow.has(y))return d.code("DOMAIN_FORBIDDEN_TLDS")}for(let y=0;y<f.length;++y){const m=f[y];if(!m.length)return d.code("DOMAIN_EMPTY_SEGMENT");if(m.length>63)return d.code("DOMAIN_LONG_SEGMENT");if(y<f.length-1){if(!c.domainSegmentRx.test(m))return d.code("DOMAIN_INVALID_CHARS")}else if(!c.tldSegmentRx.test(m))return d.code("DOMAIN_INVALID_TLDS_CHARS")}return null},i.isValid=function(l,u){return!i.analyze(l,u)},c.punycode=function(l){l.includes("%")&&(l=l.replace(/%/g,"%25"));try{return new c.URL(`http://${l}`).host}catch{return l}}},1745:(s,i,o)=>{const a=o(9848),d=o(5380),c=o(2178),l={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(a.TextEncoder||TextEncoder)};i.analyze=function(u,p){return l.email(u,p)},i.isValid=function(u,p){return!l.email(u,p)},l.email=function(u,p={}){if(typeof u!="string")throw new Error("Invalid input: email must be a string");if(!u)return c.code("EMPTY_STRING");const f=!l.nonAsciiRx.test(u);if(!f){if(p.allowUnicode===!1)return c.code("FORBIDDEN_UNICODE");u=u.normalize("NFC")}const h=u.split("@");if(h.length!==2)return h.length>2?c.code("MULTIPLE_AT_CHAR"):c.code("MISSING_AT_CHAR");const[y,m]=h;if(!y)return c.code("EMPTY_LOCAL");if(!p.ignoreLength){if(u.length>254)return c.code("ADDRESS_TOO_LONG");if(l.encoder.encode(y).length>64)return c.code("LOCAL_TOO_LONG")}return l.local(y,f)||d.analyze(m,p)},l.local=function(u,p){const f=u.split(".");for(const h of f){if(!h.length)return c.code("EMPTY_LOCAL_SEGMENT");if(p){if(!l.atextRx.test(h))return c.code("INVALID_LOCAL_CHARS")}else for(const y of h){if(l.atextRx.test(y))continue;const m=l.binary(y);if(!l.atomRx.test(m))return c.code("INVALID_LOCAL_CHARS")}}},l.binary=function(u){return Array.from(l.encoder.encode(u)).map(p=>String.fromCharCode(p)).join("")},l.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,l.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(s,i)=>{i.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},i.code=function(o){return{code:o,error:i.codes[o]}}},9959:(s,i,o)=>{const a=o(375),d=o(5752);i.regex=function(c={}){a(c.cidr===void 0||typeof c.cidr=="string","options.cidr must be a string");const l=c.cidr?c.cidr.toLowerCase():"optional";a(["required","optional","forbidden"].includes(l),"options.cidr must be one of required, optional, forbidden"),a(c.version===void 0||typeof c.version=="string"||Array.isArray(c.version),"options.version must be a string or an array of string");let u=c.version||["ipv4","ipv6","ipvfuture"];Array.isArray(u)||(u=[u]),a(u.length>=1,"options.version must have at least 1 version specified");for(let h=0;h<u.length;++h)a(typeof u[h]=="string","options.version must only contain strings"),u[h]=u[h].toLowerCase(),a(["ipv4","ipv6","ipvfuture"].includes(u[h]),"options.version contains unknown version "+u[h]+" - must be one of ipv4, ipv6, ipvfuture");u=Array.from(new Set(u));const p=`(?:${u.map(h=>{if(l==="forbidden")return d.ip[h];const y=`\\/${h==="ipv4"?d.ip.v4Cidr:d.ip.v6Cidr}`;return l==="required"?`${d.ip[h]}${y}`:`${d.ip[h]}(?:${y})?`}).join("|")})`,f=new RegExp(`^${p}$`);return{cidr:l,versions:u,regex:f,raw:p}}},5752:(s,i,o)=>{const a=o(375),d=o(6064),c={generate:function(){const l={},u="\\dA-Fa-f",p="["+u+"]",f="\\w-\\.~",h="!\\$&'\\(\\)\\*\\+,;=",y="%"+u,m=f+y+h+":@",b="["+m+"]",v="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";l.ipv4address="(?:"+v+"\\.){3}"+v;const E=p+"{1,4}",_="(?:"+E+":"+E+"|"+l.ipv4address+")",C="(?:"+E+":){6}"+_,k="::(?:"+E+":){5}"+_,D="(?:"+E+")?::(?:"+E+":){4}"+_,w="(?:(?:"+E+":){0,1}"+E+")?::(?:"+E+":){3}"+_,S="(?:(?:"+E+":){0,2}"+E+")?::(?:"+E+":){2}"+_,I="(?:(?:"+E+":){0,3}"+E+")?::"+E+":"+_,T="(?:(?:"+E+":){0,4}"+E+")?::"+_,g="(?:(?:"+E+":){0,5}"+E+")?::"+E,A="(?:(?:"+E+":){0,6}"+E+")?::";l.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",l.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",l.ipv6address="(?:"+C+"|"+k+"|"+D+"|"+w+"|"+S+"|"+I+"|"+T+"|"+g+"|"+A+")",l.ipvFuture="v"+p+"+\\.["+f+h+":]+",l.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",l.schemeRegex=new RegExp(l.scheme);const P="["+f+y+h+":]*",O="["+f+y+h+"]{1,255}",N="(?:\\[(?:"+l.ipv6address+"|"+l.ipvFuture+")\\]|"+l.ipv4address+"|"+O+")",M="(?:"+P+"@)?"+N+"(?::\\d*)?",L="(?:"+P+"@)?("+N+")(?::\\d*)?",x=b+"*",R=b+"+",K="(?:\\/"+x+")*",V="\\/(?:"+R+K+")?",J=R+K,se="["+f+y+h+"@]+"+K,j="(?:\\/\\/\\/"+x+K+")";return l.hierPart="(?:(?:\\/\\/"+M+K+")|"+V+"|"+J+"|"+j+")",l.hierPartCapture="(?:(?:\\/\\/"+L+K+")|"+V+"|"+J+")",l.relativeRef="(?:(?:\\/\\/"+M+K+")|"+V+"|"+se+"|)",l.relativeRefCapture="(?:(?:\\/\\/"+L+K+")|"+V+"|"+se+"|)",l.query="["+m+"\\/\\?]*(?=#|$)",l.queryWithSquareBrackets="["+m+"\\[\\]\\/\\?]*(?=#|$)",l.fragment="["+m+"\\/\\?]*",l}};c.rfc3986=c.generate(),i.ip={v4Cidr:c.rfc3986.ipv4Cidr,v6Cidr:c.rfc3986.ipv6Cidr,ipv4:c.rfc3986.ipv4address,ipv6:c.rfc3986.ipv6address,ipvfuture:c.rfc3986.ipvFuture},c.createRegex=function(l){const u=c.rfc3986,p="(?:\\?"+(l.allowQuerySquareBrackets?u.queryWithSquareBrackets:u.query)+")?(?:#"+u.fragment+")?",f=l.domain?u.relativeRefCapture:u.relativeRef;if(l.relativeOnly)return c.wrap(f+p);let h="";if(l.scheme){a(l.scheme instanceof RegExp||typeof l.scheme=="string"||Array.isArray(l.scheme),"scheme must be a RegExp, String, or Array");const b=[].concat(l.scheme);a(b.length>=1,"scheme must have at least 1 scheme specified");const v=[];for(let E=0;E<b.length;++E){const _=b[E];a(_ instanceof RegExp||typeof _=="string","scheme at position "+E+" must be a RegExp or String"),_ instanceof RegExp?v.push(_.source.toString()):(a(u.schemeRegex.test(_),"scheme at position "+E+" must be a valid scheme"),v.push(d(_)))}h=v.join("|")}const y="(?:"+(h?"(?:"+h+")":u.scheme)+":"+(l.domain?u.hierPartCapture:u.hierPart)+")",m=l.allowRelative?"(?:"+y+"|"+f+")":y;return c.wrap(m+p,h)},c.wrap=function(l,u){return{raw:l=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${l}`,regex:new RegExp(`^${l}$`),scheme:u}},c.uriRegex=c.createRegex({}),i.regex=function(l={}){return l.scheme||l.allowRelative||l.relativeOnly||l.allowQuerySquareBrackets||l.domain?c.createRegex(l):c.uriRegex}},1447:(s,i)=>{const o={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};i.Parser=class{constructor(a,d={}){if(!d[o.settings]&&d.constants)for(const c in d.constants){const l=d.constants[c];if(l!==null&&!["boolean","number","string"].includes(typeof l))throw new Error(`Formula constant ${c} contains invalid ${typeof l} value type`)}this.settings=d[o.settings]?d:Object.assign({[o.settings]:!0,constants:{},functions:{}},d),this.single=null,this._parts=null,this._parse(a)}_parse(a){let d=[],c="",l=0,u=!1;const p=h=>{if(l)throw new Error("Formula missing closing parenthesis");const y=d.length?d[d.length-1]:null;if(u||c||h){if(y&&y.type==="reference"&&h===")")return y.type="function",y.value=this._subFormula(c,y.value),void(c="");if(h===")"){const m=new i.Parser(c,this.settings);d.push({type:"segment",value:m})}else if(u){if(u==="]")return d.push({type:"reference",value:c}),void(c="");d.push({type:"literal",value:c})}else if(o.operatorCharacters.includes(c))y&&y.type==="operator"&&o.operators.includes(y.value+c)?y.value+=c:d.push({type:"operator",value:c});else if(c.match(o.numberRx))d.push({type:"constant",value:parseFloat(c)});else if(this.settings.constants[c]!==void 0)d.push({type:"constant",value:this.settings.constants[c]});else{if(!c.match(o.tokenRx))throw new Error(`Formula contains invalid token: ${c}`);d.push({type:"reference",value:c})}c=""}};for(const h of a)u?h===u?(p(),u=!1):c+=h:l?h==="("?(c+=h,++l):h===")"?(--l,l?c+=h:p(h)):c+=h:h in o.literals?u=o.literals[h]:h==="("?(p(),++l):o.operatorCharacters.includes(h)?(p(),c=h,p()):h!==" "?c+=h:p();p(),d=d.map((h,y)=>h.type!=="operator"||h.value!=="-"||y&&d[y-1].type!=="operator"?h:{type:"operator",value:"n"});let f=!1;for(const h of d){if(h.type==="operator"){if(o.operatorsPrefix.includes(h.value))continue;if(!f)throw new Error("Formula contains an operator in invalid position");if(!o.operators.includes(h.value))throw new Error(`Formula contains an unknown operator ${h.value}`)}else if(f)throw new Error("Formula missing expected operator");f=!f}if(!f)throw new Error("Formula contains invalid trailing operator");d.length===1&&["reference","literal","constant"].includes(d[0].type)&&(this.single={type:d[0].type==="reference"?"reference":"value",value:d[0].value}),this._parts=d.map(h=>{if(h.type==="operator")return o.operatorsPrefix.includes(h.value)?h:h.value;if(h.type!=="reference")return h.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(h.value))throw new Error(`Formula contains invalid reference ${h.value}`);return this.settings.reference?this.settings.reference(h.value):o.reference(h.value)})}_subFormula(a,d){const c=this.settings.functions[d];if(typeof c!="function")throw new Error(`Formula contains unknown function ${d}`);let l=[];if(a){let u="",p=0,f=!1;const h=()=>{if(!u)throw new Error(`Formula contains function ${d} with invalid arguments ${a}`);l.push(u),u=""};for(let y=0;y<a.length;++y){const m=a[y];f?(u+=m,m===f&&(f=!1)):m in o.literals&&!p?(u+=m,f=o.literals[m]):m!==","||p?(u+=m,m==="("?++p:m===")"&&--p):h()}h()}return l=l.map(u=>new i.Parser(u,this.settings)),function(u){const p=[];for(const f of l)p.push(f.evaluate(u));return c.call(u,...p)}}evaluate(a){const d=this._parts.slice();for(let c=d.length-2;c>=0;--c){const l=d[c];if(l&&l.type==="operator"){const u=d[c+1];d.splice(c+1,1);const p=o.evaluate(u,a);d[c]=o.single(l.value,p)}}return o.operatorsOrder.forEach(c=>{for(let l=1;l<d.length-1;)if(c.includes(d[l])){const u=d[l],p=o.evaluate(d[l-1],a),f=o.evaluate(d[l+1],a);d.splice(l,2);const h=o.calculate(u,p,f);d[l-1]=h===0?0:h}else l+=2}),o.evaluate(d[0],a)}},i.Parser.prototype[o.symbol]=!0,o.reference=function(a){return function(d){return d&&d[a]!==void 0?d[a]:null}},o.evaluate=function(a,d){return a===null?null:typeof a=="function"?a(d):a[o.symbol]?a.evaluate(d):a},o.single=function(a,d){if(a==="!")return!d;const c=-d;return c===0?0:c},o.calculate=function(a,d,c){if(a==="??")return o.exists(d)?d:c;if(typeof d=="string"||typeof c=="string"){if(a==="+")return(d=o.exists(d)?d:"")+(o.exists(c)?c:"")}else switch(a){case"^":return Math.pow(d,c);case"*":return d*c;case"/":return d/c;case"%":return d%c;case"+":return d+c;case"-":return d-c}switch(a){case"<":return d<c;case"<=":return d<=c;case">":return d>c;case">=":return d>=c;case"==":return d===c;case"!=":return d!==c;case"&&":return d&&c;case"||":return d||c}return null},o.exists=function(a){return a!=null}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:s=>{s.exports=JSON.parse('{"version":"17.13.3"}')}},n={},function s(i){var o=n[i];if(o!==void 0)return o.exports;var a=n[i]={exports:{}};return r[i](a,a.exports,s),a.exports}(5107);var r,n})}(Up)),Up.exports}var c6;function Nk(){if(c6)return Ac;c6=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.validateMessageObj=void 0;const e=Ok(),t=xa(),r=Je(),n=f=>{const h=[];for(const y in f)typeof f[y]=="string"?h.push(f[y]):typeof f[y]=="object"&&h.push(...n(f[y]));return h},s=e.object({content:e.string().required().allow("")}),i=e.object({content:e.string().valid(...Object.values(n(t.CHAT.META))).required(),info:e.object({affected:e.array().items(e.string()).required(),arbitrary:e.object().pattern(e.string(),e.any())}).required()}),o=e.object({content:e.string().valid(...Object.values(n(t.CHAT.REACTION))).required(),reference:e.string().required()}),a=e.object({content:e.string().valid(...Object.values(n(t.CHAT.RECEIPT))).required(),reference:e.string().required()}),d=e.object({content:e.string().valid(...Object.values(n(t.CHAT.UA))).required(),info:e.object({affected:e.array().items(e.string()).required(),arbitrary:e.object().pattern(e.string(),e.any())}).required()}),c=e.object({content:e.string().valid(...Object.values(n(t.CHAT.INTENT)))}),l=e.object({content:e.object({messageType:e.string().valid(...Object.values([r.MessageType.TEXT,r.MessageType.IMAGE,r.MessageType.AUDIO,r.MessageType.VIDEO,r.MessageType.FILE,r.MessageType.MEDIA_EMBED])).required(),messageObj:e.object({content:e.string().required()}).required()}).required(),reference:e.string().required()}),u=e.object({content:e.array().items(e.object({messageType:e.string().valid(...Object.values([r.MessageType.TEXT,r.MessageType.IMAGE,r.MessageType.AUDIO,r.MessageType.VIDEO,r.MessageType.FILE,r.MessageType.MEDIA_EMBED])).required(),messageObj:e.object({content:e.string().required()}).required()})).required()}),p=(f,h)=>{let y;switch(h){case r.MessageType.TEXT:case r.MessageType.IMAGE:case r.MessageType.VIDEO:case r.MessageType.AUDIO:case r.MessageType.FILE:case r.MessageType.MEDIA_EMBED:case r.MessageType.GIF:{y=s.validate(f).error;break}case r.MessageType.META:{y=i.validate(f).error;break}case r.MessageType.REACTION:{y=o.validate(f).error;break}case r.MessageType.RECEIPT:{y=a.validate(f).error;break}case r.MessageType.USER_ACTIVITY:{y=d.validate(f).error;break}case r.MessageType.INTENT:{y=c.validate(f).error;break}case r.MessageType.REPLY:{y=l.validate(f).error;break}case r.MessageType.COMPOSITE:{y=u.validate(f).error;break}default:throw new Error("Invalid MessageType")}if(y)throw new Error("Unable to parse this messageType. Please ensure 'messageObj' is properly defined.")};return Ac.validateMessageObj=p,Ac}var u6;function Dk(){return u6||(u6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sendCore=e.send=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=N9(),o=Mt(),a=Nk(),d=It(),c=td(),l=Xt(),u=ri(),p=m=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.sendCore)(m,s.PGPHelper)});e.send=p;const f=(m,b)=>t.__awaiter(void 0,void 0,void 0,function*(){var v,E,_;try{const C=y(m),{messageType:k,messageObj:D,account:w,signer:S,pgpPrivateKey:I,env:T}=C;let{to:g}=C;yield h(C);const A=(0,s.getWallet)({account:w,signer:S}),P=yield(0,s.getConnectedUserV2Core)(A,I,T,b);let O=yield(0,r.convertToValidDID)(g,T);const N=(0,r.getAPIBaseUrls)(T),M=!(0,r.isValidPushCAIP)(g);let L=!1,x=null;if(M){const j={recipient:g,account:w,env:T},re=yield u.getChatInfo(j);L=(E=(v=re==null?void 0:re.meta)===null||v===void 0?void 0:v.group)!==null&&E!==void 0?E:!1,x=L?yield(0,c.getGroupInfo)({chatId:g,env:T}):null,L||(g=((_=re.participants)!==null&&_!==void 0?_:[]).find(X=>X!==(0,r.walletToPCAIP10)(w)),O=g)}let R;k===n.MessageType.REPLY||k===n.MessageType.COMPOSITE?R="MessageType Not Supported by this sdk version. Plz upgrade !!!":R=D.content;const K=yield(0,i.conversationHash)({conversationId:O,account:P.did,env:T});let V;!L&&K&&!(K!=null&&K.threadHash)?V=`${N}/v1/chat/request`:V=`${N}/v1/chat/message`;const J=yield(0,o.sendMessagePayloadCore)(O,P,D,R,k,x,T,b);return(yield(0,d.axiosPost)(V,J)).data}catch(C){throw(0,l.handleError)(C,e.send.name)}});e.sendCore=f;const h=m=>t.__awaiter(void 0,void 0,void 0,function*(){const{messageType:b,messageObj:v,account:E,to:_,signer:C,pgpPrivateKey:k,env:D}=m;if(!E&&!C)throw new Error("Unable to detect sender. Please ensure that either 'account' or 'signer' is properly defined.");if(!C&&!k)throw new Error("Unable to decrypt keys. Please ensure that either 'signer' or 'pgpPrivateKey' is properly defined.");const w=(0,s.getWallet)({account:E,signer:C}),S=yield(0,s.getAccountAddress)(w);if(!(0,r.isValidPushCAIP)(S))throw new Error("Invalid sender. Please ensure that either 'account' or 'signer' is properly defined.");(0,a.validateMessageObj)(v,b)}),y=m=>{var b,v,E;const _=((b=m.message)===null||b===void 0?void 0:b.type)!==void 0?m.message.type:(v=m.messageType)!==null&&v!==void 0?v:"Text";let C=m.message;if(C===void 0){if(m.messageObj===void 0&&![n.MessageType.TEXT,n.MessageType.IMAGE,n.MessageType.FILE,n.MessageType.MEDIA_EMBED,n.MessageType.GIF].includes(_))throw new Error("Options.message is required");C=m.messageObj!==void 0?m.messageObj:{content:(E=m.messageContent)!==null&&E!==void 0?E:""}}else C=t.__rest(C,["type"]);if(_===n.MessageType.REPLY)if(typeof C.content=="object"){const T=C.content,{type:g}=T,A=t.__rest(T,["type"]);C.content={messageType:g,messageObj:A}}else throw new Error("Options.message is not properly defined for Reply");if(_===n.MessageType.COMPOSITE)if(C.content instanceof Array)C.content=C.content.map(T=>{const{type:g}=T,A=t.__rest(T,["type"]);return{messageType:g,messageObj:A}});else throw new Error("Options.message is not properly defined for Composite");const k=m.account!==void 0?m.account:null,D=m.to!==void 0?m.to:m.receiverAddress;if(D===void 0)throw new Error("Options.to is required");const w=m.signer!==void 0?m.signer:null,S=m.pgpPrivateKey!==void 0?m.pgpPrivateKey:null,I=m.env!==void 0?m.env:n.default.ENV.PROD;return{messageType:_,messageObj:C,account:k,to:D,signer:w,pgpPrivateKey:S,env:I}}}(Dp)),Dp}var Bp={},l6;function D9(){return l6||(l6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.historyCore=e.history=void 0;const t=$e,r=Je(),n=Xt(),s=tt(),i=kn(),o=Mt();var a;(function(l){l[l.MIN=1]="MIN",l[l.DEFAULT=10]="DEFAULT",l[l.MAX=30]="MAX"})(a||(a={}));const d=l=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.historyCore)(l,o.PGPHelper)});e.history=d;const c=(l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:p,limit:f=a.DEFAULT,pgpPrivateKey:h="",account:y,toDecrypt:m=!1,env:b=r.default.ENV.PROD}=l||{};try{if(f<a.MIN||f>a.MAX)throw f<a.MIN?new Error(`Limit must be more than equal to ${a.MIN}`):new Error(`Limit must be less than equal to ${a.MAX}`);const v=yield(0,o.getMessagesService)({threadhash:p,limit:f,env:b}),E=(0,o.addDeprecatedInfoToMessages)(v),_=yield(0,i.get)({account:(0,s.pCAIP10ToWallet)(y),env:b});return m?yield(0,o.decryptConversation)({messages:E,connectedUser:_,pgpPrivateKey:h,pgpHelper:u,env:b}):v}catch(v){throw(0,n.handleError)(v,e.history.name)}});e.historyCore=c}(Bp)),Bp}var Lp={},d6;function xk(){return d6||(d6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.latestCore=e.latest=void 0;const t=$e,r=Je(),n=Mt(),s=D9(),i=a=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.latestCore)(a,n.PGPHelper)});e.latest=i;const o=(a,d)=>t.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:c,pgpPrivateKey:l="",account:u,toDecrypt:p=!1,env:f=r.default.ENV.PROD}=a||{};return(0,s.history)({threadhash:c,toDecrypt:p,limit:1,pgpPrivateKey:l,account:u,env:f})});e.latestCore=o}(Lp)),Lp}var Kp={},f6;function Uk(){return f6||(f6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createGroupCoreV2=e.createGroupV2=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=Xt(),a=It(),d=u=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createGroupCoreV2)(u,s.PGPHelper)});e.createGroupV2=d;const c=(u,p)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:f=null,signer:h=null,pgpPrivateKey:y=null,env:m=n.default.ENV.PROD,groupName:b,groupDescription:v,groupImage:E,rules:_,isPublic:C,groupType:k,config:{meta:D,scheduleAt:w,scheduleEnd:S,status:I},members:T,admins:g}=u;try{const A=(0,s.getWallet)({account:f,signer:h}),P=yield(0,s.getConnectedUserV2Core)(A,y,m,p),O=T.map(z=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(z,m)})),N=g.map(z=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(z,m)})),M=yield Promise.all(O),L=yield Promise.all(N);l(u);const x={groupName:b,groupDescription:v,groupImage:E,rules:_,isPublic:C,groupType:k},R=i.SHA256(JSON.stringify(x)).toString(),V=`pgpv2:${yield p.sign({message:R,signingKey:P.privateKey})}:${P.did}`,J={meta:D,scheduleAt:w,scheduleEnd:S,status:I},se=i.SHA256(JSON.stringify(J)).toString(),re=`pgpv2:${yield p.sign({message:se,signingKey:P.privateKey})}:${P.did}`,G={members:M,admins:L},B=i.SHA256(JSON.stringify(G)).toString(),ge=`pgpv2:${yield p.sign({message:B,signingKey:P.privateKey})}:${P.did}`,Se=`${(0,r.getAPIBaseUrls)(m)}/v2/chat/groups`,F={groupName:b,groupDescription:v,groupImage:E,rules:_,isPublic:C,groupType:k,profileVerificationProof:V,config:{meta:D,scheduleAt:w,scheduleEnd:S,status:I,configVerificationProof:re},members:M,admins:L,idempotentVerificationProof:ge};return(yield(0,a.axiosPost)(Se,F)).data}catch(A){throw(0,o.handleError)(A,e.createGroupV2.name)}});e.createGroupCoreV2=c;const l=u=>{const{account:p=null,signer:f=null,pgpPrivateKey:h=null,groupName:y,groupDescription:m,groupImage:b,rules:v,isPublic:E,groupType:_,config:{meta:C,scheduleAt:k,scheduleEnd:D,status:w},members:S,admins:I}=u;if(!h&&!f)throw new Error("At least one from pgpPrivateKey or signer is necessary!");if(y==null||y.length==0)throw new Error("groupName cannot be null or empty");if(y.length>50)throw new Error("groupName cannot be more than 50 characters");if(m&&m.length>150)throw new Error("groupDescription cannot be more than 150 characters");for(let T=0;T<S.length;T++)if(S[T]&&!(0,r.isValidPushCAIP)(S[T]))throw new Error("Invalid member address!");for(let T=0;T<I.length;T++)if(!(0,r.isValidPushCAIP)(I[T]))throw new Error("Invalid admin address!");(0,s.validateScheduleDates)(k,D)}}(Kp)),Kp}var qp={},h6;function Bk(){return h6||(h6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupByName=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{groupName:d,env:c=n.default.ENV.PROD}=a||{};try{if(console.log("============================================="),console.log("NOTICE: The method 'getGroupByName' will be deprecated on January 1st, 2024. Please update your code to remove this."),console.log("============================================="),d==null||d.length==0)throw new Error("Group Name cannot be null or empty");const u=`${(0,r.getAPIBaseUrls)(c)}/v1/chat/groups?groupName=${d}`;return(yield(0,s.axiosGet)(u)).data}catch(l){throw(0,i.handleError)(l,e.getGroupByName.name)}});e.getGroupByName=o}(qp)),qp}var jp={},p6;function Lk(){return p6||(p6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupAccess=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,did:c,env:l=n.default.ENV.PROD}=a||{};try{if(d==null||d.length===0)throw new Error("chatId cannot be null or empty");if(c==null||c.length===0)throw new Error("did cannot be null or empty");const u=yield(0,r.convertToValidDID)(c,l),f=`${(0,r.getAPIBaseUrls)(l)}/v1/chat/groups/${d}/access/${u}`;return(yield(0,s.axiosGet)(f)).data}catch(u){throw(0,i.handleError)(u,e.getGroupAccess.name)}});e.getGroupAccess=o}(jp)),jp}var $p={},y6;function Kk(){return y6||(y6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.search=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{searchTerm:d,pageNumber:c,pageSize:l,env:u=n.default.ENV.PROD}=a||{};try{const f=`${(0,r.getAPIBaseUrls)(u)}/v1/chat/groups/search`;return(yield(0,s.axiosPost)(f,{searchTerm:d,pageNumber:c,pageSize:l})).data}catch(p){throw(0,i.handleError)(p,e.search.name)}});e.search=o}($p)),$p}var Vp={},g6;function qk(){return g6||(g6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reject=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=It(),a=Xt(),d=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:l=null,signer:u=null,senderAddress:p,env:f=n.default.ENV.PROD,pgpPrivateKey:h=null}=c||{};if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");const y=(0,s.getWallet)({account:l,signer:u}),m=yield(0,s.getAccountAddress)(y),v=`${(0,r.getAPIBaseUrls)(f)}/v1/chat/request/reject`;let E=!0;(0,r.isValidPushCAIP)(p)&&(E=!1);const _=yield(0,s.getConnectedUserV2)(y,h,f);let C=yield(0,r.convertToValidDID)(p,f),k=yield(0,r.convertToValidDID)(m,f);E&&(C=yield(0,r.convertToValidDID)(m,f),k=yield(0,r.convertToValidDID)(p,f));const D={fromDID:C,toDID:k},w=i.SHA256(JSON.stringify(D)).toString(),S=yield(0,s.sign)({message:w,signingKey:_.privateKey}),I=(0,s.rejectRequestPayload)(C,k,"pgp",S);return(0,o.axiosPut)(v,I).then(T=>T.data).catch(T=>{throw(0,a.handleError)(T,e.reject.name)})});e.reject=d}(Vp)),Vp}var Fp={},m6;function jk(){return m6||(m6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.modifyRoles=void 0;const t=$e,r=nn(),n=Je(),s=Xt(),i=rd(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:d,newRole:c,members:l,account:u=null,signer:p=null,env:f=n.default.ENV.PROD,pgpPrivateKey:h=null,overrideSecretKeyGeneration:y=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(u==null&&p==null)throw new Error("At least one from account or signer is necessary!");if(!l||l.length===0)throw new Error("Members array cannot be empty!");const b={chatId:d,upsert:{admins:c==="ADMIN"?l:[],members:c==="MEMBER"?l:[]},remove:[],account:u,signer:p,pgpPrivateKey:h,env:f,overrideSecretKeyGeneration:y};return yield(0,i.updateGroupMembers)(b)}catch(m){throw(0,s.handleError)(m,e.modifyRoles.name)}});e.modifyRoles=o}(Fp)),Fp}var Hp={},b6;function $k(){return b6||(b6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getChatInfo=void 0;const t=$e,r=Je(),n=Xt(),s=tt(),i=It(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{recipient:d,account:c,env:l=r.default.ENV.PROD}=a;try{if(!d||!c)throw new Error("receipient and account cannot be null or empty");const p=`${(0,s.getAPIBaseUrls)(l)}/v1/chat/${yield(0,s.convertToValidDID)(d,l)}/address/${yield(0,s.convertToValidDID)(c,l)}`;return(yield(0,i.axiosGet)(p)).data}catch(u){throw(0,n.handleError)(u,e.getChatInfo.name)}});e.getChatInfo=o}(Hp)),Hp}var v6;function ri(){return v6||(v6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptConversation=e.decryptPGPKey=e.decryptWithWalletRPCMethod=void 0;const t=$e;t.__exportStar(Rk(),e),t.__exportStar(kk(),e),t.__exportStar(Mk(),e),t.__exportStar(Dk(),e),t.__exportStar(N9(),e),t.__exportStar(M9(),e),t.__exportStar(D9(),e),t.__exportStar(xk(),e);var r=Yy();Object.defineProperty(e,"decryptWithWalletRPCMethod",{enumerable:!0,get:function(){return r.decryptWithWalletRPCMethod}});var n=Yy();Object.defineProperty(e,"decryptPGPKey",{enumerable:!0,get:function(){return n.decryptPGPKey}});var s=Mt();Object.defineProperty(e,"decryptConversation",{enumerable:!0,get:function(){return s.decryptConversation}}),t.__exportStar(m9(),e),t.__exportStar(S9(),e),t.__exportStar(Uk(),e),t.__exportStar(ed(),e),t.__exportStar(Xl(),e),t.__exportStar(Bk(),e),t.__exportStar(R9(),e),t.__exportStar(I9(),e),t.__exportStar(k9(),e),t.__exportStar(C9(),e),t.__exportStar(Lk(),e),t.__exportStar(Kk(),e),t.__exportStar(qk(),e),t.__exportStar(ig(),e),t.__exportStar(g9(),e),t.__exportStar(td(),e),t.__exportStar(eg(),e),t.__exportStar(P9(),e),t.__exportStar(jk(),e),t.__exportStar($k(),e)}(kp)),kp}var _6;function Vk(){return _6||(_6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getAccess=void 0;const t=$e,r=Je(),n=ri(),s=i=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:o,did:a,env:d=r.default.ENV.PROD}=i||{};try{if(o==null||o.length===0)throw new Error("spaceId cannot be null or empty");if(a==null||a.length===0)throw new Error("did cannot be null or empty");const c=yield(0,n.getGroupAccess)({chatId:o,did:a,env:d});return(0,n.groupAccessToSpaceAccess)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.getAccess.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.getAccess.name} -: ${c}`)}});e.getAccess=s}(Rp)),Rp}var Gp={},w6;function Fk(){return w6||(w6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.search=void 0;const t=$e,r=tt(),n=Je(),s=It(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{searchTerm:a,pageNumber:d,pageSize:c,env:l=n.default.ENV.PROD}=o||{};try{const p=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/search`;return(0,s.axiosPost)(p,{searchTerm:a,pageNumber:d,pageSize:c}).then(f=>f.data).catch(f=>{var h,y;throw!((h=f==null?void 0:f.response)===null||h===void 0)&&h.data?new Error((y=f==null?void 0:f.response)===null||y===void 0?void 0:y.data):new Error(f)})}catch(u){throw console.error(`[Push SDK] - API - Error - API ${e.search.name} -: `,u),Error(`[Push SDK] - API - Error - API ${e.search.name} -: ${u}`)}});e.search=i}(Gp)),Gp}var Sc={},E6;function Hk(){if(E6)return Sc;E6=1,Object.defineProperty(Sc,"__esModule",{value:!0}),Sc.createV2=void 0;const e=$e,t=Je(),r=Mt(),n=ri();function s(i){var o;return e.__awaiter(this,void 0,void 0,function*(){const{signer:a,spaceName:d,spaceDescription:c,listeners:l,spaceImage:u,speakers:p,isPublic:f,env:h=t.default.ENV.PROD,pgpPrivateKey:y=null,rules:m,config:b}=i||{},v=m?(0,r.convertSpaceRulesToRules)(m):null;try{const E=yield(0,n.createGroupV2)({signer:a,groupName:d,groupDescription:c,members:l,groupImage:u,admins:p,isPublic:f,env:h,pgpPrivateKey:y,groupType:"spaces",config:{meta:null,scheduleAt:b.scheduleAt,scheduleEnd:(o=b.scheduleEnd)!==null&&o!==void 0?o:null,status:"PENDING"},rules:v});return(0,r.groupInfoDtoToSpaceInfoDto)(E)}catch(E){throw console.error(`[Push SDK] - API - Error - API ${s.name} -: `,E),new Error(`[Push SDK] - API - Error - API ${s.name} -: ${E}`)}})}return Sc.createV2=s,Sc}var zp={},A6;function Gk(){return A6||(A6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.spaceFeed=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=It(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:d,pgpPrivateKey:c,env:l=n.default.ENV.PROD,toDecrypt:u=!1,recipient:p}=a||{},f=yield(0,r.convertToValidDID)(d,l),h=yield(0,r.convertToValidDID)(p,l);if(!(0,r.isValidPushCAIP)(f))throw new Error(`Invalid address ${f}`);const m=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${f}/space/${h}`;try{const v=(yield(0,i.axiosGet)(m)).data;if(Object.keys(v).length!==0){const[E]=yield(0,s.getSpaceInboxLists)({lists:[v],user:f,toDecrypt:u,pgpPrivateKey:c,env:l});return E}else return v}catch(b){throw console.error(`[Push SDK] - API ${e.spaceFeed.name}: `,b),Error(`[Push SDK] - API ${e.spaceFeed.name}: ${b}`)}});e.spaceFeed=o}(zp)),zp}var Wp={},Yp={exports:{}},Jp,S6;function zk(){if(S6)return Jp;S6=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(W,oe)=>{for(var me in oe)e(W,me,{get:oe[me],enumerable:!0})},i=(W,oe,me,Te)=>{if(oe&&typeof oe=="object"||typeof oe=="function")for(let Pe of r(oe))!n.call(W,Pe)&&Pe!==me&&e(W,Pe,{get:()=>oe[Pe],enumerable:!(Te=t(oe,Pe))||Te.enumerable});return W},o=W=>i(e({},"__esModule",{value:!0}),W),a={};s(a,{Immer:()=>je,applyPatches:()=>He,castDraft:()=>rt,castImmutable:()=>be,createDraft:()=>Qe,current:()=>Fe,enableMapSet:()=>pe,enablePatches:()=>ue,finishDraft:()=>dt,freeze:()=>A,immerable:()=>c,isDraft:()=>f,isDraftable:()=>h,nothing:()=>d,original:()=>v,produce:()=>fe,produceWithPatches:()=>ye,setAutoFreeze:()=>ie,setUseStrictIteration:()=>qe,setUseStrictShallowCopy:()=>Q}),Jp=o(a);var d=Symbol.for("immer-nothing"),c=Symbol.for("immer-draftable"),l=Symbol.for("immer-state");function u(W,...oe){throw new Error(`[Immer] minified error nr: ${W}. Full error at: https://bit.ly/3cXEKWf`)}var p=Object.getPrototypeOf;function f(W){return!!W&&!!W[l]}function h(W){var oe;return W?b(W)||Array.isArray(W)||!!W[c]||!!((oe=W.constructor)!=null&&oe[c])||S(W)||I(W):!1}var y=Object.prototype.constructor.toString(),m=new WeakMap;function b(W){if(!W||typeof W!="object")return!1;let oe=Object.getPrototypeOf(W);if(oe===null||oe===Object.prototype)return!0;let me=Object.hasOwnProperty.call(oe,"constructor")&&oe.constructor;if(me===Object)return!0;if(typeof me!="function")return!1;let Te=m.get(me);return Te===void 0&&(Te=Function.toString.call(me),m.set(me,Te)),Te===y}function v(W){return f(W)||u(15,W),W[l].t}function E(W,oe,me=!0){_(W)===0?(me?Reflect.ownKeys(W):Object.keys(W)).forEach(Te=>{oe(Te,W[Te],W)}):W.forEach((Te,Pe)=>oe(Pe,Te,W))}function _(W){let oe=W[l];return oe?oe.o:Array.isArray(W)?1:S(W)?2:I(W)?3:0}function C(W,oe){return _(W)===2?W.has(oe):Object.prototype.hasOwnProperty.call(W,oe)}function k(W,oe){return _(W)===2?W.get(oe):W[oe]}function D(W,oe,me){let Te=_(W);Te===2?W.set(oe,me):Te===3?W.add(me):W[oe]=me}function w(W,oe){return W===oe?W!==0||1/W===1/oe:W!==W&&oe!==oe}function S(W){return W instanceof Map}function I(W){return W instanceof Set}function T(W){return W.e||W.t}function g(W,oe){if(S(W))return new Map(W);if(I(W))return new Set(W);if(Array.isArray(W))return Array.prototype.slice.call(W);let me=b(W);if(oe===!0||oe==="class_only"&&!me){let Te=Object.getOwnPropertyDescriptors(W);delete Te[l];let Pe=Reflect.ownKeys(Te);for(let ke=0;ke<Pe.length;ke++){let Ne=Pe[ke],Ue=Te[Ne];Ue.writable===!1&&(Ue.writable=!0,Ue.configurable=!0),(Ue.get||Ue.set)&&(Te[Ne]={configurable:!0,writable:!0,enumerable:Ue.enumerable,value:W[Ne]})}return Object.create(p(W),Te)}else{let Te=p(W);if(Te!==null&&me)return{...W};let Pe=Object.create(Te);return Object.assign(Pe,W)}}function A(W,oe=!1){return N(W)||f(W)||!h(W)||(_(W)>1&&Object.defineProperties(W,{set:O,add:O,clear:O,delete:O}),Object.freeze(W),oe&&Object.values(W).forEach(me=>A(me,!0))),W}function P(){u(2)}var O={value:P};function N(W){return W===null||typeof W!="object"?!0:Object.isFrozen(W)}var M={};function L(W){let oe=M[W];return oe||u(0,W),oe}function x(W,oe){M[W]||(M[W]=oe)}var R;function K(){return R}function V(W,oe){return{a:[],i:W,f:oe,P:!0,d:0}}function J(W,oe){oe&&(L("Patches"),W.u=[],W.h=[],W.I=oe)}function se(W){j(W),W.a.forEach(G),W.a=null}function j(W){W===R&&(R=W.i)}function re(W){return R=V(R,W)}function G(W){let oe=W[l];oe.o===0||oe.o===1?oe.x():oe.m=!0}function B(W,oe){oe.d=oe.a.length;let me=oe.a[0];return W!==void 0&&W!==me?(me[l].s&&(se(oe),u(4)),h(W)&&(W=X(oe,W),oe.i||_e(oe,W)),oe.u&&L("Patches").T(me[l].t,W,oe.u,oe.h)):W=X(oe,me,[]),se(oe),oe.u&&oe.I(oe.u,oe.h),W!==d?W:void 0}function X(W,oe,me){if(N(oe))return oe;let Te=W.f.shouldUseStrictIteration(),Pe=oe[l];if(!Pe)return E(oe,(ke,Ne)=>ge(W,Pe,oe,ke,Ne,me),Te),oe;if(Pe.n!==W)return oe;if(!Pe.s)return _e(W,Pe.t,!0),Pe.t;if(!Pe.c){Pe.c=!0,Pe.n.d--;let ke=Pe.e,Ne=ke,Ue=!1;Pe.o===3&&(Ne=new Set(ke),ke.clear(),Ue=!0),E(Ne,(Re,Me)=>ge(W,Pe,ke,Re,Me,me,Ue),Te),_e(W,ke,!1),me&&W.u&&L("Patches").g(Pe,me,W.u,W.h)}return Pe.e}function ge(W,oe,me,Te,Pe,ke,Ne){if(Pe==null||typeof Pe!="object"&&!Ne)return;let Ue=N(Pe);if(!(Ue&&!Ne)){if(f(Pe)){let Re=ke&&oe&&oe.o!==3&&!C(oe.r,Te)?ke.concat(Te):void 0,Me=X(W,Pe,Re);if(D(me,Te,Me),f(Me))W.P=!1;else return}else Ne&&me.add(Pe);if(h(Pe)&&!Ue){if(!W.f.y&&W.d<1||oe&&oe.t&&oe.t[Te]===Pe&&Ue)return;X(W,Pe),(!oe||!oe.n.i)&&typeof Te!="symbol"&&(S(me)?me.has(Te):Object.prototype.propertyIsEnumerable.call(me,Te))&&_e(W,Pe)}}}function _e(W,oe,me=!1){!W.i&&W.f.y&&W.P&&A(oe,me)}function Se(W,oe){let me=Array.isArray(W),Te={o:me?1:0,n:oe?oe.n:K(),s:!1,c:!1,r:{},i:oe,t:W,p:null,e:null,x:null,l:!1},Pe=Te,ke=F;me&&(Pe=[Te],ke=q);let{revoke:Ne,proxy:Ue}=Proxy.revocable(Pe,ke);return Te.p=Ue,Te.x=Ne,Ue}var F={get(W,oe){if(oe===l)return W;let me=T(W);if(!C(me,oe))return ee(W,me,oe);let Te=me[oe];return W.c||!h(Te)?Te:Te===z(W.t,oe)?(ne(W),W.e[oe]=De(Te,W)):Te},has(W,oe){return oe in T(W)},ownKeys(W){return Reflect.ownKeys(T(W))},set(W,oe,me){let Te=le(T(W),oe);if(Te!=null&&Te.set)return Te.set.call(W.p,me),!0;if(!W.s){let Pe=z(T(W),oe),ke=Pe==null?void 0:Pe[l];if(ke&&ke.t===me)return W.e[oe]=me,W.r[oe]=!1,!0;if(w(me,Pe)&&(me!==void 0||C(W.t,oe)))return!0;ne(W),ce(W)}return W.e[oe]===me&&(me!==void 0||oe in W.e)||Number.isNaN(me)&&Number.isNaN(W.e[oe])||(W.e[oe]=me,W.r[oe]=!0),!0},deleteProperty(W,oe){return z(W.t,oe)!==void 0||oe in W.t?(W.r[oe]=!1,ne(W),ce(W)):delete W.r[oe],W.e&&delete W.e[oe],!0},getOwnPropertyDescriptor(W,oe){let me=T(W),Te=Reflect.getOwnPropertyDescriptor(me,oe);return Te&&{writable:!0,configurable:W.o!==1||oe!=="length",enumerable:Te.enumerable,value:me[oe]}},defineProperty(){u(11)},getPrototypeOf(W){return p(W.t)},setPrototypeOf(){u(12)}},q={};E(F,(W,oe)=>{q[W]=function(){return arguments[0]=arguments[0][0],oe.apply(this,arguments)}}),q.deleteProperty=function(W,oe){return q.set.call(this,W,oe,void 0)},q.set=function(W,oe,me){return F.set.call(this,W[0],oe,me,W[0])};function z(W,oe){let me=W[l];return(me?T(me):W)[oe]}function ee(W,oe,me){var Pe;let Te=le(oe,me);return Te?"value"in Te?Te.value:(Pe=Te.get)==null?void 0:Pe.call(W.p):void 0}function le(W,oe){if(!(oe in W))return;let me=p(W);for(;me;){let Te=Object.getOwnPropertyDescriptor(me,oe);if(Te)return Te;me=p(me)}}function ce(W){W.s||(W.s=!0,W.i&&ce(W.i))}function ne(W){W.e||(W.e=g(W.t,W.n.f.S))}var je=class{constructor(W){this.y=!0,this.S=!1,this.b=!0,this.produce=(oe,me,Te)=>{if(typeof oe=="function"&&typeof me!="function"){let ke=me;me=oe;let Ne=this;return function(Ue=ke,...Re){return Ne.produce(Ue,Me=>me.call(this,Me,...Re))}}typeof me!="function"&&u(6),Te!==void 0&&typeof Te!="function"&&u(7);let Pe;if(h(oe)){let ke=re(this),Ne=De(oe,void 0),Ue=!0;try{Pe=me(Ne),Ue=!1}finally{Ue?se(ke):j(ke)}return J(ke,Te),B(Pe,ke)}else if(!oe||typeof oe!="object"){if(Pe=me(oe),Pe===void 0&&(Pe=oe),Pe===d&&(Pe=void 0),this.y&&A(Pe,!0),Te){let ke=[],Ne=[];L("Patches").T(oe,Pe,ke,Ne),Te(ke,Ne)}return Pe}else u(1,oe)},this.produceWithPatches=(oe,me)=>{if(typeof oe=="function")return(ke,...Ne)=>this.produceWithPatches(ke,Ue=>oe(Ue,...Ne));let Te,Pe;return[this.produce(oe,me,(ke,Ne)=>{Te=ke,Pe=Ne}),Te,Pe]},typeof(W==null?void 0:W.autoFreeze)=="boolean"&&this.setAutoFreeze(W.autoFreeze),typeof(W==null?void 0:W.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(W.useStrictShallowCopy),typeof(W==null?void 0:W.useStrictIteration)=="boolean"&&this.setUseStrictIteration(W.useStrictIteration)}createDraft(W){h(W)||u(8),f(W)&&(W=Fe(W));let oe=re(this),me=De(W,void 0);return me[l].l=!0,j(oe),me}finishDraft(W,oe){let me=W&&W[l];(!me||!me.l)&&u(9);let{n:Te}=me;return J(Te,oe),B(void 0,Te)}setAutoFreeze(W){this.y=W}setUseStrictShallowCopy(W){this.S=W}setUseStrictIteration(W){this.b=W}shouldUseStrictIteration(){return this.b}applyPatches(W,oe){let me;for(me=oe.length-1;me>=0;me--){let Pe=oe[me];if(Pe.path.length===0&&Pe.op==="replace"){W=Pe.value;break}}me>-1&&(oe=oe.slice(me+1));let Te=L("Patches").A;return f(W)?Te(W,oe):this.produce(W,Pe=>Te(Pe,oe))}};function De(W,oe){let me=S(W)?L("MapSet").D(W,oe):I(W)?L("MapSet").R(W,oe):Se(W,oe);return(oe?oe.n:K()).a.push(me),me}function Fe(W){return f(W)||u(10,W),he(W)}function he(W){if(!h(W)||N(W))return W;let oe=W[l],me,Te=!0;if(oe){if(!oe.s)return oe.t;oe.c=!0,me=g(W,oe.n.f.S),Te=oe.n.f.shouldUseStrictIteration()}else me=g(W,!0);return E(me,(Pe,ke)=>{D(me,Pe,he(ke))},Te),oe&&(oe.c=!1),me}function ue(){let W="replace",oe="add",me="remove";function Te(Ee,Ce,Oe,Be){switch(Ee.o){case 0:case 2:return ke(Ee,Ce,Oe,Be);case 1:return Pe(Ee,Ce,Oe,Be);case 3:return Ne(Ee,Ce,Oe,Be)}}function Pe(Ee,Ce,Oe,Be){let{t:Ve,r:$}=Ee,Y=Ee.e;Y.length<Ve.length&&([Ve,Y]=[Y,Ve],[Oe,Be]=[Be,Oe]);for(let Z=0;Z<Ve.length;Z++)if($[Z]&&Y[Z]!==Ve[Z]){let U=Ce.concat([Z]);Oe.push({op:W,path:U,value:et(Y[Z])}),Be.push({op:W,path:U,value:et(Ve[Z])})}for(let Z=Ve.length;Z<Y.length;Z++){let U=Ce.concat([Z]);Oe.push({op:oe,path:U,value:et(Y[Z])})}for(let Z=Y.length-1;Ve.length<=Z;--Z){let U=Ce.concat([Z]);Be.push({op:me,path:U})}}function ke(Ee,Ce,Oe,Be){let{t:Ve,e:$}=Ee;E(Ee.r,(Y,Z)=>{let U=k(Ve,Y),ae=k($,Y),Ae=Z?C(Ve,Y)?W:oe:me;if(U===ae&&Ae===W)return;let Ie=Ce.concat(Y);Oe.push(Ae===me?{op:Ae,path:Ie}:{op:Ae,path:Ie,value:ae}),Be.push(Ae===oe?{op:me,path:Ie}:Ae===me?{op:oe,path:Ie,value:et(U)}:{op:W,path:Ie,value:et(U)})})}function Ne(Ee,Ce,Oe,Be){let{t:Ve,e:$}=Ee,Y=0;Ve.forEach(Z=>{if(!$.has(Z)){let U=Ce.concat([Y]);Oe.push({op:me,path:U,value:Z}),Be.unshift({op:oe,path:U,value:Z})}Y++}),Y=0,$.forEach(Z=>{if(!Ve.has(Z)){let U=Ce.concat([Y]);Oe.push({op:oe,path:U,value:Z}),Be.unshift({op:me,path:U,value:Z})}Y++})}function Ue(Ee,Ce,Oe,Be){Oe.push({op:W,path:[],value:Ce===d?void 0:Ce}),Be.push({op:W,path:[],value:Ee})}function Re(Ee,Ce){return Ce.forEach(Oe=>{let{path:Be,op:Ve}=Oe,$=Ee;for(let ae=0;ae<Be.length-1;ae++){let Ae=_($),Ie=Be[ae];typeof Ie!="string"&&typeof Ie!="number"&&(Ie=""+Ie),(Ae===0||Ae===1)&&(Ie==="__proto__"||Ie==="constructor")&&u(16+3),typeof $=="function"&&Ie==="prototype"&&u(16+3),$=k($,Ie),typeof $!="object"&&u(16+2,Be.join("/"))}let Y=_($),Z=Me(Oe.value),U=Be[Be.length-1];switch(Ve){case W:switch(Y){case 2:return $.set(U,Z);case 3:u(16);default:return $[U]=Z}case oe:switch(Y){case 1:return U==="-"?$.push(Z):$.splice(U,0,Z);case 2:return $.set(U,Z);case 3:return $.add(Z);default:return $[U]=Z}case me:switch(Y){case 1:return $.splice(U,1);case 2:return $.delete(U);case 3:return $.delete(Oe.value);default:return delete $[U]}default:u(16+1,Ve)}}),Ee}function Me(Ee){if(!h(Ee))return Ee;if(Array.isArray(Ee))return Ee.map(Me);if(S(Ee))return new Map(Array.from(Ee.entries()).map(([Oe,Be])=>[Oe,Me(Be)]));if(I(Ee))return new Set(Array.from(Ee).map(Me));let Ce=Object.create(p(Ee));for(let Oe in Ee)Ce[Oe]=Me(Ee[Oe]);return C(Ee,c)&&(Ce[c]=Ee[c]),Ce}function et(Ee){return f(Ee)?Me(Ee):Ee}x("Patches",{A:Re,g:Te,T:Ue})}function pe(){class W extends Map{constructor(Re,Me){super(),this[l]={o:2,i:Me,n:Me?Me.n:K(),s:!1,c:!1,e:void 0,r:void 0,t:Re,p:this,l:!1,m:!1}}get size(){return T(this[l]).size}has(Re){return T(this[l]).has(Re)}set(Re,Me){let et=this[l];return Ne(et),(!T(et).has(Re)||T(et).get(Re)!==Me)&&(me(et),ce(et),et.r.set(Re,!0),et.e.set(Re,Me),et.r.set(Re,!0)),this}delete(Re){if(!this.has(Re))return!1;let Me=this[l];return Ne(Me),me(Me),ce(Me),Me.t.has(Re)?Me.r.set(Re,!1):Me.r.delete(Re),Me.e.delete(Re),!0}clear(){let Re=this[l];Ne(Re),T(Re).size&&(me(Re),ce(Re),Re.r=new Map,E(Re.t,Me=>{Re.r.set(Me,!1)}),Re.e.clear())}forEach(Re,Me){let et=this[l];T(et).forEach((Ee,Ce,Oe)=>{Re.call(Me,this.get(Ce),Ce,this)})}get(Re){let Me=this[l];Ne(Me);let et=T(Me).get(Re);if(Me.c||!h(et)||et!==Me.t.get(Re))return et;let Ee=De(et,Me);return me(Me),Me.e.set(Re,Ee),Ee}keys(){return T(this[l]).keys()}values(){let Re=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{let Me=Re.next();return Me.done?Me:{done:!1,value:this.get(Me.value)}}}}entries(){let Re=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{let Me=Re.next();if(Me.done)return Me;let et=this.get(Me.value);return{done:!1,value:[Me.value,et]}}}}[Symbol.iterator](){return this.entries()}}function oe(Ue,Re){return new W(Ue,Re)}function me(Ue){Ue.e||(Ue.r=new Map,Ue.e=new Map(Ue.t))}class Te extends Set{constructor(Re,Me){super(),this[l]={o:3,i:Me,n:Me?Me.n:K(),s:!1,c:!1,e:void 0,t:Re,p:this,a:new Map,m:!1,l:!1}}get size(){return T(this[l]).size}has(Re){let Me=this[l];return Ne(Me),Me.e?!!(Me.e.has(Re)||Me.a.has(Re)&&Me.e.has(Me.a.get(Re))):Me.t.has(Re)}add(Re){let Me=this[l];return Ne(Me),this.has(Re)||(ke(Me),ce(Me),Me.e.add(Re)),this}delete(Re){if(!this.has(Re))return!1;let Me=this[l];return Ne(Me),ke(Me),ce(Me),Me.e.delete(Re)||(Me.a.has(Re)?Me.e.delete(Me.a.get(Re)):!1)}clear(){let Re=this[l];Ne(Re),T(Re).size&&(ke(Re),ce(Re),Re.e.clear())}values(){let Re=this[l];return Ne(Re),ke(Re),Re.e.values()}entries(){let Re=this[l];return Ne(Re),ke(Re),Re.e.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(Re,Me){let et=this.values(),Ee=et.next();for(;!Ee.done;)Re.call(Me,Ee.value,Ee.value,this),Ee=et.next()}}function Pe(Ue,Re){return new Te(Ue,Re)}function ke(Ue){Ue.e||(Ue.e=new Set,Ue.t.forEach(Re=>{if(h(Re)){let Me=De(Re,Ue);Ue.a.set(Re,Me),Ue.e.add(Me)}else Ue.e.add(Re)}))}function Ne(Ue){Ue.m&&u(3,JSON.stringify(T(Ue)))}x("MapSet",{D:oe,R:Pe})}var de=new je,fe=de.produce,ye=de.produceWithPatches.bind(de),ie=de.setAutoFreeze.bind(de),Q=de.setUseStrictShallowCopy.bind(de),qe=de.setUseStrictIteration.bind(de),He=de.applyPatches.bind(de),Qe=de.createDraft.bind(de),dt=de.finishDraft.bind(de);function rt(W){return W}function be(W){return W}return Jp}var P6;function ii(){return P6||(P6=1,Yp.exports=zk()),Yp.exports}var Zp={},Xp={},Qp,T6;function Wk(){return T6||(T6=1,Qp=function(){if(typeof globalThis>"u")return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}),Qp}var Kd={exports:{}},I6;function Yk(){if(I6)return Kd.exports;I6=1;var e=65536,t=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser.
|
|
76
|
-
Use Chrome, Firefox or Internet Explorer 11`)}var n=$A().Buffer,s=Tt.crypto||Tt.msCrypto;s&&s.getRandomValues?Kd.exports=i:Kd.exports=r;function i(o,a){if(o>t)throw new RangeError("requested too many random bytes");var d=n.allocUnsafe(o);if(o>0)if(o>e)for(var c=0;c<o;c+=e)s.getRandomValues(d.slice(c,c+e));else s.getRandomValues(d);return typeof a=="function"?Mr.nextTick(function(){a(null,d)}):d}return Kd.exports}/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ey,C6;function Jk(){if(C6)return ey;C6=1;let e;return ey=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:Tt):t=>(e||(e=Promise.resolve())).then(t).catch(r=>setTimeout(()=>{throw r},0)),ey}var ty,R6;function Zk(){if(R6)return ty;R6=1;function e(r,n){for(const s in n)Object.defineProperty(r,s,{value:n[s],enumerable:!0,configurable:!0});return r}function t(r,n,s){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");s||(s={}),typeof n=="object"&&(s=n,n=""),n&&(s.code=n);try{return e(r,s)}catch{s.message=r.message,s.stack=r.stack;const o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),e(new o,s)}}return ty=t,ty}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ry,k6;function Xk(){if(k6)return ry;k6=1;const e=Kn()("simple-peer"),t=Wk(),r=Yk(),n=VA(),s=Jk(),i=Zk(),{Buffer:o}=u8,a=64*1024,d=5*1e3,c=5*1e3;function l(f){return f.replace(/a=ice-options:trickle\s\n/g,"")}function u(f){console.warn(f)}class p extends n.Duplex{constructor(h){if(h=Object.assign({allowHalfOpen:!1},h),super(h),this._id=r(4).toString("hex").slice(0,7),this._debug("new peer %o",h),this.channelName=h.initiator?h.channelName||r(20).toString("hex"):null,this.initiator=h.initiator||!1,this.channelConfig=h.channelConfig||p.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},p.config,h.config),this.offerOptions=h.offerOptions||{},this.answerOptions=h.answerOptions||{},this.sdpTransform=h.sdpTransform||(y=>y),this.streams=h.streams||(h.stream?[h.stream]:[]),this.trickle=h.trickle!==void 0?h.trickle:!0,this.allowHalfTrickle=h.allowHalfTrickle!==void 0?h.allowHalfTrickle:!1,this.iceCompleteTimeout=h.iceCompleteTimeout||d,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=h.wrtc&&typeof h.wrtc=="object"?h.wrtc:t(),!this._wrtc)throw i(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(y){this.destroy(i(y,"ERR_PC_CONSTRUCTOR"));return}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=y=>{this._onIceCandidate(y)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(y=>{this.destroy(i(y,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=y=>{this._setupData(y)},this.streams&&this.streams.forEach(y=>{this.addStream(y)}),this._pc.ontrack=y=>{this._onTrack(y)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof h=="string")try{h=JSON.parse(h)}catch{h={}}this._debug("signal()"),h.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),h.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(h.transceiverRequest.kind,h.transceiverRequest.init)),h.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(h.candidate):this._pendingCandidates.push(h.candidate)),h.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(h)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(y=>{this._addIceCandidate(y)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(y=>{this.destroy(i(y,"ERR_SET_REMOTE_DESCRIPTION"))}),!h.sdp&&!h.candidate&&!h.renegotiate&&!h.transceiverRequest&&this.destroy(i(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(h){const y=new this._wrtc.RTCIceCandidate(h);this._pc.addIceCandidate(y).catch(m=>{!y.address||y.address.endsWith(".local")?u("Ignoring unsupported ICE candidate."):this.destroy(i(m,"ERR_ADD_ICE_CANDIDATE"))})}send(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(h)}}addTransceiver(h,y){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(h,y),this._needsNegotiation()}catch(m){this.destroy(i(m,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:h,init:y}})}}addStream(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),h.getTracks().forEach(y=>{this.addTrack(y,h)})}}addTrack(h,y){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const m=this._senderMap.get(h)||new Map;let b=m.get(y);if(!b)b=this._pc.addTrack(h,y),m.set(y,b),this._senderMap.set(h,m),this._needsNegotiation();else throw b.removed?i(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):i(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(h,y,m){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const b=this._senderMap.get(h),v=b?b.get(m):null;if(!v)throw i(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");y&&this._senderMap.set(y,b),v.replaceTrack!=null?v.replaceTrack(y):this.destroy(i(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(h,y){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const m=this._senderMap.get(h),b=m?m.get(y):null;if(!b)throw i(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{b.removed=!0,this._pc.removeTrack(b)}catch(v){v.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(b):this.destroy(i(v,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),h.getTracks().forEach(y=>{this.removeTrack(y,h)})}}_needsNegotiation(){this._debug("_needsNegotiation"),!this._batchedNegotiation&&(this._batchedNegotiation=!0,s(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(h){this._destroy(h,()=>{})}_destroy(h,y){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",h&&(h.message||h)),s(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",h&&(h.message||h)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,h&&this.emit("error",h),this.emit("close"),y()}))}_setupData(h){if(!h.channel)return this.destroy(i(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=h.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=a),this.channelName=this._channel.label,this._channel.onmessage=m=>{this._onChannelMessage(m)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=m=>{const b=m.error instanceof Error?m.error:new Error(`Datachannel error: ${m.message} ${m.filename}:${m.lineno}:${m.colno}`);this.destroy(i(b,"ERR_DATA_CHANNEL"))};let y=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(y&&this._onChannelClose(),y=!0):y=!1},c)}_read(){}_write(h,y,m){if(this.destroyed)return m(i(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(h)}catch(b){return this.destroy(i(b,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>a?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=m):m(null)}else this._debug("write before connect"),this._chunk=h,this._cb=m}_onFinish(){if(this.destroyed)return;const h=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?h():this.once("connect",h)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(h=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(h.sdp=l(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const y=()=>{if(this.destroyed)return;const v=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:v.type,sdp:v.sdp})},m=()=>{this._debug("createOffer success"),!this.destroyed&&(this.trickle||this._iceComplete?y():this.once("_iceComplete",y))},b=v=>{this.destroy(i(v,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(h).then(m).catch(b)}).catch(h=>{this.destroy(i(h,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(h=>{!h.mid&&h.sender.track&&!h.requested&&(h.requested=!0,this.addTransceiver(h.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(h=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(h.sdp=l(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const y=()=>{if(this.destroyed)return;const v=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:v.type,sdp:v.sdp}),this.initiator||this._requestMissingTransceivers()},m=()=>{this.destroyed||(this.trickle||this._iceComplete?y():this.once("_iceComplete",y))},b=v=>{this.destroy(i(v,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(h).then(m).catch(b)}).catch(h=>{this.destroy(i(h,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(i(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const h=this._pc.iceConnectionState,y=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",h,y),this.emit("iceStateChange",h,y),(h==="connected"||h==="completed")&&(this._pcReady=!0,this._maybeReady()),h==="failed"&&this.destroy(i(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),h==="closed"&&this.destroy(i(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(h){const y=m=>(Object.prototype.toString.call(m.values)==="[object Array]"&&m.values.forEach(b=>{Object.assign(m,b)}),m);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(m=>{const b=[];m.forEach(v=>{b.push(y(v))}),h(null,b)},m=>h(m)):this._pc.getStats.length>0?this._pc.getStats(m=>{if(this.destroyed)return;const b=[];m.result().forEach(v=>{const E={};v.names().forEach(_=>{E[_]=v.stat(_)}),E.id=v.id,E.type=v.type,E.timestamp=v.timestamp,b.push(y(E))}),h(null,b)},m=>h(m)):h(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const h=()=>{this.destroyed||this.getStats((y,m)=>{if(this.destroyed)return;y&&(m=[]);const b={},v={},E={};let _=!1;m.forEach(k=>{(k.type==="remotecandidate"||k.type==="remote-candidate")&&(b[k.id]=k),(k.type==="localcandidate"||k.type==="local-candidate")&&(v[k.id]=k),(k.type==="candidatepair"||k.type==="candidate-pair")&&(E[k.id]=k)});const C=k=>{_=!0;let D=v[k.localCandidateId];D&&(D.ip||D.address)?(this.localAddress=D.ip||D.address,this.localPort=Number(D.port)):D&&D.ipAddress?(this.localAddress=D.ipAddress,this.localPort=Number(D.portNumber)):typeof k.googLocalAddress=="string"&&(D=k.googLocalAddress.split(":"),this.localAddress=D[0],this.localPort=Number(D[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let w=b[k.remoteCandidateId];w&&(w.ip||w.address)?(this.remoteAddress=w.ip||w.address,this.remotePort=Number(w.port)):w&&w.ipAddress?(this.remoteAddress=w.ipAddress,this.remotePort=Number(w.portNumber)):typeof k.googRemoteAddress=="string"&&(w=k.googRemoteAddress.split(":"),this.remoteAddress=w[0],this.remotePort=Number(w[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(m.forEach(k=>{k.type==="transport"&&k.selectedCandidatePairId&&C(E[k.selectedCandidatePairId]),(k.type==="googCandidatePair"&&k.googActiveConnection==="true"||(k.type==="candidatepair"||k.type==="candidate-pair")&&k.selected)&&C(k)}),!_&&(!Object.keys(E).length||Object.keys(v).length)){setTimeout(h,100);return}else this._connecting=!1,this._connected=!0;if(this._chunk){try{this.send(this._chunk)}catch(D){return this.destroy(i(D,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const k=this._cb;this._cb=null,k(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};h()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>a||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(h=>{this._pc.removeTrack(h),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(h){this.destroyed||(h.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:h.candidate.candidate,sdpMLineIndex:h.candidate.sdpMLineIndex,sdpMid:h.candidate.sdpMid}}):!h.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),h.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(h){if(this.destroyed)return;let y=h.data;y instanceof ArrayBuffer&&(y=o.from(y)),this.push(y)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const h=this._cb;this._cb=null,h(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(h){this.destroyed||h.streams.forEach(y=>{this._debug("on track"),this.emit("track",h.track,y),this._remoteTracks.push({track:h.track,stream:y}),!this._remoteStreams.some(m=>m.id===y.id)&&(this._remoteStreams.push(y),s(()=>{this._debug("on stream"),this.emit("stream",y)}))})}_debug(){const h=[].slice.call(arguments);h[0]="["+this._id+"] "+h[0],e.apply(null,h)}}return p.WEBRTC_SUPPORT=!!t(),p.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},p.channelConfig={},ry=p,ry}var qd={},ny={},Pc={},Pr={},iy={},Tc={},jd={},M6;function x9(){if(M6)return jd;M6=1,Object.defineProperty(jd,"__esModule",{value:!0}),jd.default=r;let e;const t=new Uint8Array(16);function r(){if(!e&&(e=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!e))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(t)}return jd}var ja={},Ic={},Cc={},O6;function Qk(){if(O6)return Cc;O6=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.default=void 0;var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return Cc.default=e,Cc}var N6;function qh(){if(N6)return Ic;N6=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.default=void 0;var e=t(Qk());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){return typeof s=="string"&&e.default.test(s)}var n=r;return Ic.default=n,Ic}var D6;function jh(){if(D6)return ja;D6=1,Object.defineProperty(ja,"__esModule",{value:!0}),ja.default=void 0,ja.unsafeStringify=n;var e=t(qh());function t(o){return o&&o.__esModule?o:{default:o}}const r=[];for(let o=0;o<256;++o)r.push((o+256).toString(16).slice(1));function n(o,a=0){return r[o[a+0]]+r[o[a+1]]+r[o[a+2]]+r[o[a+3]]+"-"+r[o[a+4]]+r[o[a+5]]+"-"+r[o[a+6]]+r[o[a+7]]+"-"+r[o[a+8]]+r[o[a+9]]+"-"+r[o[a+10]]+r[o[a+11]]+r[o[a+12]]+r[o[a+13]]+r[o[a+14]]+r[o[a+15]]}function s(o,a=0){const d=n(o,a);if(!(0,e.default)(d))throw TypeError("Stringified UUID is invalid");return d}var i=s;return ja.default=i,ja}var x6;function eM(){if(x6)return Tc;x6=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.default=void 0;var e=r(x9()),t=jh();function r(c){return c&&c.__esModule?c:{default:c}}let n,s,i=0,o=0;function a(c,l,u){let p=l&&u||0;const f=l||new Array(16);c=c||{};let h=c.node||n,y=c.clockseq!==void 0?c.clockseq:s;if(h==null||y==null){const C=c.random||(c.rng||e.default)();h==null&&(h=n=[C[0]|1,C[1],C[2],C[3],C[4],C[5]]),y==null&&(y=s=(C[6]<<8|C[7])&16383)}let m=c.msecs!==void 0?c.msecs:Date.now(),b=c.nsecs!==void 0?c.nsecs:o+1;const v=m-i+(b-o)/1e4;if(v<0&&c.clockseq===void 0&&(y=y+1&16383),(v<0||m>i)&&c.nsecs===void 0&&(b=0),b>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=m,o=b,s=y,m+=122192928e5;const E=((m&268435455)*1e4+b)%4294967296;f[p++]=E>>>24&255,f[p++]=E>>>16&255,f[p++]=E>>>8&255,f[p++]=E&255;const _=m/4294967296*1e4&268435455;f[p++]=_>>>8&255,f[p++]=_&255,f[p++]=_>>>24&15|16,f[p++]=_>>>16&255,f[p++]=y>>>8|128,f[p++]=y&255;for(let C=0;C<6;++C)f[p+C]=h[C];return l||(0,t.unsafeStringify)(f)}var d=a;return Tc.default=d,Tc}var Rc={},hs={},kc={},U6;function U9(){if(U6)return kc;U6=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.default=void 0;var e=t(qh());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){if(!(0,e.default)(s))throw TypeError("Invalid UUID");let i;const o=new Uint8Array(16);return o[0]=(i=parseInt(s.slice(0,8),16))>>>24,o[1]=i>>>16&255,o[2]=i>>>8&255,o[3]=i&255,o[4]=(i=parseInt(s.slice(9,13),16))>>>8,o[5]=i&255,o[6]=(i=parseInt(s.slice(14,18),16))>>>8,o[7]=i&255,o[8]=(i=parseInt(s.slice(19,23),16))>>>8,o[9]=i&255,o[10]=(i=parseInt(s.slice(24,36),16))/1099511627776&255,o[11]=i/4294967296&255,o[12]=i>>>24&255,o[13]=i>>>16&255,o[14]=i>>>8&255,o[15]=i&255,o}var n=r;return kc.default=n,kc}var B6;function B9(){if(B6)return hs;B6=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.URL=hs.DNS=void 0,hs.default=o;var e=jh(),t=r(U9());function r(a){return a&&a.__esModule?a:{default:a}}function n(a){a=unescape(encodeURIComponent(a));const d=[];for(let c=0;c<a.length;++c)d.push(a.charCodeAt(c));return d}const s="6ba7b810-9dad-11d1-80b4-00c04fd430c8";hs.DNS=s;const i="6ba7b811-9dad-11d1-80b4-00c04fd430c8";hs.URL=i;function o(a,d,c){function l(u,p,f,h){var y;if(typeof u=="string"&&(u=n(u)),typeof p=="string"&&(p=(0,t.default)(p)),((y=p)===null||y===void 0?void 0:y.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+u.length);if(m.set(p),m.set(u,p.length),m=c(m),m[6]=m[6]&15|d,m[8]=m[8]&63|128,f){h=h||0;for(let b=0;b<16;++b)f[h+b]=m[b];return f}return(0,e.unsafeStringify)(m)}try{l.name=a}catch{}return l.DNS=s,l.URL=i,l}return hs}var Mc={},L6;function tM(){if(L6)return Mc;L6=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.default=void 0;function e(f){if(typeof f=="string"){const h=unescape(encodeURIComponent(f));f=new Uint8Array(h.length);for(let y=0;y<h.length;++y)f[y]=h.charCodeAt(y)}return t(n(s(f),f.length*8))}function t(f){const h=[],y=f.length*32,m="0123456789abcdef";for(let b=0;b<y;b+=8){const v=f[b>>5]>>>b%32&255,E=parseInt(m.charAt(v>>>4&15)+m.charAt(v&15),16);h.push(E)}return h}function r(f){return(f+64>>>9<<4)+14+1}function n(f,h){f[h>>5]|=128<<h%32,f[r(h)-1]=h;let y=1732584193,m=-271733879,b=-1732584194,v=271733878;for(let E=0;E<f.length;E+=16){const _=y,C=m,k=b,D=v;y=d(y,m,b,v,f[E],7,-680876936),v=d(v,y,m,b,f[E+1],12,-389564586),b=d(b,v,y,m,f[E+2],17,606105819),m=d(m,b,v,y,f[E+3],22,-1044525330),y=d(y,m,b,v,f[E+4],7,-176418897),v=d(v,y,m,b,f[E+5],12,1200080426),b=d(b,v,y,m,f[E+6],17,-1473231341),m=d(m,b,v,y,f[E+7],22,-45705983),y=d(y,m,b,v,f[E+8],7,1770035416),v=d(v,y,m,b,f[E+9],12,-1958414417),b=d(b,v,y,m,f[E+10],17,-42063),m=d(m,b,v,y,f[E+11],22,-1990404162),y=d(y,m,b,v,f[E+12],7,1804603682),v=d(v,y,m,b,f[E+13],12,-40341101),b=d(b,v,y,m,f[E+14],17,-1502002290),m=d(m,b,v,y,f[E+15],22,1236535329),y=c(y,m,b,v,f[E+1],5,-165796510),v=c(v,y,m,b,f[E+6],9,-1069501632),b=c(b,v,y,m,f[E+11],14,643717713),m=c(m,b,v,y,f[E],20,-373897302),y=c(y,m,b,v,f[E+5],5,-701558691),v=c(v,y,m,b,f[E+10],9,38016083),b=c(b,v,y,m,f[E+15],14,-660478335),m=c(m,b,v,y,f[E+4],20,-405537848),y=c(y,m,b,v,f[E+9],5,568446438),v=c(v,y,m,b,f[E+14],9,-1019803690),b=c(b,v,y,m,f[E+3],14,-187363961),m=c(m,b,v,y,f[E+8],20,1163531501),y=c(y,m,b,v,f[E+13],5,-1444681467),v=c(v,y,m,b,f[E+2],9,-51403784),b=c(b,v,y,m,f[E+7],14,1735328473),m=c(m,b,v,y,f[E+12],20,-1926607734),y=l(y,m,b,v,f[E+5],4,-378558),v=l(v,y,m,b,f[E+8],11,-2022574463),b=l(b,v,y,m,f[E+11],16,1839030562),m=l(m,b,v,y,f[E+14],23,-35309556),y=l(y,m,b,v,f[E+1],4,-1530992060),v=l(v,y,m,b,f[E+4],11,1272893353),b=l(b,v,y,m,f[E+7],16,-155497632),m=l(m,b,v,y,f[E+10],23,-1094730640),y=l(y,m,b,v,f[E+13],4,681279174),v=l(v,y,m,b,f[E],11,-358537222),b=l(b,v,y,m,f[E+3],16,-722521979),m=l(m,b,v,y,f[E+6],23,76029189),y=l(y,m,b,v,f[E+9],4,-640364487),v=l(v,y,m,b,f[E+12],11,-421815835),b=l(b,v,y,m,f[E+15],16,530742520),m=l(m,b,v,y,f[E+2],23,-995338651),y=u(y,m,b,v,f[E],6,-198630844),v=u(v,y,m,b,f[E+7],10,1126891415),b=u(b,v,y,m,f[E+14],15,-1416354905),m=u(m,b,v,y,f[E+5],21,-57434055),y=u(y,m,b,v,f[E+12],6,1700485571),v=u(v,y,m,b,f[E+3],10,-1894986606),b=u(b,v,y,m,f[E+10],15,-1051523),m=u(m,b,v,y,f[E+1],21,-2054922799),y=u(y,m,b,v,f[E+8],6,1873313359),v=u(v,y,m,b,f[E+15],10,-30611744),b=u(b,v,y,m,f[E+6],15,-1560198380),m=u(m,b,v,y,f[E+13],21,1309151649),y=u(y,m,b,v,f[E+4],6,-145523070),v=u(v,y,m,b,f[E+11],10,-1120210379),b=u(b,v,y,m,f[E+2],15,718787259),m=u(m,b,v,y,f[E+9],21,-343485551),y=i(y,_),m=i(m,C),b=i(b,k),v=i(v,D)}return[y,m,b,v]}function s(f){if(f.length===0)return[];const h=f.length*8,y=new Uint32Array(r(h));for(let m=0;m<h;m+=8)y[m>>5]|=(f[m/8]&255)<<m%32;return y}function i(f,h){const y=(f&65535)+(h&65535);return(f>>16)+(h>>16)+(y>>16)<<16|y&65535}function o(f,h){return f<<h|f>>>32-h}function a(f,h,y,m,b,v){return i(o(i(i(h,f),i(m,v)),b),y)}function d(f,h,y,m,b,v,E){return a(h&y|~h&m,f,h,b,v,E)}function c(f,h,y,m,b,v,E){return a(h&m|y&~m,f,h,b,v,E)}function l(f,h,y,m,b,v,E){return a(h^y^m,f,h,b,v,E)}function u(f,h,y,m,b,v,E){return a(y^(h|~m),f,h,b,v,E)}var p=e;return Mc.default=p,Mc}var K6;function rM(){if(K6)return Rc;K6=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.default=void 0;var e=r(B9()),t=r(tM());function r(i){return i&&i.__esModule?i:{default:i}}var s=(0,e.default)("v3",48,t.default);return Rc.default=s,Rc}var Oc={},Nc={},q6;function nM(){if(q6)return Nc;q6=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.default=void 0;var t={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};return Nc.default=t,Nc}var j6;function iM(){if(j6)return Oc;j6=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.default=void 0;var e=n(nM()),t=n(x9()),r=jh();function n(o){return o&&o.__esModule?o:{default:o}}function s(o,a,d){if(e.default.randomUUID&&!a&&!o)return e.default.randomUUID();o=o||{};const c=o.random||(o.rng||t.default)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,a){d=d||0;for(let l=0;l<16;++l)a[d+l]=c[l];return a}return(0,r.unsafeStringify)(c)}var i=s;return Oc.default=i,Oc}var Dc={},xc={},$6;function sM(){if($6)return xc;$6=1,Object.defineProperty(xc,"__esModule",{value:!0}),xc.default=void 0;function e(s,i,o,a){switch(s){case 0:return i&o^~i&a;case 1:return i^o^a;case 2:return i&o^i&a^o&a;case 3:return i^o^a}}function t(s,i){return s<<i|s>>>32-i}function r(s){const i=[1518500249,1859775393,2400959708,3395469782],o=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof s=="string"){const l=unescape(encodeURIComponent(s));s=[];for(let u=0;u<l.length;++u)s.push(l.charCodeAt(u))}else Array.isArray(s)||(s=Array.prototype.slice.call(s));s.push(128);const a=s.length/4+2,d=Math.ceil(a/16),c=new Array(d);for(let l=0;l<d;++l){const u=new Uint32Array(16);for(let p=0;p<16;++p)u[p]=s[l*64+p*4]<<24|s[l*64+p*4+1]<<16|s[l*64+p*4+2]<<8|s[l*64+p*4+3];c[l]=u}c[d-1][14]=(s.length-1)*8/Math.pow(2,32),c[d-1][14]=Math.floor(c[d-1][14]),c[d-1][15]=(s.length-1)*8&4294967295;for(let l=0;l<d;++l){const u=new Uint32Array(80);for(let b=0;b<16;++b)u[b]=c[l][b];for(let b=16;b<80;++b)u[b]=t(u[b-3]^u[b-8]^u[b-14]^u[b-16],1);let p=o[0],f=o[1],h=o[2],y=o[3],m=o[4];for(let b=0;b<80;++b){const v=Math.floor(b/20),E=t(p,5)+e(v,f,h,y)+m+i[v]+u[b]>>>0;m=y,y=h,h=t(f,30)>>>0,f=p,p=E}o[0]=o[0]+p>>>0,o[1]=o[1]+f>>>0,o[2]=o[2]+h>>>0,o[3]=o[3]+y>>>0,o[4]=o[4]+m>>>0}return[o[0]>>24&255,o[0]>>16&255,o[0]>>8&255,o[0]&255,o[1]>>24&255,o[1]>>16&255,o[1]>>8&255,o[1]&255,o[2]>>24&255,o[2]>>16&255,o[2]>>8&255,o[2]&255,o[3]>>24&255,o[3]>>16&255,o[3]>>8&255,o[3]&255,o[4]>>24&255,o[4]>>16&255,o[4]>>8&255,o[4]&255]}var n=r;return xc.default=n,xc}var V6;function aM(){if(V6)return Dc;V6=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.default=void 0;var e=r(B9()),t=r(sM());function r(i){return i&&i.__esModule?i:{default:i}}var s=(0,e.default)("v5",80,t.default);return Dc.default=s,Dc}var Uc={},F6;function oM(){if(F6)return Uc;F6=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.default=void 0;var e="00000000-0000-0000-0000-000000000000";return Uc.default=e,Uc}var Bc={},H6;function cM(){if(H6)return Bc;H6=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.default=void 0;var e=t(qh());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){if(!(0,e.default)(s))throw TypeError("Invalid UUID");return parseInt(s.slice(14,15),16)}var n=r;return Bc.default=n,Bc}var G6;function ag(){return G6||(G6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return o.default}});var t=l(eM()),r=l(rM()),n=l(iM()),s=l(aM()),i=l(oM()),o=l(cM()),a=l(qh()),d=l(jh()),c=l(U9());function l(u){return u&&u.__esModule?u:{default:u}}}(iy)),iy}var sy={},z6;function Ur(){return z6||(z6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VIDEO_NOTIFICATION_ACCESS_TYPE=e.DEFAULT_DOMAIN=e.SPACE_ROLES=e.SPACE_INVITE_ROLES=e.SPACE_DISCONNECT_TYPE=e.SPACE_ACCEPT_REQUEST_TYPE=e.SPACE_REQUEST_TYPE=e.VIDEO_CALL_TYPE=e.ADDITIONAL_META_TYPE=e.NOTIFICATION_TYPE=e.IDENTITY_TYPE=e.SUPPORTED_CHAINS=e.SOURCE_TYPES=e.CHAIN_ID_TO_SOURCE=void 0,e.CHAIN_ID_TO_SOURCE={1:"ETH_MAINNET",11155111:"ETH_TEST_SEPOLIA",137:"POLYGON_MAINNET",80002:"POLYGON_TEST_AMOY",56:"BSC_MAINNET",97:"BSC_TESTNET",10:"OPTIMISM_MAINNET",11155420:"OPTIMISM_TESTNET",2442:"POLYGON_ZK_EVM_TESTNET",1101:"POLYGON_ZK_EVM_MAINNET",421614:"ARBITRUM_TESTNET",42161:"ARBITRUMONE_MAINNET",122:"FUSE_MAINNET",123:"FUSE_TESTNET",80085:"BERACHAIN_TESTNET",59141:"LINEA_TESTNET",59144:"LINEA_MAINNET",7560:"CYBER_CONNECT_MAINNET",111557560:"CYBER_CONNECT_TESTNET",84532:"BASE_TESTNET",8453:"BASE_MAINNET"},e.SOURCE_TYPES={ETH_MAINNET:"ETH_MAINNET",ETH_TEST_SEPOLIA:"ETH_TEST_SEPOLIA",POLYGON_MAINNET:"POLYGON_MAINNET",POLYGON_TEST_AMOY:"POLYGON_TEST_AMOY",BSC_MAINNET:"BSC_MAINNET",BSC_TESTNET:"BSC_TESTNET",OPTIMISM_MAINNET:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON_ZK_EVM_TESTNET:"POLYGON_ZK_EVM_TESTNET",POLYGON_ZK_EVM_MAINNET:"POLYGON_ZK_EVM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",ARBITRUMONE_MAINNET:"ARBITRUMONE_MAINNET",FUSE_TESTNET:"FUSE_TESTNET",FUSE_MAINNET:"FUSE_MAINNET",BERACHAIN_TESTNET:"BERACHAIN_TESTNET",LINEA_TESTNET:"LINEA_TESTNET",LINEA_MAINNET:"LINEA_MAINNET",THE_GRAPH:"THE_GRAPH",PUSH_VIDEO:"PUSH_VIDEO",SIMULATE:"SIMULATE",CYBER_CONNECT_TESTNET:"CYBER_CONNECT_TESTNET",CYBER_CONNECT_MAINNET:"CYBER_CONNECT_MAINNET",BASE_TESTNET:"BASE_TESTNET",BASE_MAINNET:"BASE_MAINNET"},e.SUPPORTED_CHAINS=[1,11155111,42,137,80002,56,97,10,11155420,2442,1101,421614,42161,122,123,80085,111557560,7560,59141,59144,84532,8453],function(t){t[t.MINIMAL=0]="MINIMAL",t[t.IPFS=1]="IPFS",t[t.DIRECT_PAYLOAD=2]="DIRECT_PAYLOAD",t[t.SUBGRAPH=3]="SUBGRAPH"}(e.IDENTITY_TYPE||(e.IDENTITY_TYPE={})),function(t){t[t.BROADCAST=1]="BROADCAST",t[t.TARGETTED=3]="TARGETTED",t[t.SUBSET=4]="SUBSET"}(e.NOTIFICATION_TYPE||(e.NOTIFICATION_TYPE={})),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.PUSH_VIDEO=1]="PUSH_VIDEO",t[t.PUSH_SPACE=2]="PUSH_SPACE"}(e.ADDITIONAL_META_TYPE||(e.ADDITIONAL_META_TYPE={})),function(t){t[t.PUSH_VIDEO=1]="PUSH_VIDEO",t[t.PUSH_SPACE=2]="PUSH_SPACE"}(e.VIDEO_CALL_TYPE||(e.VIDEO_CALL_TYPE={})),function(t){t[t.JOIN_SPEAKER=0]="JOIN_SPEAKER",t[t.ESTABLISH_MESH=1]="ESTABLISH_MESH",t[t.INVITE_TO_PROMOTE=2]="INVITE_TO_PROMOTE",t[t.REQUEST_TO_PROMOTE=3]="REQUEST_TO_PROMOTE"}(e.SPACE_REQUEST_TYPE||(e.SPACE_REQUEST_TYPE={})),function(t){t[t.ACCEPT_JOIN_SPEAKER=0]="ACCEPT_JOIN_SPEAKER",t[t.ACCEPT_INVITE=1]="ACCEPT_INVITE",t[t.ACCEPT_PROMOTION=2]="ACCEPT_PROMOTION"}(e.SPACE_ACCEPT_REQUEST_TYPE||(e.SPACE_ACCEPT_REQUEST_TYPE={})),function(t){t[t.STOP=0]="STOP",t[t.LEAVE=1]="LEAVE"}(e.SPACE_DISCONNECT_TYPE||(e.SPACE_DISCONNECT_TYPE={})),function(t){t[t.CO_HOST=0]="CO_HOST",t[t.SPEAKER=1]="SPEAKER"}(e.SPACE_INVITE_ROLES||(e.SPACE_INVITE_ROLES={})),function(t){t[t.HOST=0]="HOST",t[t.CO_HOST=1]="CO_HOST",t[t.SPEAKER=2]="SPEAKER",t[t.LISTENER=3]="LISTENER"}(e.SPACE_ROLES||(e.SPACE_ROLES={})),e.DEFAULT_DOMAIN="push.org",function(t){t.PUSH_CHAT="PUSH_CHAT"}(e.VIDEO_NOTIFICATION_ACCESS_TYPE||(e.VIDEO_NOTIFICATION_ACCESS_TYPE={}))}(sy)),sy}var W6;function uM(){if(W6)return Pr;W6=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.getCAIPFormat=Pr.getSource=Pr.getPayloadIdentity=Pr.getVerificationProof=Pr.getRecipientFieldForAPIPayload=Pr.getRecipients=Pr.getPayloadForAPIInput=Pr.getUUID=void 0;const e=$e,t=ag(),r=tt(),n=Fr,s=Ur(),i=Mt();function o(){return(0,t.v4)()}Pr.getUUID=o;function a(h,y){var m,b,v,E,_,C,k,D,w,S,I,T,g,A,P,O,N,M,L,x,R;return h!=null&&h.notification&&(h!=null&&h.payload)?{notification:{title:(m=h==null?void 0:h.notification)===null||m===void 0?void 0:m.title,body:(b=h==null?void 0:h.notification)===null||b===void 0?void 0:b.body},data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({acta:((v=h==null?void 0:h.payload)===null||v===void 0?void 0:v.cta)||"",aimg:((E=h==null?void 0:h.payload)===null||E===void 0?void 0:E.img)||"",amsg:((_=h==null?void 0:h.payload)===null||_===void 0?void 0:_.body)||"",asub:((C=h==null?void 0:h.payload)===null||C===void 0?void 0:C.title)||"",type:((k=h==null?void 0:h.type)===null||k===void 0?void 0:k.toString())||""},(h==null?void 0:h.expiry)&&{etime:h==null?void 0:h.expiry}),((D=h==null?void 0:h.payload)===null||D===void 0?void 0:D.etime)&&{etime:(w=h==null?void 0:h.payload)===null||w===void 0?void 0:w.etime}),(h==null?void 0:h.hidden)&&{hidden:h==null?void 0:h.hidden}),((S=h==null?void 0:h.payload)===null||S===void 0?void 0:S.hidden)&&{hidden:(I=h==null?void 0:h.payload)===null||I===void 0?void 0:I.hidden}),((T=h==null?void 0:h.payload)===null||T===void 0?void 0:T.silent)&&{silent:(g=h==null?void 0:h.payload)===null||g===void 0?void 0:g.silent}),((A=h==null?void 0:h.payload)===null||A===void 0?void 0:A.sectype)&&{sectype:(P=h==null?void 0:h.payload)===null||P===void 0?void 0:P.sectype}),((O=h==null?void 0:h.payload)===null||O===void 0?void 0:O.metadata)&&{metadata:(N=h==null?void 0:h.payload)===null||N===void 0?void 0:N.metadata}),((M=h==null?void 0:h.payload)===null||M===void 0?void 0:M.additionalMeta)&&{additionalMeta:(L=h==null?void 0:h.payload)===null||L===void 0?void 0:L.additionalMeta}),((x=h==null?void 0:h.payload)===null||x===void 0?void 0:x.index)&&{index:(R=h==null?void 0:h.payload)===null||R===void 0?void 0:R.index}),recipients:y}:null}Pr.getPayloadForAPIInput=a;function d({env:h,notificationType:y,channel:m,recipients:b,secretType:v}){return e.__awaiter(this,void 0,void 0,function*(){let E="";if(v){let _="";if(y===s.NOTIFICATION_TYPE.TARGETTED){if(typeof b=="string")return E=yield(0,r.getCAIPAddress)(h,b,"Recipient"),_="",{[E]:_}}else if(y===s.NOTIFICATION_TYPE.SUBSET&&Array.isArray(b))return b.reduce((k,D)=>e.__awaiter(this,void 0,void 0,function*(){return E=yield(0,r.getCAIPAddress)(h,D,"Recipient"),_="",Object.assign(Object.assign({},k),{[E]:_})}),{})}else{if(y===s.NOTIFICATION_TYPE.BROADCAST)return yield(0,r.getCAIPAddress)(h,m,"Recipient");if(y===s.NOTIFICATION_TYPE.TARGETTED){if(typeof b=="string")return yield(0,r.getCAIPAddress)(h,b,"Recipient")}else if(y===s.NOTIFICATION_TYPE.SUBSET&&Array.isArray(b)&&Array.isArray(b)){const _={};return b.map(C=>e.__awaiter(this,void 0,void 0,function*(){E=yield(0,r.getCAIPAddress)(h,C,"Recipient"),_[E]=null})),_}}return b})}Pr.getRecipients=d;function c({env:h,notificationType:y,recipients:m,channel:b}){return e.__awaiter(this,void 0,void 0,function*(){return y===s.NOTIFICATION_TYPE.TARGETTED&&typeof m=="string"?yield(0,r.getCAIPAddress)(h,m,"Recipient"):yield(0,r.getCAIPAddress)(h,b,"Recipient")})}Pr.getRecipientFieldForAPIPayload=c;function l({senderType:h,signer:y,chainId:m,notificationType:b,identityType:v,verifyingContract:E,payload:_,ipfsHash:C,graph:k={},uuid:D,chatId:w,wallet:S,pgpPrivateKey:I,env:T,rules:g}){return e.__awaiter(this,void 0,void 0,function*(){let A=null,P=null;switch(v){case s.IDENTITY_TYPE.MINIMAL:{A={data:`${v}+${b}+${_.notification.title}+${_.notification.body}`};break}case s.IDENTITY_TYPE.IPFS:{A={data:`1+${C}`};break}case s.IDENTITY_TYPE.DIRECT_PAYLOAD:{A={data:`2+${JSON.stringify(_)}`};break}case s.IDENTITY_TYPE.SUBGRAPH:{A={data:`3+graph:${k==null?void 0:k.id}+${k==null?void 0:k.counter}`};break}default:throw new Error("Invalid IdentityType")}switch(h){case 0:{if(I){const O=n.SHA256(JSON.stringify(A)).toString();P=`pgpv4:${yield(0,i.sign)({message:O,signingKey:I})}`}else{const O={Data:[{name:"data",type:"string"}]},N={name:"EPNS COMM V1",chainId:m,verifyingContract:E};P=`eip712v2:${yield new r.Signer(y).signTypedData(N,O,A,"Data")}::uid::${D}`}break}case 1:{const O=n.SHA256(JSON.stringify(A)).toString();P=`pgpv2:${yield(0,i.sign)({message:O,signingKey:I})}:meta:${w}::uid::${D}`;break}default:throw new Error("Invalid SenderType")}return P})}Pr.getVerificationProof=l;function u({identityType:h,payload:y,notificationType:m,ipfsHash:b,graph:v={}}){return h===s.IDENTITY_TYPE.MINIMAL?`0+${m}+${y.notification.title}+${y.notification.body}`:h===s.IDENTITY_TYPE.IPFS?`1+${b}`:h===s.IDENTITY_TYPE.DIRECT_PAYLOAD?`2+${JSON.stringify(y)}`:h===s.IDENTITY_TYPE.SUBGRAPH?`3+graph:${v==null?void 0:v.id}+${v==null?void 0:v.counter}`:null}Pr.getPayloadIdentity=u;function p(h,y,m){return m===1?s.SOURCE_TYPES.PUSH_VIDEO:y===s.IDENTITY_TYPE.SUBGRAPH?s.SOURCE_TYPES.THE_GRAPH:s.CHAIN_ID_TO_SOURCE[h]}Pr.getSource=p;function f(h,y){return s.SUPPORTED_CHAINS.includes(h)?`eip155:${h}:${y}`:y}return Pr.getCAIPFormat=f,Pr}var Y6;function lM(){if(Y6)return Pc;Y6=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.sendNotification=void 0;const e=$e,t=uM(),r=tt(),n=Ur(),s=Je(),i=It();function o(c){var l,u;if(!(c!=null&&c.channel))throw'[Push SDK] - Error - sendNotification() - "channel" is mandatory!';if(!(0,r.isValidPushCAIP)(c.channel))throw'[Push SDK] - Error - sendNotification() - "channel" is invalid!';if(c.senderType===0&&c.signer===void 0)throw'[Push SDK] - Error - sendNotification() - "signer" is mandatory!';if(c.senderType===1&&c.pgpPrivateKey===void 0)throw'[Push SDK] - Error - sendNotification() - "pgpPrivateKey" is mandatory!';if((c==null?void 0:c.identityType)===n.IDENTITY_TYPE.DIRECT_PAYLOAD||(c==null?void 0:c.identityType)===n.IDENTITY_TYPE.MINIMAL){if(!c.notification)throw'[Push SDK] - Error - sendNotification() - "notification" mandatory for Identity Type: Direct Payload, Minimal!';if(!c.payload)throw'[Push SDK] - Error - sendNotification() - "payload" mandatory for Identity Type: Direct Payload, Minimal!'}const p=(l=c.payload)===null||l===void 0?void 0:l.additionalMeta,f=typeof((u=c.payload)===null||u===void 0?void 0:u.additionalMeta)=="object"&&(c.payload.additionalMeta.type===`${n.VIDEO_CALL_TYPE.PUSH_VIDEO}+1`||c.payload.additionalMeta.type===`${n.VIDEO_CALL_TYPE.PUSH_SPACE}+1`);if(p&&f&&!c.chatId&&!c.rules)throw new Error("[Push SDK] - Error - sendNotification() - Either chatId or rules object is required to send a additional meta notification for video or spaces")}function a(c){return e.__awaiter(this,void 0,void 0,function*(){try{const{channelFound:l,channelorAlias:u,recipient:p,type:f,env:h,senderType:y}=c||{};if(y===1||l)return!1;const m=typeof p=="string"&&(p==null?void 0:p.split(":").length)==3?p.split(":")[2]:p;return u==m&&f==n.NOTIFICATION_TYPE.TARGETTED}catch{return!0}})}function d(c){var l;return e.__awaiter(this,void 0,void 0,function*(){try{const{senderType:u=0,signer:p,type:f,identityType:h,payload:y,recipients:m,channel:b,graph:v,ipfsHash:E,env:_=s.ENV.PROD,chatId:C,rules:k,pgpPrivateKey:D,channelFound:w=!0}=c||{};o(c),y&&y.additionalMeta&&typeof y.additionalMeta=="object"&&!y.additionalMeta.domain&&(y.additionalMeta.domain=n.DEFAULT_DOMAIN);const S=yield(0,r.getCAIPAddress)(_,b,"Channel"),I=(0,r.getCAIPDetails)(S);if(!I)throw Error("Invalid Channel CAIP!");const T=(0,t.getUUID)(),g=parseInt(I.networkId,10),A=(0,r.getAPIBaseUrls)(_);let P="";if(u===0){const{EPNS_COMMUNICATOR_CONTRACT:V}=(0,r.getConfig)(_,I);P=V}const O=yield(0,t.getRecipients)({env:_,notificationType:f,channel:S,recipients:m,secretType:y==null?void 0:y.sectype}),N=(0,t.getPayloadForAPIInput)(c,O),M=yield(0,t.getVerificationProof)({senderType:u,signer:p,chainId:g,identityType:h,notificationType:f,verifyingContract:P,payload:N,graph:v,ipfsHash:E,uuid:T,chatId:(l=k==null?void 0:k.access.data.chatId)!==null&&l!==void 0?l:C,pgpPrivateKey:D}),L=(0,t.getPayloadIdentity)({identityType:h,payload:N,notificationType:f,graph:v,ipfsHash:E}),x=(yield a({channelFound:w,channelorAlias:c.channel,recipient:c.recipients,type:c.type,env:c.env,senderType:c.senderType}))?n.SOURCE_TYPES.SIMULATE:(0,t.getSource)(g,h,u),R=Object.assign({verificationProof:M,identity:L,sender:u===1&&!(0,r.isValidNFTCAIP)(S)?`${I==null?void 0:I.blockchain}:${I==null?void 0:I.address}`:S,source:x,recipient:yield(0,t.getRecipientFieldForAPIPayload)({env:_,notificationType:f,recipients:m||"",channel:S})},k||C?{rules:k??{access:{data:{chatId:C},type:n.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT}}}:{}),K=`${A}/v1/payloads/`;return yield(0,i.axiosPost)(K,R,{headers:{"Content-Type":"application/json"}})}catch(u){throw console.error("[Push SDK] - Error - sendNotification() - ",JSON.stringify(u)),u}})}return Pc.sendNotification=d,Pc}var J6;function $h(){return J6||(J6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SPACE_DISCONNECT_TYPE=e.SPACE_ACCEPT_REQUEST_TYPE=e.SPACE_REQUEST_TYPE=e.ADDITIONAL_META_TYPE=e.IDENTITY_TYPE=e.NOTIFICATION_TYPE=void 0,$e.__exportStar(lM(),e);var r=Ur();Object.defineProperty(e,"NOTIFICATION_TYPE",{enumerable:!0,get:function(){return r.NOTIFICATION_TYPE}}),Object.defineProperty(e,"IDENTITY_TYPE",{enumerable:!0,get:function(){return r.IDENTITY_TYPE}}),Object.defineProperty(e,"ADDITIONAL_META_TYPE",{enumerable:!0,get:function(){return r.ADDITIONAL_META_TYPE}}),Object.defineProperty(e,"SPACE_REQUEST_TYPE",{enumerable:!0,get:function(){return r.SPACE_REQUEST_TYPE}}),Object.defineProperty(e,"SPACE_ACCEPT_REQUEST_TYPE",{enumerable:!0,get:function(){return r.SPACE_ACCEPT_REQUEST_TYPE}}),Object.defineProperty(e,"SPACE_DISCONNECT_TYPE",{enumerable:!0,get:function(){return r.SPACE_DISCONNECT_TYPE}})}(ny)),ny}var Z6;function dM(){if(Z6)return qd;Z6=1,Object.defineProperty(qd,"__esModule",{value:!0});const e=$e,t=tt(),r=$h(),n=Je(),s=Ur(),i=({signer:o,chainId:a,pgpPrivateKey:d},{recipientAddress:c,senderAddress:l,chatId:u,rules:p,status:f,signalData:h=null,env:y=n.default.ENV.PROD,callType:m=s.VIDEO_CALL_TYPE.PUSH_VIDEO,callDetails:b})=>e.__awaiter(void 0,void 0,void 0,function*(){var v;try{const E={recipientAddress:c,senderAddress:l,chatId:(v=p==null?void 0:p.access.data.chatId)!==null&&v!==void 0?v:u,signalData:h,status:f,callDetails:b},_=(0,t.getCAIPWithChainId)(l,a),C=(0,t.getCAIPWithChainId)(c,a),k=`Video Call from ${l}`,D=s.NOTIFICATION_TYPE.TARGETTED;yield(0,r.sendNotification)({senderType:1,signer:o,pgpPrivateKey:d,chatId:u,rules:p,type:D,identityType:2,notification:{title:k,body:k},payload:{title:"VideoCall",body:"VideoCall",cta:"",img:"",additionalMeta:{type:`${m}+1`,data:JSON.stringify(E)}},recipients:C,channel:_,env:y})}catch(E){console.error("Error occured while sending notification for video call",E)}});return qd.default=i,qd}var An={},X6;function L9(){if(X6)return An;X6=1,Object.defineProperty(An,"__esModule",{value:!0}),An.endStream=An.stopAudioStream=An.restartAudioStream=An.stopVideoStream=An.restartVideoStream=void 0;const e=i=>{i.getVideoTracks().forEach(a=>a.enabled=!0)};An.restartVideoStream=e;const t=i=>{i.getVideoTracks().forEach(a=>a.enabled=!1)};An.stopVideoStream=t;const r=i=>{i.getAudioTracks().forEach(a=>a.enabled=!0)};An.restartAudioStream=r;const n=i=>{i.getAudioTracks().forEach(a=>a.enabled=!1)};An.stopAudioStream=n;const s=i=>{i.getTracks().forEach(o=>o.stop())};return An.endStream=s,An}var $d={},Q6;function fM(){if(Q6)return $d;Q6=1,Object.defineProperty($d,"__esModule",{value:!0});const e=t=>{try{return JSON.parse(t)&&!!t}catch{return!1}};return $d.default=e,$d}var Lc={},e_;function hM(){if(e_)return Lc;e_=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.getIceServerConfig=void 0;const e=$e,t=tt(),r=Je(),n=Fr,s=It(),i="turnserversecret",o=(a=r.default.ENV.PROD)=>e.__awaiter(void 0,void 0,void 0,function*(){const c=`${(0,t.getAPIBaseUrls)(a)}/v1/turnserver/iceconfig`,{data:l}=yield(0,s.axiosGet)(c),{config:u}=JSON.parse(n.AES.decrypt(l,i).toString(n.enc.Utf8));return u});return Lc.getIceServerConfig=o,Lc}var Vd={},t_;function K9(){if(t_)return Vd;t_=1,Object.defineProperty(Vd,"__esModule",{value:!0});const e=(t,r)=>t.findIndex(n=>n.address===r);return Vd.default=e,Vd}var Fd={},r_;function pM(){if(r_)return Fd;r_=1,Object.defineProperty(Fd,"__esModule",{value:!0});const e=ng(),t=pn(),r=({incomingPeers:n})=>{const s=[];return n.forEach(i=>{i.status===t.VideoCallStatus.CONNECTED&&s.push((0,e.default)(i.address))}),s};return Fd.default=r,Fd}var Hd={},n_;function yM(){if(n_)return Hd;n_=1,Object.defineProperty(Hd,"__esModule",{value:!0});const e=({localAddress:t,localConnectedAddresses:r,receivedConnectedAddresses:n})=>n.filter(s=>!r.includes(s)&&s!==t);return Hd.default=e,Hd}var Kc={},i_;function gM(){if(i_)return Kc;i_=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.validateVideoRules=void 0;const e=Ur(),t=r=>{if(r.access.type===e.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&(!r.access.data.chatId||r.access.data.chatId===""))throw new Error("Invalid rules object recieved. For access as Push Chat, chatId is required!")};return Kc.validateVideoRules=t,Kc}var s_;function q9(){return s_||(s_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Video=e.initVideoCallData=void 0;const t=$e,r=Xk(),n=ii(),s=Je(),i=dM(),o=L9(),a=fM(),d=hM(),c=pn(),l=K9(),u=pM(),p=yM(),f=Ur(),h=gM();e.initVideoCallData={meta:{chatId:"",initiator:{address:"",signal:null},broadcast:{livepeerInfo:null,hostAddress:"",coHostAddress:""}},local:{stream:null,audio:null,video:null,address:""},incoming:[{stream:null,audio:null,video:null,address:"",status:c.VideoCallStatus.UNINITIALIZED,retryCount:0}]};class y{constructor({signer:b,chainId:v,pgpPrivateKey:E,env:_=s.default.ENV.PROD,setData:C,callType:k=f.VIDEO_CALL_TYPE.PUSH_VIDEO,onReceiveStream:D=()=>t.__awaiter(this,void 0,void 0,function*(){return Promise.resolve()})}){this.peerInstances={},this.signer=b,this.chainId=v,this.pgpPrivateKey=E,this.env=_,this.callType=k,this.onReceiveStream=D,C(()=>e.initVideoCallData),this.data=e.initVideoCallData,this.setData=function(w){C(w),this.data=w(this.data)}}create(b){return t.__awaiter(this,void 0,void 0,function*(){const{audio:v=!0,video:E=!0,stream:_=null}=b||{};try{const C=_!==null?_:yield navigator.mediaDevices.getUserMedia({video:E,audio:v});this.setData(k=>(0,n.produce)(k,D=>{D.local.stream=C,D.local.video=E,D.local.audio=v}))}catch(C){console.error("error in create",C)}})}request(b){return t.__awaiter(this,void 0,void 0,function*(){const{senderAddress:v,recipientAddress:E,chatId:_,rules:C,onReceiveMessage:k,retry:D=!1,details:w}=b||{};C&&(0,h.validateVideoRules)(C);const S=Array.isArray(E)?E:[E];for(const I of S)try{this.setData(g=>(0,n.produce)(g,A=>{A.local.address=v,A.meta.chatId=_??C.access.data.chatId,A.meta.initiator.address=v;const P=(0,l.default)(g.incoming,I);P===-1?A.incoming.push({stream:null,audio:null,video:null,address:I,status:D?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,retryCount:D?1:0}):(A.incoming[P].address=I,A.incoming[P].status=D?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,A.incoming[P].retryCount+=D?1:0)}));const T=yield(0,d.getIceServerConfig)(this.env);this.peerInstances[I]=new r({initiator:!0,trickle:!1,stream:this.data.local.stream,config:{iceServers:T}}),this.peerInstances[I].on("signal",g=>{this.setData(A=>(0,n.produce)(A,P=>{P.meta.initiator.signal=g})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:v,recipientAddress:I,status:D?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,chatId:_,rules:C,signalData:g,env:this.env,callType:this.callType,callDetails:w})}),this.peerInstances[I].on("connect",()=>{this.peerInstances[I].send(`initial message from ${v}`),this.peerInstances[I].send(JSON.stringify({type:"isVideoOn",value:this.data.local.video})),this.peerInstances[I].send(JSON.stringify({type:"isAudioOn",value:this.data.local.audio}));const g=(0,u.default)({incomingPeers:this.data.incoming});this.peerInstances[I].send(JSON.stringify({type:"connectedAddresses",value:g}))}),this.peerInstances[I].on("data",g=>{var A,P,O,N,M;if((0,a.default)(g)){const L=JSON.parse(g);if(L.type==="connectedAddresses"){const x=L.value,R=(0,u.default)({incomingPeers:this.data.incoming}),K=(0,p.default)({localAddress:v,localConnectedAddresses:R,receivedConnectedAddresses:x});this.request({senderAddress:v,recipientAddress:K,chatId:_,rules:C,details:{type:f.SPACE_REQUEST_TYPE.ESTABLISH_MESH,data:{}}})}if(L.type==="isVideoOn"&&this.setData(x=>(0,n.produce)(x,R=>{const K=(0,l.default)(x.incoming,I);R.incoming[K].video=L.value})),L.type==="isAudioOn"&&this.setData(x=>(0,n.produce)(x,R=>{const K=(0,l.default)(x.incoming,I);R.incoming[K].audio=L.value})),L.type==="endCall"){if(this.callType===f.VIDEO_CALL_TYPE.PUSH_SPACE&&((A=L==null?void 0:L.details)===null||A===void 0?void 0:A.type)===f.SPACE_DISCONNECT_TYPE.LEAVE&&((P=this.peerInstances[I])===null||P===void 0||P.destroy(),this.peerInstances[I]=null,this.setData(x=>(0,n.produce)(x,R=>{const K=(0,l.default)(x.incoming,I);R.incoming.splice(K,1)}))),this.callType===f.VIDEO_CALL_TYPE.PUSH_SPACE&&((O=L==null?void 0:L.details)===null||O===void 0?void 0:O.type)===f.SPACE_DISCONNECT_TYPE.STOP){for(const x in this.peerInstances)(N=this.peerInstances[x])===null||N===void 0||N.destroy(),this.peerInstances[x]=null;this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}this.callType===f.VIDEO_CALL_TYPE.PUSH_VIDEO&&((M=this.peerInstances[I])===null||M===void 0||M.destroy(),this.peerInstances[I]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData))}}else k&&k(g)}),this.peerInstances[I].on("stream",g=>{const A=(0,l.default)(this.data.incoming,I);this.onReceiveStream(g,I,this.data.incoming[A].audio),this.setData(P=>(0,n.produce)(P,O=>{O.incoming[A].stream=g}))})}catch(T){console.error("error in request",T)}})}acceptRequest(b){return t.__awaiter(this,void 0,void 0,function*(){const{signalData:v,senderAddress:E,recipientAddress:_,chatId:C,rules:k,onReceiveMessage:D,retry:w=!1,details:S}=b||{};k&&(0,h.validateVideoRules)(k);try{if(this.peerInstances[_])return Promise.resolve();const I=yield(0,d.getIceServerConfig)(this.env);this.peerInstances[_]=new r({initiator:!1,trickle:!1,stream:this.data.local.stream,config:{iceServers:I}}),this.setData(T=>(0,n.produce)(T,g=>{g.local.address=E,g.meta.chatId=C??k.access.data.chatId,g.meta.initiator.address=E;const A=(0,l.default)(T.incoming,_);A===-1?g.incoming.push({stream:null,audio:null,video:null,address:_,status:w?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,retryCount:w?1:0}):(g.incoming[A].address=_,g.incoming[A].status=w?c.VideoCallStatus.RETRY_RECEIVED:c.VideoCallStatus.RECEIVED,g.incoming[A].retryCount+=w?1:0)})),this.peerInstances[_].on("error",T=>{this.data.incoming[0].retryCount>=5&&this.disconnect({peerAddress:_}),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:E,recipientAddress:_,status:c.VideoCallStatus.RETRY_INITIALIZED,chatId:C,rules:k,signalData:null,callType:this.callType,env:this.env})}),this.peerInstances[_].signal(v),this.peerInstances[_].on("signal",T=>{this.setData(g=>(0,n.produce)(g,A=>{A.meta.initiator.signal=T})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:E,recipientAddress:_,status:w?c.VideoCallStatus.RETRY_RECEIVED:c.VideoCallStatus.RECEIVED,chatId:C,rules:k,signalData:T,env:this.env,callType:this.callType,callDetails:S})}),this.peerInstances[_].on("connect",()=>{this.peerInstances[_].send(JSON.stringify({type:"isVideoOn",value:this.data.local.video})),this.peerInstances[_].send(JSON.stringify({type:"isAudioOn",value:this.data.local.audio}));const T=(0,u.default)({incomingPeers:this.data.incoming});this.peerInstances[_].send(JSON.stringify({type:"connectedAddresses",value:T})),this.setData(g=>(0,n.produce)(g,A=>{const P=(0,l.default)(g.incoming,_);A.incoming[P].status=c.VideoCallStatus.CONNECTED}))}),this.peerInstances[_].on("data",T=>{var g,A,P,O,N;if((0,a.default)(T)){const M=JSON.parse(T);if(M.type==="connectedAddresses"){const L=M.value,x=(0,u.default)({incomingPeers:this.data.incoming}),R=(0,p.default)({localAddress:E,localConnectedAddresses:x,receivedConnectedAddresses:L});this.request({senderAddress:E,recipientAddress:R,chatId:C,rules:k,details:{type:f.SPACE_REQUEST_TYPE.ESTABLISH_MESH,data:{}}})}if(M.type==="isVideoOn"&&this.setData(L=>(0,n.produce)(L,x=>{const R=(0,l.default)(L.incoming,_);x.incoming[R].video=M.value})),M.type==="isAudioOn"&&this.setData(L=>(0,n.produce)(L,x=>{const R=(0,l.default)(L.incoming,_);x.incoming[R].audio=M.value})),M.type==="endCall"){if(this.callType===f.VIDEO_CALL_TYPE.PUSH_SPACE&&((g=M==null?void 0:M.details)===null||g===void 0?void 0:g.type)===f.SPACE_DISCONNECT_TYPE.LEAVE&&((A=this.peerInstances[_])===null||A===void 0||A.destroy(),this.peerInstances[_]=null,this.setData(L=>(0,n.produce)(L,x=>{const R=(0,l.default)(L.incoming,_);x.incoming.splice(R,1)}))),this.callType===f.VIDEO_CALL_TYPE.PUSH_SPACE&&((P=M==null?void 0:M.details)===null||P===void 0?void 0:P.type)===f.SPACE_DISCONNECT_TYPE.STOP){for(const L in this.peerInstances)(O=this.peerInstances[L])===null||O===void 0||O.destroy(),this.peerInstances[L]=null;this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}this.callType===f.VIDEO_CALL_TYPE.PUSH_VIDEO&&((N=this.peerInstances[_])===null||N===void 0||N.destroy(),this.peerInstances[_]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData))}}else D&&D(T)}),this.peerInstances[_].on("stream",T=>{const g=(0,l.default)(this.data.incoming,_);this.onReceiveStream(T,_,this.data.incoming[g].audio),this.setData(A=>(0,n.produce)(A,P=>{P.incoming[g].stream=T}))})}catch(I){console.error("error in accept request",I)}})}connect(b){var v;const{peerAddress:E,signalData:_}=b||{};try{E||console.warn("disconnect requires a peer address"),this.peerInstances[E||this.data.incoming[0].address].on("error",C=>{const k=E?(0,l.default)(this.data.incoming,E):0;this.data.incoming[k].retryCount>=5&&this.disconnect({peerAddress:E||this.data.incoming[0].address}),this.request({senderAddress:this.data.local.address,recipientAddress:this.data.incoming[k].address,chatId:this.data.meta.chatId,retry:!0})}),(v=this.peerInstances[E||this.data.incoming[0].address])===null||v===void 0||v.signal(_),this.setData(C=>(0,n.produce)(C,k=>{const D=E?(0,l.default)(C.incoming,E):0;k.incoming[D].status=c.VideoCallStatus.CONNECTED})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:this.data.local.address,recipientAddress:E||this.data.incoming[0].address,status:c.VideoCallStatus.CONNECTED,rules:{access:{type:f.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:this.data.meta.chatId}}},signalData:_,env:this.env})}catch(C){console.error("error in connect",C)}}disconnect(b){var v,E,_;const{peerAddress:C,details:k}=b||{};try{b!=null&&b.peerAddress||console.warn("disconnect requires a peer address");const D=C?(0,l.default)(this.data.incoming,C):0,w=this.data.incoming[D].status===c.VideoCallStatus.CONNECTED;w&&((v=this.peerInstances[C||this.data.incoming[0].address])===null||v===void 0||v.send(JSON.stringify({type:"endCall",value:!0,details:k})),(E=this.peerInstances[C||this.data.incoming[0].address])===null||E===void 0||E.destroy()),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:this.data.local.address,recipientAddress:this.data.incoming[D].address,status:w?c.VideoCallStatus.ENDED:c.VideoCallStatus.DISCONNECTED,chatId:this.data.meta.chatId,signalData:null,env:this.env,callType:this.callType,callDetails:k}),(_=this.peerInstances[C||this.data.incoming[0].address])===null||_===void 0||_.destroy(),this.peerInstances[C||this.data.incoming[0].address]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}catch(D){console.error("error in disconnect",D)}}enableVideo(b){var v;const{state:E}=b||{};if(this.data.local.video!==E){for(const _ of this.data.incoming)_.status===c.VideoCallStatus.CONNECTED&&((v=this.peerInstances[_.address])===null||v===void 0||v.send(JSON.stringify({type:"isVideoOn",value:E})));this.data.local.stream&&(E?(0,o.restartVideoStream)(this.data.local.stream):(0,o.stopVideoStream)(this.data.local.stream),this.setData(_=>(0,n.produce)(_,C=>{C.local.video=E})))}}enableAudio(b){const{state:v}=b||{};if(this.data.local.audio!==v){for(const E of this.data.incoming)if(E.status===c.VideoCallStatus.CONNECTED&&this.peerInstances[E.address])try{this.peerInstances[E.address].send(JSON.stringify({type:"isAudioOn",value:v}))}catch(_){console.error("Error sending data:",_)}this.data.local.stream&&(v?(0,o.restartAudioStream)(this.data.local.stream):(0,o.stopAudioStream)(this.data.local.stream),this.setData(E=>(0,n.produce)(E,_=>{_.local.audio=v})))}}isInitiator(){return this.data.meta.initiator.address===""||this.data.local.address===""?!1:this.data.meta.initiator.address===this.data.local.address}}e.Video=y}(Xp)),Xp}var a_;function og(){return a_||(a_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),$e.__exportStar(q9(),e)}(Zp)),Zp}var qc={},o_;function mM(){if(o_)return qc;o_=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.update=void 0;const e=$e,t=pn(),r=Mt(),n=ed(),s=Fs();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{spaceName:a,spaceImage:d,spaceDescription:c,scheduleAt:l,scheduleEnd:u,meta:p}=o||{};try{const f=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env}),h=(0,r.getSpacesMembersList)(f.members,f.pendingMembers),y=(0,r.getSpaceAdminsList)(f.members,f.pendingMembers);if(f.status===t.ChatStatus.ACTIVE&&l)throw new Error("Unable change the start date/time of an active space");if(f.status===t.ChatStatus.ENDED&&u)throw new Error("Unable change the end date/time of an ended space");const m=yield(0,n.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:a||f.spaceName,groupImage:d||f.spaceImage,groupDescription:c||f.spaceDescription,members:h,admins:y,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:l||f.scheduleAt,scheduleEnd:u||f.scheduleEnd,meta:p||f.meta});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},(0,r.groupDtoToSpaceDto)(m)),{liveSpaceData:this.spaceSpecificData.liveSpaceData}))}catch(f){throw console.error(`[Push SDK] - API - Error - API ${i.name} -: `,f),Error(`[Push SDK] - API - Error - API ${i.name} -: ${f}`)}})}return qc.update=i,qc}var jc={},Gd={},c_;function To(){if(c_)return Gd;c_=1,Object.defineProperty(Gd,"__esModule",{value:!0});const e=$e,t=ri(),r=Je(),n=({liveSpaceData:s,action:i,spaceId:o,pgpPrivateKey:a,signer:d,env:c})=>e.__awaiter(void 0,void 0,void 0,function*(){yield(0,t.send)({receiverAddress:o,pgpPrivateKey:a,env:c,signer:d,messageType:r.MessageType.META,messageObj:{content:i,info:{affected:[],arbitrary:s}}})});return Gd.default=n,Gd}var u_;function bM(){if(u_)return jc;u_=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.start=void 0;const e=$e,t=pn(),r=Mt(),n=Fs(),s=ed(),i=ii(),o=tt(),a=xa(),d=To();function c(){return e.__awaiter(this,void 0,void 0,function*(){try{!this.data.local.stream&&(yield this.create({audio:!0,video:!1}));const l=yield(0,n.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(l.status!==t.ChatStatus.PENDING)throw new Error("Unable to start the space as it is not in the pending state");if(this.data.local.address!==(0,o.pCAIP10ToWallet)(l.spaceCreator))throw new Error("Only host is allowed to start a space");const u=(0,r.getSpacesMembersList)(l.members,l.pendingMembers),p=(0,r.getSpaceAdminsList)(l.members,l.pendingMembers),f=yield(0,s.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:l.spaceName,groupImage:l.spaceImage,groupDescription:l.spaceDescription,members:u,admins:p,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:l.scheduleAt,scheduleEnd:l.scheduleEnd,status:t.ChatStatus.ACTIVE}),h={host:{address:this.data.local.address,audio:this.data.local.audio,emojiReactions:null},coHosts:[],speakers:[],listeners:[]};yield(0,d.default)({liveSpaceData:h,action:a.CHAT.META.SPACE.CREATE,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,env:this.env}),this.setSpaceData(y=>(0,i.produce)(y,m=>{m=Object.assign(Object.assign({},(0,r.groupDtoToSpaceDto)(f)),{liveSpaceData:h,connectionData:m.connectionData}),m.connectionData.meta.broadcast={livepeerInfo:null,hostAddress:this.data.local.address}}))}catch(l){throw console.error(`[Push SDK] - API - Error - API ${c.name} -: `,l),Error(`[Push SDK] - API - Error - API ${c.name} -: ${l}`)}})}return jc.start=c,jc}var $c={},l_;function vM(){if(l_)return $c;l_=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.inviteToPromote=void 0;const e=$e,t=ii(),r=Ur();function n(s){return e.__awaiter(this,void 0,void 0,function*(){const{inviteeAddress:i,role:o}=s||{};this.setSpaceSpecificData(a=>(0,t.produce)(a,d=>{d.inviteeDetails&&(d.inviteeDetails[i]=o)})),this.request({senderAddress:this.data.local.address,recipientAddress:i,chatId:this.spaceSpecificData.spaceId,details:{type:r.SPACE_REQUEST_TYPE.INVITE_TO_PROMOTE,data:{role:o}}})})}return $c.inviteToPromote=n,$c}var Vc={},d_;function _M(){if(d_)return Vc;d_=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.acceptPromotionInvite=void 0;const e=$e,t=Ur();function r(n){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:s,invitorAddress:i,spaceId:o}=n||{};this.acceptRequest({signalData:s,senderAddress:this.data.local.address,recipientAddress:i,chatId:o,details:{type:t.SPACE_ACCEPT_REQUEST_TYPE.ACCEPT_INVITE,data:{}}})})}return Vc.acceptPromotionInvite=r,Vc}var Fc={},f_;function wM(){if(f_)return Fc;f_=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.connectInvitee=void 0;const e=$e,t=ii(),r=sg();function n(s){var i;return e.__awaiter(this,void 0,void 0,function*(){const{signalData:o,inviteeAddress:a}=s||{};if(!(!((i=this.spaceSpecificData)===null||i===void 0)&&i.inviteeDetails)||!Object.keys(this.spaceSpecificData.inviteeDetails).includes(a))return Promise.resolve();this.spaceSpecificData.inviteeDetails[a],this.setSpaceSpecificData(d=>(0,t.produce)(d,c=>{c.inviteeDetails&&delete c.inviteeDetails[a]})),yield(0,r.addSpeakers)({spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,speakers:[a]}),this.connect({signalData:o,peerAddress:a})})}return Fc.connectInvitee=n,Fc}var Hc={},h_;function EM(){if(h_)return Hc;h_=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.rejectPromotionInvite=void 0;const e=$e;function t(r){return e.__awaiter(this,void 0,void 0,function*(){const{invitorAddress:n}=r||{};this.disconnect({peerAddress:n})})}return Hc.rejectPromotionInvite=t,Hc}var Gc={},p_;function AM(){if(p_)return Gc;p_=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.requestToBePromoted=void 0;const e=$e,t=tt(),r=Ur();function n(s){return e.__awaiter(this,void 0,void 0,function*(){const{role:i,promotorAddress:o}=s||{};this.request({senderAddress:this.data.local.address,recipientAddress:(0,t.pCAIP10ToWallet)(o),chatId:this.spaceSpecificData.spaceId,details:{type:r.SPACE_REQUEST_TYPE.REQUEST_TO_PROMOTE,data:{role:i}}})})}return Gc.requestToBePromoted=n,Gc}var zc={},y_;function SM(){if(y_)return zc;y_=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.acceptPromotionRequest=void 0;const e=$e,t=ii(),r=sg(),n=To(),s=tt(),i=pn();function o(a){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:d,promoteeAddress:c,spaceId:l,role:u}=a||{};yield(0,r.addSpeakers)({spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,speakers:[(0,s.pCAIP10ToWallet)(c)],env:this.env});const p=(0,t.produce)(this.spaceSpecificData.liveSpaceData,f=>{const h=this.spaceSpecificData.liveSpaceData.listeners.findIndex(y=>(0,s.pCAIP10ToWallet)(y.address)===(0,s.pCAIP10ToWallet)(c));f.listeners.splice(h,1),f.speakers.push({address:(0,s.pCAIP10ToWallet)(c),emojiReactions:null,audio:null})});yield(0,n.default)({spaceId:this.spaceSpecificData.spaceId,pgpPrivateKey:this.pgpPrivateKey,env:this.env,signer:this.signer,liveSpaceData:p,action:i.CHAT.META.SPACE.SPEAKER.PRVILEGE})})}return zc.acceptPromotionRequest=o,zc}var Wc={},g_;function PM(){if(g_)return Wc;g_=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.rejectPromotionRequest=void 0;const e=$e,t=ii(),r=To(),n=xa(),s=tt();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{promoteeAddress:a}=o||{};this.disconnect({peerAddress:(0,s.pCAIP10ToWallet)(a)});const d=(0,t.produce)(this.spaceSpecificData.liveSpaceData,c=>{const l=this.spaceSpecificData.liveSpaceData.listeners.findIndex(u=>u.address===(0,s.pCAIP10ToWallet)(a));l>-1&&(c.listeners[l].handRaised=!1)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:d})),yield(0,r.default)({liveSpaceData:d,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:n.CHAT.META.GROUP.USER.INTERACTION})})}return Wc.rejectPromotionRequest=i,Wc}var Yc={},m_;function TM(){if(m_)return Yc;m_=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.connectPromotor=void 0;const e=$e;function t(r){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:n,promotorAddress:s}=r||{};this.connect({signalData:n,peerAddress:s})})}return Yc.connectPromotor=t,Yc}var Jc={},b_;function IM(){if(b_)return Jc;b_=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.join=void 0;const e=$e,t=Ur(),r=pn(),n=O9(),s=Fs(),i=K9(),o=ng();function a(){return e.__awaiter(this,void 0,void 0,function*(){try{const d=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(d.status!==r.ChatStatus.ACTIVE)throw new Error("Space not active yet");let c=!1,l=!1;const u=(0,o.default)(this.data.local.address);d.members.forEach(m=>{(0,o.default)(m.wallet)===u&&(m.isSpeaker?c=!0:l=!0)});let p=!1;d.pendingMembers.forEach(m=>{(0,o.default)(m.wallet)===u&&m.isSpeaker&&(p=!0)});const f=(0,o.default)(d.spaceCreator),h=(0,i.default)(this.data.incoming,f);if((c||p)&&h>-1)return Promise.resolve();!c&&!l&&(yield(0,n.approve)({signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,senderAddress:this.spaceSpecificData.spaceId,env:this.env})),(c||p)&&(!this.data.local.stream&&(yield this.create({audio:!0,video:!1})),yield this.request({senderAddress:this.data.local.address,recipientAddress:f,chatId:this.spaceSpecificData.spaceId,details:{type:t.SPACE_REQUEST_TYPE.JOIN_SPEAKER,data:{}}}));const y=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},y),{liveSpaceData:this.spaceSpecificData.liveSpaceData}))}catch(d){throw console.error(`[Push SDK] - API - Error - API ${a.name} -: `,d),Error(`[Push SDK] - API - Error - API ${a.name} -: ${d}`)}})}return Jc.join=a,Jc}var Zc={},v_;function CM(){if(v_)return Zc;v_=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.leave=void 0;const e=$e,t=Ur();function r(){return e.__awaiter(this,void 0,void 0,function*(){try{this.data.incoming.slice(1).forEach(({address:n})=>{this.disconnect({peerAddress:n,details:{type:t.SPACE_DISCONNECT_TYPE.LEAVE,data:{}}})})}catch(n){throw console.error(`[Push SDK] - API - Error - API ${stop.name} -: `,n),Error(`[Push SDK] - API - Error - API ${stop.name} -: ${n}`)}})}return Zc.leave=r,Zc}var Xc={},__;function RM(){if(__)return Xc;__=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.stop=void 0;const e=$e,t=Mt(),r=ed(),n=Fs(),s=pn(),i=Ur();function o(){return e.__awaiter(this,void 0,void 0,function*(){try{const a=yield(0,n.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(a.status===s.ChatStatus.ENDED)throw new Error("Space already ended");const d=(0,t.getSpacesMembersList)(a.members,a.pendingMembers),c=(0,t.getSpaceAdminsList)(a.members,a.pendingMembers),l=yield(0,r.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:a.spaceName,groupImage:a.spaceImage,groupDescription:a.spaceDescription,members:d,admins:c,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:a.scheduleAt,scheduleEnd:a.scheduleEnd,status:s.ChatStatus.ENDED});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},(0,t.groupDtoToSpaceDto)(l)),{liveSpaceData:this.spaceSpecificData.liveSpaceData})),this.data.incoming.slice(1).forEach(({address:u})=>{this.disconnect({peerAddress:u,details:{type:i.SPACE_DISCONNECT_TYPE.STOP,data:{}}})})}catch(a){throw console.error(`[Push SDK] - API - Error - API ${o.name} -: `,a),Error(`[Push SDK] - API - Error - API ${o.name} -: ${a}`)}})}return Xc.stop=o,Xc}var Qc={},zd={},w_;function kM(){if(w_)return zd;w_=1,Object.defineProperty(zd,"__esModule",{value:!0});const e=$e,t=ri(),r=Je(),n=cg(),s=({localAddress:i,spaceId:o,pgpPrivateKey:a,env:d})=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const u=(yield(0,t.conversationHash)({account:i,conversationId:o,env:d})).threadHash;let p=n.initLiveSpaceData;const f=yield(0,t.history)({threadhash:u,account:i,pgpPrivateKey:a,toDecrypt:!0,env:d});let h=null;for(const y of f)if(y.messageType===r.MessageType.META&&typeof y.messageObj=="object"&&y.messageObj!==null){h=y;break}return h!==null&&typeof h.messageObj=="object"&&h.messageObj!==null&&(p=(l=(c=h.messageObj)===null||c===void 0?void 0:c.info)===null||l===void 0?void 0:l.arbitrary),p});return zd.default=s,zd}var E_;function MM(){if(E_)return Qc;E_=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.initialize=void 0;const e=$e,t=pn(),r=Fs(),n=kM();function s(i){return e.__awaiter(this,void 0,void 0,function*(){const{spaceId:o}=i||{},a=yield(0,r.get)({spaceId:o,env:this.env});let d=this.spaceSpecificData.liveSpaceData;a.status===t.ChatStatus.ACTIVE&&(d=yield(0,n.default)({localAddress:this.data.local.address,spaceId:o,pgpPrivateKey:this.pgpPrivateKey,env:this.env})),this.setSpaceSpecificData(()=>Object.assign(Object.assign({},a),{liveSpaceData:d}))})}return Qc.initialize=s,Qc}var Wd={},A_;function OM(){if(A_)return Wd;A_=1,Object.defineProperty(Wd,"__esModule",{value:!0});const e=(t,r)=>{t.addStream(r,void 0)};return Wd.default=e,Wd}var eu={},S_;function NM(){if(S_)return eu;S_=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.broadcastRaisedHand=void 0;const e=$e,t=ii(),r=To(),n=xa(),s=tt();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{promoteeAddress:a}=o||{},d=(0,t.produce)(this.spaceSpecificData.liveSpaceData,c=>{const l=this.spaceSpecificData.liveSpaceData.listeners.findIndex(u=>(0,s.pCAIP10ToWallet)(u.address)===(0,s.pCAIP10ToWallet)(a));l!==-1&&(c.listeners[l].handRaised=!0)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:d})),yield(0,r.default)({liveSpaceData:d,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:n.CHAT.META.GROUP.USER.INTERACTION})})}return eu.broadcastRaisedHand=i,eu}var tu={},P_;function DM(){if(P_)return tu;P_=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.onReceiveMetaMessage=void 0;const e=Je();function t(r){var n,s;const{receivedMetaMessage:i}=r||{};if(i.messageType!==e.MessageType.META||typeof i.messageObj!="object"||!(!((s=(n=i==null?void 0:i.messageObj)===null||n===void 0?void 0:n.info)===null||s===void 0)&&s.arbitrary))return;const o=i.messageObj.info.arbitrary;this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:o}))}return tu.onReceiveMetaMessage=t,tu}var ru={},T_;function xM(){if(T_)return ru;T_=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.onJoinListener=void 0;const e=$e,t=To(),r=Fs(),n=tt(),s=ii(),i=xa();function o(a){return e.__awaiter(this,void 0,void 0,function*(){const{receivedAddress:d}=a||{};if((0,n.pCAIP10ToWallet)(this.spaceSpecificData.spaceCreator)!==this.data.local.address||!(yield(0,r.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env})).members.find(p=>(0,n.pCAIP10ToWallet)(p.wallet)===(0,n.pCAIP10ToWallet)(d)&&!p.isSpeaker))return;const u=(0,s.produce)(this.spaceSpecificData.liveSpaceData,p=>{this.spaceSpecificData.liveSpaceData.listeners.find(h=>(0,n.pCAIP10ToWallet)(h.address)===(0,n.pCAIP10ToWallet)(d))||p.listeners.push({address:(0,n.pCAIP10ToWallet)(d),handRaised:!1,emojiReactions:null})});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:u})),yield(0,t.default)({spaceId:this.spaceSpecificData.spaceId,pgpPrivateKey:this.pgpPrivateKey,env:this.env,signer:this.signer,liveSpaceData:u,action:i.CHAT.META.SPACE.LISTENER.ADD})})}return ru.onJoinListener=o,ru}var I_;function cg(){return I_||(I_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Space=e.initSpaceData=e.initSpaceSpecificData=e.initLiveSpaceData=void 0;const t=$e,r=ii(),n=Je(),s=og(),i=mM(),o=bM(),a=vM(),d=_M(),c=wM(),l=EM(),u=AM(),p=SM(),f=PM(),h=TM(),y=IM(),m=CM(),b=RM(),v=MM(),E=OM(),_=pn(),C=Ur(),k=To(),D=xa(),w=NM(),S=DM(),I=xM(),T=tt();e.initLiveSpaceData={host:{address:"",audio:null,emojiReactions:null},coHosts:[],speakers:[],listeners:[]},e.initSpaceSpecificData={members:[],pendingMembers:[],contractAddressERC20:null,numberOfERC20:-1,contractAddressNFT:null,numberOfNFTTokens:-1,verificationProof:"",spaceImage:null,spaceName:"",isPublic:!1,spaceDescription:"",spaceCreator:"",spaceId:"",scheduleAt:null,scheduleEnd:null,status:null,inviteeDetails:{},liveSpaceData:e.initLiveSpaceData},e.initSpaceData=Object.assign(Object.assign({},e.initSpaceSpecificData),{connectionData:s.initVideoCallData});class g extends s.Video{constructor(P){const{signer:O,pgpPrivateKey:N,address:M,chainId:L,env:x=n.default.ENV.PROD,setSpaceData:R}=P||{};super({signer:O,chainId:L,pgpPrivateKey:N,env:x,callType:C.VIDEO_CALL_TYPE.PUSH_SPACE,onReceiveStream:(K,V,J)=>t.__awaiter(this,void 0,void 0,function*(){var se;if(this.spaceSpecificData.status===_.ChatStatus.ACTIVE&&(!((se=this.data.meta.broadcast)===null||se===void 0)&&se.hostAddress)&&this.data.meta.broadcast.hostAddress===this.data.local.address){(0,E.default)(this.mergedStream,K);const j=(0,r.produce)(this.spaceSpecificData.liveSpaceData,re=>{const G=this.spaceSpecificData.liveSpaceData.listeners.findIndex(B=>B.address===V);re.speakers.push({address:V,audio:J,emojiReactions:G>-1?this.spaceSpecificData.liveSpaceData.listeners[G].emojiReactions:null}),G>-1&&re.listeners.splice(G,1)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:j})),yield(0,k.default)({liveSpaceData:j,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:D.CHAT.META.GROUP.ADMIN.PRVILEGE})}}),setData:function(){}}),this.mergedStream=null,this.initialize=v.initialize,this.update=i.update,this.createAudioStream=()=>t.__awaiter(this,void 0,void 0,function*(){yield this.create({audio:!0,video:!1})}),this.start=o.start,this.onReceiveMetaMessage=S.onReceiveMetaMessage,this.onJoinListener=I.onJoinListener,this.inviteToPromote=a.inviteToPromote,this.acceptPromotionInvite=d.acceptPromotionInvite,this.connectInvitee=c.connectInvitee,this.rejectPromotionInvite=l.rejectPromotionInvite,this.requestToBePromoted=u.requestToBePromoted,this.broadcastRaisedHand=w.broadcastRaisedHand,this.acceptPromotionRequest=p.acceptPromotionRequest,this.connectPromotor=h.connectPromotor,this.rejectPromotionRequest=f.rejectPromotionRequest,this.join=y.join,this.leave=m.leave,this.stop=b.stop,this.setData=function(K){const V=K(this.data);R(()=>Object.assign(Object.assign({},this.spaceSpecificData),{connectionData:V})),this.data=V},this.setSpaceSpecificData=function(K){const V=K(this.spaceSpecificData);R(()=>Object.assign(Object.assign({},V),{connectionData:this.data})),this.spaceSpecificData=V},this.setSpaceData=function(K){const V=K(Object.assign(Object.assign({},this.spaceSpecificData),{connectionData:this.data})),{connectionData:J}=V,se=t.__rest(V,["connectionData"]);this.spaceSpecificData=se,this.setData(()=>J)},this.setData(K=>(0,r.produce)(K,V=>{V.local.address=(0,T.pCAIP10ToWallet)(M)})),R(()=>e.initSpaceData),this.spaceSpecificData=e.initSpaceSpecificData}}e.Space=g,e.default=g}(Wp)),Wp}var C_;function ug(){return C_||(C_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.space=void 0;const t=$e;t.__exportStar(ng(),e),t.__exportStar(vk(),e),t.__exportStar(_k(),e),t.__exportStar(Fs(),e),t.__exportStar(wk(),e),t.__exportStar(Ek(),e),t.__exportStar(Sk(),e),t.__exportStar(sg(),e),t.__exportStar(Pk(),e),t.__exportStar(Tk(),e),t.__exportStar(Ik(),e),t.__exportStar(O9(),e),t.__exportStar(Ck(),e),t.__exportStar(Vk(),e),t.__exportStar(Fk(),e),t.__exportStar(Hk(),e);var r=Gk();Object.defineProperty(e,"space",{enumerable:!0,get:function(){return r.spaceFeed}}),t.__exportStar(cg(),e)}(sp)),sp}var R_;function nd(){if(R_)return Bd;R_=1,Object.defineProperty(Bd,"__esModule",{value:!0});const e=Je(),t=Lh(),r=Ql(),n=Kh(),s=ug(),i=pn(),o=og(),a={ENV:e.ENV,STREAM:n.STREAM,CHAT:{LIST_TYPE:r.ChatListType,MESSAGE_TYPE:e.MessageType,GROUP:{RULES:{CONDITION_TYPE:i.ConditionType,CATEGORY:i.GROUP_RULES_CATEGORY,SUBCATEGORY:i.GROUP_RULES_SUB_CATEGORY,PERMISSION:i.GROUP_RULES_PERMISSION,INVITER_ROLE:i.GROUP_INVITER_ROLE}}},VIDEO:{EVENT:n.VideoEventType,STATUS:i.VideoCallStatus,INITIAL_DATA:o.initVideoCallData},SPACE:{EVENT:n.SpaceEventType,INITIAL_DATA:s.initSpaceData},ALPHA_FEATURES:e.ALPHA_FEATURES,USER:{ENCRYPTION_TYPE:e.ENCRYPTION_TYPE},NOTIFICATION:{TYPE:i.NotifictaionType,CHANNEL:{LIST_TYPE:t.ChannelListType}},FILTER:{CHANNEL_LIST:{SORT:t.ChannelListSortType,ORDER:t.ChannelListOrderType},NOTIFICATION_TYPE:i.NotifictaionType,TAGS:{USER:"USER",PUSH:"PUSH",ALL:"*"}}};return Bd.default=a,Bd}var k_;function UM(){if(k_)return bc;k_=1,Object.defineProperty(bc,"__esModule",{value:!0}),bc.getChannels=void 0;const e=$e,t=nd(),r=tt(),n=It(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:o=t.default.ENV.PROD,page:a=1,limit:d=10,sort:c=t.default.FILTER.CHANNEL_LIST.SORT.SUBSCRIBER,order:l=t.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:u,tag:p,user_subscribed:f}=i||{},m=`${`${(0,r.getAPIBaseUrls)(o)}/v1/channels`}?page=${a}&limit=${d}&sort=${c}&order=${l}${u?`&filter=${u}`:""}${p?`&tag=${p}`:""}${f?`&user_subscribed=${f}`:""}`;return yield(0,n.axiosGet)(m).then(b=>b.data).catch(b=>{throw console.error(`[Push SDK] - API ${m}: `,b),Error(`[Push SDK] - API - Error - API ${m} -: ${b}`)})});return bc.getChannels=s,bc}var nu={},M_;function BM(){if(M_)return nu;M_=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.getDelegates=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD}=i||{},d=yield(0,t.getCAIPAddress)(a,o,"Channel"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/channels`}/${d}/delegates`;return yield(0,n.axiosGet)(u).then(p=>{var f;return(f=p.data)===null||f===void 0?void 0:f.delegates}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return nu.getDelegates=s,nu}var iu={},su={},O_;function LM(){if(O_)return su;O_=1,Object.defineProperty(su,"__esModule",{value:!0}),su.parseSubscrbersApiResponse=void 0;const e=rg();function t(r){const n=r.subscribers.map(s=>({subscriber:s.subscriber,settings:s.settings?(0,e.parseSettings)(s.settings):null}));return{itemcount:r.itemcount,subscribers:[...n]}}return su.parseSubscrbersApiResponse=t,su}var N_;function KM(){if(N_)return iu;N_=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.getSubscribers=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=LM(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){try{const{channel:a,page:d=1,limit:c=10,category:l=null,setting:u=!1,env:p=r.default.ENV.PROD,raw:f=!0}=o||{};try{if(a==null||a.length==0)throw new Error("channel cannot be null or empty");if(d<=0)throw new Error("page must be greater than 0");if(c<=0)throw new Error("limit must be greater than 0");if(c>30)throw new Error("limit must be lesser than or equal to 30");const h=yield(0,t.getCAIPAddress)(p,a,"Channel");let m=`${(0,t.getAPIBaseUrls)(p)}/v1/channels/${h}/subscribers?page=${d}&limit=${c}&setting=${u}`;return l&&(m=m+`&category=${l}`),yield(0,n.axiosGet)(m).then(b=>f?b.data:(0,s.parseSubscrbersApiResponse)(b.data)).catch(b=>{console.error(`[Push SDK] - API ${m}: `,b)})}catch(h){throw console.error("[Push SDK] - API - Error - API send() -: ",h),Error(`[Push SDK] - API - Error - API send() -: ${h}`)}}catch(a){throw console.error("[Push SDK] - API - Error - API send() -: ",a),Error(`[Push SDK] - API - Error - API send() -: ${a}`)}});return iu.getSubscribers=i,iu}var au={},D_;function qM(){if(D_)return au;D_=1,Object.defineProperty(au,"__esModule",{value:!0}),au.search=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{query:o,env:a=r.default.ENV.PROD,page:d=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT,filter:l,tag:u,user_subscribed:p,oldFormat:f=!0}=i||{};if(!o)throw Error('"query" not provided!');const y=`${(0,t.getAPIBaseUrls)(a)}/v1/channels/search/`,m=Object.assign(Object.assign(Object.assign({page:d,limit:(0,t.getLimit)(c),query:o},u&&{tag:u}),l&&{filter:l}),p&&{user_subscribed:p}),b=`${y}?${(0,t.getQueryParams)(m)}`;return(0,n.axiosGet)(b).then(v=>{const E=v.data.channels,C={itemCount:v.data.itemCount||E.length,result:E};return typeof f<"u"&&f?E:C}).catch(v=>{console.error(`[Push SDK] - API ${b}: `,v)})});return au.search=s,au}var ou={},x_;function jM(){if(x_)return ou;x_=1,Object.defineProperty(ou,"__esModule",{value:!0}),ou.getTags=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD}=i||{},d=yield(0,t.getCAIPAddress)(a,o,"Channel"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/channels`}/${d}/tags`;return yield(0,n.axiosGet)(u).then(p=>{var f;return(f=p.data)===null||f===void 0?void 0:f.tags}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return ou.getTags=s,ou}var cu={},U_;function $M(){if(U_)return cu;U_=1,Object.defineProperty(cu,"__esModule",{value:!0}),cu.searchTags=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{query:o,env:a=r.default.ENV.LOCAL,page:d=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT}=i||{};if(!o)throw Error('"query" not provided!');const u=`${(0,t.getAPIBaseUrls)(a)}/v1/channels/search/tags`,p={page:d,limit:(0,t.getLimit)(c),query:o},f=`${u}?${(0,t.getQueryParams)(p)}`;return(0,n.axiosGet)(f).then(h=>h.data.channels).catch(h=>{console.error(`[Push SDK] - API ${f}: `,h)})});return cu.searchTags=s,cu}var uu={},Sn={},B_;function Vh(){if(B_)return Sn;B_=1,Object.defineProperty(Sn,"__esModule",{value:!0}),Sn.getTypeInformationV2=Sn.getTypeInformation=Sn.getSubscriptionMessageV2=Sn.getSubscriptionMessage=Sn.getDomainInformation=void 0;const e=(i,o)=>({name:"EPNS COMM V1",chainId:i,verifyingContract:o});Sn.getDomainInformation=e;const t=(i,o,a)=>({channel:i,[a==="Unsubscribe"?"unsubscriber":"subscriber"]:o,action:a});Sn.getSubscriptionMessage=t;const r=(i,o,a,d)=>{const c=a==="Unsubscribe"?"unsubscriber":"subscriber";return a=="Subscribe"?JSON.stringify({channel:i,[c]:o,action:a,userSetting:d??""},null,4):JSON.stringify({channel:i,[c]:o,action:a},null,4)};Sn.getSubscriptionMessageV2=r;const n=i=>i==="Subscribe"?{Subscribe:[{name:"channel",type:"address"},{name:"subscriber",type:"address"},{name:"action",type:"string"}]}:{Unsubscribe:[{name:"channel",type:"address"},{name:"unsubscriber",type:"address"},{name:"action",type:"string"}]};Sn.getTypeInformation=n;const s=()=>({Data:[{name:"data",type:"string"}]});return Sn.getTypeInformationV2=s,Sn}var L_;function VM(){if(L_)return uu;L_=1,Object.defineProperty(uu,"__esModule",{value:!0}),uu.subscribe=void 0;const e=$e,t=tt(),r=Vh(),n=Je(),s=It(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{signer:a,channelAddress:d,userAddress:c,verifyingContractAddress:l,origin:u,env:p=n.default.ENV.PROD,onSuccess:f,onError:h}=o||{};try{const y=yield(0,t.getCAIPAddress)(p,d,"Channel"),m=(0,t.getCAIPDetails)(y);if(!m)throw Error("Invalid Channel CAIP!");const b=parseInt(m.networkId,10),v=yield(0,t.getCAIPAddress)(p,c,"User"),E=(0,t.getCAIPDetails)(v);if(!E)throw Error("Invalid User CAIP!");const{API_BASE_URL:_,EPNS_COMMUNICATOR_CONTRACT:C}=(0,t.getConfig)(p,m),k=`${_}/v1/channels/${y}/subscribe`,D=(0,r.getDomainInformation)(b,l||C),w=(0,r.getTypeInformation)("Subscribe"),S=(0,r.getSubscriptionMessage)(m.address,E.address,"Subscribe"),A={verificationProof:yield new t.Signer(a).signTypedData(D,w,S,"Subscribe"),message:Object.assign(Object.assign({},S),{channel:y,subscriber:v}),origin:u};return yield(0,s.axiosPost)(k,A),typeof f=="function"&&f(),{status:"success",message:"successfully opted into channel"}}catch(y){return typeof h=="function"&&h(y),{status:"error",message:y instanceof Error?y.message:JSON.stringify(y)}}});return uu.subscribe=i,uu}var lu={},K_;function FM(){if(K_)return lu;K_=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.subscribeV2=void 0;const e=$e,t=tt(),r=Vh(),n=Je(),s=It(),i=Mt(),o=Fr,a=d=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const{signer:u,channelAddress:p,userAddress:f,settings:h=void 0,verifyingContractAddress:y,env:m=n.default.ENV.PROD,origin:b,onSuccess:v,onError:E,pgpPrivateKey:_}=d||{};try{const C=yield(0,t.getCAIPAddress)(m,p,"Channel"),k=(0,t.getCAIPDetails)(C);if(!k)throw Error("Invalid Channel CAIP!");const D=parseInt(k.networkId,10),w=yield(0,t.getCAIPAddress)(m,f,"User"),S=(0,t.getCAIPDetails)(w);if(!S)throw Error("Invalid User CAIP!");const{API_BASE_URL:I,EPNS_COMMUNICATOR_CONTRACT:T}=(0,t.getConfig)(m,k),g=`${I}/v1/channels/${C}/subscribe`;let A,P={data:{}};if(_){P={data:(0,r.getSubscriptionMessageV2)(k.address,w,"Subscribe",h)};const L=o.SHA256(JSON.stringify(P)).toString();console.log(" hash ",L),A=`pgpv4:${yield(0,i.sign)({message:L,signingKey:_})}`}else{const M=(0,r.getDomainInformation)(D,y||T),L=(0,r.getTypeInformationV2)();P={data:(0,r.getSubscriptionMessageV2)(k.address,S.address,"Subscribe",h)},A=`eip712v2:${yield new t.Signer(u).signTypedData(M,L,P,"Data")}`}const O={verificationProof:A,message:P.data,origin:b},N=yield(0,s.axiosPost)(g,O);return typeof v=="function"&&v(),{status:N.status,message:"successfully opted into channel"}}catch(C){return typeof E=="function"&&E(C),{status:(l=(c=C==null?void 0:C.response)===null||c===void 0?void 0:c.status)!==null&&l!==void 0?l:"",message:C instanceof Error?C.message:JSON.stringify(C)}}});return lu.subscribeV2=a,lu}var du={},q_;function HM(){if(q_)return du;q_=1,Object.defineProperty(du,"__esModule",{value:!0}),du.unsubscribe=void 0;const e=$e,t=tt(),r=Vh(),n=Je(),s=It(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{signer:a,channelAddress:d,userAddress:c,verifyingContractAddress:l,env:u=n.default.ENV.PROD,onSuccess:p,onError:f}=o||{};try{const h=yield(0,t.getCAIPAddress)(u,d,"Channel"),y=(0,t.getCAIPDetails)(h);if(!y)throw Error("Invalid Channel CAIP!");const m=parseInt(y.networkId,10),b=yield(0,t.getCAIPAddress)(u,c,"User"),v=(0,t.getCAIPDetails)(b);if(!v)throw Error("Invalid User CAIP!");const{API_BASE_URL:E,EPNS_COMMUNICATOR_CONTRACT:_}=(0,t.getConfig)(u,y),C=`${E}/v1/channels/${h}/unsubscribe`,k=(0,r.getDomainInformation)(m,l||_),D=(0,r.getTypeInformation)("Unsubscribe"),w=(0,r.getSubscriptionMessage)(y.address,v.address,"Unsubscribe"),g={verificationProof:yield new t.Signer(a).signTypedData(k,D,w,"Unsubscribe"),message:Object.assign(Object.assign({},w),{channel:h,unsubscriber:b})};return yield(0,s.axiosPost)(C,g),typeof p=="function"&&p(),{status:"success",message:"successfully opted out channel"}}catch(h){return typeof f=="function"&&f(h),{status:"error",message:h instanceof Error?h.message:JSON.stringify(h)}}});return du.unsubscribe=i,du}var fu={},j_;function GM(){if(j_)return fu;j_=1,Object.defineProperty(fu,"__esModule",{value:!0}),fu.unsubscribeV2=void 0;const e=$e,t=tt(),r=Vh(),n=Je(),s=It(),i=Mt(),o=Fr,a=d=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const{signer:u,channelAddress:p,userAddress:f,verifyingContractAddress:h,env:y=n.default.ENV.PROD,onSuccess:m,onError:b,pgpPrivateKey:v}=d||{};try{const E=yield(0,t.getCAIPAddress)(y,p,"Channel"),_=(0,t.getCAIPDetails)(E);if(!_)throw Error("Invalid Channel CAIP!");const C=parseInt(_.networkId,10),k=yield(0,t.getCAIPAddress)(y,f,"User"),D=(0,t.getCAIPDetails)(k);if(!D)throw Error("Invalid User CAIP!");const{API_BASE_URL:w,EPNS_COMMUNICATOR_CONTRACT:S}=(0,t.getConfig)(y,_),I=`${w}/v1/channels/${E}/unsubscribe`,T=(0,r.getDomainInformation)(C,h||S),g=(0,r.getTypeInformationV2)();let A={data:{}},P;if(v){A={data:(0,r.getSubscriptionMessageV2)(_.address,k,"Unsubscribe")};const L=o.SHA256(JSON.stringify(A)).toString();P=`pgpv4:${yield(0,i.sign)({message:L,signingKey:v})}`}else A={data:(0,r.getSubscriptionMessageV2)(_.address,D.address,"Unsubscribe")},P=`eip712v2:${yield new t.Signer(u).signTypedData(T,g,A,"Data")}`;const O={verificationProof:P,message:A.data},N=yield(0,s.axiosPost)(I,O);return typeof m=="function"&&m(),{status:N.status,message:"successfully opted out channel"}}catch(E){return typeof b=="function"&&b(E),{status:(l=(c=E==null?void 0:E.response)===null||c===void 0?void 0:c.status)!==null&&l!==void 0?l:"",message:E instanceof Error?E.message:JSON.stringify(E)}}});return fu.unsubscribeV2=a,fu}var hu={},$_;function zM(){if($_)return hu;$_=1,Object.defineProperty(hu,"__esModule",{value:!0}),hu.getAllTags=void 0;const e=$e,t=tt(),r=Je(),n=It(),s=nd(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{page:a=1,limit:d=10,order:c=s.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:l=s.default.FILTER.TAGS.PUSH,env:u=r.default.ENV.PROD}=o||{},f=`${(0,t.getAPIBaseUrls)(u)}/v1/channels`,h={page:a,limit:d,order:c,filter:l},y=`${f}/tags/all?${(0,t.getQueryParams)(h)}`;return yield(0,n.axiosGet)(y).then(m=>{var b;return(b=m.data)===null||b===void 0?void 0:b.tags}).catch(m=>{console.error(`[EPNS-SDK] - API ${y}: `,m)})});return hu.getAllTags=i,hu}var V_;function Io(){return V_||(V_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$e;t.__exportStar(gk(),e),t.__exportStar(mk(),e),t.__exportStar(bk(),e),t.__exportStar(UM(),e),t.__exportStar(BM(),e),t.__exportStar(KM(),e),t.__exportStar(qM(),e),t.__exportStar(jM(),e),t.__exportStar($M(),e),t.__exportStar(VM(),e),t.__exportStar(FM(),e),t.__exportStar(HM(),e),t.__exportStar(GM(),e),t.__exportStar(zM(),e)}(rp)),rp}var pu={},yu={},ay={},F_;function j9(){return F_||(F_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupProfile=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=It(),a=td(),d=Xt(),c=l=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:u,groupName:p,groupImage:f,groupDescription:h,rules:y,account:m=null,signer:b=null,env:v=n.default.ENV.PROD,pgpPrivateKey:E=null}=l||{};try{if(m==null&&b==null)throw new Error("At least one from account or signer is necessary!");const _=(0,s.getWallet)({account:m,signer:b}),C=yield(0,s.getAccountAddress)(_);(0,s.updateGroupRequestValidator)(u,p,[],[],C,h);const k=yield(0,a.getGroupInfo)({chatId:u,env:v}),D={groupName:p,groupDescription:h,groupImage:f,rules:y??{},isPublic:k.isPublic,groupType:k.groupType},w=i.SHA256(JSON.stringify(D)).toString(),S=yield(0,s.getConnectedUserV2)(_,E,v),I=yield(0,s.sign)({message:w,signingKey:S.privateKey}),g="pgpv2"+":"+I+":"+S.did,P=`${(0,r.getAPIBaseUrls)(v)}/v1/chat/groups/${u}/profile`,{isPublic:O,groupType:N}=D,M=t.__rest(D,["isPublic","groupType"]);return M.profileVerificationProof=g,(yield(0,o.axiosPut)(P,M)).data}catch(_){throw(0,d.handleError)(_,e.updateGroupProfile.name)}});e.updateGroupProfile=c}(ay)),ay}var gu={},H_;function lg(){if(H_)return gu;H_=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.User=void 0;const e=$e,t=kn();class r{constructor(s,i){this.account=s,this.env=i}info(s){return e.__awaiter(this,void 0,void 0,function*(){const i=(s==null?void 0:s.overrideAccount)||this.account;return yield t.get({account:i,env:this.env})})}}return gu.User=r,gu}var oy={},G_;function $9(){return G_||(G_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupConfig=void 0;const t=$e,r=tt(),n=Je(),s=Mt(),i=Fr,o=It(),a=Xt(),d=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:l,meta:u,scheduleAt:p,scheduleEnd:f,status:h,account:y=null,signer:m=null,env:b=n.default.ENV.PROD,pgpPrivateKey:v=null}=c||{};try{if(y==null&&m==null)throw new Error("At least one from account or signer is necessary!");const E=(0,s.getWallet)({account:y,signer:m}),_={meta:u,scheduleAt:p,scheduleEnd:f,status:h},C=i.SHA256(JSON.stringify(_)).toString(),k=yield(0,s.getConnectedUserV2)(E,v,b),D=yield(0,s.sign)({message:C,signingKey:k.privateKey}),S="pgpv2"+":"+D+":"+k.did,T=`${(0,r.getAPIBaseUrls)(b)}/v1/chat/groups/${l}/config`,g=_;return g.configVerificationProof=S,(yield(0,o.axiosPut)(T,g)).data}catch(E){throw(0,a.handleError)(E,e.updateGroupConfig.name)}});e.updateGroupConfig=d}(oy)),oy}var z_;function dg(){if(z_)return yu;z_=1,Object.defineProperty(yu,"__esModule",{value:!0}),yu.Chat=void 0;const e=$e,t=Je(),r=Ql(),n=kn(),s=ri(),i=Mt(),o=tt(),a=j9(),d=lg(),c=$9(),l=Mo();class u{constructor(f,h,y,m,b,v){this.account=f,this.env=h,this.alpha=y,this.decryptedPgpPvtKey=m,this.signer=b,this.progressHook=v,this.group={create:(E,_)=>e.__awaiter(this,void 0,void 0,function*(){var C,k,D;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const w={account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,groupName:E,groupDescription:(C=_==null?void 0:_.description)!==null&&C!==void 0?C:null,groupImage:(k=_==null?void 0:_.image)!==null&&k!==void 0?k:null,rules:(D=_==null?void 0:_.rules)!==null&&D!==void 0?D:{},isPublic:!(_!=null&&_.private),groupType:"default",config:{meta:null,scheduleAt:null,scheduleEnd:null,status:null},members:_!=null&&_.members?_.members:[],admins:_!=null&&_.admins?_.admins:[]},S=yield s.createGroupV2(w);return this.scalabilityV2Feature?S:yield s.getGroup({chatId:S.chatId,env:this.env})}),participants:{list:(E,_)=>e.__awaiter(this,void 0,void 0,function*(){const{page:C=1,limit:k=20,filter:D={pending:void 0,role:void 0}}=_??{},w={chatId:E,page:C,limit:k,pending:D.pending,role:D.role,env:this.env};return{members:yield s.getGroupMembers(w)}}),count:E=>e.__awaiter(this,void 0,void 0,function*(){const _=yield s.getGroupMemberCount({chatId:E,env:this.env});return{participants:_.overallCount-_.pendingCount,pending:_.pendingCount}}),status:(E,_)=>e.__awaiter(this,void 0,void 0,function*(){const C=(_==null?void 0:_.overrideAccount)||this.account,k=yield s.getGroupMemberStatus({chatId:E,did:C,env:this.env});return{pending:k.isPending,role:k.isAdmin?"admin":"member",participant:k.isMember}})},permissions:E=>e.__awaiter(this,void 0,void 0,function*(){const _={chatId:E,did:this.account,env:this.env};return yield s.getGroupAccess(_)}),info:E=>e.__awaiter(this,void 0,void 0,function*(){return this.scalabilityV2Feature?yield s.getGroupInfo({chatId:E,env:this.env}):yield s.getGroup({chatId:E,env:this.env})}),update:(E,_)=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const C=yield s.getGroupInfo({chatId:E,env:this.env});if(!C)throw new Error("Group not found");const k={chatId:E,groupName:_.name?_.name:C.groupName,groupDescription:_.description!==void 0?_.description:C.groupDescription,groupImage:_.image!==void 0?_.image:C.groupImage,rules:_.rules?_.rules:C.rules,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env},D={chatId:E,meta:_.meta?_.meta:C.meta,scheduleAt:_.scheduleAt?_.scheduleAt:C.scheduleAt,scheduleEnd:_.scheduleEnd?_.scheduleEnd:C.scheduleEnd,status:_.status?_.status:C.status,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};yield(0,a.updateGroupProfile)(k);const w=yield(0,c.updateGroupConfig)(D);return this.scalabilityV2Feature?w:yield s.getGroup({chatId:w.chatId,env:this.env})}),add:(E,_)=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const{role:C,accounts:k}=_;if(!["ADMIN","MEMBER"].includes(C))throw new Error("Invalid role provided.");if(!k||k.length===0)throw new Error("accounts array cannot be empty!");k.forEach(S=>{if(!(0,o.isValidPushCAIP)(S))throw new Error(`Invalid account address: ${S}`)});let w;return C==="ADMIN"?w=yield s.addAdmins({chatId:E,admins:k,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):w=yield s.addMembers({chatId:E,members:k,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}),this.scalabilityV2Feature?w:yield s.getGroup({chatId:w.chatId,env:this.env})}),remove:(E,_)=>e.__awaiter(this,void 0,void 0,function*(){const{accounts:C}=_;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());if(!C||C.length===0)throw new Error("Accounts array cannot be empty!");C.forEach(w=>{if(!(0,o.isValidPushCAIP)(w))throw new Error(`Invalid account address: ${w}`)});const k=[],D=[];for(const w of C){const S=yield s.getGroupMemberStatus({chatId:E,did:w,env:this.env});S.isAdmin?k.push(w):S.isMember&&D.push(w)}return k.length>0&&(yield s.removeAdmins({chatId:E,admins:k,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),D.length>0&&(yield s.removeMembers({chatId:E,members:D,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),yield this.group.info(E)}),modify:(E,_)=>e.__awaiter(this,void 0,void 0,function*(){const{role:C,accounts:k}=_;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());if(!["ADMIN","MEMBER"].includes(C))throw new Error("Invalid role provided.");if(!k||k.length===0)throw new Error("accounts array cannot be empty!");return k.forEach(w=>{if(!(0,o.isValidPushCAIP)(w))throw new Error(`Invalid account address: ${w}`)}),yield s.modifyRoles({chatId:E,newRole:C,members:k,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})}),join:E=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const _=yield s.getGroupMemberStatus({chatId:E,did:this.account,env:this.env});return _.isPending?yield s.approve({senderAddress:E,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):_.isMember||(yield s.addMembers({chatId:E,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),yield this.group.info(E)}),leave:E=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const _=yield s.getGroupMemberStatus({chatId:E,did:this.account,env:this.env});let C;return _.isAdmin?C=yield s.removeAdmins({chatId:E,admins:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):C=yield s.removeMembers({chatId:E,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}),this.scalabilityV2Feature?C:yield s.getGroup({chatId:C.chatId,env:this.env})}),reject:E=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());yield s.reject({senderAddress:E,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey})})},this.userInstance=new d.User(this.account,this.env),this.scalabilityV2Feature=this.alpha.feature.includes(t.ALPHA_FEATURES.SCALABILITY_V2)}list(f,h){return e.__awaiter(this,void 0,void 0,function*(){const m={account:(h==null?void 0:h.overrideAccount)||this.account,pgpPrivateKey:this.decryptedPgpPvtKey,page:h==null?void 0:h.page,limit:h==null?void 0:h.limit,env:this.env,toDecrypt:!!this.decryptedPgpPvtKey};switch(f){case r.ChatListType.CHATS:return yield s.chats(m);case r.ChatListType.REQUESTS:return yield s.requests(m);default:throw new Error("Invalid Chat List Type")}})}latest(f){return e.__awaiter(this,void 0,void 0,function*(){const{threadHash:h,intent:y}=yield s.conversationHash({conversationId:f,account:this.account,env:this.env});if(!h)return{};const m=yield s.latest({threadhash:h,toDecrypt:!!this.decryptedPgpPvtKey,pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,env:this.env}),b=y?"CHATS":"REQUESTS";return m.map(v=>Object.assign(Object.assign({},v),{listType:b}))})}history(f,h){return e.__awaiter(this,void 0,void 0,function*(){let y;const{threadHash:m,intent:b}=yield s.conversationHash({conversationId:f,account:this.account,env:this.env});if(h!=null&&h.reference?y=h.reference:y=m,!y)return[];const v=yield s.history({account:this.account,env:this.env,threadhash:y,pgpPrivateKey:this.decryptedPgpPvtKey,toDecrypt:!!this.decryptedPgpPvtKey,limit:h==null?void 0:h.limit}),E=b?"CHATS":"REQUESTS";return v.map(_=>Object.assign(Object.assign({},_),{listType:E}))})}message(f,h){return e.__awaiter(this,void 0,void 0,function*(){let y=null;const{threadHash:m,intent:b}=yield s.conversationHash({conversationId:f,account:this.account,env:this.env});if(y=(h==null?void 0:h.reference)||m,!y)return{};const v=yield this.history(f,{reference:y,limit:1}),E=b?"CHATS":"REQUESTS";return v.length>0?Object.assign(Object.assign({},v[0]),{listType:E}):null})}send(f,h){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());h.type||(h.type=t.MessageType.TEXT);const y={message:h,to:f,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};return yield s.send(y)})}decrypt(f){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield s.decryptConversation({pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,messages:f,pgpHelper:i.PGPHelper,connectedUser:yield this.userInstance.info()})})}accept(f){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield s.approve({senderAddress:f,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})})}reject(f){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());yield s.reject({senderAddress:f,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey})})}block(f){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const h=yield n.get({account:this.account,env:this.env});for(const y of f)if(!(0,o.isValidPushCAIP)(y))throw new Error("Invalid address in the users: "+y);if(h.profile.blockedUsersList||(h.profile.blockedUsersList=[]),h.profile.blockedUsersList=[...new Set([...h.profile.blockedUsersList,...f])],!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield n.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:h.profile.name,desc:h.profile.desc,picture:h.profile.picture,blockedUsersList:h.profile.blockedUsersList},env:this.env,progressHook:this.progressHook})})}unblock(f){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const h=yield n.get({account:this.account,env:this.env});for(const b of f)if(!(0,o.isValidPushCAIP)(b))throw new Error("Invalid address in the users: "+b);if(!h.profile.blockedUsersList)return h;const y=f.map(b=>e.__awaiter(this,void 0,void 0,function*(){return(yield(0,o.convertToValidDID)(b,this.env)).toLowerCase()})),m=yield Promise.all(y);return h.profile.blockedUsersList=h.profile.blockedUsersList.filter(b=>{m.includes(b.toLowerCase())}),yield n.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:h.profile.name,desc:h.profile.desc,picture:h.profile.picture,blockedUsersList:h.profile.blockedUsersList},env:this.env,progressHook:this.progressHook})})}info(f,h){var y,m,b;return e.__awaiter(this,void 0,void 0,function*(){const v=(h==null?void 0:h.overrideAccount)||this.account,E={recipient:f,account:v,env:this.env};try{const _=yield s.getChatInfo(E),C=(m=(y=_.meta)===null||y===void 0?void 0:y.group)!==null&&m!==void 0?m:!1;let k=f;if(C)k=_.chatId;else{const S=((b=_.participants)!==null&&b!==void 0?b:[]).find(I=>I!==(0,o.walletToPCAIP10)(v));S&&(k=S)}return{meta:_.meta,list:_.list,participants:_.participants,chatId:_.chatId,recipient:k}}catch(_){throw console.error("Error in Chat.info: ",_),new Error(`Error fetching chat info: ${_}`)}})}}return yu.Chat=u,yu}var mu={},W_;function WM(){if(W_)return mu;W_=1,Object.defineProperty(mu,"__esModule",{value:!0}),mu.Profile=void 0;const e=$e,t=kn(),r=Mo();class n{constructor(i,o,a,d,c){this.account=i,this.env=o,this.cache=a,this.decryptedPgpPvtKey=d,this.progressHook=c}info(i){return e.__awaiter(this,void 0,void 0,function*(){const o=(i==null?void 0:i.overrideAccount)||this.account,a=`profile-${o}`;if(this.cache.has(a))return this.cache.get(a);const d=yield t.get({account:o,env:this.env});return this.cache.set(a,d.profile),d.profile})}update(i){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(r.PushAPI.ensureSignerMessage());const{name:o,desc:a,picture:d}=i,c=yield t.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:o,desc:a,picture:d},env:this.env,progressHook:this.progressHook}),l=`profile-${this.account}`;return this.cache.delete(l),c.profile})}}return mu.Profile=n,mu}var bu={},Y_;function YM(){if(Y_)return bu;Y_=1,Object.defineProperty(bu,"__esModule",{value:!0}),bu.Encryption=void 0;const e=$e,t=kn(),r=Mo(),n=lg();class s{constructor(o,a,d,c,l,u){this.account=o,this.env=a,this.decryptedPgpPvtKey=d,this.pgpPublicKey=c,this.signer=l,this.progressHook=u,this.userInstance=new n.User(this.account,this.env)}info(){return e.__awaiter(this,void 0,void 0,function*(){const o=yield this.userInstance.info();let a;if(this.signer){const d=JSON.stringify(JSON.parse(o.encryptedPrivateKey).encryptedPassword),c=this.account.toLowerCase().startsWith("scw")?{SCWPGP_V1:{encryptedPassword:d}}:{NFTPGP_V1:{encryptedPassword:d}};a=yield t.decryptAuth({account:this.account,env:this.env,signer:this.signer,progressHook:this.progressHook,additionalMeta:c})}return Object.assign({decryptedPgpPrivateKey:this.decryptedPgpPvtKey,pgpPublicKey:this.pgpPublicKey},a!=null?{decryptedPassword:a}:{})})}update(o,a){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(r.PushAPI.ensureSignerMessage());if(!this.decryptedPgpPvtKey||!this.pgpPublicKey)throw new Error(r.PushAPI.ensureSignerMessage());return yield t.auth.update({account:this.account,pgpEncryptionVersion:o,additionalMeta:a==null?void 0:a.versionMeta,progressHook:this.progressHook,signer:this.signer,env:this.env,pgpPrivateKey:this.decryptedPgpPvtKey,pgpPublicKey:this.pgpPublicKey})})}}return bu.Encryption=s,bu}var vu={},_u={},Yd={exports:{}},Jd={},cy={},ji={},wu={},$i={},Eu={},na={},uy={},$a={},Vi={},J_;function fg(){if(J_)return Vi;J_=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.ERROR_PACKET=Vi.PACKET_TYPES_REVERSE=Vi.PACKET_TYPES=void 0;const e=Object.create(null);Vi.PACKET_TYPES=e,e.open="0",e.close="1",e.ping="2",e.pong="3",e.message="4",e.upgrade="5",e.noop="6";const t=Object.create(null);Vi.PACKET_TYPES_REVERSE=t,Object.keys(e).forEach(n=>{t[e[n]]=n});const r={type:"error",data:"parser error"};return Vi.ERROR_PACKET=r,Vi}var Z_;function JM(){if(Z_)return $a;Z_=1,Object.defineProperty($a,"__esModule",{value:!0}),$a.encodePacket=void 0,$a.encodePacketToBinary=d;const e=fg(),t=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",r=typeof ArrayBuffer=="function",n=c=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(c):c&&c.buffer instanceof ArrayBuffer,s=({type:c,data:l},u,p)=>t&&l instanceof Blob?u?p(l):i(l,p):r&&(l instanceof ArrayBuffer||n(l))?u?p(l):i(new Blob([l]),p):p(e.PACKET_TYPES[c]+(l||""));$a.encodePacket=s;const i=(c,l)=>{const u=new FileReader;return u.onload=function(){const p=u.result.split(",")[1];l("b"+(p||""))},u.readAsDataURL(c)};function o(c){return c instanceof Uint8Array?c:c instanceof ArrayBuffer?new Uint8Array(c):new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}let a;function d(c,l){if(t&&c.data instanceof Blob)return c.data.arrayBuffer().then(o).then(l);if(r&&(c.data instanceof ArrayBuffer||n(c.data)))return l(o(c.data));s(c,!1,u=>{a||(a=new TextEncoder),l(a.encode(u))})}return $a}var Au={},ia={},X_;function ZM(){if(X_)return ia;X_=1,Object.defineProperty(ia,"__esModule",{value:!0}),ia.decode=ia.encode=void 0;const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<e.length;s++)t[e.charCodeAt(s)]=s;const r=s=>{let i=new Uint8Array(s),o,a=i.length,d="";for(o=0;o<a;o+=3)d+=e[i[o]>>2],d+=e[(i[o]&3)<<4|i[o+1]>>4],d+=e[(i[o+1]&15)<<2|i[o+2]>>6],d+=e[i[o+2]&63];return a%3===2?d=d.substring(0,d.length-1)+"=":a%3===1&&(d=d.substring(0,d.length-2)+"=="),d};ia.encode=r;const n=s=>{let i=s.length*.75,o=s.length,a,d=0,c,l,u,p;s[s.length-1]==="="&&(i--,s[s.length-2]==="="&&i--);const f=new ArrayBuffer(i),h=new Uint8Array(f);for(a=0;a<o;a+=4)c=t[s.charCodeAt(a)],l=t[s.charCodeAt(a+1)],u=t[s.charCodeAt(a+2)],p=t[s.charCodeAt(a+3)],h[d++]=c<<2|l>>4,h[d++]=(l&15)<<4|u>>2,h[d++]=(u&3)<<6|p&63;return f};return ia.decode=n,ia}var Q_;function XM(){if(Q_)return Au;Q_=1,Object.defineProperty(Au,"__esModule",{value:!0}),Au.decodePacket=void 0;const e=fg(),t=ZM(),r=typeof ArrayBuffer=="function",n=(o,a)=>{if(typeof o!="string")return{type:"message",data:i(o,a)};const d=o.charAt(0);return d==="b"?{type:"message",data:s(o.substring(1),a)}:e.PACKET_TYPES_REVERSE[d]?o.length>1?{type:e.PACKET_TYPES_REVERSE[d],data:o.substring(1)}:{type:e.PACKET_TYPES_REVERSE[d]}:e.ERROR_PACKET};Au.decodePacket=n;const s=(o,a)=>{if(r){const d=(0,t.decode)(o);return i(d,a)}else return{base64:!0,data:o}},i=(o,a)=>{switch(a){case"blob":return o instanceof Blob?o:new Blob([o]);case"arraybuffer":default:return o instanceof ArrayBuffer?o:o.buffer}};return Au}var e4;function id(){return e4||(e4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodePayload=e.decodePacket=e.encodePayload=e.encodePacket=e.protocol=void 0,e.createPacketEncoderStream=a,e.createPacketDecoderStream=u;const t=JM();Object.defineProperty(e,"encodePacket",{enumerable:!0,get:function(){return t.encodePacket}});const r=XM();Object.defineProperty(e,"decodePacket",{enumerable:!0,get:function(){return r.decodePacket}});const n=fg(),s=String.fromCharCode(30),i=(p,f)=>{const h=p.length,y=new Array(h);let m=0;p.forEach((b,v)=>{(0,t.encodePacket)(b,!1,E=>{y[v]=E,++m===h&&f(y.join(s))})})};e.encodePayload=i;const o=(p,f)=>{const h=p.split(s),y=[];for(let m=0;m<h.length;m++){const b=(0,r.decodePacket)(h[m],f);if(y.push(b),b.type==="error")break}return y};e.decodePayload=o;function a(){return new TransformStream({transform(p,f){(0,t.encodePacketToBinary)(p,h=>{const y=h.length;let m;if(y<126)m=new Uint8Array(1),new DataView(m.buffer).setUint8(0,y);else if(y<65536){m=new Uint8Array(3);const b=new DataView(m.buffer);b.setUint8(0,126),b.setUint16(1,y)}else{m=new Uint8Array(9);const b=new DataView(m.buffer);b.setUint8(0,127),b.setBigUint64(1,BigInt(y))}p.data&&typeof p.data!="string"&&(m[0]|=128),f.enqueue(m),f.enqueue(h)})}})}let d;function c(p){return p.reduce((f,h)=>f+h.length,0)}function l(p,f){if(p[0].length===f)return p.shift();const h=new Uint8Array(f);let y=0;for(let m=0;m<f;m++)h[m]=p[0][y++],y===p[0].length&&(p.shift(),y=0);return p.length&&y<p[0].length&&(p[0]=p[0].slice(y)),h}function u(p,f){d||(d=new TextDecoder);const h=[];let y=0,m=-1,b=!1;return new TransformStream({transform(v,E){for(h.push(v);;){if(y===0){if(c(h)<1)break;const _=l(h,1);b=(_[0]&128)===128,m=_[0]&127,m<126?y=3:m===126?y=1:y=2}else if(y===1){if(c(h)<2)break;const _=l(h,2);m=new DataView(_.buffer,_.byteOffset,_.length).getUint16(0),y=3}else if(y===2){if(c(h)<8)break;const _=l(h,8),C=new DataView(_.buffer,_.byteOffset,_.length),k=C.getUint32(0);if(k>Math.pow(2,53-32)-1){E.enqueue(n.ERROR_PACKET);break}m=k*Math.pow(2,32)+C.getUint32(4),y=3}else{if(c(h)<m)break;const _=l(h,m);E.enqueue((0,r.decodePacket)(b?_:d.decode(_),f)),y=0}if(m===0||m>p){E.enqueue(n.ERROR_PACKET);break}}}})}e.protocol=4}(uy)),uy}function dn(e){if(e)return QM(e)}function QM(e){for(var t in dn.prototype)e[t]=dn.prototype[t];return e}dn.prototype.on=dn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};dn.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this};dn.prototype.off=dn.prototype.removeListener=dn.prototype.removeAllListeners=dn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,s=0;s<r.length;s++)if(n=r[s],n===t||n.fn===t){r.splice(s,1);break}return r.length===0&&delete this._callbacks["$"+e],this};dn.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,t)}return this};dn.prototype.emitReserved=dn.prototype.emit;dn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};dn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const eO=Object.freeze(Object.defineProperty({__proto__:null,Emitter:dn},Symbol.toStringTag,{value:"Module"})),Co=Bl(eO);var sa={},ci={},t4;function Ro(){if(t4)return ci;t4=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.defaultBinaryType=ci.globalThisShim=ci.nextTick=void 0,ci.createCookieJar=e,ci.nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?r=>Promise.resolve().then(r):(r,n)=>n(r,0))(),ci.globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),ci.defaultBinaryType="arraybuffer";function e(){}return ci}var r4;function ko(){if(r4)return sa;r4=1,Object.defineProperty(sa,"__esModule",{value:!0}),sa.pick=t,sa.installTimerFunctions=s,sa.byteLength=o,sa.randomString=d;const e=Ro();function t(c,...l){return l.reduce((u,p)=>(c.hasOwnProperty(p)&&(u[p]=c[p]),u),{})}const r=e.globalThisShim.setTimeout,n=e.globalThisShim.clearTimeout;function s(c,l){l.useNativeTimers?(c.setTimeoutFn=r.bind(e.globalThisShim),c.clearTimeoutFn=n.bind(e.globalThisShim)):(c.setTimeoutFn=e.globalThisShim.setTimeout.bind(e.globalThisShim),c.clearTimeoutFn=e.globalThisShim.clearTimeout.bind(e.globalThisShim))}const i=1.33;function o(c){return typeof c=="string"?a(c):Math.ceil((c.byteLength||c.size)*i)}function a(c){let l=0,u=0;for(let p=0,f=c.length;p<f;p++)l=c.charCodeAt(p),l<128?u+=1:l<2048?u+=2:l<55296||l>=57344?u+=3:(p++,u+=4);return u}function d(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}return sa}var Su={},n4;function V9(){if(n4)return Su;n4=1,Object.defineProperty(Su,"__esModule",{value:!0}),Su.encode=e,Su.decode=t;function e(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function t(r){let n={},s=r.split("&");for(let i=0,o=s.length;i<o;i++){let a=s[i].split("=");n[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return n}return Su}var i4;function Fh(){if(i4)return na;i4=1;var e=Tt&&Tt.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(na,"__esModule",{value:!0}),na.Transport=na.TransportError=void 0;const t=id(),r=Co,n=ko(),s=V9(),o=(0,e(Kn()).default)("engine.io-client:transport");class a extends Error{constructor(l,u,p){super(l),this.description=u,this.context=p,this.type="TransportError"}}na.TransportError=a;class d extends r.Emitter{constructor(l){super(),this.writable=!1,(0,n.installTimerFunctions)(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,u,p){return super.emitReserved("error",new a(l,u,p)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"?this.write(l):o("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const u=(0,t.decodePacket)(l,this.socket.binaryType);this.onPacket(u)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,u={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(u)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const u=(0,s.encode)(l);return u.length?"?"+u:""}}return na.Transport=d,na}var s4;function F9(){if(s4)return Eu;s4=1;var e=Tt&&Tt.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Eu,"__esModule",{value:!0}),Eu.Polling=void 0;const t=Fh(),r=ko(),n=id(),i=(0,e(Kn()).default)("engine.io-client:polling");class o extends t.Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(d){this.readyState="pausing";const c=()=>{i("paused"),this.readyState="paused",d()};if(this._polling||!this.writable){let l=0;this._polling&&(i("we are currently polling - waiting to pause"),l++,this.once("pollComplete",function(){i("pre-pause polling complete"),--l||c()})),this.writable||(i("we are currently writing - waiting to pause"),l++,this.once("drain",function(){i("pre-pause writing complete"),--l||c()}))}else c()}_poll(){i("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(d){i("polling got data %s",d);const c=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};(0,n.decodePayload)(d,this.socket.binaryType).forEach(c),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():i('ignoring poll - transport state "%s"',this.readyState))}doClose(){const d=()=>{i("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(i("transport open - closing"),d()):(i("transport not open - deferring close"),this.once("open",d))}write(d){this.writable=!1,(0,n.encodePayload)(d,c=>{this.doWrite(c,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const d=this.opts.secure?"https":"http",c=this.query||{};return this.opts.timestampRequests!==!1&&(c[this.opts.timestampParam]=(0,r.randomString)()),!this.supportsBinary&&!c.sid&&(c.b64=1),this.createUri(d,c)}}return Eu.Polling=o,Eu}var Pu={},a4;function tO(){if(a4)return Pu;a4=1,Object.defineProperty(Pu,"__esModule",{value:!0}),Pu.hasCORS=void 0;let e=!1;try{e=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}return Pu.hasCORS=e,Pu}var o4;function Jy(){if(o4)return $i;o4=1;var e=Tt&&Tt.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty($i,"__esModule",{value:!0}),$i.XHR=$i.Request=$i.BaseXHR=void 0;const t=F9(),r=Co,n=ko(),s=Ro(),i=tO(),a=(0,e(Kn()).default)("engine.io-client:polling");function d(){}class c extends t.Polling{constructor(m){if(super(m),typeof location<"u"){const b=location.protocol==="https:";let v=location.port;v||(v=b?"443":"80"),this.xd=typeof location<"u"&&m.hostname!==location.hostname||v!==m.port}}doWrite(m,b){const v=this.request({method:"POST",data:m});v.on("success",b),v.on("error",(E,_)=>{this.onError("xhr post error",E,_)})}doPoll(){a("xhr poll");const m=this.request();m.on("data",this.onData.bind(this)),m.on("error",(b,v)=>{this.onError("xhr poll error",b,v)}),this.pollXhr=m}}$i.BaseXHR=c;class l extends r.Emitter{constructor(m,b,v){super(),this.createRequest=m,(0,n.installTimerFunctions)(this,v),this._opts=v,this._method=v.method||"GET",this._uri=b,this._data=v.data!==void 0?v.data:null,this._create()}_create(){var m;const b=(0,n.pick)(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");b.xdomain=!!this._opts.xd;const v=this._xhr=this.createRequest(b);try{a("xhr open %s: %s",this._method,this._uri),v.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){v.setDisableHeaderCheck&&v.setDisableHeaderCheck(!0);for(let E in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(E)&&v.setRequestHeader(E,this._opts.extraHeaders[E])}}catch{}if(this._method==="POST")try{v.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{v.setRequestHeader("Accept","*/*")}catch{}(m=this._opts.cookieJar)===null||m===void 0||m.addCookies(v),"withCredentials"in v&&(v.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(v.timeout=this._opts.requestTimeout),v.onreadystatechange=()=>{var E;v.readyState===3&&((E=this._opts.cookieJar)===null||E===void 0||E.parseCookies(v.getResponseHeader("set-cookie"))),v.readyState===4&&(v.status===200||v.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof v.status=="number"?v.status:0)},0))},a("xhr data %s",this._data),v.send(this._data)}catch(E){this.setTimeoutFn(()=>{this._onError(E)},0);return}typeof document<"u"&&(this._index=l.requestsCount++,l.requests[this._index]=this)}_onError(m){this.emitReserved("error",m,this._xhr),this._cleanup(!0)}_cleanup(m){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=d,m)try{this._xhr.abort()}catch{}typeof document<"u"&&delete l.requests[this._index],this._xhr=null}}_onLoad(){const m=this._xhr.responseText;m!==null&&(this.emitReserved("data",m),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if($i.Request=l,l.requestsCount=0,l.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",u);else if(typeof addEventListener=="function"){const y="onpagehide"in s.globalThisShim?"pagehide":"unload";addEventListener(y,u,!1)}}function u(){for(let y in l.requests)l.requests.hasOwnProperty(y)&&l.requests[y].abort()}const p=function(){const y=h({xdomain:!1});return y&&y.responseType!==null}();class f extends c{constructor(m){super(m);const b=m&&m.forceBase64;this.supportsBinary=p&&!b}request(m={}){return Object.assign(m,{xd:this.xd},this.opts),new l(h,this.uri(),m)}}$i.XHR=f;function h(y){const m=y.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!m||i.hasCORS))return new XMLHttpRequest}catch{}if(!m)try{return new s.globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}return $i}var aa={},c4;function Zy(){if(c4)return aa;c4=1;var e=Tt&&Tt.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(aa,"__esModule",{value:!0}),aa.WS=aa.BaseWS=void 0;const t=Fh(),r=ko(),n=id(),s=Ro(),o=(0,e(Kn()).default)("engine.io-client:websocket"),a=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class d extends t.Transport{get name(){return"websocket"}doOpen(){const p=this.uri(),f=this.opts.protocols,h=a?{}:(0,r.pick)(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(h.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(p,f,h)}catch(y){return this.emitReserved("error",y)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=p=>this.onClose({description:"websocket connection closed",context:p}),this.ws.onmessage=p=>this.onData(p.data),this.ws.onerror=p=>this.onError("websocket error",p)}write(p){this.writable=!1;for(let f=0;f<p.length;f++){const h=p[f],y=f===p.length-1;(0,n.encodePacket)(h,this.supportsBinary,m=>{try{this.doWrite(h,m)}catch{o("websocket closed before onclose event")}y&&(0,s.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const p=this.opts.secure?"wss":"ws",f=this.query||{};return this.opts.timestampRequests&&(f[this.opts.timestampParam]=(0,r.randomString)()),this.supportsBinary||(f.b64=1),this.createUri(p,f)}}aa.BaseWS=d;const c=s.globalThisShim.WebSocket||s.globalThisShim.MozWebSocket;class l extends d{createSocket(p,f,h){return a?new c(p,f,h):f?new c(p,f):new c(p)}doWrite(p,f){this.ws.send(f)}}return aa.WS=l,aa}var Tu={},u4;function H9(){if(u4)return Tu;u4=1;var e=Tt&&Tt.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Tu,"__esModule",{value:!0}),Tu.WT=void 0;const t=Fh(),r=Ro(),n=id(),i=(0,e(Kn()).default)("engine.io-client:webtransport");class o extends t.Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(d){return this.emitReserved("error",d)}this._transport.closed.then(()=>{i("transport closed gracefully"),this.onClose()}).catch(d=>{i("transport closed due to %s",d),this.onError("webtransport error",d)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(d=>{const c=(0,n.createPacketDecoderStream)(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=d.readable.pipeThrough(c).getReader(),u=(0,n.createPacketEncoderStream)();u.readable.pipeTo(d.writable),this._writer=u.writable.getWriter();const p=()=>{l.read().then(({done:h,value:y})=>{if(h){i("session is closed");return}i("received chunk: %o",y),this.onPacket(y),p()}).catch(h=>{i("an error occurred while reading: %s",h)})};p();const f={type:"open"};this.query.sid&&(f.data=`{"sid":"${this.query.sid}"}`),this._writer.write(f).then(()=>this.onOpen())})})}write(d){this.writable=!1;for(let c=0;c<d.length;c++){const l=d[c],u=c===d.length-1;this._writer.write(l).then(()=>{u&&(0,r.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var d;(d=this._transport)===null||d===void 0||d.close()}}return Tu.WT=o,Tu}var l4;function G9(){if(l4)return wu;l4=1,Object.defineProperty(wu,"__esModule",{value:!0}),wu.transports=void 0;const e=Jy(),t=Zy(),r=H9();return wu.transports={websocket:t.WS,webtransport:r.WT,polling:e.XHR},wu}var Zd={},d4;function z9(){if(d4)return Zd;d4=1,Object.defineProperty(Zd,"__esModule",{value:!0}),Zd.parse=r;const e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,t=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function r(i){if(i.length>8e3)throw"URI too long";const o=i,a=i.indexOf("["),d=i.indexOf("]");a!=-1&&d!=-1&&(i=i.substring(0,a)+i.substring(a,d).replace(/:/g,";")+i.substring(d,i.length));let c=e.exec(i||""),l={},u=14;for(;u--;)l[t[u]]=c[u]||"";return a!=-1&&d!=-1&&(l.source=o,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=n(l,l.path),l.queryKey=s(l,l.query),l}function n(i,o){const a=/\/{2,9}/g,d=o.replace(a,"/").split("/");return(o.slice(0,1)=="/"||o.length===0)&&d.splice(0,1),o.slice(-1)=="/"&&d.splice(d.length-1,1),d}function s(i,o){const a={};return o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(d,c,l){c&&(a[c]=l)}),a}return Zd}var f4;function h4(){if(f4)return ji;f4=1;var e=Tt&&Tt.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(ji,"__esModule",{value:!0}),ji.Socket=ji.SocketWithUpgrade=ji.SocketWithoutUpgrade=void 0;const t=G9(),r=ko(),n=V9(),s=z9(),i=Co,o=id(),a=Ro(),c=(0,e(Kn()).default)("engine.io-client:socket"),l=typeof addEventListener=="function"&&typeof removeEventListener=="function",u=[];l&&addEventListener("offline",()=>{c("closing %d connection(s) because the network was lost",u.length),u.forEach(y=>y())},!1);class p extends i.Emitter{constructor(m,b){if(super(),this.binaryType=a.defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,m&&typeof m=="object"&&(b=m,m=null),m){const v=(0,s.parse)(m);b.hostname=v.host,b.secure=v.protocol==="https"||v.protocol==="wss",b.port=v.port,v.query&&(b.query=v.query)}else b.host&&(b.hostname=(0,s.parse)(b.host).host);(0,r.installTimerFunctions)(this,b),this.secure=b.secure!=null?b.secure:typeof location<"u"&&location.protocol==="https:",b.hostname&&!b.port&&(b.port=this.secure?"443":"80"),this.hostname=b.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=b.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},b.transports.forEach(v=>{const E=v.prototype.name;this.transports.push(E),this._transportsByName[E]=v}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},b),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=(0,n.decode)(this.opts.query)),l&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(c("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},u.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=(0,a.createCookieJar)()),this._open()}createTransport(m){c('creating transport "%s"',m);const b=Object.assign({},this.opts.query);b.EIO=o.protocol,b.transport=m,this.id&&(b.sid=this.id);const v=Object.assign({},this.opts,{query:b,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[m]);return c("options: %j",v),new this._transportsByName[m](v)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const m=this.opts.rememberUpgrade&&p.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const b=this.createTransport(m);b.open(),this.setTransport(b)}setTransport(m){c("setting transport %s",m.name),this.transport&&(c("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=m,m.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",b=>this._onClose("transport close",b))}onOpen(){c("socket open"),this.readyState="open",p.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(m){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(c('socket receive: type "%s", data "%s"',m.type,m.data),this.emitReserved("packet",m),this.emitReserved("heartbeat"),m.type){case"open":this.onHandshake(JSON.parse(m.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const b=new Error("server error");b.code=m.data,this._onError(b);break;case"message":this.emitReserved("data",m.data),this.emitReserved("message",m.data);break}else c('packet received with socket readyState "%s"',this.readyState)}onHandshake(m){this.emitReserved("handshake",m),this.id=m.sid,this.transport.query.sid=m.sid,this._pingInterval=m.pingInterval,this._pingTimeout=m.pingTimeout,this._maxPayload=m.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const m=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+m,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},m),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const m=this._getWritablePackets();c("flushing %d packets in socket",m.length),this.transport.send(m),this._prevBufferLen=m.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let b=1;for(let v=0;v<this.writeBuffer.length;v++){const E=this.writeBuffer[v].data;if(E&&(b+=(0,r.byteLength)(E)),v>0&&b>this._maxPayload)return c("only send %d out of %d packets",v,this.writeBuffer.length),this.writeBuffer.slice(0,v);b+=2}return c("payload size is %d (max: %d)",b,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const m=Date.now()>this._pingTimeoutTime;return m&&(c("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,(0,a.nextTick)(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),m}write(m,b,v){return this._sendPacket("message",m,b,v),this}send(m,b,v){return this._sendPacket("message",m,b,v),this}_sendPacket(m,b,v,E){if(typeof b=="function"&&(E=b,b=void 0),typeof v=="function"&&(E=v,v=null),this.readyState==="closing"||this.readyState==="closed")return;v=v||{},v.compress=v.compress!==!1;const _={type:m,data:b,options:v};this.emitReserved("packetCreate",_),this.writeBuffer.push(_),E&&this.once("flush",E),this.flush()}close(){const m=()=>{this._onClose("forced close"),c("socket closing - telling transport to close"),this.transport.close()},b=()=>{this.off("upgrade",b),this.off("upgradeError",b),m()},v=()=>{this.once("upgrade",b),this.once("upgradeError",b)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?v():m()}):this.upgrading?v():m()),this}_onError(m){if(c("socket error %j",m),p.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return c("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",m),this._onClose("transport error",m)}_onClose(m,b){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(c('socket close with reason: "%s"',m),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),l&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const v=u.indexOf(this._offlineEventListener);v!==-1&&(c("removing listener for the 'offline' event"),u.splice(v,1))}this.readyState="closed",this.id=null,this.emitReserved("close",m,b),this.writeBuffer=[],this._prevBufferLen=0}}}ji.SocketWithoutUpgrade=p,p.protocol=o.protocol;class f extends p{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){c("starting upgrade probes");for(let m=0;m<this._upgrades.length;m++)this._probe(this._upgrades[m])}}_probe(m){c('probing transport "%s"',m);let b=this.createTransport(m),v=!1;p.priorWebsocketSuccess=!1;const E=()=>{v||(c('probe transport "%s" opened',m),b.send([{type:"ping",data:"probe"}]),b.once("packet",I=>{if(!v)if(I.type==="pong"&&I.data==="probe"){if(c('probe transport "%s" pong',m),this.upgrading=!0,this.emitReserved("upgrading",b),!b)return;p.priorWebsocketSuccess=b.name==="websocket",c('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{v||this.readyState!=="closed"&&(c("changing transport and sending upgrade packet"),S(),this.setTransport(b),b.send([{type:"upgrade"}]),this.emitReserved("upgrade",b),b=null,this.upgrading=!1,this.flush())})}else{c('probe transport "%s" failed',m);const T=new Error("probe error");T.transport=b.name,this.emitReserved("upgradeError",T)}}))};function _(){v||(v=!0,S(),b.close(),b=null)}const C=I=>{const T=new Error("probe error: "+I);T.transport=b.name,_(),c('probe transport "%s" failed because of error: %s',m,I),this.emitReserved("upgradeError",T)};function k(){C("transport closed")}function D(){C("socket closed")}function w(I){b&&I.name!==b.name&&(c('"%s" works - aborting "%s"',I.name,b.name),_())}const S=()=>{b.removeListener("open",E),b.removeListener("error",C),b.removeListener("close",k),this.off("close",D),this.off("upgrading",w)};b.once("open",E),b.once("error",C),b.once("close",k),this.once("close",D),this.once("upgrading",w),this._upgrades.indexOf("webtransport")!==-1&&m!=="webtransport"?this.setTimeoutFn(()=>{v||b.open()},200):b.open()}onHandshake(m){this._upgrades=this._filterUpgrades(m.upgrades),super.onHandshake(m)}_filterUpgrades(m){const b=[];for(let v=0;v<m.length;v++)~this.transports.indexOf(m[v])&&b.push(m[v]);return b}}ji.SocketWithUpgrade=f;class h extends f{constructor(m,b={}){const v=typeof m=="object"?m:b;(!v.transports||v.transports&&typeof v.transports[0]=="string")&&(v.transports=(v.transports||["polling","websocket","webtransport"]).map(E=>t.transports[E]).filter(E=>!!E)),super(m,v)}}return ji.Socket=h,ji}var Iu={},p4;function rO(){if(p4)return Iu;p4=1,Object.defineProperty(Iu,"__esModule",{value:!0}),Iu.Fetch=void 0;const e=F9();class t extends e.Polling{doPoll(){this._fetch().then(n=>{if(!n.ok)return this.onError("fetch read error",n.status,n);n.text().then(s=>this.onData(s))}).catch(n=>{this.onError("fetch read error",n)})}doWrite(n,s){this._fetch(n).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);s()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(n){var s;const i=n!==void 0,o=new Headers(this.opts.extraHeaders);return i&&o.set("content-type","text/plain;charset=UTF-8"),(s=this.socket._cookieJar)===null||s===void 0||s.appendCookies(o),fetch(this.uri(),{method:i?"POST":"GET",body:i?n:null,headers:o,credentials:this.opts.withCredentials?"include":"omit"}).then(a=>{var d;return(d=this.socket._cookieJar)===null||d===void 0||d.parseCookies(a.headers.getSetCookie()),a})}}return Iu.Fetch=t,Iu}var y4;function hg(){return y4||(y4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WebTransport=e.WebSocket=e.NodeWebSocket=e.XHR=e.NodeXHR=e.Fetch=e.nextTick=e.parse=e.installTimerFunctions=e.transports=e.TransportError=e.Transport=e.protocol=e.SocketWithUpgrade=e.SocketWithoutUpgrade=e.Socket=void 0;const t=h4();Object.defineProperty(e,"Socket",{enumerable:!0,get:function(){return t.Socket}});var r=h4();Object.defineProperty(e,"SocketWithoutUpgrade",{enumerable:!0,get:function(){return r.SocketWithoutUpgrade}}),Object.defineProperty(e,"SocketWithUpgrade",{enumerable:!0,get:function(){return r.SocketWithUpgrade}}),e.protocol=t.Socket.protocol;var n=Fh();Object.defineProperty(e,"Transport",{enumerable:!0,get:function(){return n.Transport}}),Object.defineProperty(e,"TransportError",{enumerable:!0,get:function(){return n.TransportError}});var s=G9();Object.defineProperty(e,"transports",{enumerable:!0,get:function(){return s.transports}});var i=ko();Object.defineProperty(e,"installTimerFunctions",{enumerable:!0,get:function(){return i.installTimerFunctions}});var o=z9();Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return o.parse}});var a=Ro();Object.defineProperty(e,"nextTick",{enumerable:!0,get:function(){return a.nextTick}});var d=rO();Object.defineProperty(e,"Fetch",{enumerable:!0,get:function(){return d.Fetch}});var c=Jy();Object.defineProperty(e,"NodeXHR",{enumerable:!0,get:function(){return c.XHR}});var l=Jy();Object.defineProperty(e,"XHR",{enumerable:!0,get:function(){return l.XHR}});var u=Zy();Object.defineProperty(e,"NodeWebSocket",{enumerable:!0,get:function(){return u.WS}});var p=Zy();Object.defineProperty(e,"WebSocket",{enumerable:!0,get:function(){return p.WS}});var f=H9();Object.defineProperty(e,"WebTransport",{enumerable:!0,get:function(){return f.WT}})}(cy)),cy}var g4;function nO(){if(g4)return Jd;g4=1;var e=Tt&&Tt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.url=s;const t=hg(),n=(0,e(Kn()).default)("socket.io-client:url");function s(i,o="",a){let d=i;a=a||typeof location<"u"&&location,i==null&&(i=a.protocol+"//"+a.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=a.protocol+i:i=a.host+i),/^(https?|wss?):\/\//.test(i)||(n("protocol-less url %s",i),typeof a<"u"?i=a.protocol+"//"+i:i="https://"+i),n("parse %s",i),d=(0,t.parse)(i)),d.port||(/^(http|ws)$/.test(d.protocol)?d.port="80":/^(http|ws)s$/.test(d.protocol)&&(d.port="443")),d.path=d.path||"/";const l=d.host.indexOf(":")!==-1?"["+d.host+"]":d.host;return d.id=d.protocol+"://"+l+":"+d.port+o,d.href=d.protocol+"://"+l+(a&&a.port===d.port?"":":"+d.port),d}return Jd}var Cu={},Ru={},On={},ku={},Mu={},m4;function W9(){if(m4)return Mu;m4=1,Object.defineProperty(Mu,"__esModule",{value:!0}),Mu.isBinary=i,Mu.hasBinary=o;const e=typeof ArrayBuffer=="function",t=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,r=Object.prototype.toString,n=typeof Blob=="function"||typeof Blob<"u"&&r.call(Blob)==="[object BlobConstructor]",s=typeof File=="function"||typeof File<"u"&&r.call(File)==="[object FileConstructor]";function i(a){return e&&(a instanceof ArrayBuffer||t(a))||n&&a instanceof Blob||s&&a instanceof File}function o(a,d){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let c=0,l=a.length;c<l;c++)if(o(a[c]))return!0;return!1}if(i(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return o(a.toJSON(),!0);for(const c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&o(a[c]))return!0;return!1}return Mu}var b4;function iO(){if(b4)return ku;b4=1,Object.defineProperty(ku,"__esModule",{value:!0}),ku.deconstructPacket=t,ku.reconstructPacket=n;const e=W9();function t(i){const o=[],a=i.data,d=i;return d.data=r(a,o),d.attachments=o.length,{packet:d,buffers:o}}function r(i,o){if(!i)return i;if((0,e.isBinary)(i)){const a={_placeholder:!0,num:o.length};return o.push(i),a}else if(Array.isArray(i)){const a=new Array(i.length);for(let d=0;d<i.length;d++)a[d]=r(i[d],o);return a}else if(typeof i=="object"&&!(i instanceof Date)){const a={};for(const d in i)Object.prototype.hasOwnProperty.call(i,d)&&(a[d]=r(i[d],o));return a}return i}function n(i,o){return i.data=s(i.data,o),delete i.attachments,i}function s(i,o){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<o.length)return o[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let a=0;a<i.length;a++)i[a]=s(i[a],o);else if(typeof i=="object")for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(i[a]=s(i[a],o));return i}return ku}var v4;function pg(){if(v4)return On;v4=1,Object.defineProperty(On,"__esModule",{value:!0}),On.Decoder=On.Encoder=On.PacketType=On.protocol=void 0,On.isPacketValid=y;const e=Co,t=iO(),r=W9(),s=(0,Kn().default)("socket.io-parser"),i=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];On.protocol=5;var o;(function(m){m[m.CONNECT=0]="CONNECT",m[m.DISCONNECT=1]="DISCONNECT",m[m.EVENT=2]="EVENT",m[m.ACK=3]="ACK",m[m.CONNECT_ERROR=4]="CONNECT_ERROR",m[m.BINARY_EVENT=5]="BINARY_EVENT",m[m.BINARY_ACK=6]="BINARY_ACK"})(o||(On.PacketType=o={}));class a{constructor(b){this.replacer=b}encode(b){return s("encoding packet %j",b),(b.type===o.EVENT||b.type===o.ACK)&&(0,r.hasBinary)(b)?this.encodeAsBinary({type:b.type===o.EVENT?o.BINARY_EVENT:o.BINARY_ACK,nsp:b.nsp,data:b.data,id:b.id}):[this.encodeAsString(b)]}encodeAsString(b){let v=""+b.type;return(b.type===o.BINARY_EVENT||b.type===o.BINARY_ACK)&&(v+=b.attachments+"-"),b.nsp&&b.nsp!=="/"&&(v+=b.nsp+","),b.id!=null&&(v+=b.id),b.data!=null&&(v+=JSON.stringify(b.data,this.replacer)),s("encoded %j as %s",b,v),v}encodeAsBinary(b){const v=(0,t.deconstructPacket)(b),E=this.encodeAsString(v.packet),_=v.buffers;return _.unshift(E),_}}On.Encoder=a;class d extends e.Emitter{constructor(b){super(),this.reviver=b}add(b){let v;if(typeof b=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");v=this.decodeString(b);const E=v.type===o.BINARY_EVENT;E||v.type===o.BINARY_ACK?(v.type=E?o.EVENT:o.ACK,this.reconstructor=new c(v),v.attachments===0&&super.emitReserved("decoded",v)):super.emitReserved("decoded",v)}else if((0,r.isBinary)(b)||b.base64)if(this.reconstructor)v=this.reconstructor.takeBinaryData(b),v&&(this.reconstructor=null,super.emitReserved("decoded",v));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+b)}decodeString(b){let v=0;const E={type:Number(b.charAt(0))};if(o[E.type]===void 0)throw new Error("unknown packet type "+E.type);if(E.type===o.BINARY_EVENT||E.type===o.BINARY_ACK){const C=v+1;for(;b.charAt(++v)!=="-"&&v!=b.length;);const k=b.substring(C,v);if(k!=Number(k)||b.charAt(v)!=="-")throw new Error("Illegal attachments");E.attachments=Number(k)}if(b.charAt(v+1)==="/"){const C=v+1;for(;++v&&!(b.charAt(v)===","||v===b.length););E.nsp=b.substring(C,v)}else E.nsp="/";const _=b.charAt(v+1);if(_!==""&&Number(_)==_){const C=v+1;for(;++v;){const k=b.charAt(v);if(k==null||Number(k)!=k){--v;break}if(v===b.length)break}E.id=Number(b.substring(C,v+1))}if(b.charAt(++v)){const C=this.tryParse(b.substr(v));if(d.isPayloadValid(E.type,C))E.data=C;else throw new Error("invalid payload")}return s("decoded %s as %j",b,E),E}tryParse(b){try{return JSON.parse(b,this.reviver)}catch{return!1}}static isPayloadValid(b,v){switch(b){case o.CONNECT:return f(v);case o.DISCONNECT:return v===void 0;case o.CONNECT_ERROR:return typeof v=="string"||f(v);case o.EVENT:case o.BINARY_EVENT:return Array.isArray(v)&&(typeof v[0]=="number"||typeof v[0]=="string"&&i.indexOf(v[0])===-1);case o.ACK:case o.BINARY_ACK:return Array.isArray(v)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}On.Decoder=d;class c{constructor(b){this.packet=b,this.buffers=[],this.reconPack=b}takeBinaryData(b){if(this.buffers.push(b),this.buffers.length===this.reconPack.attachments){const v=(0,t.reconstructPacket)(this.reconPack,this.buffers);return this.finishedReconstruction(),v}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function l(m){return typeof m=="string"}const u=Number.isInteger||function(m){return typeof m=="number"&&isFinite(m)&&Math.floor(m)===m};function p(m){return m===void 0||u(m)}function f(m){return Object.prototype.toString.call(m)==="[object Object]"}function h(m,b){switch(m){case o.CONNECT:return b===void 0||f(b);case o.DISCONNECT:return b===void 0;case o.EVENT:return Array.isArray(b)&&(typeof b[0]=="number"||typeof b[0]=="string"&&i.indexOf(b[0])===-1);case o.ACK:return Array.isArray(b);case o.CONNECT_ERROR:return typeof b=="string"||f(b);default:return!1}}function y(m){return l(m.nsp)&&p(m.id)&&h(m.type,m.data)}return On}var Xd={},_4;function Y9(){if(_4)return Xd;_4=1,Object.defineProperty(Xd,"__esModule",{value:!0}),Xd.on=e;function e(t,r,n){return t.on(r,n),function(){t.off(r,n)}}return Xd}var w4;function J9(){if(w4)return Ru;w4=1;var e=Tt&&Tt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(Ru,"__esModule",{value:!0}),Ru.Socket=void 0;const t=pg(),r=Y9(),n=Co,i=(0,e(Kn()).default)("socket.io-client:socket"),o=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class a extends n.Emitter{constructor(c,l,u){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=c,this.nsp=l,u&&u.auth&&(this.auth=u.auth),this._opts=Object.assign({},u),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const c=this.io;this.subs=[(0,r.on)(c,"open",this.onopen.bind(this)),(0,r.on)(c,"packet",this.onpacket.bind(this)),(0,r.on)(c,"error",this.onerror.bind(this)),(0,r.on)(c,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...c){return c.unshift("message"),this.emit.apply(this,c),this}emit(c,...l){var u,p,f;if(o.hasOwnProperty(c))throw new Error('"'+c.toString()+'" is a reserved event name');if(l.unshift(c),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(l),this;const h={type:t.PacketType.EVENT,data:l};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof l[l.length-1]=="function"){const v=this.ids++;i("emitting packet with ack id %d",v);const E=l.pop();this._registerAckCallback(v,E),h.id=v}const y=(p=(u=this.io.engine)===null||u===void 0?void 0:u.transport)===null||p===void 0?void 0:p.writable,m=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!y?i("discard packet as the transport is not currently writable"):m?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h),this.flags={},this}_registerAckCallback(c,l){var u;const p=(u=this.flags.timeout)!==null&&u!==void 0?u:this._opts.ackTimeout;if(p===void 0){this.acks[c]=l;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[c];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===c&&(i("removing packet with ack id %d from the buffer",c),this.sendBuffer.splice(y,1));i("event with ack id %d has timed out after %d ms",c,p),l.call(this,new Error("operation has timed out"))},p),h=(...y)=>{this.io.clearTimeoutFn(f),l.apply(this,y)};h.withError=!0,this.acks[c]=h}emitWithAck(c,...l){return new Promise((u,p)=>{const f=(h,y)=>h?p(h):u(y);f.withError=!0,l.push(f),this.emit(c,...l)})}_addToQueue(c){let l;typeof c[c.length-1]=="function"&&(l=c.pop());const u={id:this._queueSeq++,tryCount:0,pending:!1,args:c,flags:Object.assign({fromQueue:!0},this.flags)};c.push((p,...f)=>u!==this._queue[0]?i("packet [%d] already acknowledged",u.id):(p!==null?u.tryCount>this._opts.retries&&(i("packet [%d] is discarded after %d tries",u.id,u.tryCount),this._queue.shift(),l&&l(p)):(i("packet [%d] was successfully sent",u.id),this._queue.shift(),l&&l(null,...f)),u.pending=!1,this._drainQueue())),this._queue.push(u),this._drainQueue()}_drainQueue(c=!1){if(i("draining queue"),!this.connected||this._queue.length===0)return;const l=this._queue[0];if(l.pending&&!c){i("packet [%d] has already been sent and is waiting for an ack",l.id);return}l.pending=!0,l.tryCount++,i("sending packet [%d] (try n°%d)",l.id,l.tryCount),this.flags=l.flags,this.emit.apply(this,l.args)}packet(c){c.nsp=this.nsp,this.io._packet(c)}onopen(){i("transport is open - connecting"),typeof this.auth=="function"?this.auth(c=>{this._sendConnectPacket(c)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(c){this.packet({type:t.PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},c):c})}onerror(c){this.connected||this.emitReserved("connect_error",c)}onclose(c,l){i("close (%s)",c),this.connected=!1,delete this.id,this.emitReserved("disconnect",c,l),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(c=>{if(!this.sendBuffer.some(u=>String(u.id)===c)){const u=this.acks[c];delete this.acks[c],u.withError&&u.call(this,new Error("socket has been disconnected"))}})}onpacket(c){if(c.nsp===this.nsp)switch(c.type){case t.PacketType.CONNECT:c.data&&c.data.sid?this.onconnect(c.data.sid,c.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case t.PacketType.EVENT:case t.PacketType.BINARY_EVENT:this.onevent(c);break;case t.PacketType.ACK:case t.PacketType.BINARY_ACK:this.onack(c);break;case t.PacketType.DISCONNECT:this.ondisconnect();break;case t.PacketType.CONNECT_ERROR:this.destroy();const u=new Error(c.data.message);u.data=c.data.data,this.emitReserved("connect_error",u);break}}onevent(c){const l=c.data||[];i("emitting event %j",l),c.id!=null&&(i("attaching ack callback to event"),l.push(this.ack(c.id))),this.connected?this.emitEvent(l):this.receiveBuffer.push(Object.freeze(l))}emitEvent(c){if(this._anyListeners&&this._anyListeners.length){const l=this._anyListeners.slice();for(const u of l)u.apply(this,c)}super.emit.apply(this,c),this._pid&&c.length&&typeof c[c.length-1]=="string"&&(this._lastOffset=c[c.length-1])}ack(c){const l=this;let u=!1;return function(...p){u||(u=!0,i("sending ack %j",p),l.packet({type:t.PacketType.ACK,id:c,data:p}))}}onack(c){const l=this.acks[c.id];if(typeof l!="function"){i("bad ack %s",c.id);return}delete this.acks[c.id],i("calling ack %s with %j",c.id,c.data),l.withError&&c.data.unshift(null),l.apply(this,c.data)}onconnect(c,l){i("socket connected with id %s",c),this.id=c,this.recovered=l&&this._pid===l,this._pid=l,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(c=>this.emitEvent(c)),this.receiveBuffer=[],this.sendBuffer.forEach(c=>{this.notifyOutgoingListeners(c),this.packet(c)}),this.sendBuffer=[]}ondisconnect(){i("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(c=>c()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(i("performing disconnect (%s)",this.nsp),this.packet({type:t.PacketType.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(c){return this.flags.compress=c,this}get volatile(){return this.flags.volatile=!0,this}timeout(c){return this.flags.timeout=c,this}onAny(c){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(c),this}prependAny(c){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(c),this}offAny(c){if(!this._anyListeners)return this;if(c){const l=this._anyListeners;for(let u=0;u<l.length;u++)if(c===l[u])return l.splice(u,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(c){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(c),this}prependAnyOutgoing(c){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(c),this}offAnyOutgoing(c){if(!this._anyOutgoingListeners)return this;if(c){const l=this._anyOutgoingListeners;for(let u=0;u<l.length;u++)if(c===l[u])return l.splice(u,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(c){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const l=this._anyOutgoingListeners.slice();for(const u of l)u.apply(this,c.data)}}}return Ru.Socket=a,Ru}var Qd={},E4;function sO(){if(E4)return Qd;E4=1,Object.defineProperty(Qd,"__esModule",{value:!0}),Qd.Backoff=e;function e(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}return e.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),n=Math.floor(r*this.jitter*t);t=Math.floor(r*10)&1?t+n:t-n}return Math.min(t,this.max)|0},e.prototype.reset=function(){this.attempts=0},e.prototype.setMin=function(t){this.ms=t},e.prototype.setMax=function(t){this.max=t},e.prototype.setJitter=function(t){this.jitter=t},Qd}var A4;function aO(){if(A4)return Cu;A4=1;var e=Tt&&Tt.__createBinding||(Object.create?function(f,h,y,m){m===void 0&&(m=y);var b=Object.getOwnPropertyDescriptor(h,y);(!b||("get"in b?!h.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return h[y]}}),Object.defineProperty(f,m,b)}:function(f,h,y,m){m===void 0&&(m=y),f[m]=h[y]}),t=Tt&&Tt.__setModuleDefault||(Object.create?function(f,h){Object.defineProperty(f,"default",{enumerable:!0,value:h})}:function(f,h){f.default=h}),r=Tt&&Tt.__importStar||function(f){if(f&&f.__esModule)return f;var h={};if(f!=null)for(var y in f)y!=="default"&&Object.prototype.hasOwnProperty.call(f,y)&&e(h,f,y);return t(h,f),h},n=Tt&&Tt.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(Cu,"__esModule",{value:!0}),Cu.Manager=void 0;const s=hg(),i=J9(),o=r(pg()),a=Y9(),d=sO(),c=Co,u=(0,n(Kn()).default)("socket.io-client:manager");class p extends c.Emitter{constructor(h,y){var m;super(),this.nsps={},this.subs=[],h&&typeof h=="object"&&(y=h,h=void 0),y=y||{},y.path=y.path||"/socket.io",this.opts=y,(0,s.installTimerFunctions)(this,y),this.reconnection(y.reconnection!==!1),this.reconnectionAttempts(y.reconnectionAttempts||1/0),this.reconnectionDelay(y.reconnectionDelay||1e3),this.reconnectionDelayMax(y.reconnectionDelayMax||5e3),this.randomizationFactor((m=y.randomizationFactor)!==null&&m!==void 0?m:.5),this.backoff=new d.Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(y.timeout==null?2e4:y.timeout),this._readyState="closed",this.uri=h;const b=y.parser||o;this.encoder=new b.Encoder,this.decoder=new b.Decoder,this._autoConnect=y.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(h){return arguments.length?(this._reconnection=!!h,h||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(h){return h===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=h,this)}reconnectionDelay(h){var y;return h===void 0?this._reconnectionDelay:(this._reconnectionDelay=h,(y=this.backoff)===null||y===void 0||y.setMin(h),this)}randomizationFactor(h){var y;return h===void 0?this._randomizationFactor:(this._randomizationFactor=h,(y=this.backoff)===null||y===void 0||y.setJitter(h),this)}reconnectionDelayMax(h){var y;return h===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=h,(y=this.backoff)===null||y===void 0||y.setMax(h),this)}timeout(h){return arguments.length?(this._timeout=h,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(h){if(u("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=new s.Socket(this.uri,this.opts);const y=this.engine,m=this;this._readyState="opening",this.skipReconnect=!1;const b=(0,a.on)(y,"open",function(){m.onopen(),h&&h()}),v=_=>{u("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",_),h?h(_):this.maybeReconnectOnOpen()},E=(0,a.on)(y,"error",v);if(this._timeout!==!1){const _=this._timeout;u("connect attempt will timeout after %d",_);const C=this.setTimeoutFn(()=>{u("connect attempt timed out after %d",_),b(),v(new Error("timeout")),y.close()},_);this.opts.autoUnref&&C.unref(),this.subs.push(()=>{this.clearTimeoutFn(C)})}return this.subs.push(b),this.subs.push(E),this}connect(h){return this.open(h)}onopen(){u("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");const h=this.engine;this.subs.push((0,a.on)(h,"ping",this.onping.bind(this)),(0,a.on)(h,"data",this.ondata.bind(this)),(0,a.on)(h,"error",this.onerror.bind(this)),(0,a.on)(h,"close",this.onclose.bind(this)),(0,a.on)(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(h){try{this.decoder.add(h)}catch(y){this.onclose("parse error",y)}}ondecoded(h){(0,s.nextTick)(()=>{this.emitReserved("packet",h)},this.setTimeoutFn)}onerror(h){u("error",h),this.emitReserved("error",h)}socket(h,y){let m=this.nsps[h];return m?this._autoConnect&&!m.active&&m.connect():(m=new i.Socket(this,h,y),this.nsps[h]=m),m}_destroy(h){const y=Object.keys(this.nsps);for(const m of y)if(this.nsps[m].active){u("socket %s is still active, skipping close",m);return}this._close()}_packet(h){u("writing packet %j",h);const y=this.encoder.encode(h);for(let m=0;m<y.length;m++)this.engine.write(y[m],h.options)}cleanup(){u("cleanup"),this.subs.forEach(h=>h()),this.subs.length=0,this.decoder.destroy()}_close(){u("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(h,y){var m;u("closed due to %s",h),this.cleanup(),(m=this.engine)===null||m===void 0||m.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",h,y),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const h=this;if(this.backoff.attempts>=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const y=this.backoff.duration();u("will wait %dms before reconnect attempt",y),this._reconnecting=!0;const m=this.setTimeoutFn(()=>{h.skipReconnect||(u("attempting reconnect"),this.emitReserved("reconnect_attempt",h.backoff.attempts),!h.skipReconnect&&h.open(b=>{b?(u("reconnect attempt error"),h._reconnecting=!1,h.reconnect(),this.emitReserved("reconnect_error",b)):(u("reconnect success"),h.onreconnect())}))},y);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}}onreconnect(){const h=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",h)}}return Cu.Manager=p,Cu}var S4;function oO(){return S4||(S4=1,function(e,t){var r=Tt&&Tt.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebTransport=t.WebSocket=t.NodeWebSocket=t.XHR=t.NodeXHR=t.Fetch=t.Socket=t.Manager=t.protocol=void 0,t.io=c,t.connect=c,t.default=c;const n=nO(),s=aO();Object.defineProperty(t,"Manager",{enumerable:!0,get:function(){return s.Manager}});const i=J9();Object.defineProperty(t,"Socket",{enumerable:!0,get:function(){return i.Socket}});const a=(0,r(Kn()).default)("socket.io-client"),d={};function c(p,f){typeof p=="object"&&(f=p,p=void 0),f=f||{};const h=(0,n.url)(p,f.path||"/socket.io"),y=h.source,m=h.id,b=h.path,v=d[m]&&b in d[m].nsps,E=f.forceNew||f["force new connection"]||f.multiplex===!1||v;let _;return E?(a("ignoring socket cache for %s",y),_=new s.Manager(y,f)):(d[m]||(a("new io instance for %s",y),d[m]=new s.Manager(y,f)),_=d[m]),h.query&&!f.query&&(f.query=h.queryKey),_.socket(h.path,f)}Object.assign(c,{Manager:s.Manager,Socket:i.Socket,io:c,connect:c});var l=pg();Object.defineProperty(t,"protocol",{enumerable:!0,get:function(){return l.protocol}});var u=hg();Object.defineProperty(t,"Fetch",{enumerable:!0,get:function(){return u.Fetch}}),Object.defineProperty(t,"NodeXHR",{enumerable:!0,get:function(){return u.NodeXHR}}),Object.defineProperty(t,"XHR",{enumerable:!0,get:function(){return u.XHR}}),Object.defineProperty(t,"NodeWebSocket",{enumerable:!0,get:function(){return u.NodeWebSocket}}),Object.defineProperty(t,"WebSocket",{enumerable:!0,get:function(){return u.WebSocket}}),Object.defineProperty(t,"WebTransport",{enumerable:!0,get:function(){return u.WebTransport}}),e.exports=c}(Yd,Yd.exports)),Yd.exports}var P4;function cO(){if(P4)return _u;P4=1,Object.defineProperty(_u,"__esModule",{value:!0}),_u.createSocketConnection=void 0;const e=$e,t=oO(),r=nn(),n=tt();function s({user:i,env:o,socketType:a="notification",socketOptions:d}){return e.__awaiter(this,void 0,void 0,function*(){const{autoConnect:c=!0,reconnectionAttempts:l=5,reconnectionDelay:u,reconnectionDelayMax:p}=d||{};let f=r.API_BASE_URL[o];f.endsWith("/apis")&&(f=f.substring(0,f.length-5));const h=["websocket"];let y=null;try{const m=a==="chat"?(0,n.walletToPCAIP10)(i):yield(0,n.getCAIPAddress)(o,i,"User"),b=a==="notification"?{address:m}:{mode:"chat",did:m};y=(0,t.io)(f,Object.assign(Object.assign({transports:h,query:b,autoConnect:c,reconnectionAttempts:l},u!==void 0&&{reconnectionDelay:u}),p!==void 0&&{reconnectionDelayMax:p}))}catch(m){console.error("[PUSH-SDK] - Socket connection error: ",m)}return y})}return _u.createSocketConnection=s,_u}var Ou={},T4;function uO(){if(T4)return Ou;T4=1,Object.defineProperty(Ou,"__esModule",{value:!0}),Ou.DataModifier=void 0;const e=Kh(),t=pn(),r=Ur();let n=class Z9{static handleChatGroupEvent(i,o=!1){switch(i.eventType){case"create":return this.mapToCreateGroupEvent(i,o);case"update":return this.mapToUpdateGroupEvent(i,o);case e.GroupEventType.JoinGroup:return this.mapToJoinGroupEvent(i,o);case e.GroupEventType.LeaveGroup:return this.mapToLeaveGroupEvent(i,o);case e.MessageEventType.Request:return this.mapToRequestEvent(i,o);case e.GroupEventType.Remove:return this.mapToRemoveEvent(i,o);case e.GroupEventType.RoleChange:return this.mapToRoleChangeEvent(i,o);default:return console.warn("Unknown eventType:",i.eventType),i}}static mapToJoinGroupEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.JoinGroup};return o?Object.assign(Object.assign({},a),{raw:{verificationProof:i.verificationProof}}):a}static mapToLeaveGroupEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.LeaveGroup};return o?Object.assign(Object.assign({},a),{raw:{verificationProof:i.verificationProof}}):a}static mapToRequestEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.MessageEventType.Request,meta:{group:i.isGroup||!1}};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToRemoveEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.Remove};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToRoleChangeEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,newRole:i.newRole,event:e.GroupEventType.RoleChange};return o&&(a.raw={verificationProof:i.verificationProof}),a}static buildChatGroupEventMetaAndRaw(i,o){const a={name:i.groupName,description:i.groupDescription,image:i.groupImage,owner:i.groupCreator,private:!i.isPublic,rules:i.rules||{}};if(o){const d={verificationProof:i.verificationProof};return{meta:a,raw:d}}return{meta:a}}static mapToGroupEvent(i,o,a){const{meta:d,raw:c}=this.buildChatGroupEventMetaAndRaw(o,a),l={event:i,origin:o.messageOrigin,timestamp:o.timestamp,chatId:o.chatId,from:o.from,meta:d};return a&&(l.raw=c),l}static mapToCreateGroupEvent(i,o){return this.mapToGroupEvent(e.GroupEventType.CreateGroup,i,o)}static mapToUpdateGroupEvent(i,o){return this.mapToGroupEvent(e.GroupEventType.UpdateGroup,i,o)}static mapToMessageEvent(i,o=!1,a){i.hasIntent===!1&&a==="message"&&(a=e.MessageEventType.Request);const d={event:a,origin:i.messageOrigin,timestamp:i.timestamp.toString(),chatId:i.chatId,from:i.fromCAIP10,to:[i.toCAIP10],message:Object.assign({type:i.messageType},i.messageObj),meta:{group:i.isGroup||!1},reference:i.cid};if(o){const c={fromCAIP10:i.fromCAIP10,toCAIP10:i.toCAIP10,fromDID:i.fromDID,toDID:i.toDID,encType:i.encType,encryptedSecret:i.encryptedSecret,signature:i.signature,sigType:i.sigType,verificationProof:i.verificationProof,previousReference:i.link};d.raw=c}return d}static handleChatEvent(i,o=!1){if(!i)throw console.error("Error in handleChatEvent: data is undefined or null"),new Error("data is undefined or null");const a={Chat:e.MessageEventType.Message,Request:e.MessageEventType.Request,Approve:e.MessageEventType.Accept,Reject:e.MessageEventType.Reject},d=i.eventType||i.messageCategory;if(!a[d])throw console.error("Error in handleChatEvent: Invalid eventType or messageCategory",JSON.stringify(i)),new Error("Invalid eventType or messageCategory in data");const c=a[d];return c?this.mapToMessageEvent(i,o,c):(console.warn("Unknown eventType:",i.eventType||i.messageCategory),i)}static mapToNotificationEvent(i,o,a,d=!1){var c,l,u;const p=Object.keys(e.NOTIFICATION.TYPE).find(y=>e.NOTIFICATION.TYPE[y]===i.payload.data.type)||"BROADCAST";let f;Array.isArray(i.payload.recipients)?f=i.payload.recipients:typeof i.payload.recipients=="string"?f=[i.payload.recipients]:f=Object.keys(i.payload.recipients);const h={event:o,origin:a,timestamp:i.epoch,from:i.sender,to:f,notifID:i.payload_id.toString(),channel:{name:i.payload.data.app,icon:i.payload.data.icon,url:i.payload.data.url},meta:{type:"NOTIFICATION."+p},message:{notification:{title:i.payload.notification.title,body:i.payload.notification.body},payload:{title:i.payload.data.asub,body:i.payload.data.amsg,cta:i.payload.data.acta,embed:i.payload.data.aimg,meta:{domain:((c=i.payload.data.additionalMeta)===null||c===void 0?void 0:c.domain)||"push.org",type:(l=i.payload.data.additionalMeta)===null||l===void 0?void 0:l.type,data:(u=i.payload.data.additionalMeta)===null||u===void 0?void 0:u.data}}},config:{expiry:i.payload.data.etime,silent:i.payload.data.silent==="1",hidden:i.payload.data.hidden==="1"},source:i.source};return d&&(h.raw={verificationProof:i.payload.verificationProof}),h}static convertToProposedName(i){switch(i){case"message":return e.ProposedEventNames.Message;case"request":return e.ProposedEventNames.Request;case"accept":return e.ProposedEventNames.Accept;case"reject":return e.ProposedEventNames.Reject;case"leaveGroup":return e.ProposedEventNames.LeaveGroup;case"joinGroup":return e.ProposedEventNames.JoinGroup;case"createGroup":return e.ProposedEventNames.CreateGroup;case"updateGroup":return e.ProposedEventNames.UpdateGroup;case"remove":return e.ProposedEventNames.Remove;case"roleChange":return e.ProposedEventNames.RoleChange;default:throw new Error(`Unknown current event name: ${i}`)}}static convertToProposedNameForSpace(i){switch(i){case"create":return e.ProposedEventNames.CreateSpace;case"update":return e.ProposedEventNames.UpdateSpace;case"request":return e.ProposedEventNames.SpaceRequest;case"accept":return e.ProposedEventNames.SpaceAccept;case"reject":return e.ProposedEventNames.SpaceReject;case"leaveSpace":return e.ProposedEventNames.LeaveSpace;case"joinSpace":return e.ProposedEventNames.JoinSpace;case"remove":return e.ProposedEventNames.SpaceRemove;case"start":return e.ProposedEventNames.StartSpace;case"stop":return e.ProposedEventNames.StopSpace;default:throw new Error(`Unknown current event name: ${i}`)}}static handleToField(i){var o;switch(i.event){case e.ProposedEventNames.LeaveGroup:case e.ProposedEventNames.JoinGroup:i.to=null;break;case e.ProposedEventNames.Accept:case e.ProposedEventNames.Reject:!((o=i.meta)===null||o===void 0)&&o.group&&(i.to=null);break}}static handleSpaceEvent(i,o=!1){switch(i.eventType){case"create":return this.mapToCreateSpaceEvent(i,o);case"update":return this.mapToUpdateSpaceEvent(i,o);case"request":return this.mapToRequestSpaceEvent(i,o);case"remove":return this.mapToRemoveSpaceEvent(i,o);case"joinSpace":return this.mapToJoinSpaceEvent(i,o);case"leaveSpace":return this.mapToLeaveSpaceEvent(i,o);case"start":return this.mapToStartSpaceEvent(i,o);case"stop":return this.mapToStopSpaceEvent(i,o);default:switch(i.messageCategory){case"Approve":return this.mapToSpaceApproveEvent(i,o);case"Reject":return this.mapToSpaceRejectEvent(i,o);default:return console.warn("Unknown eventType or messageCategory for space:",i.eventType,i.messageCategory),i}}}static mapToCreateSpaceEvent(i,o){const a={event:i.eventType,origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.spaceCreator,meta:{name:i.spaceName,description:i.spaceDescription,image:i.spaceImage,owner:i.spaceCreator,private:!i.isPublic,rules:i.rules||{}}};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToUpdateSpaceEvent(i,o){const a={event:i.eventType,origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.spaceCreator,meta:{name:i.spaceName,description:i.spaceDescription,image:i.spaceImage,owner:i.spaceCreator,private:!i.isPublic,rules:i.rules||{}}};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToRequestSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:e.MessageEventType.Request};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToSpaceApproveEvent(i,o){const a={event:"request",origin:i.messageOrigin==="other"?"self":"other",timestamp:i.timestamp,spaceId:i.chatId,from:i.fromCAIP10,to:[i.toCAIP10]};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToSpaceRejectEvent(i,o){const a={event:"reject",origin:i.messageOrigin==="other"?"other":"self",timestamp:i.timestamp.toString(),spaceId:i.chatId,from:i.fromCAIP10,to:null};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToRemoveSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:"remove"};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToJoinSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToLeaveSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToStartSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:null,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToStopSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:null,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static convertToProposedNameForVideo(i){switch(i){case t.VideoCallStatus.INITIALIZED:return e.VideoEventType.REQUEST;case t.VideoCallStatus.RECEIVED:return e.VideoEventType.APPROVE;case t.VideoCallStatus.CONNECTED:return e.VideoEventType.CONNECT;case t.VideoCallStatus.ENDED:return e.VideoEventType.DISCONNECT;case t.VideoCallStatus.DISCONNECTED:return e.VideoEventType.DENY;case t.VideoCallStatus.RETRY_INITIALIZED:return e.VideoEventType.RETRY_REQUEST;case t.VideoCallStatus.RETRY_RECEIVED:return e.VideoEventType.RETRY_APPROVE;default:throw new Error(`Unknown video call status: ${i}`)}}static mapToVideoEvent(i,o,a=!1){var d,c;const{senderAddress:l,signalData:u,status:p,chatId:f}=JSON.parse((d=i.payload.data.additionalMeta)===null||d===void 0?void 0:d.data),h=(c=i.payload.rules)!==null&&c!==void 0?c:{access:{type:r.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:f}}},y={address:l,signal:u,meta:{rules:h}},b={event:Z9.convertToProposedNameForVideo(p),origin:o,timestamp:i.epoch,peerInfo:y};return a&&(b.raw={verificationProof:i.payload.verificationProof}),b}};return Ou.DataModifier=n,Ou}var I4;function lO(){if(I4)return vu;I4=1,Object.defineProperty(vu,"__esModule",{value:!0}),vu.PushStream=void 0;const e=$e,t=c8,r=cO(),n=Je(),s=Kh(),i=uO(),o=tt(),a=dg(),d=nn(),c=$h(),l=ag();let u=class X9 extends t.EventEmitter{constructor(f,h,y,m,b,v){var E;super(),this._listen=h,this.decryptedPgpPvtKey=m,this.progressHook=b,this.signer=v,this.account=f,this.raw=(E=y.raw)!==null&&E!==void 0?E:!1,this.options=y,this.listen=h,this.disconnected=!1,this.uid=(0,l.v4)(),this.chatSocketCount=0,this.notifSocketCount=0,this.chatSocketConnected=!1,this.notifSocketConnected=!1,this.chatInstance=new a.Chat(this.account,this.options.env,d.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD],this.decryptedPgpPvtKey,this.signer,this.progressHook)}static initialize(f,h,y,m,b,v,E){return e.__awaiter(this,void 0,void 0,function*(){const _={raw:!1,connection:{auto:!0,retries:3},env:y};if(!h||h.length===0)throw new Error("The listen property must have at least one STREAM type.");const C=Object.assign(Object.assign({},_),E),k=C.overrideAccount||f;return h.includes("*")&&(h=Object.values(s.STREAM)),new X9(k,h,C,m,b,v)})}reinit(f,h){return e.__awaiter(this,void 0,void 0,function*(){this.listen=f,this.options=Object.assign(Object.assign({},this.options),h),yield this.connect(!0)})}connect(f=!1){return e.__awaiter(this,void 0,void 0,function*(){return new Promise((h,y)=>{e.__awaiter(this,void 0,void 0,function*(){var m,b,v,E,_,C,k,D,w,S,I,T,g,A;const P=!this.listen||this.listen.length===0||this.listen.includes(s.STREAM.CHAT)||this.listen.includes(s.STREAM.CHAT_OPS)||this.listen.includes(s.STREAM.SPACE)||this.listen.includes(s.STREAM.SPACE_OPS),O=!this.listen||this.listen.length===0||this.listen.includes(s.STREAM.NOTIF)||this.listen.includes(s.STREAM.NOTIF_OPS)||this.listen.includes(s.STREAM.VIDEO);console.log("RestAPI::PushStream::connect - Initialization flags:",{shouldInitializeChatSocket:P,shouldInitializeNotifSocket:O});let N=f?this.chatSocketConnected:!1,M=f?this.notifSocketConnected:!1;const L=()=>{console.log("RestAPI::PushStream::connect - Checking conditions for STREAM.CONNECT event.",{shouldInitializeChatSocket:P,isChatSocketConnected:N,shouldInitializeNotifSocket:O,isNotifSocketConnected:M}),(P&&N||!P)&&(O&&M||!O)?(this.emit(s.STREAM.CONNECT),console.log("RestAPI::PushStream::connect - Emitted STREAM.CONNECT"),h()):console.log("RestAPI::PushStream:: not emitting")};setTimeout(()=>{this.notifSocketConnected||this.chatSocketConnected||y(new Error("Connection timeout"))},5e3);const R=V=>e.__awaiter(this,void 0,void 0,function*(){V==="chat"?(N=!1,this.chatSocketConnected=!1,console.log("RestAPI::PushStream::handleSocketDisconnection - Chat socket disconnected. Decrementing chatSocketCount.","Previous chatSocketCount:",this.chatSocketCount),this.chatSocketCount--,console.log("RestAPI::PushStream::handleSocketDisconnection - New chatSocketCount:",this.chatSocketCount),M?this.pushNotificationSocket&&this.pushNotificationSocket.connected&&(console.log("RestAPI::PushStream::handleSocketDisconnection - Disconnecting Notification Socket..."),this.pushNotificationSocket.disconnect()):(this.emit(s.STREAM.DISCONNECT),console.log("RestAPI::PushStream::handleSocketDisconnection - Emitted STREAM.DISCONNECT for chat."))):V==="notif"&&(M=!1,this.notifSocketConnected=!1,console.log("RestAPI::PushStream::handleSocketDisconnection - Notification socket disconnected. Decrementing notifSocketCount.","Previous notifSocketCount:",this.notifSocketCount),this.notifSocketCount--,console.log("RestAPI::PushStream::handleSocketDisconnection - New notifSocketCount:",this.notifSocketCount),N?this.pushChatSocket&&this.pushChatSocket.connected&&(console.log("RestAPI::PushStream::handleSocketDisconnection - Disconnecting Chat Socket..."),this.pushChatSocket.disconnect()):(this.emit(s.STREAM.DISCONNECT),console.log("RestAPI::PushStream::handleSocketDisconnection - Emitted STREAM.DISCONNECT for notification.")))});P&&(this.pushChatSocket?this.pushChatSocket&&!this.chatSocketConnected?(console.log("RestAPI::PushStream::ChatSocket::Reconnect - Attempting to reconnect push chat socket..."),this.pushChatSocket.connect()):console.log("RestAPI::PushStream::ChatSocket::Status - Push chat socket already connected"):(console.log("RestAPI::PushStream::ChatSocket::Create - pushChatSocket does not exist, creating new socket connection..."),this.pushChatSocket=yield(0,r.createSocketConnection)({user:(0,o.walletToPCAIP10)(this.account),socketType:"chat",socketOptions:{autoConnect:(v=(b=(m=this.options)===null||m===void 0?void 0:m.connection)===null||b===void 0?void 0:b.auto)!==null&&v!==void 0?v:!0,reconnectionAttempts:(C=(_=(E=this.options)===null||E===void 0?void 0:E.connection)===null||_===void 0?void 0:_.retries)!==null&&C!==void 0?C:3},env:(k=this.options)===null||k===void 0?void 0:k.env}),this.pushChatSocket||y(new Error("RestAPI::PushStream::ChatSocket::Error - Push chat socket not connected")))),O&&(this.pushNotificationSocket?this.pushNotificationSocket&&!this.notifSocketConnected?(console.log("RestAPI::PushStream::NotifSocket::Reconnect - Attempting to reconnect push notification socket..."),this.pushNotificationSocket.connect()):console.log("RestAPI::PushStream::NotifSocket::Status - Push notification socket already connected"):(console.log("RestAPI::PushStream::NotifSocket::Create - pushNotificationSocket does not exist, creating new socket connection..."),this.pushNotificationSocket=yield(0,r.createSocketConnection)({user:(0,o.pCAIP10ToWallet)(this.account),env:(D=this.options)===null||D===void 0?void 0:D.env,socketOptions:{autoConnect:(I=(S=(w=this.options)===null||w===void 0?void 0:w.connection)===null||S===void 0?void 0:S.auto)!==null&&I!==void 0?I:!0,reconnectionAttempts:(A=(g=(T=this.options)===null||T===void 0?void 0:T.connection)===null||g===void 0?void 0:g.retries)!==null&&A!==void 0?A:3}}),this.pushNotificationSocket||y(new Error("RestAPI::PushStream::NotifSocket::Error - Push notification socket not connected"))));const K=V=>!this.listen||this.listen.length===0?!0:this.listen.includes(V);this.pushChatSocket&&(L(),this.pushChatSocket.off(s.EVENTS.CONNECT),this.pushChatSocket.on(s.EVENTS.CONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){N=!0,this.chatSocketCount++,this.chatSocketConnected=!0,L(),console.log(`RestAPI::PushStream::EVENTS.CONNECT:: Chat Socket Connected (ID: ${this.pushChatSocket.id})`)})),this.pushChatSocket.off(s.EVENTS.DISCONNECT),this.pushChatSocket.on(s.EVENTS.DISCONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log("RestAPI::PushStream::ChatSocket::Disconnect - Chat socket disconnected."),yield R("chat")})),this.pushChatSocket.off(s.EVENTS.CHAT_GROUPS),this.pushChatSocket.on(s.EVENTS.CHAT_GROUPS,V=>{try{const J=i.DataModifier.handleChatGroupEvent(V,this.raw);J.event=i.DataModifier.convertToProposedName(J.event),J.streamUid=this.uid,i.DataModifier.handleToField(J),this.shouldEmitChat(V.chatId)&&(V.eventType===s.GroupEventType.JoinGroup||V.eventType===s.GroupEventType.LeaveGroup||V.eventType===s.MessageEventType.Request||V.eventType===s.GroupEventType.Remove||V.eventType===s.GroupEventType.RoleChange?K(s.STREAM.CHAT)&&this.emit(s.STREAM.CHAT,J):K(s.STREAM.CHAT_OPS)&&this.emit(s.STREAM.CHAT_OPS,J))}catch(J){console.error("Error handling CHAT_GROUPS event:",J,"Data:",V)}}),this.pushChatSocket.off(s.EVENTS.CHAT_RECEIVED_MESSAGE),this.pushChatSocket.on(s.EVENTS.CHAT_RECEIVED_MESSAGE,V=>e.__awaiter(this,void 0,void 0,function*(){try{(V.messageCategory=="Chat"||V.messageCategory=="Request")&&this.decryptedPgpPvtKey&&(V=yield this.chatInstance.decrypt([V]),V=V[0]);const J=i.DataModifier.handleChatEvent(V,this.raw);J.event=i.DataModifier.convertToProposedName(J.event),i.DataModifier.handleToField(J),this.shouldEmitChat(V.chatId)&&K(s.STREAM.CHAT)&&this.emit(s.STREAM.CHAT,J)}catch(J){console.error("Error handling CHAT_RECEIVED_MESSAGE event:",J,"Data:",V)}})),this.pushChatSocket.off("SPACES"),this.pushChatSocket.on("SPACES",V=>{try{const J=i.DataModifier.handleSpaceEvent(V,this.raw);J.event=i.DataModifier.convertToProposedNameForSpace(J.event),i.DataModifier.handleToField(J),this.shouldEmitSpace(V.spaceId)&&(V.eventType===s.SpaceEventType.Join||V.eventType===s.SpaceEventType.Leave||V.eventType===s.MessageEventType.Request||V.eventType===s.SpaceEventType.Remove||V.eventType===s.SpaceEventType.Start||V.eventType===s.SpaceEventType.Stop?K(s.STREAM.SPACE)&&this.emit(s.STREAM.SPACE,J):K(s.STREAM.SPACE_OPS)&&this.emit(s.STREAM.SPACE_OPS,J))}catch(J){console.error("Error handling SPACES event:",J,"Data:",V)}}),this.pushChatSocket.off("SPACES_MESSAGES"),this.pushChatSocket.on("SPACES_MESSAGES",V=>{try{const J=i.DataModifier.handleSpaceEvent(V,this.raw);J.event=i.DataModifier.convertToProposedNameForSpace(J.event),i.DataModifier.handleToField(J),this.shouldEmitSpace(V.spaceId)&&K(s.STREAM.SPACE)&&this.emit(s.STREAM.SPACE,J)}catch(J){console.error("Error handling SPACES event:",J,"Data:",V)}})),this.pushNotificationSocket&&(L(),this.pushNotificationSocket.off(s.EVENTS.CONNECT),this.pushNotificationSocket.on(s.EVENTS.CONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log(`RestAPI::PushStream::NotifSocket::Connect - Notification Socket Connected (ID: ${this.pushNotificationSocket.id})`),M=!0,this.notifSocketCount++,this.notifSocketConnected=!0,L()})),this.pushNotificationSocket.off(s.EVENTS.DISCONNECT),this.pushNotificationSocket.on(s.EVENTS.DISCONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log("RestAPI::PushStream::NotifSocket::Disconnect - Notification socket disconnected."),yield R("notif")})),this.pushNotificationSocket.off(s.EVENTS.USER_FEEDS),this.pushNotificationSocket.on(s.EVENTS.USER_FEEDS,V=>{var J;try{if(((J=V.payload.data.additionalMeta)===null||J===void 0?void 0:J.type)===`${c.ADDITIONAL_META_TYPE.PUSH_VIDEO}+1`&&K(s.STREAM.VIDEO)&&this.shouldEmitVideo(V.sender)){const se=i.DataModifier.mapToVideoEvent(V,this.account===V.sender?s.MessageOrigin.Self:s.MessageOrigin.Other,this.raw);this.emit(s.STREAM.VIDEO,se)}else{const se=i.DataModifier.mapToNotificationEvent(V,s.NotificationEventType.INBOX,this.account===V.sender?"self":"other",this.raw);this.shouldEmitChannel(se.from)&&K(s.STREAM.NOTIF)&&this.emit(s.STREAM.NOTIF,se)}}catch(se){console.error(`RestAPI::PushStream::NotifSocket::UserFeeds::Error - Error handling event: ${se}, Data: ${JSON.stringify(V)}`)}}),this.pushNotificationSocket.off(s.EVENTS.USER_SPAM_FEEDS),this.pushNotificationSocket.on(s.EVENTS.USER_SPAM_FEEDS,V=>{try{const J=i.DataModifier.mapToNotificationEvent(V,s.NotificationEventType.SPAM,this.account===V.sender?"self":"other",this.raw);J.origin=this.account===J.from?"self":"other",this.shouldEmitChannel(J.from)&&K(s.STREAM.NOTIF)&&this.emit(s.STREAM.NOTIF,J)}catch(J){console.error("Error handling USER_SPAM_FEEDS event:",J,"Data:",V)}})),this.disconnected=!1})})})}connected(){return console.log(`RestAPI::PushStream::connected::Notification Socket Connected: ${this.notifSocketConnected}`),console.log(`RestAPI::PushStream::connected::Chat Socket Connected: ${this.chatSocketConnected}`),this.notifSocketConnected||this.chatSocketConnected}disconnect(){return e.__awaiter(this,void 0,void 0,function*(){this.pushChatSocket&&this.chatSocketConnected&&(this.pushChatSocket.disconnect(),console.log("RestAPI::PushStream::disconnect::Push chat socket disconnected.")),this.pushNotificationSocket&&this.notifSocketConnected&&(this.pushNotificationSocket.disconnect(),console.log("RestAPI::PushStream::disconnect::Push notification socket disconnected."))})}info(){return{options:this.options,listen:this.listen}}shouldEmitChat(f){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.chats)||this.options.filter.chats.length===0||this.options.filter.chats.includes("*")?!0:this.options.filter.chats.includes(f)}shouldEmitSpace(f){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.spaces)||this.options.filter.spaces.length===0||this.options.filter.spaces.includes("*")?!0:this.options.filter.spaces.includes(f)}shouldEmitChannel(f){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.channels)||this.options.filter.channels.length===0||this.options.filter.channels.includes("*")?!0:this.options.filter.channels.includes(f)}shouldEmitVideo(f){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.video)||this.options.filter.video.length===0||this.options.filter.video.includes("*")?!0:this.options.filter.video.includes(f)}};return vu.PushStream=u,vu}var Nu={},Du={},oa={};const dO=Bl(xS);var C4;function sd(){if(C4)return oa;C4=1,Object.defineProperty(oa,"__esModule",{value:!0}),oa.PushNotificationBaseClass=oa.FEED_MAP=void 0;const e=$e,t=Je(),r=nn(),n=Mt(),s=Ur(),i=dO,o=Aa,a=Io(),d=tt(),c=It(),l=Mo(),u=Aa,p="Account is required",f="*",h=125,y=1,m="-",b="+",v=3,E=2,_=1,C="1",k="1";oa.FEED_MAP={INBOX:!1,SPAM:!0};class D{constructor(S,I,T,g){this.signer=S,this.env=I,this.guestMode=!!(T&&S),this.account=T,this.pgpPrivateKey=g,this.initializeCoreContract({signer:this.signer,env:this.env})}initializeCoreContract(S){return e.__awaiter(this,void 0,void 0,function*(){const{env:I=t.ENV.STAGING,signer:T=null}=S||{};let g;if(T)if(yield(0,n.getAccountAddress)({account:null,signer:T}),new d.Signer(T).isViemSigner(T)){const P=(0,o.createPublicClient)({chain:r.TOKEN_VIEM_NETWORK_MAP[I],transport:(0,o.http)()});g=(0,o.getContract)({abi:r.ABIS.CORE,address:r.CORE_CONFIG[I].EPNS_CORE_CONTRACT,client:{public:P}})}else g=new i.ethers.Contract(r.CORE_CONFIG[I].EPNS_CORE_CONTRACT,r.ABIS.CORE,T);this.coreContract=g})}checkUserAddressExists(S){if(!S&&!this.account&&!this.guestMode)throw new Error(p);return!0}checkSignerObjectExists(){if(!this.signer)throw new Error(l.PushAPI.ensureSignerMessage());return!0}getNotificationType(S,I){return S.length==1?S[0]==f?{recipient:I,type:s.NOTIFICATION_TYPE.BROADCAST}:{recipient:S[0],type:s.NOTIFICATION_TYPE.TARGETTED}:{recipient:S,type:s.NOTIFICATION_TYPE.SUBSET}}generateNotificationLowLevelPayload({signer:S,env:I,recipients:T,options:g,channel:A,channelInfo:P}){var O,N,M,L,x,R,K,V,J,se,j,re,G,B,X,ge,_e,Se;A||(A=`${this.account}`);const F=this.getNotificationType(T,A),q=s.IDENTITY_TYPE.DIRECT_PAYLOAD;let z="";const ee=P&&P.channel_settings?JSON.parse(P.channel_settings):null,le=!!P;return!((O=g.payload)===null||O===void 0)&&O.category&&ee&&(ee[g.payload.category-1].type==E&&(z=g.payload.category+m+E+m+ee[g.payload.category-1].default),ee[g.payload.category-1].type==_&&(z=g.payload.category+m+_),ee[g.payload.category-1].type==v&&(z=g.payload.category+m+v+m+ee[g.payload.category-1].default.lower)),{signer:S,channel:A,type:F.type,identityType:q,notification:g.notification,payload:{title:(M=(N=g.payload)===null||N===void 0?void 0:N.title)!==null&&M!==void 0?M:g.notification.title,body:(x=(L=g.payload)===null||L===void 0?void 0:L.body)!==null&&x!==void 0?x:g.notification.body,cta:(K=(R=g.payload)===null||R===void 0?void 0:R.cta)!==null&&K!==void 0?K:"",img:(J=(V=g.payload)===null||V===void 0?void 0:V.embed)!==null&&J!==void 0?J:"",hidden:(se=g.config)===null||se===void 0?void 0:se.hidden,etime:(j=g.config)===null||j===void 0?void 0:j.expiry,silent:(re=g.config)===null||re===void 0?void 0:re.silent,additionalMeta:(G=g.payload)===null||G===void 0?void 0:G.meta,index:!((B=g.payload)===null||B===void 0)&&B.category?z:""},recipients:F.recipient,graph:(X=g.advanced)===null||X===void 0?void 0:X.graph,ipfsHash:(ge=g.advanced)===null||ge===void 0?void 0:ge.ipfs,env:I,chatId:(_e=g.advanced)===null||_e===void 0?void 0:_e.chatid,pgpPrivateKey:(Se=g.advanced)===null||Se===void 0?void 0:Se.pgpPrivateKey,channelFound:le}}isEmpty(S){return S.trim().length==0}isValidLength(S,I=h,T=y){return S.length>=T&&S.length<=I}isValidUrl(S){return!!new RegExp("^((?:https|http):\\/\\/)((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(S)}verifyEmptyChannelParameters(S){if(this.isEmpty(S.name))throw new Error("Channel name cannot be empty");if(this.isEmpty(S.description))throw new Error("Channel description cannot be empty");if(this.isEmpty(S.icon))throw new Error("Channel icon cannot be empty");if(this.isEmpty(S.url))throw new Error("Channel url cannot ne empty");return!0}validateParameterLength(S){if(this.isValidLength(S.name))if(this.isValidLength(S.description)){if(!this.isValidLength(S.url)||!this.isValidUrl(S.url))throw new Error(`Channel url either excees ${h} characters or is not a valid url`);return!0}else throw new Error(`Channel description should not exceed ${h} characters`);else throw new Error(`Channel name should not exceed ${h} characters`)}validateChannelParameters(S){return this.verifyEmptyChannelParameters(S)&&this.validateParameterLength(S)}createContractInstance(S,I,T){if(!this.signer)throw new Error("Signer is not provided");let g;const A=this.signer?new d.Signer(this.signer):null;if(A!=null&&A.isViemSigner(this.signer)){const P=(0,o.createPublicClient)({chain:T,transport:(0,o.http)()});g=(0,o.getContract)({abi:I,address:S,client:{public:P}})}else g=new i.ethers.Contract(S,I,this.signer);return g}fetchBalance(S,I){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");let T;const g=new d.Signer(this.signer);try{return g.isViemSigner(this.signer)?T=BigInt(yield S.read.balanceOf({args:[I]})):T=BigInt(yield S.balanceOf(I)),T}catch(A){throw new Error(JSON.stringify(A))}})}fetchAllownace(S,I,T){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");const g=new d.Signer(this.signer);let A;try{return g.isViemSigner(this.signer)?A=BigInt(yield S.read.allowance({args:[I,T]})):A=BigInt(yield S.allowance(I,T)),A}catch(P){throw new Error(JSON.stringify(P))}})}fetchUpdateCounter(S,I){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");let T;const g=new d.Signer(this.signer);try{return g.isViemSigner(this.signer)?T=BigInt(yield S.read.channelUpdateCounter({args:[I]})):T=BigInt(yield S.channelUpdateCounter(I)),T+BigInt(1)}catch(A){throw new Error(JSON.stringify(A))}})}approveToken(S,I,T){var g,A;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");if(new d.Signer(this.signer).isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");const N=yield S.write.approve({args:[I,T]})}else{if(!this.signer||!this.signer.provider)throw new Error("ethers provider/signer is not provided");const N=yield S.approve(I,T);yield(A=(g=this.signer)===null||g===void 0?void 0:g.provider)===null||A===void 0?void 0:A.waitForTransaction(N.hash)}return!0}catch(P){return console.error(P),!1}})}createChannel(S,I,T,g){var A,P;return e.__awaiter(this,void 0,void 0,function*(){let O;try{if(!this.signer)throw new Error("Signer is not provided");if(new d.Signer(this.signer).isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");O=yield S.write.createChannelWithPUSH({args:[I,(0,o.toHex)(new Uint8Array(T)),g,this.getTimeBound()]})}else{const L=yield S.createChannelWithPUSH(I,T,g,this.getTimeBound(),{gasLimit:1e6}),x=yield(P=(A=this.signer)===null||A===void 0?void 0:A.provider)===null||P===void 0?void 0:P.waitForTransaction(L.hash);if((x==null?void 0:x.status)==0)throw new Error("Something Went wrong while creating your channel");O=L.hash}return O}catch(N){throw new Error(N==null?void 0:N.message)}})}updateChannel(S,I,T,g){var A,P;return e.__awaiter(this,void 0,void 0,function*(){let O;try{if(!this.signer)throw new Error("Signer is not provided");if(new d.Signer(this.signer).isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");O=yield S.write.updateChannelMeta({args:[I,(0,o.toHex)(new Uint8Array(T)),g]})}else{const L=yield S.updateChannelMeta(I,T,g,{gasLimit:1e6}),x=yield(P=(A=this.signer)===null||A===void 0?void 0:A.provider)===null||P===void 0?void 0:P.waitForTransaction(L.hash);if((x==null?void 0:x.status)==0)throw new Error("Something Went wrong while updating your channel");O=L.hash}return O}catch(N){throw new Error(N==null?void 0:N.message)}})}verifyChannel(S,I){var T,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new d.Signer(this.signer);let P;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");P=yield S.write.verify({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const N=yield S.verify(I);yield(g=(T=this.signer)===null||T===void 0?void 0:T.provider)===null||g===void 0?void 0:g.waitForTransaction(N.hash),P=N.hash}return P}catch(A){throw new Error(A.message)}})}createChanelSettings(S,I,T,g,A){var P,O;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const N=new d.Signer(this.signer);let M;if(N.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");M=yield S.write.createChannelSettings({args:[I,T,g,A]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const x=yield S.createChannelSettings(I,T,g,A);yield(O=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||O===void 0?void 0:O.waitForTransaction(x.hash),M=x.hash}return M}catch(N){throw new Error(N.message)}})}addDelegator(S,I){var T,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new d.Signer(this.signer);let P;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");P=yield S.write.addDelegate({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const N=yield S.addDelegate(I);yield(g=(T=this.signer)===null||T===void 0?void 0:T.provider)===null||g===void 0?void 0:g.waitForTransaction(N.hash),P=N.hash}return P}catch(A){throw new Error(A.message)}})}removeDelegator(S,I){var T,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new d.Signer(this.signer);let P;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");P=yield S.write.removeDelegate({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const N=yield S.removeDelegate(I);yield(g=(T=this.signer)===null||T===void 0?void 0:T.provider)===null||g===void 0?void 0:g.waitForTransaction(N.hash),P=N.hash}return P}catch(A){throw new Error(A.message)}})}getChainId(S){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");return new d.Signer(this.signer).getChainId()})}uploadToIPFSViaPushNode(S){return e.__awaiter(this,void 0,void 0,function*(){try{return(yield(0,c.axiosPost)(`${r.CORE_CONFIG[this.env].API_BASE_URL}/v1/ipfs/upload`,{data:S})).data.cid}catch{throw new Error("Something went wrong while uploading data to IPFS")}})}getTimeBound(S){return 0}getMinimalSetting(S){var I,T;let g="",A="";for(let P=0;P<S.length;P++){const O=S[P];if(O.type==_&&(g=g+b+_+m+O.default),O.type==E&&O.data){const N=O.data&&O.data.enabled!=null?Number(O.data.enabled).toString():C,M=(I=O.data.ticker)!==null&&I!==void 0?I:k;g=g+b+E+m+N+m+O.default+m+O.data.lower+m+O.data.upper+m+M}if(O.type==v&&O.default&&typeof O.default=="object"&&O.data){const N=O.data&&O.data.enabled!=null?Number(O.data.enabled).toString():C,M=(T=O.data.ticker)!==null&&T!==void 0?T:k;g=g+b+v+m+N+m+O.default.lower+m+O.default.upper+m+O.data.lower+m+O.data.upper+m+M}A=A+b+O.description}return{setting:g.replace(/^\+/,""),description:A.replace(/^\+/,"")}}getMinimalUserSetting(S){var I,T;if(!S)return null;let g="",A=0;for(let P=0;P<S.length;P++){const O=S[P],N=O.enabled?1:0;O.enabled&&A++,Object.keys(O).includes("value")?typeof O.value=="number"?g=g+E+m+N+m+O.value:g=g+v+m+N+m+((I=O.value)===null||I===void 0?void 0:I.lower)+m+((T=O.value)===null||T===void 0?void 0:T.upper):g=g+_+m+N,P!=S.length-1&&(g=g+b)}return A+b+g}getChannelOrAliasInfo(S){return e.__awaiter(this,void 0,void 0,function*(){try{const I=(0,d.validateCAIP)(S)?S:(0,d.getFallbackETHCAIPAddress)(this.env,this.account),{networkId:T}=(0,d.getCAIPDetails)(I);let g=I;if(T!=="1"&&T!=="11155111"){const P=yield this.getAliasInfo(S);g=(P==null?void 0:P.channel)||g}return(yield a.getChannel({channel:g,env:this.env}))||null}catch{return null}})}initiateAddAlias(S,I){var T,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new d.Signer(this.signer);let P;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");P=yield S.write.verifyChannelAlias({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const N=yield S.verifyChannelAlias(I);yield(g=(T=this.signer)===null||T===void 0?void 0:T.provider)===null||g===void 0?void 0:g.waitForTransaction(N.hash),P=N.hash}return P}catch(A){throw new Error(A.message)}})}verifyAlias(S,I){var T,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new d.Signer(this.signer);let P;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");P=yield S.write.verifyChannelAlias({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const R=yield S.verifyChannelAlias(I);yield(g=(T=this.signer)===null||T===void 0?void 0:T.provider)===null||g===void 0?void 0:g.waitForTransaction(R.hash),P=R.hash}const O=yield A.getChainId(),N=yield A.getAddress(),M=`eip155:${O}:${N}`,L=yield this.getChannelOrAliasInfo(M);return{verifyAliasRes:P,channelInfo:L}}catch(A){throw new Error(A.message)}})}getAliasInfo(S){return e.__awaiter(this,void 0,void 0,function*(){const g=`${`${(0,d.getAPIBaseUrls)(this.env)}/v1/alias`}/${S}/channel`;try{return(yield(0,c.axiosGet)(g)).data}catch{return null}})}getAddressFromCaip(S){return S==null?void 0:S.split(":")[(S==null?void 0:S.split(":").length)-1]}isValidPCaip(S){const I=S.split(":");return I.length==2&&I[0]=="eip155"&&u.isAddress(I[1])}}return oa.PushNotificationBaseClass=D,oa}var R4;function fO(){if(R4)return Du;R4=1,Object.defineProperty(Du,"__esModule",{value:!0}),Du.Alias=void 0;const e=$e,t=nn(),r=t,n=A9(),s=sd();class i extends s.PushNotificationBaseClass{constructor(a,d,c){super(a,d,c),this.info=l=>e.__awaiter(this,void 0,void 0,function*(){try{return yield n.getAliasInfo(Object.assign(Object.assign({},l),{env:this.env}))}catch(u){throw new Error(`Push SDK Error: API : alias::info : ${u}`)}}),this.initiate=(l,u)=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const f=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][f]||!r.VIEM_CONFIG[this.env][f])throw new Error("Unsupported Chainid");const h=t.default[this.env][f].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][f].NETWORK),m=yield this.initiateAddAlias(y,l);let b={tx:m};return u!=null&&u.raw&&(b=Object.assign(Object.assign({},b),{raw:{initiateVerificationProof:m}})),b}catch(p){throw new Error(`Push SDK Error: Contract : alias::add : ${p}`)}}),this.verify=(l,u)=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const f=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][f]||!r.VIEM_CONFIG[this.env][f])throw new Error("Unsupported Chainid");const h=t.default[this.env][f].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][f].NETWORK),{verifyAliasRes:m,channelInfo:b}=yield this.verifyAlias(y,l);let v={tx:m};return u!=null&&u.raw&&(v=Object.assign(Object.assign({},v),{raw:{initiateVerificationProof:b.initiate_verification_proof,verifyVerificationProof:m}})),v}catch(p){throw new Error(`Push SDK Error: Contract : alias::verify : ${p}`)}})}}return Du.Alias=i,Du}var xu={},k4;function hO(){if(k4)return xu;k4=1,Object.defineProperty(xu,"__esModule",{value:!0}),xu.Delegate=void 0;const e=$e,t=nn(),r=t,n=Io(),s=tt(),i=sd();class o extends i.PushNotificationBaseClass{constructor(d,c,l){super(d,c,l),this.get=u=>e.__awaiter(this,void 0,void 0,function*(){try{let p=u!=null&&u.channel?u.channel:this.account?(0,s.getFallbackETHCAIPAddress)(this.env,this.account):null;return this.checkUserAddressExists(p),p=(0,s.validateCAIP)(p)?p:(0,s.getFallbackETHCAIPAddress)(this.env,p),this.checkUserAddressExists(p),yield n.getDelegates({channel:p,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : delegate::get : ${p}`)}}),this.add=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists(),(0,s.validateCAIP)(u)&&(u=this.getAddressFromCaip(u));const f=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][f]||!r.VIEM_CONFIG[this.env][f])throw new Error("Unsupported Chainid");const h=t.default[this.env][f].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][f].NETWORK);return{transactionHash:yield this.addDelegator(y,u)}}catch(p){throw new Error(`Push SDK Error: Contract : delegate::add : ${p}`)}}),this.remove=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists(),(0,s.validateCAIP)(u)&&(u=this.getAddressFromCaip(u));const f=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][f]||!r.VIEM_CONFIG[this.env][f])throw new Error("Unsupported Chainid");const h=t.default[this.env][f].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][f].NETWORK);return{transactionHash:yield this.removeDelegator(y,u)}}catch(p){throw new Error(`Push SDK Error: Contract : delegate::remove : ${p}`)}})}}return xu.Delegate=o,xu}var Uu={},M4;function pO(){if(M4)return Uu;M4=1,Object.defineProperty(Uu,"__esModule",{value:!0}),Uu.Tags=void 0;const e=$e,t=Je(),r=Io(),n=sd(),s=nd();class i extends n.PushNotificationBaseClass{constructor(a,d,c,l){super(d,c,l),this.get=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info();return yield r.getTags({channel:p,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : tags::get : ${p}`)}}),this.add=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info(),f=yield this.channel.update({name:p.name,description:p.info,url:p.url,icon:p.icon,tags:u});return{tags:u}}catch(p){throw new Error(`Push SDK Error: Contract : tags::add : ${p}`)}}),this.update=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info();return yield this.channel.update({name:p.name,description:p.info,url:p.url,icon:p.icon,tags:u}),{tags:u}}catch(p){throw new Error(`Push SDK Error: Contract : tags::update : ${p}`)}}),this.remove=()=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const u=yield this.channel.info();return yield this.channel.update({name:u.name,description:u.info,url:u.url,icon:u.icon,tags:[]}),{status:"success"}}catch(u){throw new Error(`Push SDK Error: Contract : tags::remove : ${u}`)}}),this.search=(u,p)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:f=t.default.PAGINATION.INITIAL_PAGE,limit:h=t.default.PAGINATION.LIMIT}=p||{};return yield r.searchTags({query:u,page:f,limit:h,env:this.env})}catch(f){throw new Error(`Push SDK Error: API : channel::tags::search : ${f}`)}}),this.list=u=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:p=t.default.PAGINATION.INITIAL_PAGE,limit:f=t.default.PAGINATION.LIMIT,order:h=s.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:y=s.default.FILTER.TAGS.PUSH}=u||{};return yield r.getAllTags({page:p,limit:f,order:h,filter:y,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : channel::tags::list : ${p}`)}}),this.channel=a}}return Uu.Tags=i,Uu}var O4;function yO(){if(O4)return Nu;O4=1,Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.Channel=void 0;const e=$e,t=Je(),r=Aa,n=Io(),s=nn(),i=tt(),o=$h(),a=Da(),d=Lh(),c=fO(),l=hO(),u=pO(),p=sd();class f extends p.PushNotificationBaseClass{constructor(y,m,b,v){super(y,m,b,v),this.info=(E,_)=>e.__awaiter(this,void 0,void 0,function*(){try{const{raw:C=!0}=_||{};return this.checkUserAddressExists(E),E=E??(0,i.getFallbackETHCAIPAddress)(this.env,this.account),yield n.getChannel({channel:E,env:this.env,raw:C})}catch(C){throw new Error(`Push SDK Error: API : channel::info : ${C}`)}}),this.search=(E,_)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:C=t.default.PAGINATION.INITIAL_PAGE,limit:k=t.default.PAGINATION.LIMIT,filter:D,tag:w,user_subscribed:S,oldFormat:I=!0}=_||{};return yield n.search({query:E,page:C,limit:k,filter:D,tag:w,user_subscribed:S,env:this.env,oldFormat:I})}catch(C){throw new Error(`Push SDK Error: API : channel::search : ${C}`)}}),this.subscribers=E=>e.__awaiter(this,void 0,void 0,function*(){var _,C;try{let k=E!=null&&E.channel?E.channel:this.account?(0,i.getFallbackETHCAIPAddress)(this.env,this.account):null;return this.checkUserAddressExists(k),k=(0,i.validateCAIP)(k)?k:(0,i.getFallbackETHCAIPAddress)(this.env,k),E&&E.page?yield n.getSubscribers({channel:k,env:this.env,page:E.page,limit:(_=E.limit)!==null&&_!==void 0?_:10,setting:(C=E.setting)!==null&&C!==void 0?C:!1,category:E.category,raw:E.raw}):yield n._getSubscribers({channel:k,env:this.env})}catch(k){throw new Error(`Push SDK Error: API : channel::subscribers : ${k}`)}}),this.send=(E,_)=>e.__awaiter(this,void 0,void 0,function*(){var C,k,D;try{this.checkSignerObjectExists();const w=yield this.getChannelOrAliasInfo((C=_.channel)!==null&&C!==void 0?C:this.account);_.advanced=_.advanced||{},_.advanced.pgpPrivateKey=(k=_.advanced.pgpPrivateKey)!==null&&k!==void 0?k:this.pgpPrivateKey;const S=this.generateNotificationLowLevelPayload({signer:this.signer,env:this.env,recipients:E,options:_,channel:(D=_.channel)!==null&&D!==void 0?D:this.account,channelInfo:w});return yield o.sendNotification(S)}catch(w){throw new Error(`Push SDK Error: API : channel::send : ${w}`)}}),this.create=E=>e.__awaiter(this,void 0,void 0,function*(){const{name:_,description:C,url:k,icon:D,alias:w=null,progressHook:S}=E||{};let I=E.tags;try{let T;this.validateChannelParameters(E);const g=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),A=yield this.fetchBalance(g,this.account),P=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18);if(P>A)throw new Error("Insufficient PUSH balance");if(w){if(!(0,i.validateCAIP)(w))throw new Error("Invalid alias CAIP");const J=(0,i.getCAIPDetails)(w);T={[`${J==null?void 0:J.blockchain}:${J==null?void 0:J.networkId}`]:J==null?void 0:J.address}}if(I&&I.length>5&&(I=I.slice(0,5)),(I&&I.length>0?I.join(""):"").length>512)throw new Error("Tags length should not exceed 512 characters");S==null||S(a.default["PUSH-CREATE-01"]);const N={name:_,info:C,url:k,icon:D,aliasDetails:T??{},tags:I},M=yield this.uploadToIPFSViaPushNode(JSON.stringify(N));if(!((yield this.fetchAllownace(g,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=P)&&(S==null||S(a.default["PUSH-CREATE-02"]),!(yield this.approveToken(g,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,P))))throw new Error("Something went wrong while approving the token");const x=s.CHANNEL_TYPE.GENERAL,R="1+"+M,K=r.stringToBytes(R);S==null||S(a.default["PUSH-CREATE-03"]);const V=yield this.createChannel(this.coreContract,x,K,P);return S==null||S(a.default["PUSH-CREATE-04"]),{transactionHash:V}}catch(T){const g=a.default["PUSH-ERROR-02"];throw S==null||S(g("Create Channel",T)),new Error(`Push SDK Error: Contract : createChannelWithPUSH : ${T}`)}}),this.update=E=>e.__awaiter(this,void 0,void 0,function*(){const{name:_,description:C,url:k,icon:D,alias:w=null,progressHook:S}=E||{};let I=E.tags;try{let T;this.validateChannelParameters(E);const g=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),A=yield this.fetchBalance(g,this.account),P=yield this.fetchUpdateCounter(this.coreContract,this.account),N=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18)*P;if(N>A)throw new Error("Insufficient PUSH balance");if(w){if(!(0,i.validateCAIP)(w))throw new Error("Invalid alias CAIP");const se=(0,i.getCAIPDetails)(w);T={[`${se==null?void 0:se.blockchain}:${se==null?void 0:se.networkId}`]:se==null?void 0:se.address}}I&&I.length>5&&(I=I.slice(0,5));const M=I&&I.length>0?I.join(""):"";S==null||S(a.default["PUSH-UPDATE-01"]);const L={name:_,info:C,url:k,icon:D,aliasDetails:T??{},tags:I},x=yield this.uploadToIPFSViaPushNode(JSON.stringify(L));if(!((yield this.fetchAllownace(g,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=N)&&(S==null||S(a.default["PUSH-UPDATE-02"]),!(yield this.approveToken(g,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,N))))throw new Error("Something went wrong while approving the token");const K="1+"+x,V=r.stringToBytes(K);S==null||S(a.default["PUSH-UPDATE-03"]);const J=yield this.updateChannel(this.coreContract,this.account,V,N);return S==null||S(a.default["PUSH-UPDATE-04"]),{transactionHash:J}}catch(T){const g=a.default["PUSH-ERROR-02"];throw S==null||S(g("Update Channel",T)),new Error(`Push SDK Error: Contract channel::update : ${T}`)}}),this.verify=E=>e.__awaiter(this,void 0,void 0,function*(){try{if(this.checkSignerObjectExists(),(0,i.validateCAIP)(E)&&(E=E.split(":")[2]),!r.isAddress(E))throw new Error("Invalid channel address");const _=yield this.info(this.account);if((_==null?void 0:_.verified_status)==0)throw new Error("Only verified channel can verify other channel");const C=yield this.verifyChannel(this.coreContract,E);if(!C)throw new Error("Something went wrong while verifying the channel");return{transactionHash:C}}catch(_){throw new Error(`Push SDK Error: Contract channel::verify : ${_}`)}}),this.setting=E=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const _=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),C=yield this.fetchBalance(_,this.account),k=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18),D=yield this.fetchUpdateCounter(this.coreContract,this.account),w=k*D;if(w>C)throw new Error("Insufficient PUSH balance");if(!((yield this.fetchAllownace(_,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=w)&&!(yield this.approveToken(_,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,w)))throw new Error("Something went wrong while approving your token");const{setting:I,description:T}=this.getMinimalSetting(E);return{transactionHash:yield this.createChanelSettings(this.coreContract,E.length,I,T,k)}}catch(_){throw new Error(`Push SDK Error: Contract : channel::setting : ${_}`)}}),this.notifications=(E,_)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:C,limit:k,filter:D=null,raw:w=!0}=_||{};return yield n.getChannelNotifications({channel:E,env:this.env,filter:D,raw:w,page:C,limit:k})}catch(C){throw new Error(`Push SDK Error: Contract : channel::notifications : ${C}`)}}),this.list=E=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:_,limit:C,sort:k=d.ChannelListSortType.SUBSCRIBER,order:D=d.ChannelListOrderType.DESCENDING,filter:w,tag:S,user_subscribed:I}=E||{};return yield n.getChannels({env:this.env,page:_,limit:C,sort:k,order:D,filter:w,tag:S,user_subscribed:I})}catch(_){throw new Error(`Push SDK Error: Contract : channel::list : ${_}`)}}),this.delegate=new l.Delegate(y,m,b),this.alias=new c.Alias(y,m,b),this.tags=new u.Tags(this,y,m,b)}}return Nu.Channel=f,Nu}var ly={},N4;function gO(){return N4||(N4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Notification=e.FEED_MAP=void 0;const t=$e,r=Je(),n=Lh(),s=kn(),i=Io(),o=tt(),a=sd(),d="Channel is needed";e.FEED_MAP={INBOX:!1,SPAM:!0};class c extends a.PushNotificationBaseClass{constructor(u,p,f,h){super(u,p,f,h),this.list=(y=n.FeedType.INBOX,m)=>t.__awaiter(this,void 0,void 0,function*(){const{page:b=r.default.PAGINATION.INITIAL_PAGE,limit:v=r.default.PAGINATION.LIMIT,channels:E=[],raw:_=!1}=m||{};try{let C;m!=null&&m.account?this.isValidPCaip(m.account)?C=(0,o.pCAIP10ToWallet)(m.account):C=m.account:this.account&&(C=(0,o.getFallbackETHCAIPAddress)(this.env,this.account)),this.checkUserAddressExists(C);const k=this.getAddressFromCaip(C);if(E.length==0)return yield s.getFeeds({user:k,page:b,limit:v,spam:e.FEED_MAP[y],raw:_,env:this.env});{const D=E.map(I=>t.__awaiter(this,void 0,void 0,function*(){return yield s.getFeedsPerChannel({user:k,page:b,limit:v,spam:e.FEED_MAP[y],raw:_,env:this.env,channels:[I]})}));return(yield Promise.all(D)).flat()}}catch(C){throw new Error(`Push SDK Error: API : notifcaiton::list : ${C}`)}}),this.subscriptions=y=>t.__awaiter(this,void 0,void 0,function*(){try{const{page:m=r.default.PAGINATION.INITIAL_PAGE,limit:b=r.default.PAGINATION.LIMIT,channel:v=null,raw:E}=y||{};let _;return y!=null&&y.account?this.isValidPCaip(y.account)?_=(0,o.pCAIP10ToWallet)(y.account):_=y.account:this.account&&(_=(0,o.getFallbackETHCAIPAddress)(this.env,this.account)),this.checkUserAddressExists(_),yield s.getSubscriptions({user:_,env:this.env,channel:v,raw:E})}catch(m){throw new Error(`Push SDK Error: API : notifcaiton::subscriptions : ${m}`)}}),this.subscribe=(y,m)=>t.__awaiter(this,void 0,void 0,function*(){try{const{onSuccess:b,onError:v,settings:E}=m||{};if(this.checkSignerObjectExists(),this.checkUserAddressExists(),!y&&y!="")throw new Error(d);this.isValidPCaip(y)&&(y=(0,o.pCAIP10ToWallet)(y)),(0,o.validateCAIP)(y)||(y=(0,o.getFallbackETHCAIPAddress)(this.env,y));const _=(0,o.getCAIPDetails)(y),C=(0,o.getCAIPWithChainId)(this.account,parseInt(_==null?void 0:_.networkId)),k=this.getMinimalUserSetting(E);return yield i.subscribeV2({signer:this.signer,channelAddress:y,userAddress:C,env:this.env,settings:k??"",onSuccess:b,onError:v,pgpPrivateKey:this.pgpPrivateKey})}catch(b){throw new Error(`Push SDK Error: API : notifcaiton::subscribe : ${b}`)}}),this.unsubscribe=(y,m)=>t.__awaiter(this,void 0,void 0,function*(){try{const{onSuccess:b,onError:v}=m||{};if(this.checkUserAddressExists(),this.checkSignerObjectExists(),!y&&y!="")return new Error(d);this.isValidPCaip(y)&&(y=(0,o.pCAIP10ToWallet)(y)),(0,o.validateCAIP)(y)||(y=(0,o.getFallbackETHCAIPAddress)(this.env,y));const E=(0,o.getCAIPDetails)(y),_=(0,o.getCAIPWithChainId)(this.account,parseInt(E==null?void 0:E.networkId));return yield i.unsubscribeV2({signer:this.signer,channelAddress:y,userAddress:_,env:this.env,onSuccess:b,onError:v,pgpPrivateKey:this.pgpPrivateKey})}catch(b){throw new Error(`Push SDK Error: API : notifcaiton::unsubscribe : ${b}`)}})}}e.Notification=c}(ly)),ly}var Bu={},Lu={},D4;function mO(){if(D4)return Lu;D4=1,Object.defineProperty(Lu,"__esModule",{value:!0}),Lu.SpaceV2=void 0;const e=$e,t=Ur();let r=class{constructor({spaceV1Instance:s,spaceInfo:i}){this.spaceV1Instance=s,this.spaceInfo=i}start(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.start()})}join(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.join()})}update(s){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.update(s)})}leave(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.leave()})}stop(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.stop()})}requestForMic(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.requestToBePromoted({role:t.SPACE_INVITE_ROLES.SPEAKER,promotorAddress:this.spaceInfo.spaceCreator})})}acceptMicRequest({address:s,signal:i}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.acceptPromotionRequest({promoteeAddress:s,spaceId:this.spaceInfo.spaceId,role:t.SPACE_INVITE_ROLES.SPEAKER,signalData:i})})}rejectMicRequest({address:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.rejectPromotionRequest({promoteeAddress:s})})}inviteToPromote({address:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.inviteToPromote({inviteeAddress:s,role:t.SPACE_INVITE_ROLES.SPEAKER})})}acceptPromotionInvite({signal:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.acceptPromotionInvite({invitorAddress:this.spaceInfo.spaceCreator,spaceId:this.spaceInfo.spaceId,signalData:s})})}rejectPromotionInvite(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.rejectPromotionInvite({invitorAddress:this.spaceInfo.spaceCreator})})}config({audio:s}){typeof s=="boolean"&&this.spaceV1Instance.enableAudio({state:s})}};return Lu.SpaceV2=r,Lu}var x4;function bO(){if(x4)return Bu;x4=1,Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.Space=void 0;const e=$e,t=Ql(),r=ug(),n=ri(),s=Mo(),i=j9(),o=$9(),a=ri(),d=tt(),c=dg(),l=tt(),u=mO(),p=cg();class f{constructor(y,m,b,v,E){this.account=y,this.env=m,this.decryptedPgpPvtKey=b,this.signer=v,this.progressHook=E,this.participants={list:(_,C)=>e.__awaiter(this,void 0,void 0,function*(){const{page:k=1,limit:D=20}=C??{},w={chatId:_,page:k,limit:D,env:this.env};return{members:(yield n.getGroupMembers(w)).map(T=>({address:T.address,intent:T.intent,role:T.role.toUpperCase()==="ADMIN"?"SPEAKER":"LISTENER",userInfo:T.userInfo}))}}),count:_=>e.__awaiter(this,void 0,void 0,function*(){const C=yield n.getGroupMemberCount({chatId:_,env:this.env});return{participants:C.overallCount-C.pendingCount,pending:C.pendingCount}}),status:(_,C)=>e.__awaiter(this,void 0,void 0,function*(){const k=yield n.getGroupMemberStatus({chatId:_,did:C,env:this.env});return{pending:k.isPending,role:k.isAdmin?"SPEAKER":"LISTENER",participant:k.isMember}})},this.chatInstance=new c.Chat(this.account,this.env,{feature:[]},this.decryptedPgpPvtKey,this.signer)}create(y,m){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is required to create a space.");const b={signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,spaceName:y,spaceDescription:m.description||null,listeners:m.participants.listeners,speakers:m.participants.speakers,spaceImage:m.image||null,isPublic:typeof m.private=="boolean"?!m.private:!0,rules:m.rules||{},config:{scheduleAt:m.schedule.start,scheduleEnd:m.schedule.end||null},env:this.env};return yield r.createV2(b)})}update(y,m){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());let b=null;try{if(b=yield n.getGroupInfo({chatId:y,env:this.env}),!b)throw new Error("Space not found")}catch{throw new Error("Space not found")}const v={chatId:y,groupName:m.name?m.name:b.groupName,groupDescription:m.description?m.description:b.groupDescription,groupImage:m.image?m.image:b.groupImage,rules:m.rules?m.rules:b.rules,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env},E={chatId:y,meta:m.meta?m.meta:b.meta,scheduleAt:m.scheduleAt?m.scheduleAt:b.scheduleAt,scheduleEnd:m.scheduleEnd?m.scheduleEnd:b.scheduleEnd,status:m.status?m.status:b.status,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};yield(0,i.updateGroupProfile)(v);const _=yield(0,o.updateGroupConfig)(E);return(0,a.groupInfoDtoToSpaceInfoDto)(_)})}info(y){return e.__awaiter(this,void 0,void 0,function*(){const m=yield n.getGroupInfo({chatId:y,env:this.env});return(0,a.groupInfoDtoToSpaceInfoDto)(m)})}permissions(y){return e.__awaiter(this,void 0,void 0,function*(){const m={chatId:y,did:this.account,env:this.env};return yield n.getGroupAccess(m)})}add(y,m){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const{role:b,accounts:v}=m;if(!["SPEAKER","LISTENER"].includes(b))throw new Error("Invalid role provided.");if(!v||v.length===0)throw new Error("accounts array cannot be empty!");v.forEach(C=>{if(!(0,d.isValidPushCAIP)(C))throw new Error(`Invalid account address: ${C}`)});let _;return b==="SPEAKER"?_=yield n.addAdmins({chatId:y,admins:v,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):_=yield n.addMembers({chatId:y,members:v,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}),(0,a.groupInfoDtoToSpaceInfoDto)(_)})}remove(y,m){return e.__awaiter(this,void 0,void 0,function*(){const{accounts:b}=m;if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());if(!b||b.length===0)throw new Error("Accounts array cannot be empty!");b.forEach(_=>{if(!(0,d.isValidPushCAIP)(_))throw new Error(`Invalid account address: ${_}`)});const v=[],E=[];for(const _ of b){const C=yield n.getGroupMemberStatus({chatId:y,did:_,env:this.env});C.isAdmin?v.push(_):C.isMember&&E.push(_)}return v.length>0&&(yield n.removeAdmins({chatId:y,admins:v,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),E.length>0&&(yield n.removeMembers({chatId:y,members:E,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),yield this.info(y)})}modify(y,m){return e.__awaiter(this,void 0,void 0,function*(){const{role:b,accounts:v}=m;if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());if(!["SPEAKER","LISTENER"].includes(b))throw new Error("Invalid role provided.");if(!v||v.length===0)throw new Error("accounts array cannot be empty!");v.forEach(k=>{if(!(0,d.isValidPushCAIP)(k))throw new Error(`Invalid account address: ${k}`)});let _=null;b==="SPEAKER"?_="ADMIN":_="MEMBER";const C=yield n.modifyRoles({chatId:y,newRole:_,members:v,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1});return(0,a.groupInfoDtoToSpaceInfoDto)(C)})}join(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const m=yield n.getGroupMemberStatus({chatId:y,did:this.account,env:this.env});return m.isPending?yield n.approve({senderAddress:y,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):m.isMember||(yield n.addMembers({chatId:y,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),yield this.info(y)})}leave(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const m=yield n.getGroupMemberStatus({chatId:y,did:this.account,env:this.env});let b;return m.isAdmin?b=yield n.removeAdmins({chatId:y,admins:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):b=yield n.removeMembers({chatId:y,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}),(0,a.groupInfoDtoToSpaceInfoDto)(b)})}search(y,m){return e.__awaiter(this,void 0,void 0,function*(){const{page:b=1,limit:v=20}=m??{};return(yield r.search({searchTerm:y,pageNumber:b,pageSize:v,env:this.env})).map(_=>n.spaceDtoToSpaceInfoDto(_))})}trending(y){return e.__awaiter(this,void 0,void 0,function*(){const{page:m=1,limit:b=20}=y??{};return yield r.trending({page:m,limit:b,env:this.env})})}list(y,m){return e.__awaiter(this,void 0,void 0,function*(){const v={account:(m==null?void 0:m.overrideAccount)||this.account,pgpPrivateKey:this.decryptedPgpPvtKey,page:m==null?void 0:m.page,limit:m==null?void 0:m.limit,env:this.env,toDecrypt:!!this.decryptedPgpPvtKey};switch(y){case t.SpaceListType.SPACES:return yield r.spaces(v);case t.SpaceListType.REQUESTS:return yield r.requests(v);default:throw new Error("Invalid Space List Type")}})}accept(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return this.chatInstance.accept(y)})}reject(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return this.chatInstance.reject(y)})}get chat(){return{send:(y,m)=>e.__awaiter(this,void 0,void 0,function*(){return this.chatInstance.send(y,m)}),decrypt:y=>e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return yield this.chatInstance.decrypt(y)}),latest:y=>e.__awaiter(this,void 0,void 0,function*(){return yield this.chatInstance.latest(y)}),history:(y,m)=>e.__awaiter(this,void 0,void 0,function*(){return yield this.chatInstance.history(y,m)})}}initialize(y){return e.__awaiter(this,void 0,void 0,function*(){const{onChange:m,spaceId:b}=y;if(!this.signer)throw new Error("Signer is required for push space");if(!this.decryptedPgpPvtKey)throw new Error("PushSDK was initialized in readonly mode. Space functionality is not available.");const v=yield new l.Signer(this.signer).getChainId();if(!v)throw new Error("Chain Id not retrievable from signer");const E=new p.Space({signer:this.signer,chainId:v,pgpPrivateKey:this.decryptedPgpPvtKey,setSpaceData:m,address:this.account,env:this.env});yield E.initialize({spaceId:b});const _=yield this.info(b);return new u.SpaceV2({spaceV1Instance:E,spaceInfo:_})})}}return Bu.Space=f,Bu}var Ku={},qu={},ju={},U4;function vO(){if(U4)return ju;U4=1,Object.defineProperty(ju,"__esModule",{value:!0}),ju.validatePeerInfo=void 0;const e=tt(),t=Ur(),r=n=>{const{signal:s,address:i,meta:o}=n;if(!s)throw new Error("Invalid signal data received");if(!(0,e.isValidPushCAIP)(i))throw new Error("Invalid address received");if(o.rules.access.type===t.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&!o.rules.access.data.chatId)throw new Error("ChatId not found in meta.rules")};return ju.validatePeerInfo=r,ju}var B4;function _O(){if(B4)return qu;B4=1,Object.defineProperty(qu,"__esModule",{value:!0}),qu.VideoV2=void 0;const e=$e,t=ii(),r=ri(),n=tt(),s=Ur(),i=pn(),o=vO();let a=class{constructor({videoV1Instance:c,account:l,decryptedPgpPvtKey:u,env:p,peerInfos:f}){this.videoInstance=c,this.account=l,this.decryptedPgpPvtKey=u,this.env=p,this.peerInfos=f}request(c,l){return e.__awaiter(this,void 0,void 0,function*(){const{rules:u}=l||{};for(const f of c)if(!(0,n.isValidPushCAIP)(f))throw new Error("Invalid recipient address found");if(c.length===0)throw new Error("Alteast one recipient address is required for a video call");if(c.length>1&&(u==null?void 0:u.access.type)===s.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&!u.access.data.chatId)throw new Error("For multiple recipient addresses, chatId is required for a video call");let p="";if(!(u!=null&&u.access.data.chatId)){let f=1;const h=30;for(;!p;){const y=yield(0,r.chats)({account:this.account,toDecrypt:!0,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,page:f,limit:h});if(y.length===0)break;y.forEach(m=>{m.did===(0,n.walletToPCAIP10)(c[0])&&m.chatId&&(p=m.chatId)}),f++}if(!p)throw new Error(`ChatId not found between local user (${this.account}) and recipient (${c[0]}).`)}this.videoInstance.setData(f=>(0,t.produce)(f,h=>{var y;h.local.address=this.account,h.incoming=c.map(m=>({address:(0,n.pCAIP10ToWallet)(m),status:i.VideoCallStatus.INITIALIZED})),h.meta.chatId=(y=u==null?void 0:u.access.data.chatId)!==null&&y!==void 0?y:p})),yield this.videoInstance.request({senderAddress:(0,n.pCAIP10ToWallet)(this.account),recipientAddress:c.map(f=>(0,n.pCAIP10ToWallet)(f)),rules:u??{access:{type:s.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:p}}}})})}approve(c){return e.__awaiter(this,void 0,void 0,function*(){if(!c){const u=Object.keys(this.peerInfos);if(u.length!==1)throw new Error("Either no request exists or more than one request found. Please pass an address.");c=u[0]}const l=this.peerInfos[(0,n.walletToPCAIP10)(c)];(0,o.validatePeerInfo)(l),yield this.videoInstance.acceptRequest({senderAddress:(0,n.pCAIP10ToWallet)(this.account),recipientAddress:(0,n.pCAIP10ToWallet)(c),signalData:l.signal,rules:l.meta.rules})})}deny(c){return e.__awaiter(this,void 0,void 0,function*(){if(!c){const u=Object.keys(this.peerInfos);if(u.length!==1)throw new Error("Either no request exists or more than one request found. Please pass an address.");c=u[0]}const l=this.peerInfos[(0,n.walletToPCAIP10)(c)];(0,o.validatePeerInfo)(l),yield this.videoInstance.disconnect({peerAddress:(0,n.pCAIP10ToWallet)(c)})})}disconnect(){return e.__awaiter(this,void 0,void 0,function*(){yield this.videoInstance.disconnect()})}config({video:c,audio:l}){typeof c=="boolean"&&this.videoInstance.enableVideo({state:c}),typeof l=="boolean"&&this.videoInstance.enableAudio({state:l})}};return qu.VideoV2=a,qu}var L4;function wO(){if(L4)return Ku;L4=1,Object.defineProperty(Ku,"__esModule",{value:!0}),Ku.Video=void 0;const e=$e,t=nd(),r=pn(),n=tt(),s=q9(),i=_O(),o=ii(),a=L9();class d{constructor(l,u,p,f){this.account=l,this.env=u,this.decryptedPgpPvtKey=p,this.signer=f,this.peerInfos={}}initialize(l,u){return e.__awaiter(this,void 0,void 0,function*(){const{stream:p,config:f,media:h}=u;if(!this.signer)throw new Error("Signer is required for push video");if(!this.decryptedPgpPvtKey)throw new Error("PushSDK was initialized in readonly mode. Video functionality is not available.");const y=yield new n.Signer(this.signer).getChainId();if(!y)throw new Error("Chain Id not retrievable from signer");const m=new s.Video({signer:this.signer,chainId:y,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,setData:l});return yield m.create(Object.assign(Object.assign(Object.assign({},h&&{stream:h}),(f==null?void 0:f.audio)&&{audio:f.audio}),(f==null?void 0:f.video)&&{video:f.video})),p.on(t.default.STREAM.VIDEO,b=>{const{address:v,signal:E,meta:{rules:_}}=b.peerInfo,C=_.access.data.chatId;b.event===t.default.VIDEO.EVENT.REQUEST&&(this.peerInfos[(0,n.walletToPCAIP10)(b.peerInfo.address)]=b.peerInfo,m.setData(k=>(0,o.produce)(k,D=>{D.local.address=this.account,D.incoming[0].address=v,D.incoming[0].status=r.VideoCallStatus.RECEIVED,D.meta.chatId=C,D.meta.initiator.address=v,D.meta.initiator.signal=E}))),C&&C===m.data.meta.chatId&&(b.event===t.default.VIDEO.EVENT.DENY&&(m.data.local.stream&&(0,a.endStream)(m.data.local.stream),m.setData(()=>s.initVideoCallData)),(b.event===t.default.VIDEO.EVENT.APPROVE||b.event===t.default.VIDEO.EVENT.RETRY_APPROVE)&&m.connect({peerAddress:v,signalData:E}),b.event===t.default.VIDEO.EVENT.RETRY_REQUEST&&m.isInitiator()&&m.request({senderAddress:this.account,recipientAddress:v,rules:_,retry:!0}),b.event===t.default.VIDEO.EVENT.RETRY_REQUEST&&!m.isInitiator()&&m.acceptRequest({signalData:E,senderAddress:this.account,recipientAddress:v,rules:_,retry:!0}))}),new i.VideoV2({videoV1Instance:m,account:this.account,decryptedPgpPvtKey:this.decryptedPgpPvtKey,env:this.env,peerInfos:this.peerInfos})})}}return Ku.Video=d,Ku}var K4;function Mo(){if(K4)return pu;K4=1,Object.defineProperty(pu,"__esModule",{value:!0}),pu.PushAPI=void 0;const e=$e,t=Je(),r=kn(),n=ri(),s=Mt(),i=dg(),o=WM(),a=YM(),d=lg(),c=lO(),l=yO(),u=gO(),p=nn(),f=bO(),h=wO(),y=tt(),m=Q2(),b=ag();let v=class Q9{constructor(_,C,k,D,w,S,I,T,g){this.signer=I,this.readMode=k,this.alpha=D,this.env=_,this.account=C,this.chainWiseAccount=(0,y.walletToPCAIP10)(C),this.decryptedPgpPvtKey=w,this.pgpPublicKey=S,this.progressHook=T,this.channel=new l.Channel(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.notification=new u.Notification(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.uid=(0,b.v4)(),this.cache=m.cache,this.chat=new i.Chat(this.account,this.env,this.alpha,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.space=new f.Space(this.account,this.env,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.profile=new o.Profile(this.account,this.env,this.cache,this.decryptedPgpPvtKey,this.progressHook),this.encryption=new a.Encryption(this.account,this.env,this.decryptedPgpPvtKey,this.pgpPublicKey,this.signer,this.progressHook),this.user=new d.User(this.account,this.env),this.video=new h.Video(this.account,this.env,this.decryptedPgpPvtKey,this.signer),this.errors=g||[]}static initialize(..._){return e.__awaiter(this,void 0,void 0,function*(){try{let C,k,D;if(_.length===1&&typeof _[0]=="object")"account"in _[0]&&typeof _[0].account=="string"?k=_[0]:[C]=_;else if(_.length===2)[C,k]=_;else throw new Error("Invalid arguments provided to initialize method.");if(k&&"decryptedPGPPrivateKey"in k&&typeof k.decryptedPGPPrivateKey=="string"&&(D=k.decryptedPGPPrivateKey),!C&&!(k!=null&&k.account))throw new Error("Either 'signer' or 'account' must be provided.");let w=!C&&!D;const S={env:t.ENV.STAGING,version:t.default.ENC_TYPE_V3,autoUpgrade:!0,account:null},I=Object.assign(Object.assign(Object.assign({},S),k),{version:(k==null?void 0:k.version)||S.version,versionMeta:(k==null?void 0:k.versionMeta)||S.versionMeta,autoUpgrade:(k==null?void 0:k.autoUpgrade)!==void 0?k==null?void 0:k.autoUpgrade:S.autoUpgrade,alpha:k!=null&&k.alpha&&k.alpha.feature?k.alpha:p.ALPHA_FEATURE_CONFIG[t.PACKAGE_BUILD]}),T=[];let g;if(C?g=yield(0,s.getAccountAddress)((0,s.getWallet)({account:I.account,signer:C})):g=k==null?void 0:k.account,!g)throw new Error("Account could not be derived.");let A;const P=yield r.get({account:g,env:I.env});if(P&&P.publicKey&&(A=P.publicKey),!w)try{if(P&&P.encryptedPrivateKey)D||(D=yield n.decryptPGPKey({encryptedPGPPrivateKey:P.encryptedPrivateKey,signer:C,toUpgrade:I.autoUpgrade,additionalMeta:I.versionMeta,progressHook:I.progressHook,env:I.env}));else{const N=yield r.create({env:I.env,account:g,signer:C,version:I.version,additionalMeta:I.versionMeta,origin:I.origin,progressHook:I.progressHook});D=N.decryptedPrivateKey,A=N.publicKey}}catch(N){const M="Error decrypting PGP private key ...swiching to Guest mode "+(`
|
|
77
|
-
`+N);if(T.push({type:"ERROR",message:M}),console.error(M),(0,y.isValidNFTCAIP)(g)){const L="NFT Account Detected. If this NFT was recently transferred to you, please ensure you have received the correct password from the previous owner. Alternatively, you can reinitialize for a fresh start. Please be aware that reinitialization will result in the loss of all previous account data.";T.push({type:"WARN",message:L}),console.warn(L)}else if((0,y.isValidSCWCAIP)(g)){const L="Smart Contract Wallet Account Detected. If this SCW was recently transferred to you, please ensure you have received the correct password from the previous owner. Alternatively, you can reinitialize for a fresh start. Please be aware that reinitialization will result in the loss of all previous account data.";T.push({type:"WARN",message:L}),console.warn(L)}w=!0}return new Q9(I.env,g,w,I.alpha,D,A,C,I.progressHook,T)}catch(C){throw console.error("Error initializing PushAPI:",C),C}})}reinitialize(_){return e.__awaiter(this,void 0,void 0,function*(){const C=yield r.create({env:this.env,account:this.account,signer:this.signer,additionalMeta:_.versionMeta,progressHook:this.progressHook});this.decryptedPgpPvtKey=C.decryptedPrivateKey,this.pgpPublicKey=C.publicKey,this.readMode=!1,this.errors=[],this.uid=(0,b.v4)(),this.chat=new i.Chat(this.account,this.env,this.alpha,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.profile=new o.Profile(this.account,this.env,this.cache,this.decryptedPgpPvtKey,this.progressHook),this.encryption=new a.Encryption(this.account,this.env,this.decryptedPgpPvtKey,this.pgpPublicKey,this.signer,this.progressHook),this.channel=new l.Channel(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.notification=new u.Notification(this.signer,this.env,this.account,this.decryptedPgpPvtKey)})}initStream(_,C){return e.__awaiter(this,void 0,void 0,function*(){if(this.stream)throw new Error("Stream is already initialized.");return this.stream=yield c.PushStream.initialize(this.account,_,this.env,this.decryptedPgpPvtKey,this.progressHook,this.signer,C),this.stream})}info(_){return e.__awaiter(this,void 0,void 0,function*(){const C=(_==null?void 0:_.overrideAccount)||this.account;return yield r.get({account:C,env:this.env})})}readmode(){return this.readMode}static ensureSignerMessage(){return"Operation not allowed in read-only mode. Signer is required."}};return pu.PushAPI=v,pu}var q4;function EO(){return q4||(q4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.video=e.space=e.chat=e.payloads=e.utils=e.user=e.channels=e.alias=e.PushAPI=e.CONSTANTS=void 0;const t=$e,r=A9();e.alias=r;const n=Io();e.channels=n;const s=kn();e.user=s;const i=tg();e.utils=i;const o=$h();e.payloads=o;const a=ri();e.chat=a;const d=ug();e.space=d;const c=og();e.video=c;const l=nd();e.CONSTANTS=l.default,t.__exportStar(pn(),e),t.__exportStar(Lh(),e),t.__exportStar(Kh(),e),t.__exportStar(Ql(),e);var u=Mo();Object.defineProperty(e,"PushAPI",{enumerable:!0,get:function(){return u.PushAPI}})}(Yh)),Yh}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),$e.__exportStar(EO(),e)})(c2);const AO=qA(c2),BO=JA({__proto__:null,default:AO},[c2]);export{BO as i};
|