@gvnrdao/dh-mcp 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/connector.js CHANGED
@@ -14313,6 +14313,9 @@ var require_pkg_src = __commonJS({
14313
14313
  });
14314
14314
  var index_exports = {};
14315
14315
  __export3(index_exports, {
14316
+ BORROWER_AUTHORIZATION_ENCODE_TYPES: () => BORROWER_AUTHORIZATION_ENCODE_TYPES,
14317
+ BORROWER_AUTHORIZATION_FIELDS: () => BORROWER_AUTHORIZATION_FIELDS,
14318
+ BORROWER_AUTHORIZATION_PRIMARY_TYPES: () => BORROWER_AUTHORIZATION_PRIMARY_TYPES,
14316
14319
  CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
14317
14320
  DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
14318
14321
  DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
@@ -14325,6 +14328,8 @@ var require_pkg_src = __commonJS({
14325
14328
  PerformanceTracker: () => PerformanceTracker,
14326
14329
  RetryStrategy: () => RetryStrategy,
14327
14330
  analyzeError: () => analyzeError,
14331
+ borrowerAuthorizationTypes: () => borrowerAuthorizationTypes,
14332
+ buildBorrowerAuthorizationDomain: () => buildBorrowerAuthorizationDomain,
14328
14333
  calculateDelay: () => calculateDelay,
14329
14334
  cidToHex: () => cidToHex,
14330
14335
  classifyError: () => classifyError,
@@ -14571,30 +14576,30 @@ var require_pkg_src = __commonJS({
14571
14576
  }
14572
14577
  },
14573
14578
  btcTransactionSigner: {
14574
- cid: "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp",
14579
+ cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
14575
14580
  authorizedCidHex: cidToHex(
14576
- "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp"
14581
+ "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
14577
14582
  ),
14578
14583
  name: "Btc Transaction Signer",
14579
14584
  description: "Production Btc Transaction Signer",
14580
14585
  version: "1.1.1",
14581
14586
  deployed: true,
14582
- deployedAt: 1786465606156,
14583
- size: 67999,
14584
- hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
14587
+ deployedAt: 1787923905597,
14588
+ size: 70646,
14589
+ hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
14585
14590
  },
14586
14591
  ucdMintValidator: {
14587
- cid: "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx",
14592
+ cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
14588
14593
  authorizedCidHex: cidToHex(
14589
- "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx"
14594
+ "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
14590
14595
  ),
14591
14596
  name: "Ucd Mint Validator",
14592
14597
  description: "Production Ucd Mint Validator",
14593
14598
  version: "1.2.1",
14594
14599
  deployed: true,
14595
- deployedAt: 1786465627201,
14596
- size: 82739,
14597
- hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
14600
+ deployedAt: 1787923919527,
14601
+ size: 86197,
14602
+ hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
14598
14603
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14599
14604
  pkp: {
14600
14605
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -14602,17 +14607,17 @@ var require_pkg_src = __commonJS({
14602
14607
  }
14603
14608
  },
14604
14609
  processPaymentValidator: {
14605
- cid: "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z",
14610
+ cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
14606
14611
  authorizedCidHex: cidToHex(
14607
- "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z"
14612
+ "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
14608
14613
  ),
14609
14614
  name: "Process Payment Validator",
14610
14615
  description: "Production Process Payment Validator",
14611
14616
  version: "1.2.1",
14612
14617
  deployed: true,
14613
- deployedAt: 1786465654796,
14614
- size: 78736,
14615
- hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
14618
+ deployedAt: 1787923987153,
14619
+ size: 82217,
14620
+ hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
14616
14621
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14617
14622
  pkp: {
14618
14623
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
@@ -14620,17 +14625,17 @@ var require_pkg_src = __commonJS({
14620
14625
  }
14621
14626
  },
14622
14627
  extendPositionValidator: {
14623
- cid: "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav",
14628
+ cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
14624
14629
  authorizedCidHex: cidToHex(
14625
- "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav"
14630
+ "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
14626
14631
  ),
14627
14632
  name: "Extend Position Validator",
14628
14633
  description: "Production Extend Position Validator",
14629
14634
  version: "1.2.1",
14630
14635
  deployed: true,
14631
- deployedAt: 1786465681874,
14632
- size: 76515,
14633
- hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
14636
+ deployedAt: 1787923999294,
14637
+ size: 79975,
14638
+ hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
14634
14639
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14635
14640
  pkp: {
14636
14641
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
@@ -14638,17 +14643,17 @@ var require_pkg_src = __commonJS({
14638
14643
  }
14639
14644
  },
14640
14645
  btcWithdrawal: {
14641
- cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
14646
+ cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
14642
14647
  authorizedCidHex: cidToHex(
14643
- "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
14648
+ "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
14644
14649
  ),
14645
14650
  name: "Btc Withdrawal",
14646
14651
  description: "Production Btc Withdrawal",
14647
14652
  version: "1.2.7",
14648
14653
  deployed: true,
14649
- deployedAt: 1786446046614,
14650
- size: 97456,
14651
- hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
14654
+ deployedAt: 1787924017769,
14655
+ size: 100069,
14656
+ hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
14652
14657
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14653
14658
  pkp: {
14654
14659
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -14760,30 +14765,30 @@ var require_pkg_src = __commonJS({
14760
14765
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
14761
14766
  },
14762
14767
  agentModuleExecutor: {
14763
- cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
14768
+ cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
14764
14769
  authorizedCidHex: cidToHex(
14765
- "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
14770
+ "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
14766
14771
  ),
14767
14772
  name: "Agent Module Executor",
14768
14773
  description: "Production Agent Module Executor",
14769
14774
  version: "1.1.1",
14770
14775
  deployed: true,
14771
- deployedAt: 1786446108348,
14772
- size: 11655,
14773
- hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
14776
+ deployedAt: 1787924032013,
14777
+ size: 13878,
14778
+ hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
14774
14779
  },
14775
14780
  staleSpendRecoveryValidator: {
14776
- cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
14781
+ cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
14777
14782
  authorizedCidHex: cidToHex(
14778
- "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm"
14783
+ "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
14779
14784
  ),
14780
14785
  name: "Stale Spend Recovery Validator",
14781
14786
  description: "Production Stale Spend Recovery Validator",
14782
14787
  version: "1.1.2",
14783
14788
  deployed: true,
14784
- deployedAt: 1785173285829,
14785
- size: 37108,
14786
- hash: "04de5fc5b6f5131dc1544e3d3d187a1f9ef9616ffd12483d119f9102b3671791",
14789
+ deployedAt: 1787924048772,
14790
+ size: 41424,
14791
+ hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
14787
14792
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14788
14793
  pkp: {
14789
14794
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
@@ -14791,17 +14796,17 @@ var require_pkg_src = __commonJS({
14791
14796
  }
14792
14797
  },
14793
14798
  btcUtxoInvalidator: {
14794
- cid: "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m",
14799
+ cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
14795
14800
  authorizedCidHex: cidToHex(
14796
- "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m"
14801
+ "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
14797
14802
  ),
14798
14803
  name: "Btc Utxo Invalidator",
14799
14804
  description: "Production Btc Utxo Invalidator",
14800
14805
  version: "1.0.0",
14801
14806
  deployed: true,
14802
- deployedAt: 1786465704240,
14803
- size: 62553,
14804
- hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
14807
+ deployedAt: 1787924133241,
14808
+ size: 66026,
14809
+ hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
14805
14810
  }
14806
14811
  };
14807
14812
  function getDeploymentsForNetwork(network) {
@@ -15560,6 +15565,101 @@ ${errorReport}`);
15560
15565
  var SECONDS_PER_DAY = 86400;
15561
15566
  var DAYS_PER_MONTH = 30;
15562
15567
  var LIT_ACTION_ETH_RPC_TIMEOUT_MS = 8e3;
15568
+ var PINNED_CONTRACT_ADDRESSES = {
15569
+ 1: {
15570
+ PositionManager: "0x12A1836e56139ccaD8722B89519d84233efc224B",
15571
+ LoanOperationsManagerModule: "0x2561974A40F1AEed1251d0A090A83cF8536FB9E9",
15572
+ BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
15573
+ BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
15574
+ LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
15575
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
15576
+ },
15577
+ 11155111: {
15578
+ PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
15579
+ LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
15580
+ BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
15581
+ BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
15582
+ LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
15583
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
15584
+ }
15585
+ };
15586
+ function getPinnedContractAddresses(chainId) {
15587
+ return PINNED_CONTRACT_ADDRESSES[chainId] ?? null;
15588
+ }
15589
+ var PROTOCOL_EIP712_DOMAIN_NAME = "DiamondHands.Protocol";
15590
+ var PROTOCOL_EIP712_DOMAIN_VERSION = "1";
15591
+ var BORROWER_AUTHORIZATION_PRIMARY_TYPES = {
15592
+ MINT: "MintRequest",
15593
+ REPAY: "RepayRequest",
15594
+ RENEW: "RenewRequest",
15595
+ WITHDRAW: "WithdrawRequest"
15596
+ };
15597
+ var BORROWER_AUTHORIZATION_FIELDS = {
15598
+ MintRequest: [
15599
+ { name: "positionId", type: "bytes32" },
15600
+ { name: "mintAmount", type: "uint256" },
15601
+ { name: "quantumTimestamp", type: "uint256" }
15602
+ ],
15603
+ RepayRequest: [
15604
+ { name: "positionId", type: "bytes32" },
15605
+ { name: "paymentAmount", type: "uint256" },
15606
+ { name: "quantumTimestamp", type: "uint256" }
15607
+ ],
15608
+ RenewRequest: [
15609
+ { name: "positionId", type: "bytes32" },
15610
+ { name: "selectedTerm", type: "uint256" },
15611
+ { name: "quantumTimestamp", type: "uint256" }
15612
+ ],
15613
+ WithdrawRequest: [
15614
+ { name: "positionId", type: "bytes32" },
15615
+ { name: "totalDeduction", type: "uint256" },
15616
+ { name: "withdrawalAddress", type: "string" },
15617
+ { name: "quantumTimestamp", type: "uint256" }
15618
+ ]
15619
+ };
15620
+ var BORROWER_AUTHORIZATION_ENCODE_TYPES = {
15621
+ MintRequest: "MintRequest(bytes32 positionId,uint256 mintAmount,uint256 quantumTimestamp)",
15622
+ RepayRequest: "RepayRequest(bytes32 positionId,uint256 paymentAmount,uint256 quantumTimestamp)",
15623
+ RenewRequest: "RenewRequest(bytes32 positionId,uint256 selectedTerm,uint256 quantumTimestamp)",
15624
+ WithdrawRequest: "WithdrawRequest(bytes32 positionId,uint256 totalDeduction,string withdrawalAddress,uint256 quantumTimestamp)"
15625
+ };
15626
+ function borrowerAuthorizationTypes(primaryType) {
15627
+ const fields = BORROWER_AUTHORIZATION_FIELDS[primaryType];
15628
+ if (!fields) {
15629
+ throw new Error(
15630
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ${Object.keys(BORROWER_AUTHORIZATION_FIELDS).join(", ")}`
15631
+ );
15632
+ }
15633
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
15634
+ }
15635
+ function buildBorrowerAuthorizationDomain(chainId, verifyingContractOverride) {
15636
+ if (!Number.isInteger(chainId) || chainId <= 0) {
15637
+ throw new Error(
15638
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
15639
+ );
15640
+ }
15641
+ const pinned = getPinnedContractAddresses(chainId);
15642
+ const pinnedLom = pinned?.LoanOperationsManagerModule;
15643
+ if (pinnedLom && verifyingContractOverride) {
15644
+ if (pinnedLom.toLowerCase() !== verifyingContractOverride.toLowerCase()) {
15645
+ throw new Error(
15646
+ `Refusing a caller-supplied verifyingContract that contradicts the pin for chainId ${chainId}: caller ${verifyingContractOverride}, pinned ${pinnedLom}`
15647
+ );
15648
+ }
15649
+ }
15650
+ const verifyingContract = pinnedLom ?? verifyingContractOverride;
15651
+ if (!verifyingContract) {
15652
+ throw new Error(
15653
+ `No pinned LoanOperationsManagerModule for chainId ${chainId} and no verifyingContract supplied; refusing to build a borrower authorization domain without one`
15654
+ );
15655
+ }
15656
+ return {
15657
+ name: PROTOCOL_EIP712_DOMAIN_NAME,
15658
+ version: PROTOCOL_EIP712_DOMAIN_VERSION,
15659
+ chainId,
15660
+ verifyingContract
15661
+ };
15662
+ }
15563
15663
  var EVMChain = /* @__PURE__ */ ((EVMChain3) => {
15564
15664
  EVMChain3["SEPOLIA"] = "sepolia";
15565
15665
  EVMChain3["ETHEREUM"] = "ethereum";
@@ -17361,11 +17461,11 @@ ${auth.clientId}`;
17361
17461
  );
17362
17462
  const prices = await Promise.race([fetchAll, timeoutPromise]);
17363
17463
  const sorted = [...prices].sort((a, b) => a - b);
17364
- let median;
17464
+ let median2;
17365
17465
  if (this.devSingleProvider) {
17366
- median = sorted[0];
17466
+ median2 = sorted[0];
17367
17467
  } else {
17368
- median = sorted[1];
17468
+ median2 = sorted[1];
17369
17469
  const spread3 = (sorted[2] - sorted[0]) / sorted[0];
17370
17470
  if (spread3 > PRICE_ORACLE_TOLERANCE) {
17371
17471
  const names = this.sources.map((s) => s.name).join(", ");
@@ -17375,10 +17475,10 @@ ${auth.clientId}`;
17375
17475
  );
17376
17476
  }
17377
17477
  }
17378
- const priceCents = Math.round(median * 100);
17478
+ const priceCents = Math.round(median2 * 100);
17379
17479
  const priceWith8Decimals = BigInt(priceCents) * 1000000n;
17380
17480
  const totalElapsed = Date.now() - startTime;
17381
- console.log(`[Price Oracle] Median price: $${median.toLocaleString()} \u2014 total time: ${totalElapsed}ms`);
17481
+ console.log(`[Price Oracle] Median price: $${median2.toLocaleString()} \u2014 total time: ${totalElapsed}ms`);
17382
17482
  console.log(`[Price Oracle] Price with 8 decimals: ${priceWith8Decimals}`);
17383
17483
  return priceWith8Decimals;
17384
17484
  }
@@ -18806,22 +18906,82 @@ var require_axios = __commonJS({
18806
18906
  var hasOwnProperty2 = (({
18807
18907
  hasOwnProperty: hasOwnProperty3
18808
18908
  }) => (obj, prop) => hasOwnProperty3.call(obj, prop))(Object.prototype);
18909
+ var isUnsafeObjectKey2 = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
18910
+ var isPrototypeBoundary2 = (obj, prototype3, source) => obj === Object.prototype || !source && prototype3 === null;
18911
+ var isSafeAndFullyMutable2 = (obj) => {
18912
+ if (!Object.isExtensible(obj)) {
18913
+ return false;
18914
+ }
18915
+ const props = Object.getOwnPropertyNames(obj);
18916
+ if (Object.getOwnPropertySymbols) {
18917
+ props.push(...Object.getOwnPropertySymbols(obj));
18918
+ }
18919
+ return props.every((prop) => {
18920
+ if (isUnsafeObjectKey2(prop)) {
18921
+ return false;
18922
+ }
18923
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
18924
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
18925
+ });
18926
+ };
18809
18927
  var hasOwnInPrototypeChain2 = (thing, prop) => {
18810
18928
  let obj = thing;
18811
18929
  const seen = [];
18812
- while (obj != null && obj !== Object.prototype) {
18930
+ while (obj != null) {
18813
18931
  if (seen.indexOf(obj) !== -1) {
18814
18932
  return false;
18815
18933
  }
18816
18934
  seen.push(obj);
18935
+ const prototype3 = getPrototypeOf2(obj);
18936
+ if (isPrototypeBoundary2(obj, prototype3, obj === thing)) {
18937
+ return false;
18938
+ }
18817
18939
  if (hasOwnProperty2(obj, prop)) {
18818
18940
  return true;
18819
18941
  }
18820
- obj = getPrototypeOf2(obj);
18942
+ obj = prototype3;
18821
18943
  }
18822
18944
  return false;
18823
18945
  };
18824
18946
  var getSafeProp2 = (obj, prop) => obj != null && hasOwnInPrototypeChain2(obj, prop) ? obj[prop] : void 0;
18947
+ var toSafeFlatObject2 = (thing) => {
18948
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
18949
+ return thing;
18950
+ }
18951
+ const sourcePrototype = getPrototypeOf2(thing);
18952
+ if (sourcePrototype === null && isSafeAndFullyMutable2(thing)) {
18953
+ return thing;
18954
+ }
18955
+ const result = /* @__PURE__ */ Object.create(null);
18956
+ const merged = /* @__PURE__ */ Object.create(null);
18957
+ const seen = [];
18958
+ let current = thing;
18959
+ while (current != null) {
18960
+ if (seen.indexOf(current) !== -1) {
18961
+ break;
18962
+ }
18963
+ seen.push(current);
18964
+ const prototype3 = current === thing ? sourcePrototype : getPrototypeOf2(current);
18965
+ if (isPrototypeBoundary2(current, prototype3, current === thing)) {
18966
+ break;
18967
+ }
18968
+ const props = Object.getOwnPropertyNames(current);
18969
+ if (Object.getOwnPropertySymbols) {
18970
+ props.push(...Object.getOwnPropertySymbols(current));
18971
+ }
18972
+ for (const prop of props) {
18973
+ if (isUnsafeObjectKey2(prop)) {
18974
+ continue;
18975
+ }
18976
+ if (!hasOwnProperty2(merged, prop)) {
18977
+ result[prop] = thing[prop];
18978
+ merged[prop] = true;
18979
+ }
18980
+ }
18981
+ current = prototype3;
18982
+ }
18983
+ return result;
18984
+ };
18825
18985
  var kindOf2 = /* @__PURE__ */ ((cache) => (thing) => {
18826
18986
  const str = toString3.call(thing);
18827
18987
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -18858,9 +19018,9 @@ var require_axios = __commonJS({
18858
19018
  return false;
18859
19019
  }
18860
19020
  const prototype3 = getPrototypeOf2(val);
18861
- return (prototype3 === null || prototype3 === Object.prototype || getPrototypeOf2(prototype3) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
18862
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
18863
- // than a plain object, while ignoring keys injected onto Object.prototype.
19021
+ return (prototype3 === null || prototype3 === Object.prototype || getPrototypeOf2(prototype3) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
19022
+ // evidence the value is tagged/iterable, while ignoring members reachable
19023
+ // only through shared or terminal prototype boundaries.
18864
19024
  !hasOwnInPrototypeChain2(val, toStringTag2) && !hasOwnInPrototypeChain2(val, iterator2);
18865
19025
  };
18866
19026
  var isEmptyObject2 = (val) => {
@@ -19272,6 +19432,7 @@ var require_axios = __commonJS({
19272
19432
  // an alias to avoid ESLint no-prototype-builtins detection
19273
19433
  hasOwnInPrototypeChain: hasOwnInPrototypeChain2,
19274
19434
  getSafeProp: getSafeProp2,
19435
+ toSafeFlatObject: toSafeFlatObject2,
19275
19436
  reduceDescriptors: reduceDescriptors2,
19276
19437
  freezeMethods: freezeMethods2,
19277
19438
  toObjectSet: toObjectSet2,
@@ -19352,7 +19513,7 @@ var require_axios = __commonJS({
19352
19513
  });
19353
19514
  return byteStringHeaders;
19354
19515
  }
19355
- var $internals2 = Symbol("internals");
19516
+ var $internals$1 = Symbol("internals");
19356
19517
  function normalizeHeader2(header) {
19357
19518
  return header && String(header).trim().toLowerCase();
19358
19519
  }
@@ -19648,7 +19809,7 @@ var require_axios = __commonJS({
19648
19809
  return computed;
19649
19810
  }
19650
19811
  static accessor(header) {
19651
- const internals = this[$internals2] = this[$internals2] = {
19812
+ const internals = this[$internals$1] = this[$internals$1] = {
19652
19813
  accessors: {}
19653
19814
  };
19654
19815
  const accessors = internals.accessors;
@@ -19869,19 +20030,16 @@ var require_axios = __commonJS({
19869
20030
  throw new TypeError("target must be an object");
19870
20031
  }
19871
20032
  formData = formData || new (FormData$1 || FormData)();
19872
- options = utils$1.toFlatObject(options, {
19873
- metaTokens: true,
19874
- dots: false,
19875
- indexes: false
19876
- }, false, function defined(option, source) {
19877
- return !utils$1.isUndefined(source[option]);
19878
- });
19879
- const metaTokens = options.metaTokens;
19880
- const visitor = options.visitor || defaultVisitor;
19881
- const dots = options.dots;
19882
- const indexes = options.indexes;
19883
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
19884
- const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH2 : options.maxDepth;
20033
+ const option = (name, fallback) => {
20034
+ const value = utils$1.getSafeProp(options, name);
20035
+ return utils$1.isUndefined(value) ? fallback : value;
20036
+ };
20037
+ const metaTokens = option("metaTokens", true);
20038
+ const visitor = option("visitor") || defaultVisitor;
20039
+ const dots = option("dots", false);
20040
+ const indexes = option("indexes", false);
20041
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
20042
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH2);
19885
20043
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
19886
20044
  const stack = [];
19887
20045
  if (!utils$1.isFunction(visitor)) {
@@ -20040,9 +20198,47 @@ var require_axios = __commonJS({
20040
20198
  }
20041
20199
  return url3;
20042
20200
  }
20201
+ var $internals3 = Symbol("internals");
20202
+ function countHandlers2(handlers) {
20203
+ return handlers ? handlers.length : 0;
20204
+ }
20205
+ function trimHandlers2(handlers) {
20206
+ if (!handlers) {
20207
+ return;
20208
+ }
20209
+ while (handlers.length && handlers[handlers.length - 1] === null) {
20210
+ handlers.pop();
20211
+ }
20212
+ }
20213
+ function syncHandlerEntries2(manager, internals) {
20214
+ const handlers = manager.handlers;
20215
+ const length = countHandlers2(handlers);
20216
+ if (handlers !== internals.handlersRef) {
20217
+ internals.handlersRef = handlers;
20218
+ internals.handlerEntries.clear();
20219
+ } else if (length !== internals.handlersLength) {
20220
+ if (!length) {
20221
+ internals.handlerEntries.clear();
20222
+ } else {
20223
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
20224
+ if (handlers[entry.index] !== entry.handler) {
20225
+ internals.handlerEntries.delete(id);
20226
+ }
20227
+ });
20228
+ }
20229
+ }
20230
+ internals.handlersLength = length;
20231
+ }
20043
20232
  var InterceptorManager2 = class {
20044
20233
  constructor() {
20045
20234
  this.handlers = [];
20235
+ this[$internals3] = {
20236
+ handlersRef: this.handlers,
20237
+ handlersLength: this.handlers.length,
20238
+ handlerEntries: /* @__PURE__ */ new Map(),
20239
+ iterationDepth: 0,
20240
+ nextId: 0
20241
+ };
20046
20242
  }
20047
20243
  /**
20048
20244
  * Add a new interceptor to the stack
@@ -20054,13 +20250,25 @@ var require_axios = __commonJS({
20054
20250
  * @return {Number} An ID used to remove interceptor later
20055
20251
  */
20056
20252
  use(fulfilled, rejected, options) {
20057
- this.handlers.push({
20253
+ const handler = {
20058
20254
  fulfilled,
20059
20255
  rejected,
20060
20256
  synchronous: options ? options.synchronous : false,
20061
20257
  runWhen: options ? options.runWhen : null
20258
+ };
20259
+ const internals = this[$internals3];
20260
+ if (this.handlers == null) {
20261
+ this.handlers = [];
20262
+ }
20263
+ syncHandlerEntries2(this, internals);
20264
+ const id = internals.nextId++;
20265
+ this.handlers.push(handler);
20266
+ internals.handlerEntries.set(id, {
20267
+ handler,
20268
+ index: this.handlers.length - 1
20062
20269
  });
20063
- return this.handlers.length - 1;
20270
+ internals.handlersLength = this.handlers.length;
20271
+ return id;
20064
20272
  }
20065
20273
  /**
20066
20274
  * Remove an interceptor from the stack
@@ -20070,8 +20278,19 @@ var require_axios = __commonJS({
20070
20278
  * @returns {void}
20071
20279
  */
20072
20280
  eject(id) {
20073
- if (this.handlers[id]) {
20074
- this.handlers[id] = null;
20281
+ const internals = this[$internals3];
20282
+ syncHandlerEntries2(this, internals);
20283
+ const entry = internals.handlerEntries.get(id);
20284
+ if (entry) {
20285
+ internals.handlerEntries.delete(id);
20286
+ if (this.handlers[entry.index] !== entry.handler) {
20287
+ return;
20288
+ }
20289
+ this.handlers[entry.index] = null;
20290
+ if (!internals.iterationDepth) {
20291
+ trimHandlers2(this.handlers);
20292
+ internals.handlersLength = this.handlers.length;
20293
+ }
20075
20294
  }
20076
20295
  }
20077
20296
  /**
@@ -20082,6 +20301,7 @@ var require_axios = __commonJS({
20082
20301
  clear() {
20083
20302
  if (this.handlers) {
20084
20303
  this.handlers = [];
20304
+ syncHandlerEntries2(this, this[$internals3]);
20085
20305
  }
20086
20306
  }
20087
20307
  /**
@@ -20095,11 +20315,22 @@ var require_axios = __commonJS({
20095
20315
  * @returns {void}
20096
20316
  */
20097
20317
  forEach(fn) {
20098
- utils$1.forEach(this.handlers, function forEachHandler(h) {
20099
- if (h !== null) {
20100
- fn(h);
20318
+ const internals = this[$internals3];
20319
+ syncHandlerEntries2(this, internals);
20320
+ internals.iterationDepth++;
20321
+ try {
20322
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
20323
+ if (h !== null) {
20324
+ fn(h);
20325
+ }
20326
+ });
20327
+ } finally {
20328
+ if (!--internals.iterationDepth) {
20329
+ syncHandlerEntries2(this, internals);
20330
+ trimHandlers2(this.handlers);
20331
+ internals.handlersLength = countHandlers2(this.handlers);
20101
20332
  }
20102
- });
20333
+ }
20103
20334
  }
20104
20335
  };
20105
20336
  var transitionalDefaults = {
@@ -20235,6 +20466,7 @@ var require_axios = __commonJS({
20235
20466
  }
20236
20467
  return null;
20237
20468
  }
20469
+ var methodList2 = Object.freeze(["get", "delete", "head", "options", "post", "put", "patch", "purge", "link", "unlink", "query"]);
20238
20470
  var own2 = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : void 0;
20239
20471
  function stringifySafely3(rawValue, parser, encoder) {
20240
20472
  if (utils$1.isString(rawValue)) {
@@ -20340,7 +20572,7 @@ var require_axios = __commonJS({
20340
20572
  }
20341
20573
  }
20342
20574
  };
20343
- utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
20575
+ utils$1.forEach(methodList2, (method) => {
20344
20576
  defaults2.headers[method] = {};
20345
20577
  });
20346
20578
  function transformData2(fns, response) {
@@ -20397,18 +20629,18 @@ var require_axios = __commonJS({
20397
20629
  }
20398
20630
  return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
20399
20631
  }
20400
- var malformedHttpProtocol2 = /^https?:(?!\/\/)/i;
20401
- var httpProtocolControlCharacters2 = /[\t\n\r]/g;
20402
- function stripLeadingC0ControlOrSpace2(url3) {
20403
- let i = 0;
20404
- while (i < url3.length && url3.charCodeAt(i) <= 32) {
20405
- i++;
20406
- }
20407
- return url3.slice(i);
20408
- }
20632
+ var urlParserControlCharacters2 = /[\t\n\r]/g;
20409
20633
  function normalizeURLForProtocolCheck2(url3) {
20410
- return stripLeadingC0ControlOrSpace2(url3).replace(httpProtocolControlCharacters2, "");
20634
+ if (typeof url3 !== "string") {
20635
+ return url3;
20636
+ }
20637
+ let start = 0;
20638
+ while (start < url3.length && url3.charCodeAt(start) <= 32) {
20639
+ start++;
20640
+ }
20641
+ return url3.slice(start).replace(urlParserControlCharacters2, "");
20411
20642
  }
20643
+ var malformedHttpProtocol2 = /^https?:(?!\/\/)/i;
20412
20644
  function redactFragment2(fragment) {
20413
20645
  if (!fragment) {
20414
20646
  return fragment;
@@ -20509,12 +20741,12 @@ var require_axios = __commonJS({
20509
20741
  function getEnv2(key) {
20510
20742
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
20511
20743
  }
20512
- var VERSION3 = "1.19.0";
20744
+ var VERSION3 = "1.20.0";
20513
20745
  function parseProtocol2(url3) {
20514
20746
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url3);
20515
20747
  return match && match[1] || "";
20516
20748
  }
20517
- var DATA_URL_PATTERN2 = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
20749
+ var DATA_URL_PATTERN2 = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
20518
20750
  function fromDataURI2(uri, asBlob, options) {
20519
20751
  const _Blob = options && options.Blob || platform.classes.Blob;
20520
20752
  const protocol = parseProtocol2(uri);
@@ -20791,7 +21023,7 @@ var require_axios = __commonJS({
20791
21023
  this.sessions = /* @__PURE__ */ Object.create(null);
20792
21024
  }
20793
21025
  getSession(authority, options) {
20794
- options = Object.assign({
21026
+ options = Object.assign(/* @__PURE__ */ Object.create(null), {
20795
21027
  sessionTimeout: 1e3
20796
21028
  }, options);
20797
21029
  let authoritySessions = this.sessions[authority];
@@ -20856,6 +21088,7 @@ var require_axios = __commonJS({
20856
21088
  };
20857
21089
  }
20858
21090
  session.once("close", removeSession);
21091
+ session.once("error", removeSession);
20859
21092
  let entry = [session, options];
20860
21093
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
20861
21094
  return session;
@@ -20874,6 +21107,13 @@ var require_axios = __commonJS({
20874
21107
  } : fn;
20875
21108
  };
20876
21109
  var LOOPBACK_HOSTNAMES2 = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
21110
+ var trimTrailingDots2 = (value) => {
21111
+ let end = value.length;
21112
+ while (end && value.charCodeAt(end - 1) === 46) {
21113
+ end--;
21114
+ }
21115
+ return end === value.length ? value : value.slice(0, end);
21116
+ };
20877
21117
  var isIPv4Loopback2 = (host) => {
20878
21118
  const parts = host.split(".");
20879
21119
  if (parts.length !== 4) return false;
@@ -20906,7 +21146,7 @@ var require_axios = __commonJS({
20906
21146
  if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
20907
21147
  h = h.slice(1, -1);
20908
21148
  }
20909
- h = h.replace(/\.+$/, "");
21149
+ h = trimTrailingDots2(h);
20910
21150
  if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
20911
21151
  const parts = h.split(".");
20912
21152
  if (parts.some((p) => p === "")) return host;
@@ -21018,6 +21258,40 @@ var require_axios = __commonJS({
21018
21258
  }
21019
21259
  return host;
21020
21260
  };
21261
+ var IPV4_OCTET_RE2 = /^(?:0|[1-9]\d{0,2})$/;
21262
+ var ipv4ToBytes2 = (host) => {
21263
+ const parts = host.split(".");
21264
+ return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE2.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
21265
+ };
21266
+ var IPV6_GROUP_RE2 = /^[0-9a-f]{1,4}$/i;
21267
+ var ipv6ToBytes2 = (host) => {
21268
+ const halves = host.split("::");
21269
+ if (halves.length > 2) {
21270
+ return null;
21271
+ }
21272
+ const groups = halves[0] ? halves[0].split(":") : [];
21273
+ if (halves.length === 2) {
21274
+ const rear = halves[1] ? halves[1].split(":") : [];
21275
+ const missing = 8 - groups.length - rear.length;
21276
+ if (missing < 1) {
21277
+ return null;
21278
+ }
21279
+ groups.push(...new Array(missing).fill("0"), ...rear);
21280
+ }
21281
+ if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE2.test(group))) {
21282
+ return null;
21283
+ }
21284
+ return groups.flatMap((group) => {
21285
+ const value = Number.parseInt(group, 16);
21286
+ return [value >> 8 & 255, value & 255];
21287
+ });
21288
+ };
21289
+ var ipToBytes2 = (host) => {
21290
+ if (typeof host !== "string" || !host) {
21291
+ return null;
21292
+ }
21293
+ return host.indexOf(":") !== -1 ? ipv6ToBytes2(host) : ipv4ToBytes2(host);
21294
+ };
21021
21295
  var normalizeNoProxyHost2 = (hostname) => {
21022
21296
  if (!hostname) {
21023
21297
  return hostname;
@@ -21025,13 +21299,99 @@ var require_axios = __commonJS({
21025
21299
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
21026
21300
  hostname = hostname.slice(1, -1);
21027
21301
  }
21028
- const trimmed = hostname.replace(/\.+$/, "");
21302
+ const trimmed = trimTrailingDots2(hostname);
21029
21303
  const ipv4 = normalizeIPAddress2(trimmed);
21030
21304
  if (ipv4 !== trimmed) {
21031
21305
  return ipv4;
21032
21306
  }
21033
21307
  return unmapIPv4MappedIPv62(trimmed);
21034
21308
  };
21309
+ var normalizeCidrBase2 = (input) => {
21310
+ let base = input;
21311
+ const startsBracket = base.charAt(0) === "[";
21312
+ const endsBracket = base.charAt(base.length - 1) === "]";
21313
+ const hasBracket = base.includes("[") || base.includes("]");
21314
+ if (startsBracket || endsBracket) {
21315
+ if (!startsBracket || !endsBracket) {
21316
+ return null;
21317
+ }
21318
+ base = base.slice(1, -1);
21319
+ if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
21320
+ return null;
21321
+ }
21322
+ } else if (hasBracket) {
21323
+ return null;
21324
+ }
21325
+ if (!base || base.charAt(base.length - 1) === ".") {
21326
+ return null;
21327
+ }
21328
+ const wasIPv6 = base.indexOf(":") !== -1;
21329
+ if (wasIPv6) {
21330
+ try {
21331
+ base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
21332
+ } catch (_err) {
21333
+ return null;
21334
+ }
21335
+ } else {
21336
+ base = normalizeIPAddress2(base);
21337
+ if (!ipv4ToBytes2(base)) {
21338
+ return null;
21339
+ }
21340
+ }
21341
+ return {
21342
+ normalized: unmapIPv4MappedIPv62(base),
21343
+ wasIPv6
21344
+ };
21345
+ };
21346
+ var CIDR_ENTRY_RE2 = /^(.+)\/(0|[1-9]\d{0,2})$/;
21347
+ var parseCidrEntry2 = (entry) => {
21348
+ if (entry.indexOf("/") === -1) {
21349
+ return void 0;
21350
+ }
21351
+ const match = CIDR_ENTRY_RE2.exec(entry);
21352
+ if (!match) {
21353
+ return null;
21354
+ }
21355
+ let prefix = Number(match[2]);
21356
+ const parsedBase = normalizeCidrBase2(match[1]);
21357
+ if (!parsedBase) {
21358
+ return null;
21359
+ }
21360
+ const {
21361
+ normalized,
21362
+ wasIPv6
21363
+ } = parsedBase;
21364
+ if (wasIPv6 && normalized.indexOf(":") === -1) {
21365
+ if (prefix < 96) {
21366
+ return null;
21367
+ }
21368
+ prefix -= 96;
21369
+ }
21370
+ const bytes = ipToBytes2(normalized);
21371
+ if (!bytes || prefix > bytes.length * 8) {
21372
+ return null;
21373
+ }
21374
+ return {
21375
+ bytes,
21376
+ prefix
21377
+ };
21378
+ };
21379
+ var isInSubnet2 = (addressBytes, networkBytes, prefix) => {
21380
+ const fullBytes = prefix >> 3;
21381
+ for (let i = 0; i < fullBytes; i++) {
21382
+ if (addressBytes[i] !== networkBytes[i]) {
21383
+ return false;
21384
+ }
21385
+ }
21386
+ const remainingBits = prefix & 7;
21387
+ if (remainingBits) {
21388
+ const mask = 255 << 8 - remainingBits & 255;
21389
+ if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
21390
+ return false;
21391
+ }
21392
+ }
21393
+ return true;
21394
+ };
21035
21395
  function shouldBypassProxy2(location) {
21036
21396
  let parsed;
21037
21397
  try {
@@ -21048,6 +21408,7 @@ var require_axios = __commonJS({
21048
21408
  }
21049
21409
  const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS3[parsed.protocol.split(":", 1)[0]] || 0;
21050
21410
  const hostname = normalizeNoProxyHost2(parsed.hostname.toLowerCase());
21411
+ const hostnameBytes = ipToBytes2(hostname);
21051
21412
  return noProxy.split(/[\s,]+/).some((entry) => {
21052
21413
  if (!entry) {
21053
21414
  return false;
@@ -21055,6 +21416,10 @@ var require_axios = __commonJS({
21055
21416
  if (entry === "*") {
21056
21417
  return true;
21057
21418
  }
21419
+ const cidr = parseCidrEntry2(entry);
21420
+ if (cidr !== void 0) {
21421
+ return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet2(hostnameBytes, cidr.bytes, cidr.prefix);
21422
+ }
21058
21423
  let [entryHost, entryPort] = parseNoProxyEntry2(entry);
21059
21424
  entryHost = normalizeNoProxyHost2(entryHost);
21060
21425
  if (!entryHost) {
@@ -21135,13 +21500,14 @@ var require_axios = __commonJS({
21135
21500
  }
21136
21501
  };
21137
21502
  const flush = () => lastArgs && invoke(lastArgs);
21138
- return [throttled, flush];
21503
+ const flushWith = (...args) => invoke(args);
21504
+ return [throttled, flush, flushWith];
21139
21505
  }
21140
21506
  var progressEventReducer2 = (listener, isDownloadStream, freq = 3) => {
21141
21507
  let bytesNotified = 0;
21142
21508
  const _speedometer = speedometer2(50, 250);
21143
21509
  return throttle2((e) => {
21144
- if (!e || typeof e.loaded !== "number") {
21510
+ if (!e || !utils$1.isNumber(e.loaded)) {
21145
21511
  return;
21146
21512
  }
21147
21513
  const rawLoaded = e.loaded;
@@ -21295,6 +21661,12 @@ var require_axios = __commonJS({
21295
21661
  var isHttps2 = /https:?/;
21296
21662
  var kAxiosSocketListener2 = Symbol("axios.http.socketListener");
21297
21663
  var kAxiosCurrentReq2 = Symbol("axios.http.currentReq");
21664
+ function handleSocketError2(err) {
21665
+ const current = this[kAxiosCurrentReq2];
21666
+ if (current && !current.destroyed) {
21667
+ current.destroy(err);
21668
+ }
21669
+ }
21298
21670
  var kAxiosInstalledTunnel2 = Symbol("axios.http.installedTunnel");
21299
21671
  var tunnelingAgentCache2 = /* @__PURE__ */ new Map();
21300
21672
  var tunnelingAgentCacheUser2 = /* @__PURE__ */ new WeakMap();
@@ -21403,10 +21775,10 @@ var require_axios = __commonJS({
21403
21775
  return false;
21404
21776
  }
21405
21777
  }
21406
- function setProxy2(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
21778
+ function setProxy2(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
21407
21779
  let proxy = configProxy;
21408
21780
  const proxyEnvAgent = getProxyEnvAgent2(options, configHttpAgent, configHttpsAgent);
21409
- if (!proxy && proxy !== false && !isNodeEnvProxyEnabled2(proxyEnvAgent)) {
21781
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled2(proxyEnvAgent)) {
21410
21782
  const proxyUrl = getProxyForUrl2(location);
21411
21783
  if (proxyUrl) {
21412
21784
  if (!shouldBypassProxy2(location)) {
@@ -21497,8 +21869,9 @@ var require_axios = __commonJS({
21497
21869
  }
21498
21870
  }
21499
21871
  options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
21500
- setProxy2(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent, configHttpAgent);
21872
+ setProxy2(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent, configHttpAgent, allowEnvProxy);
21501
21873
  };
21874
+ return Boolean(proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled2(proxyEnvAgent));
21502
21875
  }
21503
21876
  var isHttpAdapterSupported2 = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
21504
21877
  var wrapAsync2 = (asyncExecutor) => {
@@ -21526,7 +21899,7 @@ var require_axios = __commonJS({
21526
21899
  family
21527
21900
  }) => {
21528
21901
  if (!utils$1.isString(address)) {
21529
- throw TypeError("address must be a string");
21902
+ throw new AxiosError3("address must be a string", AxiosError3.ERR_BAD_OPTION_VALUE);
21530
21903
  }
21531
21904
  return {
21532
21905
  address,
@@ -21537,6 +21910,30 @@ var require_axios = __commonJS({
21537
21910
  address,
21538
21911
  family
21539
21912
  });
21913
+ var normalizedLookupCache2 = /* @__PURE__ */ new WeakMap();
21914
+ var normalizeLookup2 = (lookup) => {
21915
+ let normalized = normalizedLookupCache2.get(lookup);
21916
+ if (normalized) {
21917
+ return normalized;
21918
+ }
21919
+ const callbackLookup = callbackify2(lookup, (value) => utils$1.isArray(value) ? value : [value]);
21920
+ normalized = (hostname, opt, cb) => {
21921
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
21922
+ if (err) {
21923
+ return cb(err);
21924
+ }
21925
+ let addresses;
21926
+ try {
21927
+ addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry2(addr)) : [buildAddressEntry2(arg0, arg1)];
21928
+ } catch (error) {
21929
+ return cb(error);
21930
+ }
21931
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
21932
+ });
21933
+ };
21934
+ normalizedLookupCache2.set(lookup, normalized);
21935
+ return normalized;
21936
+ };
21540
21937
  var http2Transport2 = {
21541
21938
  request(options, cb) {
21542
21939
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
@@ -21581,6 +21978,7 @@ var require_axios = __commonJS({
21581
21978
  let family = own3("family");
21582
21979
  let httpVersion = own3("httpVersion");
21583
21980
  if (httpVersion === void 0) httpVersion = 1;
21981
+ const rawHttpVersion = httpVersion;
21584
21982
  let http2Options = own3("http2Options");
21585
21983
  const httpAgent = own3("httpAgent");
21586
21984
  const httpsAgent = own3("httpsAgent");
@@ -21597,25 +21995,20 @@ var require_axios = __commonJS({
21597
21995
  let rejected = false;
21598
21996
  let req;
21599
21997
  let connectPhaseTimer;
21600
- httpVersion = +httpVersion;
21998
+ try {
21999
+ httpVersion = +httpVersion;
22000
+ } catch (err) {
22001
+ throw new AxiosError3("Invalid protocol version: value is not a number", AxiosError3.ERR_BAD_OPTION_VALUE, config);
22002
+ }
21601
22003
  if (Number.isNaN(httpVersion)) {
21602
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
22004
+ throw new AxiosError3(`Invalid protocol version: '${rawHttpVersion}' is not a number`, AxiosError3.ERR_BAD_OPTION_VALUE, config);
21603
22005
  }
21604
22006
  if (httpVersion !== 1 && httpVersion !== 2) {
21605
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
22007
+ throw new AxiosError3(`Unsupported protocol version '${httpVersion}'`, AxiosError3.ERR_BAD_OPTION_VALUE, config);
21606
22008
  }
21607
22009
  const isHttp2 = httpVersion === 2;
21608
22010
  if (lookup) {
21609
- const _lookup = callbackify2(lookup, (value) => utils$1.isArray(value) ? value : [value]);
21610
- lookup = (hostname, opt, cb) => {
21611
- _lookup(hostname, opt, (err, arg0, arg1) => {
21612
- if (err) {
21613
- return cb(err);
21614
- }
21615
- const addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry2(addr)) : [buildAddressEntry2(arg0, arg1)];
21616
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
21617
- });
21618
- };
22011
+ lookup = normalizeLookup2(lookup);
21619
22012
  }
21620
22013
  const abortEmitter = new events.EventEmitter();
21621
22014
  function abort(reason) {
@@ -21808,6 +22201,11 @@ var require_axios = __commonJS({
21808
22201
  }));
21809
22202
  }
21810
22203
  headers.set("Accept-Encoding", utils$1.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD2 : ACCEPT_ENCODING2, false);
22204
+ if (isHttp2 && lookup) {
22205
+ http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, {
22206
+ lookup
22207
+ });
22208
+ }
21811
22209
  const options = Object.assign(/* @__PURE__ */ Object.create(null), {
21812
22210
  path: path$1,
21813
22211
  method,
@@ -21821,9 +22219,11 @@ var require_axios = __commonJS({
21821
22219
  family,
21822
22220
  beforeRedirect: dispatchBeforeRedirect2,
21823
22221
  beforeRedirects: /* @__PURE__ */ Object.create(null),
21824
- http2Options
22222
+ http2Options,
22223
+ createConnection: void 0
21825
22224
  });
21826
22225
  !utils$1.isUndefined(lookup) && (options.lookup = lookup);
22226
+ let proxyApplied = false;
21827
22227
  if (socketPath) {
21828
22228
  if (typeof socketPath !== "string") {
21829
22229
  return reject(new AxiosError3("socketPath must be a string", AxiosError3.ERR_BAD_OPTION_VALUE, config));
@@ -21841,7 +22241,18 @@ var require_axios = __commonJS({
21841
22241
  } else {
21842
22242
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
21843
22243
  options.port = parsed.port;
21844
- setProxy2(options, configProxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path, false, httpsAgent, httpAgent);
22244
+ proxyApplied = setProxy2(
22245
+ options,
22246
+ configProxy,
22247
+ protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
22248
+ false,
22249
+ httpsAgent,
22250
+ httpAgent,
22251
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
22252
+ // cannot apply either axios-resolved or agent-local environment proxies.
22253
+ // Explicit proxy config is still processed and rejected below.
22254
+ !isHttp2
22255
+ );
21845
22256
  }
21846
22257
  let transport;
21847
22258
  let isNativeTransport = false;
@@ -21851,6 +22262,9 @@ var require_axios = __commonJS({
21851
22262
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
21852
22263
  }
21853
22264
  if (isHttp2) {
22265
+ if (proxyApplied) {
22266
+ return reject(new AxiosError3("HTTP/2 requests with a proxy are not supported", AxiosError3.ERR_NOT_SUPPORT, config));
22267
+ }
21854
22268
  transport = http2Transport2;
21855
22269
  } else {
21856
22270
  const configTransport = own3("transport");
@@ -22048,12 +22462,7 @@ var require_axios = __commonJS({
22048
22462
  socket.setKeepAlive(true, 1e3 * 60);
22049
22463
  }
22050
22464
  if (!socket[kAxiosSocketListener2]) {
22051
- socket.on("error", function handleSocketError(err) {
22052
- const current = socket[kAxiosCurrentReq2];
22053
- if (current && !current.destroyed) {
22054
- current.destroy(err);
22055
- }
22056
- });
22465
+ socket.on("error", handleSocketError2);
22057
22466
  socket[kAxiosSocketListener2] = true;
22058
22467
  }
22059
22468
  socket[kAxiosCurrentReq2] = req;
@@ -22269,7 +22678,7 @@ var require_axios = __commonJS({
22269
22678
  transformResponse: defaultToConfig2,
22270
22679
  paramsSerializer: defaultToConfig2,
22271
22680
  timeout: defaultToConfig2,
22272
- timeoutMessage: defaultToConfig2,
22681
+ timeoutErrorMessage: defaultToConfig2,
22273
22682
  withCredentials: defaultToConfig2,
22274
22683
  withXSRFToken: defaultToConfig2,
22275
22684
  adapter: defaultToConfig2,
@@ -22337,10 +22746,11 @@ var require_axios = __commonJS({
22337
22746
  }
22338
22747
  }
22339
22748
  if (utils$1.isFormData(data)) {
22749
+ const getHeaders = utils$1.getSafeProp(data, "getHeaders");
22340
22750
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
22341
22751
  headers.setContentType(void 0);
22342
- } else if (utils$1.isFunction(data.getHeaders)) {
22343
- setFormDataHeaders2(headers, data.getHeaders(), own3("formDataHeaderPolicy"));
22752
+ } else if (utils$1.isFunction(getHeaders)) {
22753
+ setFormDataHeaders2(headers, getHeaders.call(data), own3("formDataHeaderPolicy"));
22344
22754
  }
22345
22755
  }
22346
22756
  if (platform.hasStandardBrowserEnv) {
@@ -22370,7 +22780,7 @@ var require_axios = __commonJS({
22370
22780
  } = _config;
22371
22781
  let onCanceled;
22372
22782
  let uploadThrottled, downloadThrottled;
22373
- let flushUpload, flushDownload;
22783
+ let flushUpload, flushDownload, flushDownloadWithEvent;
22374
22784
  function done() {
22375
22785
  flushUpload && flushUpload();
22376
22786
  flushDownload && flushDownload();
@@ -22380,7 +22790,27 @@ var require_axios = __commonJS({
22380
22790
  let request = new XMLHttpRequest();
22381
22791
  request.open(_config.method.toUpperCase(), _config.url, true);
22382
22792
  request.timeout = _config.timeout;
22383
- function onloadend() {
22793
+ function onloadend(event) {
22794
+ if (!request) {
22795
+ return;
22796
+ }
22797
+ if (request.status === 0 && (parseProtocol2(normalizeURLForProtocolCheck2(_config.url)) || parseProtocol2(platform.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
22798
+ reject(new AxiosError3("Request aborted", AxiosError3.ECONNABORTED, config, request));
22799
+ done();
22800
+ request = null;
22801
+ return;
22802
+ }
22803
+ try {
22804
+ if (event) {
22805
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
22806
+ } else {
22807
+ flushDownload && flushDownload();
22808
+ }
22809
+ } catch (err) {
22810
+ setTimeout(() => {
22811
+ throw err;
22812
+ });
22813
+ }
22384
22814
  if (!request) {
22385
22815
  return;
22386
22816
  }
@@ -22455,7 +22885,7 @@ var require_axios = __commonJS({
22455
22885
  request.responseType = _config.responseType;
22456
22886
  }
22457
22887
  if (onDownloadProgress) {
22458
- [downloadThrottled, flushDownload] = progressEventReducer2(onDownloadProgress, true);
22888
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer2(onDownloadProgress, true);
22459
22889
  request.addEventListener("progress", downloadThrottled);
22460
22890
  }
22461
22891
  if (onUploadProgress && request.upload) {
@@ -22617,6 +23047,17 @@ var require_axios = __commonJS({
22617
23047
  });
22618
23048
  };
22619
23049
  var DEFAULT_CHUNK_SIZE2 = 64 * 1024;
23050
+ var DEFAULT_REQUEST_OPTIONS2 = {
23051
+ cache: "default",
23052
+ redirect: "follow",
23053
+ referrer: "about:client",
23054
+ referrerPolicy: "",
23055
+ mode: "cors",
23056
+ integrity: "",
23057
+ keepalive: false,
23058
+ priority: "auto",
23059
+ window: null
23060
+ };
22620
23061
  var {
22621
23062
  isFunction: isFunction3
22622
23063
  } = utils$1;
@@ -22745,7 +23186,8 @@ var require_axios = __commonJS({
22745
23186
  withCredentials = "same-origin",
22746
23187
  fetchOptions,
22747
23188
  maxContentLength,
22748
- maxBodyLength
23189
+ maxBodyLength,
23190
+ maxRedirects
22749
23191
  } = resolveConfig2(config);
22750
23192
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
22751
23193
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -22846,17 +23288,44 @@ var require_axios = __commonJS({
22846
23288
  }
22847
23289
  }
22848
23290
  headers.set("User-Agent", "axios/" + VERSION3, false);
22849
- const resolvedOptions = {
22850
- ...fetchOptions,
23291
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
23292
+ if (safeFetchOptions) {
23293
+ delete safeFetchOptions.body;
23294
+ delete safeFetchOptions.headers;
23295
+ delete safeFetchOptions.method;
23296
+ delete safeFetchOptions.signal;
23297
+ delete safeFetchOptions.duplex;
23298
+ delete safeFetchOptions.credentials;
23299
+ }
23300
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
22851
23301
  signal: composedSignal,
22852
23302
  method: method.toUpperCase(),
22853
23303
  headers: toByteStringHeaderObject2(headers.normalize()),
22854
23304
  body: data,
22855
23305
  duplex: "half",
22856
23306
  credentials: isCredentialsSupported ? withCredentials : void 0
22857
- };
23307
+ });
23308
+ if (isRequestSupported) {
23309
+ utils$1.forEach(DEFAULT_REQUEST_OPTIONS2, (value, key) => {
23310
+ if (resolvedOptions[key] === void 0) {
23311
+ resolvedOptions[key] = value;
23312
+ }
23313
+ });
23314
+ if (resolvedOptions.signal === void 0) {
23315
+ resolvedOptions.signal = null;
23316
+ }
23317
+ if (resolvedOptions.body === void 0) {
23318
+ resolvedOptions.body = null;
23319
+ }
23320
+ }
23321
+ if (maxRedirects === 0) {
23322
+ resolvedOptions.redirect = "manual";
23323
+ if (safeFetchOptions) {
23324
+ safeFetchOptions.redirect = "manual";
23325
+ }
23326
+ }
22858
23327
  request = isRequestSupported && new Request(url3, resolvedOptions);
22859
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url3, resolvedOptions));
23328
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url3, resolvedOptions));
22860
23329
  const responseHeaders = AxiosHeaders3.from(response.headers);
22861
23330
  if (hasMaxContentLength) {
22862
23331
  const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
@@ -23048,9 +23517,10 @@ var require_axios = __commonJS({
23048
23517
  throw new CanceledError3(null, config);
23049
23518
  }
23050
23519
  }
23051
- function dispatchRequest2(config) {
23520
+ function dispatchRequest2(_config) {
23521
+ const config = utils$1.toSafeFlatObject(_config);
23052
23522
  throwIfCancellationRequested2(config);
23053
- config.headers = AxiosHeaders3.from(config.headers);
23523
+ config.headers = AxiosHeaders3.from(utils$1.getSafeProp(config, "headers"));
23054
23524
  config.data = transformData2.call(config, config.transformRequest);
23055
23525
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
23056
23526
  config.headers.setContentType("application/x-www-form-urlencoded", false);
@@ -23158,16 +23628,15 @@ var require_axios = __commonJS({
23158
23628
  return await this._request(configOrUrl, config);
23159
23629
  } catch (err) {
23160
23630
  if (err instanceof Error) {
23161
- let dummy = {};
23162
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
23163
- const stack = (() => {
23164
- if (!dummy.stack) {
23165
- return "";
23166
- }
23167
- const firstNewlineIndex = dummy.stack.indexOf("\n");
23168
- return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
23169
- })();
23170
23631
  try {
23632
+ let dummy = {};
23633
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
23634
+ const dummyStack = dummy.stack;
23635
+ let stack = "";
23636
+ if (typeof dummyStack === "string") {
23637
+ const firstNewlineIndex = dummyStack.indexOf("\n");
23638
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
23639
+ }
23171
23640
  if (!err.stack) {
23172
23641
  err.stack = stack;
23173
23642
  } else if (stack) {
@@ -23229,9 +23698,9 @@ var require_axios = __commonJS({
23229
23698
  baseUrl: validators3.spelling("baseURL"),
23230
23699
  withXsrfToken: validators3.spelling("withXSRFToken")
23231
23700
  }, true);
23232
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
23701
+ config.method = (utils$1.getSafeProp(config, "method") || utils$1.getSafeProp(this.defaults, "method") || "get").toLowerCase();
23233
23702
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
23234
- headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
23703
+ headers && utils$1.forEach(methodList2.concat("common"), (method) => {
23235
23704
  delete headers[method];
23236
23705
  });
23237
23706
  config.headers = AxiosHeaders3.concat(contextHeaders, headers);
@@ -23478,14 +23947,22 @@ var require_axios = __commonJS({
23478
23947
  Gone: 410,
23479
23948
  LengthRequired: 411,
23480
23949
  PreconditionFailed: 412,
23950
+ /**
23951
+ * @deprecated Use `ContentTooLarge` instead.
23952
+ */
23481
23953
  PayloadTooLarge: 413,
23954
+ ContentTooLarge: 413,
23482
23955
  UriTooLong: 414,
23483
23956
  UnsupportedMediaType: 415,
23484
23957
  RangeNotSatisfiable: 416,
23485
23958
  ExpectationFailed: 417,
23486
23959
  ImATeapot: 418,
23487
23960
  MisdirectedRequest: 421,
23961
+ /**
23962
+ * @deprecated Use `UnprocessableContent` instead.
23963
+ */
23488
23964
  UnprocessableEntity: 422,
23965
+ UnprocessableContent: 422,
23489
23966
  Locked: 423,
23490
23967
  FailedDependency: 424,
23491
23968
  TooEarly: 425,
@@ -23514,7 +23991,9 @@ var require_axios = __commonJS({
23514
23991
  InvalidSslCertificate: 526
23515
23992
  };
23516
23993
  Object.entries(HttpStatusCode3).forEach(([key, value]) => {
23517
- HttpStatusCode3[value] = key;
23994
+ if (HttpStatusCode3[value] === void 0) {
23995
+ HttpStatusCode3[value] = key;
23996
+ }
23518
23997
  });
23519
23998
  function createInstance2(defaultConfig) {
23520
23999
  const context = new Axios3(defaultConfig);
@@ -45667,22 +46146,82 @@ var { toString } = Object.prototype;
45667
46146
  var { getPrototypeOf } = Object;
45668
46147
  var { iterator, toStringTag } = Symbol;
45669
46148
  var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
46149
+ var isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
46150
+ var isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
46151
+ var isSafeAndFullyMutable = (obj) => {
46152
+ if (!Object.isExtensible(obj)) {
46153
+ return false;
46154
+ }
46155
+ const props = Object.getOwnPropertyNames(obj);
46156
+ if (Object.getOwnPropertySymbols) {
46157
+ props.push(...Object.getOwnPropertySymbols(obj));
46158
+ }
46159
+ return props.every((prop) => {
46160
+ if (isUnsafeObjectKey(prop)) {
46161
+ return false;
46162
+ }
46163
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
46164
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
46165
+ });
46166
+ };
45670
46167
  var hasOwnInPrototypeChain = (thing, prop) => {
45671
46168
  let obj = thing;
45672
46169
  const seen = [];
45673
- while (obj != null && obj !== Object.prototype) {
46170
+ while (obj != null) {
45674
46171
  if (seen.indexOf(obj) !== -1) {
45675
46172
  return false;
45676
46173
  }
45677
46174
  seen.push(obj);
46175
+ const prototype2 = getPrototypeOf(obj);
46176
+ if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
46177
+ return false;
46178
+ }
45678
46179
  if (hasOwnProperty(obj, prop)) {
45679
46180
  return true;
45680
46181
  }
45681
- obj = getPrototypeOf(obj);
46182
+ obj = prototype2;
45682
46183
  }
45683
46184
  return false;
45684
46185
  };
45685
46186
  var getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
46187
+ var toSafeFlatObject = (thing) => {
46188
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
46189
+ return thing;
46190
+ }
46191
+ const sourcePrototype = getPrototypeOf(thing);
46192
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
46193
+ return thing;
46194
+ }
46195
+ const result = /* @__PURE__ */ Object.create(null);
46196
+ const merged = /* @__PURE__ */ Object.create(null);
46197
+ const seen = [];
46198
+ let current = thing;
46199
+ while (current != null) {
46200
+ if (seen.indexOf(current) !== -1) {
46201
+ break;
46202
+ }
46203
+ seen.push(current);
46204
+ const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
46205
+ if (isPrototypeBoundary(current, prototype2, current === thing)) {
46206
+ break;
46207
+ }
46208
+ const props = Object.getOwnPropertyNames(current);
46209
+ if (Object.getOwnPropertySymbols) {
46210
+ props.push(...Object.getOwnPropertySymbols(current));
46211
+ }
46212
+ for (const prop of props) {
46213
+ if (isUnsafeObjectKey(prop)) {
46214
+ continue;
46215
+ }
46216
+ if (!hasOwnProperty(merged, prop)) {
46217
+ result[prop] = thing[prop];
46218
+ merged[prop] = true;
46219
+ }
46220
+ }
46221
+ current = prototype2;
46222
+ }
46223
+ return result;
46224
+ };
45686
46225
  var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
45687
46226
  const str = toString.call(thing);
45688
46227
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -45717,9 +46256,9 @@ var isPlainObject = (val) => {
45717
46256
  return false;
45718
46257
  }
45719
46258
  const prototype2 = getPrototypeOf(val);
45720
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
45721
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
45722
- // than a plain object, while ignoring keys injected onto Object.prototype.
46259
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
46260
+ // evidence the value is tagged/iterable, while ignoring members reachable
46261
+ // only through shared or terminal prototype boundaries.
45723
46262
  !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
45724
46263
  };
45725
46264
  var isEmptyObject = (val) => {
@@ -46130,6 +46669,7 @@ var utils_default = {
46130
46669
  // an alias to avoid ESLint no-prototype-builtins detection
46131
46670
  hasOwnInPrototypeChain,
46132
46671
  getSafeProp,
46672
+ toSafeFlatObject,
46133
46673
  reduceDescriptors,
46134
46674
  freezeMethods,
46135
46675
  toObjectSet,
@@ -46768,24 +47308,16 @@ function toFormData(obj, formData, options) {
46768
47308
  throw new TypeError("target must be an object");
46769
47309
  }
46770
47310
  formData = formData || new (FormData_default || FormData)();
46771
- options = utils_default.toFlatObject(
46772
- options,
46773
- {
46774
- metaTokens: true,
46775
- dots: false,
46776
- indexes: false
46777
- },
46778
- false,
46779
- function defined(option, source) {
46780
- return !utils_default.isUndefined(source[option]);
46781
- }
46782
- );
46783
- const metaTokens = options.metaTokens;
46784
- const visitor = options.visitor || defaultVisitor;
46785
- const dots = options.dots;
46786
- const indexes = options.indexes;
46787
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
46788
- const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
47311
+ const option = (name, fallback) => {
47312
+ const value = utils_default.getSafeProp(options, name);
47313
+ return utils_default.isUndefined(value) ? fallback : value;
47314
+ };
47315
+ const metaTokens = option("metaTokens", true);
47316
+ const visitor = option("visitor") || defaultVisitor;
47317
+ const dots = option("dots", false);
47318
+ const indexes = option("indexes", false);
47319
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
47320
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
46789
47321
  const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
46790
47322
  const stack = [];
46791
47323
  if (!utils_default.isFunction(visitor)) {
@@ -46809,7 +47341,10 @@ function toFormData(obj, formData, options) {
46809
47341
  if (Buffer_default && Buffer_default.isBufferAvailable()) {
46810
47342
  return Buffer_default.from(value);
46811
47343
  }
46812
- throw new AxiosError_default("Blob is not supported. Use a Buffer instead.", AxiosError_default.ERR_NOT_SUPPORT);
47344
+ throw new AxiosError_default(
47345
+ "Blob is not supported. Use a Buffer instead.",
47346
+ AxiosError_default.ERR_NOT_SUPPORT
47347
+ );
46813
47348
  }
46814
47349
  return value;
46815
47350
  }
@@ -46955,9 +47490,47 @@ function buildURL(url2, params, options) {
46955
47490
  }
46956
47491
 
46957
47492
  // node_modules/axios/lib/core/InterceptorManager.js
47493
+ var $internals2 = Symbol("internals");
47494
+ function countHandlers(handlers) {
47495
+ return handlers ? handlers.length : 0;
47496
+ }
47497
+ function trimHandlers(handlers) {
47498
+ if (!handlers) {
47499
+ return;
47500
+ }
47501
+ while (handlers.length && handlers[handlers.length - 1] === null) {
47502
+ handlers.pop();
47503
+ }
47504
+ }
47505
+ function syncHandlerEntries(manager, internals) {
47506
+ const handlers = manager.handlers;
47507
+ const length = countHandlers(handlers);
47508
+ if (handlers !== internals.handlersRef) {
47509
+ internals.handlersRef = handlers;
47510
+ internals.handlerEntries.clear();
47511
+ } else if (length !== internals.handlersLength) {
47512
+ if (!length) {
47513
+ internals.handlerEntries.clear();
47514
+ } else {
47515
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
47516
+ if (handlers[entry.index] !== entry.handler) {
47517
+ internals.handlerEntries.delete(id);
47518
+ }
47519
+ });
47520
+ }
47521
+ }
47522
+ internals.handlersLength = length;
47523
+ }
46958
47524
  var InterceptorManager = class {
46959
47525
  constructor() {
46960
47526
  this.handlers = [];
47527
+ this[$internals2] = {
47528
+ handlersRef: this.handlers,
47529
+ handlersLength: this.handlers.length,
47530
+ handlerEntries: /* @__PURE__ */ new Map(),
47531
+ iterationDepth: 0,
47532
+ nextId: 0
47533
+ };
46961
47534
  }
46962
47535
  /**
46963
47536
  * Add a new interceptor to the stack
@@ -46969,13 +47542,25 @@ var InterceptorManager = class {
46969
47542
  * @return {Number} An ID used to remove interceptor later
46970
47543
  */
46971
47544
  use(fulfilled, rejected, options) {
46972
- this.handlers.push({
47545
+ const handler = {
46973
47546
  fulfilled,
46974
47547
  rejected,
46975
47548
  synchronous: options ? options.synchronous : false,
46976
47549
  runWhen: options ? options.runWhen : null
47550
+ };
47551
+ const internals = this[$internals2];
47552
+ if (this.handlers == null) {
47553
+ this.handlers = [];
47554
+ }
47555
+ syncHandlerEntries(this, internals);
47556
+ const id = internals.nextId++;
47557
+ this.handlers.push(handler);
47558
+ internals.handlerEntries.set(id, {
47559
+ handler,
47560
+ index: this.handlers.length - 1
46977
47561
  });
46978
- return this.handlers.length - 1;
47562
+ internals.handlersLength = this.handlers.length;
47563
+ return id;
46979
47564
  }
46980
47565
  /**
46981
47566
  * Remove an interceptor from the stack
@@ -46985,8 +47570,19 @@ var InterceptorManager = class {
46985
47570
  * @returns {void}
46986
47571
  */
46987
47572
  eject(id) {
46988
- if (this.handlers[id]) {
46989
- this.handlers[id] = null;
47573
+ const internals = this[$internals2];
47574
+ syncHandlerEntries(this, internals);
47575
+ const entry = internals.handlerEntries.get(id);
47576
+ if (entry) {
47577
+ internals.handlerEntries.delete(id);
47578
+ if (this.handlers[entry.index] !== entry.handler) {
47579
+ return;
47580
+ }
47581
+ this.handlers[entry.index] = null;
47582
+ if (!internals.iterationDepth) {
47583
+ trimHandlers(this.handlers);
47584
+ internals.handlersLength = this.handlers.length;
47585
+ }
46990
47586
  }
46991
47587
  }
46992
47588
  /**
@@ -46997,6 +47593,7 @@ var InterceptorManager = class {
46997
47593
  clear() {
46998
47594
  if (this.handlers) {
46999
47595
  this.handlers = [];
47596
+ syncHandlerEntries(this, this[$internals2]);
47000
47597
  }
47001
47598
  }
47002
47599
  /**
@@ -47010,11 +47607,22 @@ var InterceptorManager = class {
47010
47607
  * @returns {void}
47011
47608
  */
47012
47609
  forEach(fn) {
47013
- utils_default.forEach(this.handlers, function forEachHandler(h) {
47014
- if (h !== null) {
47015
- fn(h);
47610
+ const internals = this[$internals2];
47611
+ syncHandlerEntries(this, internals);
47612
+ internals.iterationDepth++;
47613
+ try {
47614
+ utils_default.forEach(this.handlers, function forEachHandler(h) {
47615
+ if (h !== null) {
47616
+ fn(h);
47617
+ }
47618
+ });
47619
+ } finally {
47620
+ if (!--internals.iterationDepth) {
47621
+ syncHandlerEntries(this, internals);
47622
+ trimHandlers(this.handlers);
47623
+ internals.handlersLength = countHandlers(this.handlers);
47016
47624
  }
47017
- });
47625
+ }
47018
47626
  }
47019
47627
  };
47020
47628
  var InterceptorManager_default = InterceptorManager;
@@ -47172,6 +47780,22 @@ function formDataToJSON(formData) {
47172
47780
  }
47173
47781
  var formDataToJSON_default = formDataToJSON;
47174
47782
 
47783
+ // node_modules/axios/lib/core/methodList.js
47784
+ var methodList = Object.freeze([
47785
+ "get",
47786
+ "delete",
47787
+ "head",
47788
+ "options",
47789
+ "post",
47790
+ "put",
47791
+ "patch",
47792
+ "purge",
47793
+ "link",
47794
+ "unlink",
47795
+ "query"
47796
+ ]);
47797
+ var methodList_default = methodList;
47798
+
47175
47799
  // node_modules/axios/lib/defaults/index.js
47176
47800
  var own = (obj, key) => obj != null && utils_default.hasOwnProp(obj, key) ? obj[key] : void 0;
47177
47801
  function stringifySafely2(rawValue, parser, encoder) {
@@ -47284,7 +47908,7 @@ var defaults = {
47284
47908
  }
47285
47909
  }
47286
47910
  };
47287
- utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
47911
+ utils_default.forEach(methodList_default, (method) => {
47288
47912
  defaults.headers[method] = {};
47289
47913
  });
47290
47914
  var defaults_default = defaults;
@@ -47362,19 +47986,21 @@ function combineURLs(baseURL, relativeURL) {
47362
47986
  return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
47363
47987
  }
47364
47988
 
47365
- // node_modules/axios/lib/core/buildFullPath.js
47366
- var malformedHttpProtocol = /^https?:(?!\/\/)/i;
47367
- var httpProtocolControlCharacters = /[\t\n\r]/g;
47368
- function stripLeadingC0ControlOrSpace(url2) {
47369
- let i = 0;
47370
- while (i < url2.length && url2.charCodeAt(i) <= 32) {
47371
- i++;
47372
- }
47373
- return url2.slice(i);
47374
- }
47989
+ // node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js
47990
+ var urlParserControlCharacters = /[\t\n\r]/g;
47375
47991
  function normalizeURLForProtocolCheck(url2) {
47376
- return stripLeadingC0ControlOrSpace(url2).replace(httpProtocolControlCharacters, "");
47992
+ if (typeof url2 !== "string") {
47993
+ return url2;
47994
+ }
47995
+ let start = 0;
47996
+ while (start < url2.length && url2.charCodeAt(start) <= 32) {
47997
+ start++;
47998
+ }
47999
+ return url2.slice(start).replace(urlParserControlCharacters, "");
47377
48000
  }
48001
+
48002
+ // node_modules/axios/lib/core/buildFullPath.js
48003
+ var malformedHttpProtocol = /^https?:(?!\/\/)/i;
47378
48004
  function redactFragment(fragment) {
47379
48005
  if (!fragment) {
47380
48006
  return fragment;
@@ -47496,7 +48122,7 @@ var import_follow_redirects = __toESM(require_follow_redirects(), 1);
47496
48122
  var import_zlib = __toESM(require("zlib"), 1);
47497
48123
 
47498
48124
  // node_modules/axios/lib/env/data.js
47499
- var VERSION = "1.19.0";
48125
+ var VERSION = "1.20.0";
47500
48126
 
47501
48127
  // node_modules/axios/lib/helpers/parseProtocol.js
47502
48128
  function parseProtocol(url2) {
@@ -47505,7 +48131,7 @@ function parseProtocol(url2) {
47505
48131
  }
47506
48132
 
47507
48133
  // node_modules/axios/lib/helpers/fromDataURI.js
47508
- var DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
48134
+ var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
47509
48135
  function fromDataURI(uri, asBlob, options) {
47510
48136
  const _Blob = options && options.Blob || platform_default.classes.Blob;
47511
48137
  const protocol = parseProtocol(uri);
@@ -47818,6 +48444,7 @@ var Http2Sessions = class {
47818
48444
  }
47819
48445
  getSession(authority, options) {
47820
48446
  options = Object.assign(
48447
+ /* @__PURE__ */ Object.create(null),
47821
48448
  {
47822
48449
  sessionTimeout: 1e3
47823
48450
  },
@@ -47883,6 +48510,7 @@ var Http2Sessions = class {
47883
48510
  };
47884
48511
  }
47885
48512
  session.once("close", removeSession);
48513
+ session.once("error", removeSession);
47886
48514
  let entry = [session, options];
47887
48515
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
47888
48516
  return session;
@@ -47907,6 +48535,13 @@ var callbackify_default = callbackify;
47907
48535
 
47908
48536
  // node_modules/axios/lib/helpers/shouldBypassProxy.js
47909
48537
  var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
48538
+ var trimTrailingDots = (value) => {
48539
+ let end = value.length;
48540
+ while (end && value.charCodeAt(end - 1) === 46) {
48541
+ end--;
48542
+ }
48543
+ return end === value.length ? value : value.slice(0, end);
48544
+ };
47910
48545
  var isIPv4Loopback = (host) => {
47911
48546
  const parts = host.split(".");
47912
48547
  if (parts.length !== 4) return false;
@@ -47939,7 +48574,7 @@ var normalizeIPAddress = (host) => {
47939
48574
  if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
47940
48575
  h = h.slice(1, -1);
47941
48576
  }
47942
- h = h.replace(/\.+$/, "");
48577
+ h = trimTrailingDots(h);
47943
48578
  if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
47944
48579
  const parts = h.split(".");
47945
48580
  if (parts.some((p) => p === "")) return host;
@@ -48051,6 +48686,40 @@ var unmapIPv4MappedIPv6 = (host) => {
48051
48686
  }
48052
48687
  return host;
48053
48688
  };
48689
+ var IPV4_OCTET_RE = /^(?:0|[1-9]\d{0,2})$/;
48690
+ var ipv4ToBytes = (host) => {
48691
+ const parts = host.split(".");
48692
+ return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
48693
+ };
48694
+ var IPV6_GROUP_RE = /^[0-9a-f]{1,4}$/i;
48695
+ var ipv6ToBytes = (host) => {
48696
+ const halves = host.split("::");
48697
+ if (halves.length > 2) {
48698
+ return null;
48699
+ }
48700
+ const groups = halves[0] ? halves[0].split(":") : [];
48701
+ if (halves.length === 2) {
48702
+ const rear = halves[1] ? halves[1].split(":") : [];
48703
+ const missing = 8 - groups.length - rear.length;
48704
+ if (missing < 1) {
48705
+ return null;
48706
+ }
48707
+ groups.push(...new Array(missing).fill("0"), ...rear);
48708
+ }
48709
+ if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE.test(group))) {
48710
+ return null;
48711
+ }
48712
+ return groups.flatMap((group) => {
48713
+ const value = Number.parseInt(group, 16);
48714
+ return [value >> 8 & 255, value & 255];
48715
+ });
48716
+ };
48717
+ var ipToBytes = (host) => {
48718
+ if (typeof host !== "string" || !host) {
48719
+ return null;
48720
+ }
48721
+ return host.indexOf(":") !== -1 ? ipv6ToBytes(host) : ipv4ToBytes(host);
48722
+ };
48054
48723
  var normalizeNoProxyHost = (hostname) => {
48055
48724
  if (!hostname) {
48056
48725
  return hostname;
@@ -48058,13 +48727,90 @@ var normalizeNoProxyHost = (hostname) => {
48058
48727
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
48059
48728
  hostname = hostname.slice(1, -1);
48060
48729
  }
48061
- const trimmed = hostname.replace(/\.+$/, "");
48730
+ const trimmed = trimTrailingDots(hostname);
48062
48731
  const ipv4 = normalizeIPAddress(trimmed);
48063
48732
  if (ipv4 !== trimmed) {
48064
48733
  return ipv4;
48065
48734
  }
48066
48735
  return unmapIPv4MappedIPv6(trimmed);
48067
48736
  };
48737
+ var normalizeCidrBase = (input) => {
48738
+ let base = input;
48739
+ const startsBracket = base.charAt(0) === "[";
48740
+ const endsBracket = base.charAt(base.length - 1) === "]";
48741
+ const hasBracket = base.includes("[") || base.includes("]");
48742
+ if (startsBracket || endsBracket) {
48743
+ if (!startsBracket || !endsBracket) {
48744
+ return null;
48745
+ }
48746
+ base = base.slice(1, -1);
48747
+ if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
48748
+ return null;
48749
+ }
48750
+ } else if (hasBracket) {
48751
+ return null;
48752
+ }
48753
+ if (!base || base.charAt(base.length - 1) === ".") {
48754
+ return null;
48755
+ }
48756
+ const wasIPv6 = base.indexOf(":") !== -1;
48757
+ if (wasIPv6) {
48758
+ try {
48759
+ base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
48760
+ } catch (_err) {
48761
+ return null;
48762
+ }
48763
+ } else {
48764
+ base = normalizeIPAddress(base);
48765
+ if (!ipv4ToBytes(base)) {
48766
+ return null;
48767
+ }
48768
+ }
48769
+ return { normalized: unmapIPv4MappedIPv6(base), wasIPv6 };
48770
+ };
48771
+ var CIDR_ENTRY_RE = /^(.+)\/(0|[1-9]\d{0,2})$/;
48772
+ var parseCidrEntry = (entry) => {
48773
+ if (entry.indexOf("/") === -1) {
48774
+ return void 0;
48775
+ }
48776
+ const match = CIDR_ENTRY_RE.exec(entry);
48777
+ if (!match) {
48778
+ return null;
48779
+ }
48780
+ let prefix = Number(match[2]);
48781
+ const parsedBase = normalizeCidrBase(match[1]);
48782
+ if (!parsedBase) {
48783
+ return null;
48784
+ }
48785
+ const { normalized, wasIPv6 } = parsedBase;
48786
+ if (wasIPv6 && normalized.indexOf(":") === -1) {
48787
+ if (prefix < 96) {
48788
+ return null;
48789
+ }
48790
+ prefix -= 96;
48791
+ }
48792
+ const bytes = ipToBytes(normalized);
48793
+ if (!bytes || prefix > bytes.length * 8) {
48794
+ return null;
48795
+ }
48796
+ return { bytes, prefix };
48797
+ };
48798
+ var isInSubnet = (addressBytes, networkBytes, prefix) => {
48799
+ const fullBytes = prefix >> 3;
48800
+ for (let i = 0; i < fullBytes; i++) {
48801
+ if (addressBytes[i] !== networkBytes[i]) {
48802
+ return false;
48803
+ }
48804
+ }
48805
+ const remainingBits = prefix & 7;
48806
+ if (remainingBits) {
48807
+ const mask = 255 << 8 - remainingBits & 255;
48808
+ if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
48809
+ return false;
48810
+ }
48811
+ }
48812
+ return true;
48813
+ };
48068
48814
  function shouldBypassProxy(location) {
48069
48815
  let parsed;
48070
48816
  try {
@@ -48081,6 +48827,7 @@ function shouldBypassProxy(location) {
48081
48827
  }
48082
48828
  const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS2[parsed.protocol.split(":", 1)[0]] || 0;
48083
48829
  const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
48830
+ const hostnameBytes = ipToBytes(hostname);
48084
48831
  return noProxy.split(/[\s,]+/).some((entry) => {
48085
48832
  if (!entry) {
48086
48833
  return false;
@@ -48088,6 +48835,10 @@ function shouldBypassProxy(location) {
48088
48835
  if (entry === "*") {
48089
48836
  return true;
48090
48837
  }
48838
+ const cidr = parseCidrEntry(entry);
48839
+ if (cidr !== void 0) {
48840
+ return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet(hostnameBytes, cidr.bytes, cidr.prefix);
48841
+ }
48091
48842
  let [entryHost, entryPort] = parseNoProxyEntry(entry);
48092
48843
  entryHost = normalizeNoProxyHost(entryHost);
48093
48844
  if (!entryHost) {
@@ -48173,7 +48924,8 @@ function throttle(fn, freq) {
48173
48924
  }
48174
48925
  };
48175
48926
  const flush = () => lastArgs && invoke(lastArgs);
48176
- return [throttled, flush];
48927
+ const flushWith = (...args) => invoke(args);
48928
+ return [throttled, flush, flushWith];
48177
48929
  }
48178
48930
  var throttle_default = throttle;
48179
48931
 
@@ -48182,7 +48934,7 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
48182
48934
  let bytesNotified = 0;
48183
48935
  const _speedometer = speedometer_default(50, 250);
48184
48936
  return throttle_default((e) => {
48185
- if (!e || typeof e.loaded !== "number") {
48937
+ if (!e || !utils_default.isNumber(e.loaded)) {
48186
48938
  return;
48187
48939
  }
48188
48940
  const rawLoaded = e.loaded;
@@ -48343,6 +49095,12 @@ var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
48343
49095
  var isHttps = /https:?/;
48344
49096
  var kAxiosSocketListener = Symbol("axios.http.socketListener");
48345
49097
  var kAxiosCurrentReq = Symbol("axios.http.currentReq");
49098
+ function handleSocketError(err) {
49099
+ const current = this[kAxiosCurrentReq];
49100
+ if (current && !current.destroyed) {
49101
+ current.destroy(err);
49102
+ }
49103
+ }
48346
49104
  var kAxiosInstalledTunnel = Symbol("axios.http.installedTunnel");
48347
49105
  var tunnelingAgentCache = /* @__PURE__ */ new Map();
48348
49106
  var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
@@ -48445,10 +49203,10 @@ function isSameOriginRedirect(redirectOptions, requestDetails) {
48445
49203
  return false;
48446
49204
  }
48447
49205
  }
48448
- function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
49206
+ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
48449
49207
  let proxy = configProxy;
48450
49208
  const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
48451
- if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
49209
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
48452
49210
  const proxyUrl = getProxyForUrl(location);
48453
49211
  if (proxyUrl) {
48454
49212
  if (!shouldBypassProxy(location)) {
@@ -48545,9 +49303,13 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
48545
49303
  redirectOptions.href,
48546
49304
  true,
48547
49305
  configHttpsAgent,
48548
- configHttpAgent
49306
+ configHttpAgent,
49307
+ allowEnvProxy
48549
49308
  );
48550
49309
  };
49310
+ return Boolean(
49311
+ proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent)
49312
+ );
48551
49313
  }
48552
49314
  var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
48553
49315
  var wrapAsync = (asyncExecutor) => {
@@ -48572,7 +49334,7 @@ var wrapAsync = (asyncExecutor) => {
48572
49334
  };
48573
49335
  var resolveFamily = ({ address, family }) => {
48574
49336
  if (!utils_default.isString(address)) {
48575
- throw TypeError("address must be a string");
49337
+ throw new AxiosError_default("address must be a string", AxiosError_default.ERR_BAD_OPTION_VALUE);
48576
49338
  }
48577
49339
  return {
48578
49340
  address,
@@ -48580,6 +49342,30 @@ var resolveFamily = ({ address, family }) => {
48580
49342
  };
48581
49343
  };
48582
49344
  var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
49345
+ var normalizedLookupCache = /* @__PURE__ */ new WeakMap();
49346
+ var normalizeLookup = (lookup) => {
49347
+ let normalized = normalizedLookupCache.get(lookup);
49348
+ if (normalized) {
49349
+ return normalized;
49350
+ }
49351
+ const callbackLookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
49352
+ normalized = (hostname, opt, cb) => {
49353
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
49354
+ if (err) {
49355
+ return cb(err);
49356
+ }
49357
+ let addresses;
49358
+ try {
49359
+ addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
49360
+ } catch (error) {
49361
+ return cb(error);
49362
+ }
49363
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
49364
+ });
49365
+ };
49366
+ normalizedLookupCache.set(lookup, normalized);
49367
+ return normalized;
49368
+ };
48583
49369
  var http2Transport = {
48584
49370
  request(options, cb) {
48585
49371
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
@@ -48616,6 +49402,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48616
49402
  let family = own2("family");
48617
49403
  let httpVersion = own2("httpVersion");
48618
49404
  if (httpVersion === void 0) httpVersion = 1;
49405
+ const rawHttpVersion = httpVersion;
48619
49406
  let http2Options = own2("http2Options");
48620
49407
  const httpAgent = own2("httpAgent");
48621
49408
  const httpsAgent = own2("httpsAgent");
@@ -48632,25 +49419,32 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48632
49419
  let rejected = false;
48633
49420
  let req;
48634
49421
  let connectPhaseTimer;
48635
- httpVersion = +httpVersion;
49422
+ try {
49423
+ httpVersion = +httpVersion;
49424
+ } catch (err) {
49425
+ throw new AxiosError_default(
49426
+ "Invalid protocol version: value is not a number",
49427
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
49428
+ config
49429
+ );
49430
+ }
48636
49431
  if (Number.isNaN(httpVersion)) {
48637
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
49432
+ throw new AxiosError_default(
49433
+ `Invalid protocol version: '${rawHttpVersion}' is not a number`,
49434
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
49435
+ config
49436
+ );
48638
49437
  }
48639
49438
  if (httpVersion !== 1 && httpVersion !== 2) {
48640
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
49439
+ throw new AxiosError_default(
49440
+ `Unsupported protocol version '${httpVersion}'`,
49441
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
49442
+ config
49443
+ );
48641
49444
  }
48642
49445
  const isHttp2 = httpVersion === 2;
48643
49446
  if (lookup) {
48644
- const _lookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
48645
- lookup = (hostname, opt, cb) => {
48646
- _lookup(hostname, opt, (err, arg0, arg1) => {
48647
- if (err) {
48648
- return cb(err);
48649
- }
48650
- const addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
48651
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
48652
- });
48653
- };
49447
+ lookup = normalizeLookup(lookup);
48654
49448
  }
48655
49449
  const abortEmitter = new import_events.EventEmitter();
48656
49450
  function abort(reason) {
@@ -48893,6 +49687,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48893
49687
  utils_default.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
48894
49688
  false
48895
49689
  );
49690
+ if (isHttp2 && lookup) {
49691
+ http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, { lookup });
49692
+ }
48896
49693
  const options = Object.assign(/* @__PURE__ */ Object.create(null), {
48897
49694
  path: path5,
48898
49695
  method,
@@ -48903,9 +49700,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48903
49700
  family,
48904
49701
  beforeRedirect: dispatchBeforeRedirect,
48905
49702
  beforeRedirects: /* @__PURE__ */ Object.create(null),
48906
- http2Options
49703
+ http2Options,
49704
+ createConnection: void 0
48907
49705
  });
48908
49706
  !utils_default.isUndefined(lookup) && (options.lookup = lookup);
49707
+ let proxyApplied = false;
48909
49708
  if (socketPath) {
48910
49709
  if (typeof socketPath !== "string") {
48911
49710
  return reject(
@@ -48933,13 +49732,17 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48933
49732
  } else {
48934
49733
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
48935
49734
  options.port = parsed.port;
48936
- setProxy(
49735
+ proxyApplied = setProxy(
48937
49736
  options,
48938
49737
  configProxy,
48939
49738
  protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
48940
49739
  false,
48941
49740
  httpsAgent,
48942
- httpAgent
49741
+ httpAgent,
49742
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
49743
+ // cannot apply either axios-resolved or agent-local environment proxies.
49744
+ // Explicit proxy config is still processed and rejected below.
49745
+ !isHttp2
48943
49746
  );
48944
49747
  }
48945
49748
  let transport;
@@ -48950,6 +49753,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48950
49753
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
48951
49754
  }
48952
49755
  if (isHttp2) {
49756
+ if (proxyApplied) {
49757
+ return reject(
49758
+ new AxiosError_default(
49759
+ "HTTP/2 requests with a proxy are not supported",
49760
+ AxiosError_default.ERR_NOT_SUPPORT,
49761
+ config
49762
+ )
49763
+ );
49764
+ }
48953
49765
  transport = http2Transport;
48954
49766
  } else {
48955
49767
  const configTransport = own2("transport");
@@ -49037,7 +49849,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
49037
49849
  transformStream,
49038
49850
  progressEventDecorator(
49039
49851
  responseLength,
49040
- progressEventReducer(asyncDecorator(onDownloadProgress, scheduleProgress), true, 3)
49852
+ progressEventReducer(
49853
+ asyncDecorator(onDownloadProgress, scheduleProgress),
49854
+ true,
49855
+ 3
49856
+ )
49041
49857
  )
49042
49858
  )
49043
49859
  );
@@ -49186,12 +50002,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
49186
50002
  socket.setKeepAlive(true, 1e3 * 60);
49187
50003
  }
49188
50004
  if (!socket[kAxiosSocketListener]) {
49189
- socket.on("error", function handleSocketError(err) {
49190
- const current = socket[kAxiosCurrentReq];
49191
- if (current && !current.destroyed) {
49192
- current.destroy(err);
49193
- }
49194
- });
50005
+ socket.on("error", handleSocketError);
49195
50006
  socket[kAxiosSocketListener] = true;
49196
50007
  }
49197
50008
  socket[kAxiosCurrentReq] = req;
@@ -49436,7 +50247,7 @@ function mergeConfig(config1, config2) {
49436
50247
  transformResponse: defaultToConfig2,
49437
50248
  paramsSerializer: defaultToConfig2,
49438
50249
  timeout: defaultToConfig2,
49439
- timeoutMessage: defaultToConfig2,
50250
+ timeoutErrorMessage: defaultToConfig2,
49440
50251
  withCredentials: defaultToConfig2,
49441
50252
  withXSRFToken: defaultToConfig2,
49442
50253
  adapter: defaultToConfig2,
@@ -49513,10 +50324,11 @@ function resolveConfig(config) {
49513
50324
  }
49514
50325
  }
49515
50326
  if (utils_default.isFormData(data)) {
50327
+ const getHeaders = utils_default.getSafeProp(data, "getHeaders");
49516
50328
  if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv || utils_default.isReactNative(data)) {
49517
50329
  headers.setContentType(void 0);
49518
- } else if (utils_default.isFunction(data.getHeaders)) {
49519
- setFormDataHeaders(headers, data.getHeaders(), own2("formDataHeaderPolicy"));
50330
+ } else if (utils_default.isFunction(getHeaders)) {
50331
+ setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
49520
50332
  }
49521
50333
  }
49522
50334
  if (platform_default.hasStandardBrowserEnv) {
@@ -49545,7 +50357,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49545
50357
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
49546
50358
  let onCanceled;
49547
50359
  let uploadThrottled, downloadThrottled;
49548
- let flushUpload, flushDownload;
50360
+ let flushUpload, flushDownload, flushDownloadWithEvent;
49549
50361
  function done() {
49550
50362
  flushUpload && flushUpload();
49551
50363
  flushDownload && flushDownload();
@@ -49555,7 +50367,27 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49555
50367
  let request = new XMLHttpRequest();
49556
50368
  request.open(_config.method.toUpperCase(), _config.url, true);
49557
50369
  request.timeout = _config.timeout;
49558
- function onloadend() {
50370
+ function onloadend(event) {
50371
+ if (!request) {
50372
+ return;
50373
+ }
50374
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform_default.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
50375
+ reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
50376
+ done();
50377
+ request = null;
50378
+ return;
50379
+ }
50380
+ try {
50381
+ if (event) {
50382
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
50383
+ } else {
50384
+ flushDownload && flushDownload();
50385
+ }
50386
+ } catch (err) {
50387
+ setTimeout(() => {
50388
+ throw err;
50389
+ });
50390
+ }
49559
50391
  if (!request) {
49560
50392
  return;
49561
50393
  }
@@ -49643,7 +50475,10 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49643
50475
  request.responseType = _config.responseType;
49644
50476
  }
49645
50477
  if (onDownloadProgress) {
49646
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
50478
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
50479
+ onDownloadProgress,
50480
+ true
50481
+ );
49647
50482
  request.addEventListener("progress", downloadThrottled);
49648
50483
  }
49649
50484
  if (onUploadProgress && request.upload) {
@@ -49813,6 +50648,17 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
49813
50648
 
49814
50649
  // node_modules/axios/lib/adapters/fetch.js
49815
50650
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
50651
+ var DEFAULT_REQUEST_OPTIONS = {
50652
+ cache: "default",
50653
+ redirect: "follow",
50654
+ referrer: "about:client",
50655
+ referrerPolicy: "",
50656
+ mode: "cors",
50657
+ integrity: "",
50658
+ keepalive: false,
50659
+ priority: "auto",
50660
+ window: null
50661
+ };
49816
50662
  var { isFunction: isFunction2 } = utils_default;
49817
50663
  var encodeUTF82 = (str) => encodeURIComponent(str).replace(
49818
50664
  /%([0-9A-F]{2})/gi,
@@ -49943,7 +50789,8 @@ var factory = (env) => {
49943
50789
  withCredentials = "same-origin",
49944
50790
  fetchOptions,
49945
50791
  maxContentLength,
49946
- maxBodyLength
50792
+ maxBodyLength,
50793
+ maxRedirects
49947
50794
  } = resolveConfig_default(config);
49948
50795
  const hasMaxContentLength = utils_default.isNumber(maxContentLength) && maxContentLength > -1;
49949
50796
  const hasMaxBodyLength = utils_default.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -50073,17 +50920,44 @@ var factory = (env) => {
50073
50920
  }
50074
50921
  }
50075
50922
  headers.set("User-Agent", "axios/" + VERSION, false);
50076
- const resolvedOptions = {
50077
- ...fetchOptions,
50923
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
50924
+ if (safeFetchOptions) {
50925
+ delete safeFetchOptions.body;
50926
+ delete safeFetchOptions.headers;
50927
+ delete safeFetchOptions.method;
50928
+ delete safeFetchOptions.signal;
50929
+ delete safeFetchOptions.duplex;
50930
+ delete safeFetchOptions.credentials;
50931
+ }
50932
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
50078
50933
  signal: composedSignal,
50079
50934
  method: method.toUpperCase(),
50080
50935
  headers: toByteStringHeaderObject(headers.normalize()),
50081
50936
  body: data,
50082
50937
  duplex: "half",
50083
50938
  credentials: isCredentialsSupported ? withCredentials : void 0
50084
- };
50939
+ });
50940
+ if (isRequestSupported) {
50941
+ utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
50942
+ if (resolvedOptions[key] === void 0) {
50943
+ resolvedOptions[key] = value;
50944
+ }
50945
+ });
50946
+ if (resolvedOptions.signal === void 0) {
50947
+ resolvedOptions.signal = null;
50948
+ }
50949
+ if (resolvedOptions.body === void 0) {
50950
+ resolvedOptions.body = null;
50951
+ }
50952
+ }
50953
+ if (maxRedirects === 0) {
50954
+ resolvedOptions.redirect = "manual";
50955
+ if (safeFetchOptions) {
50956
+ safeFetchOptions.redirect = "manual";
50957
+ }
50958
+ }
50085
50959
  request = isRequestSupported && new Request(url2, resolvedOptions);
50086
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url2, resolvedOptions));
50960
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url2, resolvedOptions));
50087
50961
  const responseHeaders = AxiosHeaders_default.from(response.headers);
50088
50962
  if (hasMaxContentLength) {
50089
50963
  const declaredLength = utils_default.toFiniteNumber(responseHeaders.getContentLength());
@@ -50302,9 +51176,10 @@ function throwIfCancellationRequested(config) {
50302
51176
  throw new CanceledError_default(null, config);
50303
51177
  }
50304
51178
  }
50305
- function dispatchRequest(config) {
51179
+ function dispatchRequest(_config) {
51180
+ const config = utils_default.toSafeFlatObject(_config);
50306
51181
  throwIfCancellationRequested(config);
50307
- config.headers = AxiosHeaders_default.from(config.headers);
51182
+ config.headers = AxiosHeaders_default.from(utils_default.getSafeProp(config, "headers"));
50308
51183
  config.data = transformData.call(config, config.transformRequest);
50309
51184
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
50310
51185
  config.headers.setContentType("application/x-www-form-urlencoded", false);
@@ -50434,16 +51309,15 @@ var Axios = class {
50434
51309
  return await this._request(configOrUrl, config);
50435
51310
  } catch (err) {
50436
51311
  if (err instanceof Error) {
50437
- let dummy = {};
50438
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
50439
- const stack = (() => {
50440
- if (!dummy.stack) {
50441
- return "";
50442
- }
50443
- const firstNewlineIndex = dummy.stack.indexOf("\n");
50444
- return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
50445
- })();
50446
51312
  try {
51313
+ let dummy = {};
51314
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
51315
+ const dummyStack = dummy.stack;
51316
+ let stack = "";
51317
+ if (typeof dummyStack === "string") {
51318
+ const firstNewlineIndex = dummyStack.indexOf("\n");
51319
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
51320
+ }
50447
51321
  if (!err.stack) {
50448
51322
  err.stack = stack;
50449
51323
  } else if (stack) {
@@ -50513,9 +51387,9 @@ var Axios = class {
50513
51387
  },
50514
51388
  true
50515
51389
  );
50516
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
51390
+ config.method = (utils_default.getSafeProp(config, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
50517
51391
  let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
50518
- headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
51392
+ headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
50519
51393
  delete headers[method];
50520
51394
  });
50521
51395
  config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
@@ -50778,14 +51652,22 @@ var HttpStatusCode = {
50778
51652
  Gone: 410,
50779
51653
  LengthRequired: 411,
50780
51654
  PreconditionFailed: 412,
51655
+ /**
51656
+ * @deprecated Use `ContentTooLarge` instead.
51657
+ */
50781
51658
  PayloadTooLarge: 413,
51659
+ ContentTooLarge: 413,
50782
51660
  UriTooLong: 414,
50783
51661
  UnsupportedMediaType: 415,
50784
51662
  RangeNotSatisfiable: 416,
50785
51663
  ExpectationFailed: 417,
50786
51664
  ImATeapot: 418,
50787
51665
  MisdirectedRequest: 421,
51666
+ /**
51667
+ * @deprecated Use `UnprocessableContent` instead.
51668
+ */
50788
51669
  UnprocessableEntity: 422,
51670
+ UnprocessableContent: 422,
50789
51671
  Locked: 423,
50790
51672
  FailedDependency: 424,
50791
51673
  TooEarly: 425,
@@ -50814,7 +51696,9 @@ var HttpStatusCode = {
50814
51696
  InvalidSslCertificate: 526
50815
51697
  };
50816
51698
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
50817
- HttpStatusCode[value] = key;
51699
+ if (HttpStatusCode[value] === void 0) {
51700
+ HttpStatusCode[value] = key;
51701
+ }
50818
51702
  });
50819
51703
  var HttpStatusCode_default = HttpStatusCode;
50820
51704
 
@@ -51994,6 +52878,9 @@ var require_pkg_src2 = __commonJS2({
51994
52878
  });
51995
52879
  var index_exports = {};
51996
52880
  __export22(index_exports, {
52881
+ BORROWER_AUTHORIZATION_ENCODE_TYPES: () => BORROWER_AUTHORIZATION_ENCODE_TYPES,
52882
+ BORROWER_AUTHORIZATION_FIELDS: () => BORROWER_AUTHORIZATION_FIELDS,
52883
+ BORROWER_AUTHORIZATION_PRIMARY_TYPES: () => BORROWER_AUTHORIZATION_PRIMARY_TYPES,
51997
52884
  CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
51998
52885
  DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
51999
52886
  DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
@@ -52006,6 +52893,8 @@ var require_pkg_src2 = __commonJS2({
52006
52893
  PerformanceTracker: () => PerformanceTracker,
52007
52894
  RetryStrategy: () => RetryStrategy,
52008
52895
  analyzeError: () => analyzeError,
52896
+ borrowerAuthorizationTypes: () => borrowerAuthorizationTypes,
52897
+ buildBorrowerAuthorizationDomain: () => buildBorrowerAuthorizationDomain,
52009
52898
  calculateDelay: () => calculateDelay,
52010
52899
  cidToHex: () => cidToHex,
52011
52900
  classifyError: () => classifyError,
@@ -52252,30 +53141,30 @@ var require_pkg_src2 = __commonJS2({
52252
53141
  }
52253
53142
  },
52254
53143
  btcTransactionSigner: {
52255
- cid: "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp",
53144
+ cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
52256
53145
  authorizedCidHex: cidToHex(
52257
- "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp"
53146
+ "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
52258
53147
  ),
52259
53148
  name: "Btc Transaction Signer",
52260
53149
  description: "Production Btc Transaction Signer",
52261
53150
  version: "1.1.1",
52262
53151
  deployed: true,
52263
- deployedAt: 1786465606156,
52264
- size: 67999,
52265
- hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
53152
+ deployedAt: 1787923905597,
53153
+ size: 70646,
53154
+ hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
52266
53155
  },
52267
53156
  ucdMintValidator: {
52268
- cid: "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx",
53157
+ cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
52269
53158
  authorizedCidHex: cidToHex(
52270
- "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx"
53159
+ "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
52271
53160
  ),
52272
53161
  name: "Ucd Mint Validator",
52273
53162
  description: "Production Ucd Mint Validator",
52274
53163
  version: "1.2.1",
52275
53164
  deployed: true,
52276
- deployedAt: 1786465627201,
52277
- size: 82739,
52278
- hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
53165
+ deployedAt: 1787923919527,
53166
+ size: 86197,
53167
+ hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
52279
53168
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52280
53169
  pkp: {
52281
53170
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -52283,17 +53172,17 @@ var require_pkg_src2 = __commonJS2({
52283
53172
  }
52284
53173
  },
52285
53174
  processPaymentValidator: {
52286
- cid: "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z",
53175
+ cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
52287
53176
  authorizedCidHex: cidToHex(
52288
- "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z"
53177
+ "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
52289
53178
  ),
52290
53179
  name: "Process Payment Validator",
52291
53180
  description: "Production Process Payment Validator",
52292
53181
  version: "1.2.1",
52293
53182
  deployed: true,
52294
- deployedAt: 1786465654796,
52295
- size: 78736,
52296
- hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
53183
+ deployedAt: 1787923987153,
53184
+ size: 82217,
53185
+ hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
52297
53186
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52298
53187
  pkp: {
52299
53188
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
@@ -52301,17 +53190,17 @@ var require_pkg_src2 = __commonJS2({
52301
53190
  }
52302
53191
  },
52303
53192
  extendPositionValidator: {
52304
- cid: "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav",
53193
+ cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
52305
53194
  authorizedCidHex: cidToHex(
52306
- "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav"
53195
+ "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
52307
53196
  ),
52308
53197
  name: "Extend Position Validator",
52309
53198
  description: "Production Extend Position Validator",
52310
53199
  version: "1.2.1",
52311
53200
  deployed: true,
52312
- deployedAt: 1786465681874,
52313
- size: 76515,
52314
- hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
53201
+ deployedAt: 1787923999294,
53202
+ size: 79975,
53203
+ hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
52315
53204
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52316
53205
  pkp: {
52317
53206
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
@@ -52319,17 +53208,17 @@ var require_pkg_src2 = __commonJS2({
52319
53208
  }
52320
53209
  },
52321
53210
  btcWithdrawal: {
52322
- cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
53211
+ cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
52323
53212
  authorizedCidHex: cidToHex(
52324
- "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
53213
+ "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
52325
53214
  ),
52326
53215
  name: "Btc Withdrawal",
52327
53216
  description: "Production Btc Withdrawal",
52328
53217
  version: "1.2.7",
52329
53218
  deployed: true,
52330
- deployedAt: 1786446046614,
52331
- size: 97456,
52332
- hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
53219
+ deployedAt: 1787924017769,
53220
+ size: 100069,
53221
+ hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
52333
53222
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52334
53223
  pkp: {
52335
53224
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -52441,30 +53330,30 @@ var require_pkg_src2 = __commonJS2({
52441
53330
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
52442
53331
  },
52443
53332
  agentModuleExecutor: {
52444
- cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
53333
+ cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
52445
53334
  authorizedCidHex: cidToHex(
52446
- "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
53335
+ "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
52447
53336
  ),
52448
53337
  name: "Agent Module Executor",
52449
53338
  description: "Production Agent Module Executor",
52450
53339
  version: "1.1.1",
52451
53340
  deployed: true,
52452
- deployedAt: 1786446108348,
52453
- size: 11655,
52454
- hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
53341
+ deployedAt: 1787924032013,
53342
+ size: 13878,
53343
+ hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
52455
53344
  },
52456
53345
  staleSpendRecoveryValidator: {
52457
- cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
53346
+ cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
52458
53347
  authorizedCidHex: cidToHex(
52459
- "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm"
53348
+ "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
52460
53349
  ),
52461
53350
  name: "Stale Spend Recovery Validator",
52462
53351
  description: "Production Stale Spend Recovery Validator",
52463
53352
  version: "1.1.2",
52464
53353
  deployed: true,
52465
- deployedAt: 1785173285829,
52466
- size: 37108,
52467
- hash: "04de5fc5b6f5131dc1544e3d3d187a1f9ef9616ffd12483d119f9102b3671791",
53354
+ deployedAt: 1787924048772,
53355
+ size: 41424,
53356
+ hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
52468
53357
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52469
53358
  pkp: {
52470
53359
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
@@ -52472,17 +53361,17 @@ var require_pkg_src2 = __commonJS2({
52472
53361
  }
52473
53362
  },
52474
53363
  btcUtxoInvalidator: {
52475
- cid: "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m",
53364
+ cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
52476
53365
  authorizedCidHex: cidToHex(
52477
- "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m"
53366
+ "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
52478
53367
  ),
52479
53368
  name: "Btc Utxo Invalidator",
52480
53369
  description: "Production Btc Utxo Invalidator",
52481
53370
  version: "1.0.0",
52482
53371
  deployed: true,
52483
- deployedAt: 1786465704240,
52484
- size: 62553,
52485
- hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
53372
+ deployedAt: 1787924133241,
53373
+ size: 66026,
53374
+ hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
52486
53375
  }
52487
53376
  };
52488
53377
  function getDeploymentsForNetwork(network) {
@@ -53243,6 +54132,101 @@ ${errorReport}`);
53243
54132
  var SECONDS_PER_DAY = 86400;
53244
54133
  var DAYS_PER_MONTH = 30;
53245
54134
  var LIT_ACTION_ETH_RPC_TIMEOUT_MS = 8e3;
54135
+ var PINNED_CONTRACT_ADDRESSES = {
54136
+ 1: {
54137
+ PositionManager: "0x12A1836e56139ccaD8722B89519d84233efc224B",
54138
+ LoanOperationsManagerModule: "0x2561974A40F1AEed1251d0A090A83cF8536FB9E9",
54139
+ BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
54140
+ BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
54141
+ LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
54142
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
54143
+ },
54144
+ 11155111: {
54145
+ PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
54146
+ LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
54147
+ BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
54148
+ BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
54149
+ LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
54150
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
54151
+ }
54152
+ };
54153
+ function getPinnedContractAddresses(chainId) {
54154
+ return PINNED_CONTRACT_ADDRESSES[chainId] ?? null;
54155
+ }
54156
+ var PROTOCOL_EIP712_DOMAIN_NAME = "DiamondHands.Protocol";
54157
+ var PROTOCOL_EIP712_DOMAIN_VERSION = "1";
54158
+ var BORROWER_AUTHORIZATION_PRIMARY_TYPES = {
54159
+ MINT: "MintRequest",
54160
+ REPAY: "RepayRequest",
54161
+ RENEW: "RenewRequest",
54162
+ WITHDRAW: "WithdrawRequest"
54163
+ };
54164
+ var BORROWER_AUTHORIZATION_FIELDS = {
54165
+ MintRequest: [
54166
+ { name: "positionId", type: "bytes32" },
54167
+ { name: "mintAmount", type: "uint256" },
54168
+ { name: "quantumTimestamp", type: "uint256" }
54169
+ ],
54170
+ RepayRequest: [
54171
+ { name: "positionId", type: "bytes32" },
54172
+ { name: "paymentAmount", type: "uint256" },
54173
+ { name: "quantumTimestamp", type: "uint256" }
54174
+ ],
54175
+ RenewRequest: [
54176
+ { name: "positionId", type: "bytes32" },
54177
+ { name: "selectedTerm", type: "uint256" },
54178
+ { name: "quantumTimestamp", type: "uint256" }
54179
+ ],
54180
+ WithdrawRequest: [
54181
+ { name: "positionId", type: "bytes32" },
54182
+ { name: "totalDeduction", type: "uint256" },
54183
+ { name: "withdrawalAddress", type: "string" },
54184
+ { name: "quantumTimestamp", type: "uint256" }
54185
+ ]
54186
+ };
54187
+ var BORROWER_AUTHORIZATION_ENCODE_TYPES = {
54188
+ MintRequest: "MintRequest(bytes32 positionId,uint256 mintAmount,uint256 quantumTimestamp)",
54189
+ RepayRequest: "RepayRequest(bytes32 positionId,uint256 paymentAmount,uint256 quantumTimestamp)",
54190
+ RenewRequest: "RenewRequest(bytes32 positionId,uint256 selectedTerm,uint256 quantumTimestamp)",
54191
+ WithdrawRequest: "WithdrawRequest(bytes32 positionId,uint256 totalDeduction,string withdrawalAddress,uint256 quantumTimestamp)"
54192
+ };
54193
+ function borrowerAuthorizationTypes(primaryType) {
54194
+ const fields = BORROWER_AUTHORIZATION_FIELDS[primaryType];
54195
+ if (!fields) {
54196
+ throw new Error(
54197
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ${Object.keys(BORROWER_AUTHORIZATION_FIELDS).join(", ")}`
54198
+ );
54199
+ }
54200
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
54201
+ }
54202
+ function buildBorrowerAuthorizationDomain(chainId, verifyingContractOverride) {
54203
+ if (!Number.isInteger(chainId) || chainId <= 0) {
54204
+ throw new Error(
54205
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
54206
+ );
54207
+ }
54208
+ const pinned = getPinnedContractAddresses(chainId);
54209
+ const pinnedLom = pinned?.LoanOperationsManagerModule;
54210
+ if (pinnedLom && verifyingContractOverride) {
54211
+ if (pinnedLom.toLowerCase() !== verifyingContractOverride.toLowerCase()) {
54212
+ throw new Error(
54213
+ `Refusing a caller-supplied verifyingContract that contradicts the pin for chainId ${chainId}: caller ${verifyingContractOverride}, pinned ${pinnedLom}`
54214
+ );
54215
+ }
54216
+ }
54217
+ const verifyingContract = pinnedLom ?? verifyingContractOverride;
54218
+ if (!verifyingContract) {
54219
+ throw new Error(
54220
+ `No pinned LoanOperationsManagerModule for chainId ${chainId} and no verifyingContract supplied; refusing to build a borrower authorization domain without one`
54221
+ );
54222
+ }
54223
+ return {
54224
+ name: PROTOCOL_EIP712_DOMAIN_NAME,
54225
+ version: PROTOCOL_EIP712_DOMAIN_VERSION,
54226
+ chainId,
54227
+ verifyingContract
54228
+ };
54229
+ }
53246
54230
  var EVMChain = /* @__PURE__ */ ((EVMChain3) => {
53247
54231
  EVMChain3["SEPOLIA"] = "sepolia";
53248
54232
  EVMChain3["ETHEREUM"] = "ethereum";
@@ -55053,11 +56037,11 @@ ${auth.clientId}`;
55053
56037
  );
55054
56038
  const prices = await Promise.race([fetchAll, timeoutPromise]);
55055
56039
  const sorted = [...prices].sort((a, b) => a - b);
55056
- let median;
56040
+ let median2;
55057
56041
  if (this.devSingleProvider) {
55058
- median = sorted[0];
56042
+ median2 = sorted[0];
55059
56043
  } else {
55060
- median = sorted[1];
56044
+ median2 = sorted[1];
55061
56045
  const spread3 = (sorted[2] - sorted[0]) / sorted[0];
55062
56046
  if (spread3 > PRICE_ORACLE_TOLERANCE) {
55063
56047
  const names = this.sources.map((s) => s.name).join(", ");
@@ -55067,10 +56051,10 @@ ${auth.clientId}`;
55067
56051
  );
55068
56052
  }
55069
56053
  }
55070
- const priceCents = Math.round(median * 100);
56054
+ const priceCents = Math.round(median2 * 100);
55071
56055
  const priceWith8Decimals = BigInt(priceCents) * 1000000n;
55072
56056
  const totalElapsed = Date.now() - startTime;
55073
- console.log(`[Price Oracle] Median price: $${median.toLocaleString()} \u2014 total time: ${totalElapsed}ms`);
56057
+ console.log(`[Price Oracle] Median price: $${median2.toLocaleString()} \u2014 total time: ${totalElapsed}ms`);
55074
56058
  console.log(`[Price Oracle] Price with 8 decimals: ${priceWith8Decimals}`);
55075
56059
  return priceWith8Decimals;
55076
56060
  }
@@ -56835,26 +57819,83 @@ var MAKE_PAYMENT_GAS_CEILING = BigInt(1e6);
56835
57819
  var EXTEND_POSITION_GAS_CEILING = BigInt(1e6);
56836
57820
  var LIQUIDATION_COMMIT_GAS_CEILING = BigInt(1e6);
56837
57821
  var LIQUIDATION_REVEAL_GAS_CEILING = BigInt(2e6);
56838
- async function resolveEip1559FeeFields(provider) {
56839
- const feeData = await provider.getFeeData();
56840
- let maxFeePerGas = feeData.maxFeePerGas ?? void 0;
56841
- let maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? void 0;
56842
- if (!maxFeePerGas || !maxPriorityFeePerGas) {
56843
- const gasPrice = (await provider.getFeeData()).gasPrice ?? (0, import_ethers15.parseUnits)("1", "gwei");
56844
- maxFeePerGas = maxFeePerGas || gasPrice * 2n;
56845
- maxPriorityFeePerGas = maxPriorityFeePerGas || (0, import_ethers15.parseUnits)("1.5", "gwei");
56846
- }
56847
- if (maxFeePerGas < maxPriorityFeePerGas) {
56848
- maxFeePerGas = maxPriorityFeePerGas;
57822
+ var PRIORITY_FEE_FLOOR_WEI = (0, import_ethers15.parseUnits)("0.1", "gwei");
57823
+ var PRIORITY_FEE_CAP_WEI = (0, import_ethers15.parseUnits)("3", "gwei");
57824
+ var FEE_HISTORY_BLOCK_COUNT = 20;
57825
+ var FEE_HISTORY_REWARD_PERCENTILE = 75;
57826
+ function isJsonRpcSendable(provider) {
57827
+ return typeof provider.send === "function";
57828
+ }
57829
+ function parseFeeHistory(raw) {
57830
+ if (typeof raw !== "object" || raw === null) {
57831
+ throw new Error(`eth_feeHistory returned a non-object result: ${JSON.stringify(raw)}`);
57832
+ }
57833
+ const { baseFeePerGas, reward } = raw;
57834
+ if (!Array.isArray(baseFeePerGas) || baseFeePerGas.length === 0) {
57835
+ throw new Error(
57836
+ `eth_feeHistory returned no baseFeePerGas \u2014 the RPC does not support EIP-1559 fee history: ${JSON.stringify(raw)}`
57837
+ );
56849
57838
  }
57839
+ if (!Array.isArray(reward) || reward.length === 0) {
57840
+ throw new Error(
57841
+ `eth_feeHistory returned no reward percentiles \u2014 the RPC ignored the rewardPercentiles argument: ${JSON.stringify(raw)}`
57842
+ );
57843
+ }
57844
+ const nextBaseFee = (0, import_ethers15.getBigInt)(baseFeePerGas[baseFeePerGas.length - 1], "baseFeePerGas");
57845
+ const tips = reward.map((perBlock, i) => {
57846
+ if (!Array.isArray(perBlock) || perBlock.length === 0) {
57847
+ throw new Error(`eth_feeHistory reward row ${i} is empty: ${JSON.stringify(raw)}`);
57848
+ }
57849
+ return (0, import_ethers15.getBigInt)(perBlock[0], `reward[${i}]`);
57850
+ });
57851
+ return { nextBaseFee, tips };
57852
+ }
57853
+ function median(values) {
57854
+ const sorted = [...values].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
57855
+ const mid = sorted.length >> 1;
57856
+ const hi = sorted[mid];
57857
+ if (hi === void 0) {
57858
+ throw new Error("median: no values");
57859
+ }
57860
+ if (sorted.length % 2 === 1)
57861
+ return hi;
57862
+ const lo = sorted[mid - 1];
57863
+ if (lo === void 0) {
57864
+ throw new Error("median: no values");
57865
+ }
57866
+ return (lo + hi) / 2n;
57867
+ }
57868
+ function clamp(value, floor, cap) {
57869
+ if (value < floor)
57870
+ return floor;
57871
+ if (value > cap)
57872
+ return cap;
57873
+ return value;
57874
+ }
57875
+ async function resolveEip1559FeeFields(feeProvider) {
57876
+ if (!isJsonRpcSendable(feeProvider)) {
57877
+ throw new Error(
57878
+ "resolveEip1559FeeFields: feeProvider must be a JSON-RPC provider exposing send() (the SDK read provider), not a wallet BrowserProvider \u2014 eth_feeHistory is required"
57879
+ );
57880
+ }
57881
+ const history = parseFeeHistory(
57882
+ await feeProvider.send("eth_feeHistory", [
57883
+ (0, import_ethers15.toQuantity)(FEE_HISTORY_BLOCK_COUNT),
57884
+ "latest",
57885
+ [FEE_HISTORY_REWARD_PERCENTILE]
57886
+ ])
57887
+ );
57888
+ const marketTip = median(history.tips);
57889
+ const maxPriorityFeePerGas = clamp(marketTip, PRIORITY_FEE_FLOOR_WEI, PRIORITY_FEE_CAP_WEI);
57890
+ const maxFeePerGas = history.nextBaseFee * 2n + maxPriorityFeePerGas;
56850
57891
  return { maxFeePerGas, maxPriorityFeePerGas };
56851
57892
  }
56852
57893
  async function sendEip1559Transaction(params) {
56853
- const { signer, to, data, gasLimit } = params;
57894
+ const { signer, feeProvider, to, data, gasLimit } = params;
56854
57895
  if (!signer.provider) {
56855
57896
  throw new Error("Signer must have a provider attached");
56856
57897
  }
56857
- const fees = await resolveEip1559FeeFields(signer.provider);
57898
+ const fees = await resolveEip1559FeeFields(feeProvider);
56858
57899
  return signer.sendTransaction({
56859
57900
  to,
56860
57901
  data,
@@ -57038,6 +58079,77 @@ async function awaitSafeSubmissionWindowOnChain(signatureQuantum, chainNow, slee
57038
58079
  );
57039
58080
  return { waited: waitedSeconds > 0, waitedSeconds };
57040
58081
  }
58082
+ init_deployment_addresses();
58083
+ var BORROWER_AUTHORIZATION_712_DOMAIN_NAME = "DiamondHands.Protocol";
58084
+ var BORROWER_AUTHORIZATION_712_DOMAIN_VERSION = "1";
58085
+ var BORROWER_AUTHORIZATION_712_FIELDS = {
58086
+ MintRequest: [
58087
+ { name: "positionId", type: "bytes32" },
58088
+ { name: "mintAmount", type: "uint256" },
58089
+ { name: "quantumTimestamp", type: "uint256" }
58090
+ ],
58091
+ RepayRequest: [
58092
+ { name: "positionId", type: "bytes32" },
58093
+ { name: "paymentAmount", type: "uint256" },
58094
+ { name: "quantumTimestamp", type: "uint256" }
58095
+ ],
58096
+ RenewRequest: [
58097
+ { name: "positionId", type: "bytes32" },
58098
+ { name: "selectedTerm", type: "uint256" },
58099
+ { name: "quantumTimestamp", type: "uint256" }
58100
+ ],
58101
+ WithdrawRequest: [
58102
+ { name: "positionId", type: "bytes32" },
58103
+ { name: "totalDeduction", type: "uint256" },
58104
+ { name: "withdrawalAddress", type: "string" },
58105
+ { name: "quantumTimestamp", type: "uint256" }
58106
+ ]
58107
+ };
58108
+ function borrowerAuthorization712Types(primaryType) {
58109
+ const fields = BORROWER_AUTHORIZATION_712_FIELDS[primaryType];
58110
+ if (!fields) {
58111
+ throw new Error(
58112
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ` + Object.keys(BORROWER_AUTHORIZATION_712_FIELDS).join(", ")
58113
+ );
58114
+ }
58115
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
58116
+ }
58117
+ function buildBorrowerAuthorization712Domain(chainId) {
58118
+ if (!Number.isInteger(chainId) || chainId <= 0) {
58119
+ throw new Error(
58120
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
58121
+ );
58122
+ }
58123
+ const deployment = Object.values(ALL_DEPLOYMENTS).find(
58124
+ (d) => d.chainId === chainId
58125
+ );
58126
+ const verifyingContract = deployment?.contracts?.LoanOperationsManagerModule;
58127
+ if (!verifyingContract) {
58128
+ throw new Error(
58129
+ `No LoanOperationsManagerModule deployment known for chainId ${chainId}; refusing to build a borrower authorization domain without one`
58130
+ );
58131
+ }
58132
+ return {
58133
+ name: BORROWER_AUTHORIZATION_712_DOMAIN_NAME,
58134
+ version: BORROWER_AUTHORIZATION_712_DOMAIN_VERSION,
58135
+ chainId,
58136
+ verifyingContract
58137
+ };
58138
+ }
58139
+ async function signBorrowerAuthorization712(signer, primaryType, chainId, message) {
58140
+ const signTypedData = signer.signTypedData;
58141
+ if (typeof signTypedData !== "function") {
58142
+ throw new Error(
58143
+ `Signer has no signTypedData \u2014 cannot produce an EIP-712 ${primaryType}. Wallets without typed-data support must supply the signature via an authorizationProvider instead of a connected signer.`
58144
+ );
58145
+ }
58146
+ return signTypedData.call(
58147
+ signer,
58148
+ buildBorrowerAuthorization712Domain(chainId),
58149
+ borrowerAuthorization712Types(primaryType),
58150
+ message
58151
+ );
58152
+ }
57041
58153
  var PKP_NFT_ABI = [
57042
58154
  "function getPubkey(uint256 tokenId) external view returns (bytes memory)"
57043
58155
  ];
@@ -57050,29 +58162,11 @@ async function generateMintAuthorization(positionId, amount, chainId, signerOrPr
57050
58162
  const signer = signerOrPrecomputed;
57051
58163
  const timestamp = calculateNextQuantumTimestamp();
57052
58164
  const action = "mint-ucd";
57053
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
57054
- const types = [
57055
- "bytes32",
57056
- // positionId
57057
- "uint256",
57058
- // timestamp
57059
- "uint256",
57060
- // chainId
57061
- "uint256",
57062
- // amount
57063
- "bytes32"
57064
- // actionHash
57065
- ];
57066
- const values = [
58165
+ const signature = await signBorrowerAuthorization712(signer, "MintRequest", chainId, {
57067
58166
  positionId,
57068
- timestamp,
57069
- chainId,
57070
- amount.toString(),
57071
- actionHash
57072
- ];
57073
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
57074
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
57075
- const signature = await signer.signMessage(messageHashBytes);
58167
+ mintAmount: amount.toString(),
58168
+ quantumTimestamp: timestamp
58169
+ });
57076
58170
  return {
57077
58171
  positionId,
57078
58172
  timestamp,
@@ -57109,44 +58203,17 @@ async function generatePaymentAuthorization(positionId, amount, chainId, signerO
57109
58203
  throw new Error(`timestamp must be a number, got ${typeof timestamp}`);
57110
58204
  }
57111
58205
  const action = "make-payment";
57112
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
57113
- if (typeof actionHash !== "string") {
57114
- throw new Error(`actionHash must be a string, got ${typeof actionHash}`);
57115
- }
57116
- const types = [
57117
- "bytes32",
57118
- // positionId
57119
- "uint256",
57120
- // timestamp
57121
- "uint256",
57122
- // chainId
57123
- "uint256",
57124
- // amount
57125
- "bytes32"
57126
- // actionHash
57127
- ];
57128
58206
  const amountStr = amount.toString();
57129
- if (typeof amountStr !== "string") {
57130
- throw new Error(
57131
- `amount.toString() must return a string, got ${typeof amountStr}`
57132
- );
57133
- }
57134
- const values = [positionId, timestamp, chainId, amountStr, actionHash];
57135
- for (let i = 0; i < values.length; i++) {
57136
- if (typeof values[i] === "object" && values[i] !== null) {
57137
- throw new Error(
57138
- `Value at index ${i} is an object: ${JSON.stringify(values[i])}`
57139
- );
57140
- }
57141
- }
57142
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
57143
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
57144
- const signature = await signer.signMessage(messageHashBytes);
58207
+ const signature = await signBorrowerAuthorization712(signer, "RepayRequest", chainId, {
58208
+ positionId,
58209
+ paymentAmount: amountStr,
58210
+ quantumTimestamp: timestamp
58211
+ });
57145
58212
  return {
57146
58213
  positionId,
57147
58214
  timestamp,
57148
58215
  chainId,
57149
- amount: amount.toString(),
58216
+ amount: amountStr,
57150
58217
  action,
57151
58218
  signature
57152
58219
  };
@@ -57233,32 +58300,12 @@ async function generateWithdrawAuthorization(positionId, amount, chainId, signer
57233
58300
  const signer = signerOrPrecomputed;
57234
58301
  const timestamp = calculateNextQuantumTimestamp();
57235
58302
  const action = "withdraw-btc";
57236
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
57237
- const types = [
57238
- "bytes32",
57239
- // positionId
57240
- "uint256",
57241
- // timestamp
57242
- "uint256",
57243
- // chainId
57244
- "uint256",
57245
- // amount (in satoshis)
57246
- "string",
57247
- // destinationAddress (Bitcoin address)
57248
- "bytes32"
57249
- // actionHash
57250
- ];
57251
- const values = [
58303
+ const signature = await signBorrowerAuthorization712(signer, "WithdrawRequest", chainId, {
57252
58304
  positionId,
57253
- timestamp,
57254
- chainId,
57255
- amount.toString(),
57256
- destinationAddress,
57257
- actionHash
57258
- ];
57259
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
57260
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
57261
- const signature = await signer.signMessage(messageHashBytes);
58305
+ totalDeduction: amount.toString(),
58306
+ withdrawalAddress: destinationAddress,
58307
+ quantumTimestamp: timestamp
58308
+ });
57262
58309
  return {
57263
58310
  positionId,
57264
58311
  timestamp,
@@ -57307,29 +58354,11 @@ async function generateExtendAuthorization(positionId, newTerm, chainId, signerO
57307
58354
  const signer = signerOrPrecomputed;
57308
58355
  const timestamp = calculateNextQuantumTimestamp();
57309
58356
  const action = "extend-position";
57310
- const actionHash = (0, import_ethers17.keccak256)((0, import_ethers17.toUtf8Bytes)(action));
57311
- const types = [
57312
- "bytes32",
57313
- // positionId
57314
- "uint256",
57315
- // timestamp
57316
- "uint256",
57317
- // chainId
57318
- "uint256",
57319
- // newTerm (extension term in months)
57320
- "bytes32"
57321
- // actionHash
57322
- ];
57323
- const values = [
58357
+ const signature = await signBorrowerAuthorization712(signer, "RenewRequest", chainId, {
57324
58358
  positionId,
57325
- timestamp,
57326
- chainId,
57327
- newTerm,
57328
- actionHash
57329
- ];
57330
- const messageHash = (0, import_ethers17.solidityPackedKeccak256)(types, values);
57331
- const messageHashBytes = (0, import_ethers17.getBytes)(messageHash);
57332
- const signature = await signer.signMessage(messageHashBytes);
58359
+ selectedTerm: newTerm,
58360
+ quantumTimestamp: timestamp
58361
+ });
57333
58362
  return {
57334
58363
  positionId,
57335
58364
  timestamp,
@@ -57564,6 +58593,7 @@ var ServerSession = class {
57564
58593
  store;
57565
58594
  onSignaturePrompt;
57566
58595
  onSignatureResolved;
58596
+ onSessionRestored;
57567
58597
  now;
57568
58598
  fetchImpl;
57569
58599
  cached = null;
@@ -57604,6 +58634,7 @@ var ServerSession = class {
57604
58634
  this.store = opts.persistSession === false ? null : opts.sessionStore ?? createDefaultSessionStore();
57605
58635
  this.onSignaturePrompt = opts.onSignaturePrompt;
57606
58636
  this.onSignatureResolved = opts.onSignatureResolved;
58637
+ this.onSessionRestored = opts.onSessionRestored;
57607
58638
  this.now = opts.now ?? (() => Math.floor(Date.now() / 1e3));
57608
58639
  this.fetchImpl = opts.fetchImpl ?? ((...a) => fetch(...a));
57609
58640
  }
@@ -57684,7 +58715,7 @@ var ServerSession = class {
57684
58715
  */
57685
58716
  async logout() {
57686
58717
  const cached = this.cached;
57687
- const token = cached && cached.expiresAt > this.now() ? cached.token : await this.getValidToken({ silent: true }).catch(() => null);
58718
+ const token = cached && cached.expiresAt > this.now() ? cached.token : await this.tryResolveSilently(this.generation, false).then((session) => session?.token ?? null).catch(() => null);
57688
58719
  await this.clearPersisted();
57689
58720
  if (!token)
57690
58721
  return;
@@ -57756,8 +58787,9 @@ var ServerSession = class {
57756
58787
  *
57757
58788
  * `gen` is the caller's clear-generation snapshot: writes to `this.cached`
57758
58789
  * and the store are skipped if a `clearPersisted()` landed meanwhile.
58790
+ * `announce` gates `onSessionRestored` for the two persisted-store outcomes.
57759
58791
  */
57760
- async tryResolveSilently(gen) {
58792
+ async tryResolveSilently(gen, announce = true) {
57761
58793
  const nowSec = this.now();
57762
58794
  if (this.cached && this.cached.expiresAt - REFRESH_LEEWAY_SECONDS > nowSec) {
57763
58795
  return this.cached;
@@ -57772,6 +58804,8 @@ var ServerSession = class {
57772
58804
  };
57773
58805
  if (gen === this.generation)
57774
58806
  this.cached = adopted;
58807
+ if (announce)
58808
+ this.onSessionRestored?.();
57775
58809
  return adopted;
57776
58810
  }
57777
58811
  try {
@@ -57780,6 +58814,8 @@ var ServerSession = class {
57780
58814
  this.persist(persisted.payload, session);
57781
58815
  this.cached = session;
57782
58816
  }
58817
+ if (announce)
58818
+ this.onSessionRestored?.();
57783
58819
  return session;
57784
58820
  } catch (error) {
57785
58821
  if (!isLoginRejection(error))
@@ -60865,6 +61901,10 @@ function normalizePkpId(pkpId) {
60865
61901
  }
60866
61902
  return pkpId;
60867
61903
  }
61904
+ function isNormalizedChipotlePkpId(pkpId) {
61905
+ const rawId = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
61906
+ return rawId.length === 40;
61907
+ }
60868
61908
  function padPkpIdForSubgraph(pkpId) {
60869
61909
  const raw = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
60870
61910
  if (raw.length === 40) {
@@ -61149,7 +62189,7 @@ var LoanQuery = class {
61149
62189
  batch.map(async (loan) => {
61150
62190
  try {
61151
62191
  const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
61152
- const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
62192
+ const isChipotlePkpId2 = typeof rawId === "string" && isNormalizedChipotlePkpId(rawId);
61153
62193
  if (isChipotlePkpId2) {
61154
62194
  if (this.config.positionManagerCoreAddress && this.config.provider) {
61155
62195
  const pmContract = new import_ethers26.Contract(
@@ -61476,6 +62516,7 @@ function createLoanQuery(config) {
61476
62516
  );
61477
62517
  }
61478
62518
  }
62519
+ var STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS = 5e3;
61479
62520
  var WithdrawalAddressModule = class {
61480
62521
  config;
61481
62522
  graphClient;
@@ -61521,13 +62562,17 @@ var WithdrawalAddressModule = class {
61521
62562
  const reg = this.getRegistry();
61522
62563
  if (!reg.success)
61523
62564
  return reg;
62565
+ const normalized = normalizeBitcoinAddress(btcAddress2);
61524
62566
  try {
61525
- const tx2 = await reg.value.addAddress(
61526
- normalizeBitcoinAddress(btcAddress2)
61527
- );
62567
+ const tx2 = await reg.value.addAddress(normalized);
61528
62568
  return success(tx2);
61529
62569
  } catch (error) {
61530
- return this.txFailure("addAddress", error, btcAddress2);
62570
+ return this.txFailure(
62571
+ "addAddress",
62572
+ error,
62573
+ btcAddress2,
62574
+ await this.staticCallDiagnostic(reg.value, "addAddress", normalized)
62575
+ );
61531
62576
  }
61532
62577
  }
61533
62578
  /** Remove a Bitcoin address from the caller's allowlist (effective immediately). */
@@ -61535,13 +62580,17 @@ var WithdrawalAddressModule = class {
61535
62580
  const reg = this.getRegistry();
61536
62581
  if (!reg.success)
61537
62582
  return reg;
62583
+ const normalized = normalizeBitcoinAddress(btcAddress2);
61538
62584
  try {
61539
- const tx2 = await reg.value.removeAddress(
61540
- normalizeBitcoinAddress(btcAddress2)
61541
- );
62585
+ const tx2 = await reg.value.removeAddress(normalized);
61542
62586
  return success(tx2);
61543
62587
  } catch (error) {
61544
- return this.txFailure("removeAddress", error, btcAddress2);
62588
+ return this.txFailure(
62589
+ "removeAddress",
62590
+ error,
62591
+ btcAddress2,
62592
+ await this.staticCallDiagnostic(reg.value, "removeAddress", normalized)
62593
+ );
61545
62594
  }
61546
62595
  }
61547
62596
  /**
@@ -61637,16 +62686,59 @@ var WithdrawalAddressModule = class {
61637
62686
  }
61638
62687
  return success(void 0);
61639
62688
  }
61640
- txFailure(op, error, context) {
62689
+ /**
62690
+ * Ask the node for the reason a failed write did not carry.
62691
+ *
62692
+ * A failing `eth_estimateGas` frequently answers with NOTHING to decode — ethers renders that
62693
+ * as `missing revert data ... data=null, reason=null, revert=null`, which names no cause and
62694
+ * cannot distinguish "the contract rejected this" from "the RPC hiccuped". An `eth_call` of the
62695
+ * same calldata usually does carry the revert reason or custom-error selector, so this runs one
62696
+ * and folds the answer into the reported error.
62697
+ *
62698
+ * Three deliberate properties:
62699
+ *
62700
+ * 1. It runs ONLY after the write has already failed. Gating the write on a static call would
62701
+ * let a flaky endpoint — precisely the condition this exists to diagnose — block an add that
62702
+ * would otherwise have succeeded.
62703
+ * 2. It costs NO extra signature. `staticCall` is `eth_call`: a node read, never a wallet prompt.
62704
+ * 3. It can never throw. A diagnostic that escapes would replace the real cause with itself.
62705
+ * (The `try/catch` here is the authorized exception to CLAUDE.md's forbidden-patterns rule;
62706
+ * it swallows nothing — every branch returns text that is reported alongside the original.)
62707
+ *
62708
+ * A static call that SUCCEEDS is itself a finding: the contract accepts this call, so the
62709
+ * failure lay outside contract logic (RPC, gas, or nonce).
62710
+ */
62711
+ async staticCallDiagnostic(registry, op, normalizedAddress) {
62712
+ try {
62713
+ await Promise.race([
62714
+ registry[op].staticCall(normalizedAddress),
62715
+ // The failure being diagnosed is often an unresponsive endpoint, so the diagnostic must
62716
+ // not inherit that hang — the user is waiting on this error message.
62717
+ new Promise(
62718
+ (_, reject) => setTimeout(
62719
+ () => reject(new Error("static call timed out after 5s")),
62720
+ STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS
62721
+ )
62722
+ )
62723
+ ]);
62724
+ return "static call SUCCEEDED \u2014 the contract accepts this call, so the failure was not contract logic (RPC, gas, or nonce)";
62725
+ } catch (diagnostic) {
62726
+ const code = typeof diagnostic === "object" && diagnostic !== null ? diagnostic.code : void 0;
62727
+ const msg = diagnostic instanceof Error ? diagnostic.message : String(diagnostic);
62728
+ return typeof code === "string" ? `static call reverted [${code}]: ${msg}` : `static call failed: ${msg}`;
62729
+ }
62730
+ }
62731
+ txFailure(op, error, context, diagnostic) {
61641
62732
  const msg = error instanceof Error ? error.message : String(error);
62733
+ const detail = diagnostic ? `${msg} \u2014 ${diagnostic}` : msg;
61642
62734
  return failure(
61643
62735
  new SDKError({
61644
62736
  code: `SDK_WITHDRAWAL_REGISTRY_${op.toUpperCase()}_FAILED`,
61645
- message: `WithdrawalAddressRegistry.${op} failed: ${msg}`,
62737
+ message: `WithdrawalAddressRegistry.${op} failed: ${detail}`,
61646
62738
  category: "CONTRACT",
61647
62739
  severity: "MEDIUM",
61648
62740
  originalError: error instanceof Error ? error : new Error(String(error)),
61649
- context: { op, context }
62741
+ context: { op, context, diagnostic }
61650
62742
  })
61651
62743
  );
61652
62744
  }
@@ -62724,6 +63816,47 @@ function normalizePkpId2(pkpId) {
62724
63816
  }
62725
63817
  return pkpId;
62726
63818
  }
63819
+ function applyLoanEventsFilter(events, opts) {
63820
+ const { wantsEvent, fromTimestamp, toTimestamp, fromBlock, toBlock, limit } = opts;
63821
+ const inBounds = (e) => {
63822
+ const ts = e?.timestamp;
63823
+ const bn = e?.blockNumber;
63824
+ try {
63825
+ if (fromTimestamp !== void 0 && ts !== void 0 && BigInt(ts) < BigInt(fromTimestamp))
63826
+ return false;
63827
+ if (toTimestamp !== void 0 && ts !== void 0 && BigInt(ts) > BigInt(toTimestamp))
63828
+ return false;
63829
+ if (fromBlock !== void 0 && bn !== void 0 && BigInt(bn) < BigInt(fromBlock))
63830
+ return false;
63831
+ if (toBlock !== void 0 && bn !== void 0 && BigInt(bn) > BigInt(toBlock))
63832
+ return false;
63833
+ } catch {
63834
+ return true;
63835
+ }
63836
+ return true;
63837
+ };
63838
+ const narrow = (list, kind) => wantsEvent(kind) ? (list ?? []).filter(inBounds).slice(0, limit) : [];
63839
+ const single = (value, kind) => value && wantsEvent(kind) && inBounds(value) ? value : void 0;
63840
+ const filtered = {
63841
+ ...events,
63842
+ positionCreated: single(events.positionCreated, "positionCreated"),
63843
+ payments: narrow(events.payments, "payment"),
63844
+ statusUpdates: narrow(events.statusUpdates, "status"),
63845
+ liquidation: single(events.liquidation, "liquidation"),
63846
+ mints: narrow(events.mints, "mint"),
63847
+ withdrawals: narrow(events.withdrawals, "withdrawal"),
63848
+ renewals: narrow(events.renewals, "renewal"),
63849
+ operationFailures: narrow(events.operationFailures, "operationFailure"),
63850
+ mintRequests: narrow(events.mintRequests, "mintRequest"),
63851
+ burnRequests: narrow(events.burnRequests, "burnRequest"),
63852
+ collateralEvents: narrow(events.collateralEvents, "collateralEvent"),
63853
+ mintingFees: narrow(events.mintingFees, "mintingFee"),
63854
+ renewalFees: narrow(events.renewalFees, "renewalFee"),
63855
+ totalEvents: 0
63856
+ };
63857
+ filtered.totalEvents = (filtered.positionCreated ? 1 : 0) + (filtered.liquidation ? 1 : 0) + filtered.payments.length + filtered.statusUpdates.length + filtered.mints.length + filtered.withdrawals.length + filtered.renewals.length + filtered.operationFailures.length + filtered.mintRequests.length + filtered.burnRequests.length + filtered.collateralEvents.length + filtered.mintingFees.length + filtered.renewalFees.length;
63858
+ return filtered;
63859
+ }
62727
63860
  function hasLoanEventsFilter(filter2) {
62728
63861
  if (!filter2)
62729
63862
  return false;
@@ -63880,32 +65013,24 @@ var DiamondHandsGraph = class {
63880
65013
  limit = 1e3,
63881
65014
  orderDirection = "desc"
63882
65015
  } = filter2 || {};
65016
+ const wantsEvent = (kind) => !eventTypes || eventTypes.includes(kind);
65017
+ const hasBounds = fromTimestamp !== void 0 || toTimestamp !== void 0 || fromBlock !== void 0 || toBlock !== void 0;
65018
+ const pageSize = hasBounds ? THE_GRAPH_MAX_BATCH_SIZE : limit;
65019
+ const buildPositionWhereClause = () => `where: { position: "${positionId.toLowerCase()}" }`;
63883
65020
  const shouldQuery = {
63884
- positionCreated: !eventTypes || eventTypes.includes("positionCreated"),
63885
- payment: !eventTypes || eventTypes.includes("payment"),
63886
- status: !eventTypes || eventTypes.includes("status"),
63887
- liquidation: !eventTypes || eventTypes.includes("liquidation"),
63888
- mint: !eventTypes || eventTypes.includes("mint"),
63889
- withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
63890
- renewal: !eventTypes || eventTypes.includes("renewal"),
63891
- operationFailure: !eventTypes || eventTypes.includes("operationFailure"),
63892
- mintRequest: !eventTypes || eventTypes.includes("mintRequest"),
63893
- burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
63894
- collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
63895
- mintingFee: !eventTypes || eventTypes.includes("mintingFee"),
63896
- renewalFee: !eventTypes || eventTypes.includes("renewalFee")
63897
- };
63898
- const buildPositionWhereClause = () => {
63899
- const conditions = [`position: "${positionId.toLowerCase()}"`];
63900
- if (fromTimestamp)
63901
- conditions.push(`timestamp_gte: "${fromTimestamp}"`);
63902
- if (toTimestamp)
63903
- conditions.push(`timestamp_lte: "${toTimestamp}"`);
63904
- if (fromBlock)
63905
- conditions.push(`blockNumber_gte: "${fromBlock}"`);
63906
- if (toBlock)
63907
- conditions.push(`blockNumber_lte: "${toBlock}"`);
63908
- return `where: { ${conditions.join(", ")} }`;
65021
+ positionCreated: true,
65022
+ payment: true,
65023
+ status: true,
65024
+ liquidation: true,
65025
+ mint: true,
65026
+ withdrawal: true,
65027
+ renewal: true,
65028
+ operationFailure: true,
65029
+ mintRequest: true,
65030
+ burnRequest: true,
65031
+ collateralEvent: true,
65032
+ mintingFee: true,
65033
+ renewalFee: true
63909
65034
  };
63910
65035
  const query = `
63911
65036
  query GetLoanEvents($positionId: Bytes!, $limit: Int!, $orderDirection: OrderDirection!) {
@@ -64141,11 +65266,41 @@ var DiamondHandsGraph = class {
64141
65266
  `;
64142
65267
  const variables = {
64143
65268
  positionId: positionId.toLowerCase(),
64144
- limit,
65269
+ limit: pageSize,
64145
65270
  orderDirection
64146
65271
  };
64147
65272
  const result = await this.client.execute(query, variables);
64148
- return this.assembleLoanEvents(positionId, result);
65273
+ if (hasBounds) {
65274
+ const collections = [
65275
+ ["payments", result.position?.payments],
65276
+ ["statusUpdates", result.position?.statusUpdates],
65277
+ ["withdrawals", result.position?.withdrawals],
65278
+ ["renewals", result.position?.renewals],
65279
+ ["operationFailures", result.position?.operationFailures],
65280
+ ["mintRequests", result.position?.mintRequests],
65281
+ ["burnRequests", result.position?.burnRequests],
65282
+ ["mintingFees", result.position?.mintingFees],
65283
+ ["renewalFees", result.position?.renewalFees],
65284
+ ["mints", result.ucdmintEvents],
65285
+ ["collateralEvents", result.collateralEvents]
65286
+ ];
65287
+ const saturated = collections.filter(([, list]) => (list?.length ?? 0) >= pageSize).map(([name]) => name);
65288
+ if (saturated.length > 0) {
65289
+ log.warn(
65290
+ "[DiamondHandsGraph] bounded getLoanEvents page saturated \u2014 the filtered history may be incomplete",
65291
+ { positionId, pageSize, saturated }
65292
+ );
65293
+ }
65294
+ }
65295
+ const assembled = this.assembleLoanEvents(positionId, result);
65296
+ return applyLoanEventsFilter(assembled, {
65297
+ wantsEvent,
65298
+ fromTimestamp,
65299
+ toTimestamp,
65300
+ fromBlock,
65301
+ toBlock,
65302
+ limit
65303
+ });
64149
65304
  }
64150
65305
  /**
64151
65306
  * Map one position's raw event payload into `LoanEvents`.
@@ -69948,7 +71103,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
69948
71103
  persistSession: config.sessionPersistence?.enabled,
69949
71104
  sessionStore: config.sessionPersistence?.store,
69950
71105
  onSignaturePrompt: config.onSessionSignaturePrompt,
69951
- onSignatureResolved: config.onSessionSignatureResolved
71106
+ onSignatureResolved: config.onSessionSignatureResolved,
71107
+ onSessionRestored: config.onSessionRestored
69952
71108
  });
69953
71109
  }
69954
71110
  const contractManagerResult = createContractManager({
@@ -71543,6 +72699,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
71543
72699
  }
71544
72700
  const tx2 = await sendEip1559Transaction({
71545
72701
  signer,
72702
+ feeProvider: this.getProviderOrThrow(),
71546
72703
  to: positionManagerAddress,
71547
72704
  data: mintCalldata,
71548
72705
  gasLimit: MINT_UCD_GAS_CEILING
@@ -72769,6 +73926,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
72769
73926
  }
72770
73927
  const tx2 = await sendEip1559Transaction({
72771
73928
  signer: extendSigner,
73929
+ feeProvider: this.getProviderOrThrow(),
72772
73930
  to: extendTo,
72773
73931
  data: extendCalldata,
72774
73932
  gasLimit: EXTEND_POSITION_GAS_CEILING
@@ -73703,6 +74861,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
73703
74861
  }
73704
74862
  const tx2 = await sendEip1559Transaction({
73705
74863
  signer: paymentSigner,
74864
+ feeProvider: this.getProviderOrThrow(),
73706
74865
  to: paymentContractAddress,
73707
74866
  data: paymentCalldata,
73708
74867
  gasLimit: MAKE_PAYMENT_GAS_CEILING
@@ -74468,6 +75627,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
74468
75627
  });
74469
75628
  tx2 = await sendEip1559Transaction({
74470
75629
  signer: withdrawSigner,
75630
+ feeProvider: this.getProviderOrThrow(),
74471
75631
  to: positionManagerAddress,
74472
75632
  data: withdrawCalldata,
74473
75633
  gasLimit: WITHDRAW_BTC_GAS_CEILING
@@ -83617,7 +84777,7 @@ mime-types/index.js:
83617
84777
  *)
83618
84778
 
83619
84779
  axios/dist/node/axios.cjs:
83620
- (*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
84780
+ (*! Axios v1.20.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
83621
84781
 
83622
84782
  safe-buffer/index.js:
83623
84783
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)