@gvnrdao/dh-mcp 0.5.6 → 0.5.7

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.
@@ -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";
@@ -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);
@@ -45673,22 +46152,82 @@ var { toString } = Object.prototype;
45673
46152
  var { getPrototypeOf } = Object;
45674
46153
  var { iterator, toStringTag } = Symbol;
45675
46154
  var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
46155
+ var isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
46156
+ var isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
46157
+ var isSafeAndFullyMutable = (obj) => {
46158
+ if (!Object.isExtensible(obj)) {
46159
+ return false;
46160
+ }
46161
+ const props = Object.getOwnPropertyNames(obj);
46162
+ if (Object.getOwnPropertySymbols) {
46163
+ props.push(...Object.getOwnPropertySymbols(obj));
46164
+ }
46165
+ return props.every((prop) => {
46166
+ if (isUnsafeObjectKey(prop)) {
46167
+ return false;
46168
+ }
46169
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
46170
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
46171
+ });
46172
+ };
45676
46173
  var hasOwnInPrototypeChain = (thing, prop) => {
45677
46174
  let obj = thing;
45678
46175
  const seen = [];
45679
- while (obj != null && obj !== Object.prototype) {
46176
+ while (obj != null) {
45680
46177
  if (seen.indexOf(obj) !== -1) {
45681
46178
  return false;
45682
46179
  }
45683
46180
  seen.push(obj);
46181
+ const prototype2 = getPrototypeOf(obj);
46182
+ if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
46183
+ return false;
46184
+ }
45684
46185
  if (hasOwnProperty(obj, prop)) {
45685
46186
  return true;
45686
46187
  }
45687
- obj = getPrototypeOf(obj);
46188
+ obj = prototype2;
45688
46189
  }
45689
46190
  return false;
45690
46191
  };
45691
46192
  var getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
46193
+ var toSafeFlatObject = (thing) => {
46194
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
46195
+ return thing;
46196
+ }
46197
+ const sourcePrototype = getPrototypeOf(thing);
46198
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
46199
+ return thing;
46200
+ }
46201
+ const result = /* @__PURE__ */ Object.create(null);
46202
+ const merged = /* @__PURE__ */ Object.create(null);
46203
+ const seen = [];
46204
+ let current = thing;
46205
+ while (current != null) {
46206
+ if (seen.indexOf(current) !== -1) {
46207
+ break;
46208
+ }
46209
+ seen.push(current);
46210
+ const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
46211
+ if (isPrototypeBoundary(current, prototype2, current === thing)) {
46212
+ break;
46213
+ }
46214
+ const props = Object.getOwnPropertyNames(current);
46215
+ if (Object.getOwnPropertySymbols) {
46216
+ props.push(...Object.getOwnPropertySymbols(current));
46217
+ }
46218
+ for (const prop of props) {
46219
+ if (isUnsafeObjectKey(prop)) {
46220
+ continue;
46221
+ }
46222
+ if (!hasOwnProperty(merged, prop)) {
46223
+ result[prop] = thing[prop];
46224
+ merged[prop] = true;
46225
+ }
46226
+ }
46227
+ current = prototype2;
46228
+ }
46229
+ return result;
46230
+ };
45692
46231
  var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
45693
46232
  const str = toString.call(thing);
45694
46233
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -45723,9 +46262,9 @@ var isPlainObject = (val) => {
45723
46262
  return false;
45724
46263
  }
45725
46264
  const prototype2 = getPrototypeOf(val);
45726
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
45727
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
45728
- // than a plain object, while ignoring keys injected onto Object.prototype.
46265
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
46266
+ // evidence the value is tagged/iterable, while ignoring members reachable
46267
+ // only through shared or terminal prototype boundaries.
45729
46268
  !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
45730
46269
  };
45731
46270
  var isEmptyObject = (val) => {
@@ -46136,6 +46675,7 @@ var utils_default = {
46136
46675
  // an alias to avoid ESLint no-prototype-builtins detection
46137
46676
  hasOwnInPrototypeChain,
46138
46677
  getSafeProp,
46678
+ toSafeFlatObject,
46139
46679
  reduceDescriptors,
46140
46680
  freezeMethods,
46141
46681
  toObjectSet,
@@ -46774,24 +47314,16 @@ function toFormData(obj, formData, options) {
46774
47314
  throw new TypeError("target must be an object");
46775
47315
  }
46776
47316
  formData = formData || new (FormData_default || FormData)();
46777
- options = utils_default.toFlatObject(
46778
- options,
46779
- {
46780
- metaTokens: true,
46781
- dots: false,
46782
- indexes: false
46783
- },
46784
- false,
46785
- function defined(option, source) {
46786
- return !utils_default.isUndefined(source[option]);
46787
- }
46788
- );
46789
- const metaTokens = options.metaTokens;
46790
- const visitor = options.visitor || defaultVisitor;
46791
- const dots = options.dots;
46792
- const indexes = options.indexes;
46793
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
46794
- const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
47317
+ const option = (name, fallback) => {
47318
+ const value = utils_default.getSafeProp(options, name);
47319
+ return utils_default.isUndefined(value) ? fallback : value;
47320
+ };
47321
+ const metaTokens = option("metaTokens", true);
47322
+ const visitor = option("visitor") || defaultVisitor;
47323
+ const dots = option("dots", false);
47324
+ const indexes = option("indexes", false);
47325
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
47326
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
46795
47327
  const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
46796
47328
  const stack = [];
46797
47329
  if (!utils_default.isFunction(visitor)) {
@@ -46815,7 +47347,10 @@ function toFormData(obj, formData, options) {
46815
47347
  if (Buffer_default && Buffer_default.isBufferAvailable()) {
46816
47348
  return Buffer_default.from(value);
46817
47349
  }
46818
- throw new AxiosError_default("Blob is not supported. Use a Buffer instead.", AxiosError_default.ERR_NOT_SUPPORT);
47350
+ throw new AxiosError_default(
47351
+ "Blob is not supported. Use a Buffer instead.",
47352
+ AxiosError_default.ERR_NOT_SUPPORT
47353
+ );
46819
47354
  }
46820
47355
  return value;
46821
47356
  }
@@ -46961,9 +47496,47 @@ function buildURL(url2, params, options) {
46961
47496
  }
46962
47497
 
46963
47498
  // node_modules/axios/lib/core/InterceptorManager.js
47499
+ var $internals2 = Symbol("internals");
47500
+ function countHandlers(handlers) {
47501
+ return handlers ? handlers.length : 0;
47502
+ }
47503
+ function trimHandlers(handlers) {
47504
+ if (!handlers) {
47505
+ return;
47506
+ }
47507
+ while (handlers.length && handlers[handlers.length - 1] === null) {
47508
+ handlers.pop();
47509
+ }
47510
+ }
47511
+ function syncHandlerEntries(manager, internals) {
47512
+ const handlers = manager.handlers;
47513
+ const length = countHandlers(handlers);
47514
+ if (handlers !== internals.handlersRef) {
47515
+ internals.handlersRef = handlers;
47516
+ internals.handlerEntries.clear();
47517
+ } else if (length !== internals.handlersLength) {
47518
+ if (!length) {
47519
+ internals.handlerEntries.clear();
47520
+ } else {
47521
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
47522
+ if (handlers[entry.index] !== entry.handler) {
47523
+ internals.handlerEntries.delete(id);
47524
+ }
47525
+ });
47526
+ }
47527
+ }
47528
+ internals.handlersLength = length;
47529
+ }
46964
47530
  var InterceptorManager = class {
46965
47531
  constructor() {
46966
47532
  this.handlers = [];
47533
+ this[$internals2] = {
47534
+ handlersRef: this.handlers,
47535
+ handlersLength: this.handlers.length,
47536
+ handlerEntries: /* @__PURE__ */ new Map(),
47537
+ iterationDepth: 0,
47538
+ nextId: 0
47539
+ };
46967
47540
  }
46968
47541
  /**
46969
47542
  * Add a new interceptor to the stack
@@ -46975,13 +47548,25 @@ var InterceptorManager = class {
46975
47548
  * @return {Number} An ID used to remove interceptor later
46976
47549
  */
46977
47550
  use(fulfilled, rejected, options) {
46978
- this.handlers.push({
47551
+ const handler = {
46979
47552
  fulfilled,
46980
47553
  rejected,
46981
47554
  synchronous: options ? options.synchronous : false,
46982
47555
  runWhen: options ? options.runWhen : null
47556
+ };
47557
+ const internals = this[$internals2];
47558
+ if (this.handlers == null) {
47559
+ this.handlers = [];
47560
+ }
47561
+ syncHandlerEntries(this, internals);
47562
+ const id = internals.nextId++;
47563
+ this.handlers.push(handler);
47564
+ internals.handlerEntries.set(id, {
47565
+ handler,
47566
+ index: this.handlers.length - 1
46983
47567
  });
46984
- return this.handlers.length - 1;
47568
+ internals.handlersLength = this.handlers.length;
47569
+ return id;
46985
47570
  }
46986
47571
  /**
46987
47572
  * Remove an interceptor from the stack
@@ -46991,8 +47576,19 @@ var InterceptorManager = class {
46991
47576
  * @returns {void}
46992
47577
  */
46993
47578
  eject(id) {
46994
- if (this.handlers[id]) {
46995
- this.handlers[id] = null;
47579
+ const internals = this[$internals2];
47580
+ syncHandlerEntries(this, internals);
47581
+ const entry = internals.handlerEntries.get(id);
47582
+ if (entry) {
47583
+ internals.handlerEntries.delete(id);
47584
+ if (this.handlers[entry.index] !== entry.handler) {
47585
+ return;
47586
+ }
47587
+ this.handlers[entry.index] = null;
47588
+ if (!internals.iterationDepth) {
47589
+ trimHandlers(this.handlers);
47590
+ internals.handlersLength = this.handlers.length;
47591
+ }
46996
47592
  }
46997
47593
  }
46998
47594
  /**
@@ -47003,6 +47599,7 @@ var InterceptorManager = class {
47003
47599
  clear() {
47004
47600
  if (this.handlers) {
47005
47601
  this.handlers = [];
47602
+ syncHandlerEntries(this, this[$internals2]);
47006
47603
  }
47007
47604
  }
47008
47605
  /**
@@ -47016,11 +47613,22 @@ var InterceptorManager = class {
47016
47613
  * @returns {void}
47017
47614
  */
47018
47615
  forEach(fn) {
47019
- utils_default.forEach(this.handlers, function forEachHandler(h) {
47020
- if (h !== null) {
47021
- fn(h);
47616
+ const internals = this[$internals2];
47617
+ syncHandlerEntries(this, internals);
47618
+ internals.iterationDepth++;
47619
+ try {
47620
+ utils_default.forEach(this.handlers, function forEachHandler(h) {
47621
+ if (h !== null) {
47622
+ fn(h);
47623
+ }
47624
+ });
47625
+ } finally {
47626
+ if (!--internals.iterationDepth) {
47627
+ syncHandlerEntries(this, internals);
47628
+ trimHandlers(this.handlers);
47629
+ internals.handlersLength = countHandlers(this.handlers);
47022
47630
  }
47023
- });
47631
+ }
47024
47632
  }
47025
47633
  };
47026
47634
  var InterceptorManager_default = InterceptorManager;
@@ -47178,6 +47786,22 @@ function formDataToJSON(formData) {
47178
47786
  }
47179
47787
  var formDataToJSON_default = formDataToJSON;
47180
47788
 
47789
+ // node_modules/axios/lib/core/methodList.js
47790
+ var methodList = Object.freeze([
47791
+ "get",
47792
+ "delete",
47793
+ "head",
47794
+ "options",
47795
+ "post",
47796
+ "put",
47797
+ "patch",
47798
+ "purge",
47799
+ "link",
47800
+ "unlink",
47801
+ "query"
47802
+ ]);
47803
+ var methodList_default = methodList;
47804
+
47181
47805
  // node_modules/axios/lib/defaults/index.js
47182
47806
  var own = (obj, key) => obj != null && utils_default.hasOwnProp(obj, key) ? obj[key] : void 0;
47183
47807
  function stringifySafely2(rawValue, parser, encoder) {
@@ -47290,7 +47914,7 @@ var defaults = {
47290
47914
  }
47291
47915
  }
47292
47916
  };
47293
- utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
47917
+ utils_default.forEach(methodList_default, (method) => {
47294
47918
  defaults.headers[method] = {};
47295
47919
  });
47296
47920
  var defaults_default = defaults;
@@ -47368,19 +47992,21 @@ function combineURLs(baseURL, relativeURL) {
47368
47992
  return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
47369
47993
  }
47370
47994
 
47371
- // node_modules/axios/lib/core/buildFullPath.js
47372
- var malformedHttpProtocol = /^https?:(?!\/\/)/i;
47373
- var httpProtocolControlCharacters = /[\t\n\r]/g;
47374
- function stripLeadingC0ControlOrSpace(url2) {
47375
- let i = 0;
47376
- while (i < url2.length && url2.charCodeAt(i) <= 32) {
47377
- i++;
47378
- }
47379
- return url2.slice(i);
47380
- }
47995
+ // node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js
47996
+ var urlParserControlCharacters = /[\t\n\r]/g;
47381
47997
  function normalizeURLForProtocolCheck(url2) {
47382
- return stripLeadingC0ControlOrSpace(url2).replace(httpProtocolControlCharacters, "");
47998
+ if (typeof url2 !== "string") {
47999
+ return url2;
48000
+ }
48001
+ let start = 0;
48002
+ while (start < url2.length && url2.charCodeAt(start) <= 32) {
48003
+ start++;
48004
+ }
48005
+ return url2.slice(start).replace(urlParserControlCharacters, "");
47383
48006
  }
48007
+
48008
+ // node_modules/axios/lib/core/buildFullPath.js
48009
+ var malformedHttpProtocol = /^https?:(?!\/\/)/i;
47384
48010
  function redactFragment(fragment) {
47385
48011
  if (!fragment) {
47386
48012
  return fragment;
@@ -47502,7 +48128,7 @@ var import_follow_redirects = __toESM(require_follow_redirects(), 1);
47502
48128
  var import_zlib = __toESM(require("zlib"), 1);
47503
48129
 
47504
48130
  // node_modules/axios/lib/env/data.js
47505
- var VERSION = "1.19.0";
48131
+ var VERSION = "1.20.0";
47506
48132
 
47507
48133
  // node_modules/axios/lib/helpers/parseProtocol.js
47508
48134
  function parseProtocol(url2) {
@@ -47511,7 +48137,7 @@ function parseProtocol(url2) {
47511
48137
  }
47512
48138
 
47513
48139
  // node_modules/axios/lib/helpers/fromDataURI.js
47514
- var DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
48140
+ var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
47515
48141
  function fromDataURI(uri, asBlob, options) {
47516
48142
  const _Blob = options && options.Blob || platform_default.classes.Blob;
47517
48143
  const protocol = parseProtocol(uri);
@@ -47824,6 +48450,7 @@ var Http2Sessions = class {
47824
48450
  }
47825
48451
  getSession(authority, options) {
47826
48452
  options = Object.assign(
48453
+ /* @__PURE__ */ Object.create(null),
47827
48454
  {
47828
48455
  sessionTimeout: 1e3
47829
48456
  },
@@ -47889,6 +48516,7 @@ var Http2Sessions = class {
47889
48516
  };
47890
48517
  }
47891
48518
  session.once("close", removeSession);
48519
+ session.once("error", removeSession);
47892
48520
  let entry = [session, options];
47893
48521
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
47894
48522
  return session;
@@ -47913,6 +48541,13 @@ var callbackify_default = callbackify;
47913
48541
 
47914
48542
  // node_modules/axios/lib/helpers/shouldBypassProxy.js
47915
48543
  var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
48544
+ var trimTrailingDots = (value) => {
48545
+ let end = value.length;
48546
+ while (end && value.charCodeAt(end - 1) === 46) {
48547
+ end--;
48548
+ }
48549
+ return end === value.length ? value : value.slice(0, end);
48550
+ };
47916
48551
  var isIPv4Loopback = (host) => {
47917
48552
  const parts = host.split(".");
47918
48553
  if (parts.length !== 4) return false;
@@ -47945,7 +48580,7 @@ var normalizeIPAddress = (host) => {
47945
48580
  if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
47946
48581
  h = h.slice(1, -1);
47947
48582
  }
47948
- h = h.replace(/\.+$/, "");
48583
+ h = trimTrailingDots(h);
47949
48584
  if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
47950
48585
  const parts = h.split(".");
47951
48586
  if (parts.some((p) => p === "")) return host;
@@ -48057,6 +48692,40 @@ var unmapIPv4MappedIPv6 = (host) => {
48057
48692
  }
48058
48693
  return host;
48059
48694
  };
48695
+ var IPV4_OCTET_RE = /^(?:0|[1-9]\d{0,2})$/;
48696
+ var ipv4ToBytes = (host) => {
48697
+ const parts = host.split(".");
48698
+ return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
48699
+ };
48700
+ var IPV6_GROUP_RE = /^[0-9a-f]{1,4}$/i;
48701
+ var ipv6ToBytes = (host) => {
48702
+ const halves = host.split("::");
48703
+ if (halves.length > 2) {
48704
+ return null;
48705
+ }
48706
+ const groups = halves[0] ? halves[0].split(":") : [];
48707
+ if (halves.length === 2) {
48708
+ const rear = halves[1] ? halves[1].split(":") : [];
48709
+ const missing = 8 - groups.length - rear.length;
48710
+ if (missing < 1) {
48711
+ return null;
48712
+ }
48713
+ groups.push(...new Array(missing).fill("0"), ...rear);
48714
+ }
48715
+ if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE.test(group))) {
48716
+ return null;
48717
+ }
48718
+ return groups.flatMap((group) => {
48719
+ const value = Number.parseInt(group, 16);
48720
+ return [value >> 8 & 255, value & 255];
48721
+ });
48722
+ };
48723
+ var ipToBytes = (host) => {
48724
+ if (typeof host !== "string" || !host) {
48725
+ return null;
48726
+ }
48727
+ return host.indexOf(":") !== -1 ? ipv6ToBytes(host) : ipv4ToBytes(host);
48728
+ };
48060
48729
  var normalizeNoProxyHost = (hostname) => {
48061
48730
  if (!hostname) {
48062
48731
  return hostname;
@@ -48064,13 +48733,90 @@ var normalizeNoProxyHost = (hostname) => {
48064
48733
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
48065
48734
  hostname = hostname.slice(1, -1);
48066
48735
  }
48067
- const trimmed = hostname.replace(/\.+$/, "");
48736
+ const trimmed = trimTrailingDots(hostname);
48068
48737
  const ipv4 = normalizeIPAddress(trimmed);
48069
48738
  if (ipv4 !== trimmed) {
48070
48739
  return ipv4;
48071
48740
  }
48072
48741
  return unmapIPv4MappedIPv6(trimmed);
48073
48742
  };
48743
+ var normalizeCidrBase = (input) => {
48744
+ let base = input;
48745
+ const startsBracket = base.charAt(0) === "[";
48746
+ const endsBracket = base.charAt(base.length - 1) === "]";
48747
+ const hasBracket = base.includes("[") || base.includes("]");
48748
+ if (startsBracket || endsBracket) {
48749
+ if (!startsBracket || !endsBracket) {
48750
+ return null;
48751
+ }
48752
+ base = base.slice(1, -1);
48753
+ if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
48754
+ return null;
48755
+ }
48756
+ } else if (hasBracket) {
48757
+ return null;
48758
+ }
48759
+ if (!base || base.charAt(base.length - 1) === ".") {
48760
+ return null;
48761
+ }
48762
+ const wasIPv6 = base.indexOf(":") !== -1;
48763
+ if (wasIPv6) {
48764
+ try {
48765
+ base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
48766
+ } catch (_err) {
48767
+ return null;
48768
+ }
48769
+ } else {
48770
+ base = normalizeIPAddress(base);
48771
+ if (!ipv4ToBytes(base)) {
48772
+ return null;
48773
+ }
48774
+ }
48775
+ return { normalized: unmapIPv4MappedIPv6(base), wasIPv6 };
48776
+ };
48777
+ var CIDR_ENTRY_RE = /^(.+)\/(0|[1-9]\d{0,2})$/;
48778
+ var parseCidrEntry = (entry) => {
48779
+ if (entry.indexOf("/") === -1) {
48780
+ return void 0;
48781
+ }
48782
+ const match = CIDR_ENTRY_RE.exec(entry);
48783
+ if (!match) {
48784
+ return null;
48785
+ }
48786
+ let prefix = Number(match[2]);
48787
+ const parsedBase = normalizeCidrBase(match[1]);
48788
+ if (!parsedBase) {
48789
+ return null;
48790
+ }
48791
+ const { normalized, wasIPv6 } = parsedBase;
48792
+ if (wasIPv6 && normalized.indexOf(":") === -1) {
48793
+ if (prefix < 96) {
48794
+ return null;
48795
+ }
48796
+ prefix -= 96;
48797
+ }
48798
+ const bytes = ipToBytes(normalized);
48799
+ if (!bytes || prefix > bytes.length * 8) {
48800
+ return null;
48801
+ }
48802
+ return { bytes, prefix };
48803
+ };
48804
+ var isInSubnet = (addressBytes, networkBytes, prefix) => {
48805
+ const fullBytes = prefix >> 3;
48806
+ for (let i = 0; i < fullBytes; i++) {
48807
+ if (addressBytes[i] !== networkBytes[i]) {
48808
+ return false;
48809
+ }
48810
+ }
48811
+ const remainingBits = prefix & 7;
48812
+ if (remainingBits) {
48813
+ const mask = 255 << 8 - remainingBits & 255;
48814
+ if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
48815
+ return false;
48816
+ }
48817
+ }
48818
+ return true;
48819
+ };
48074
48820
  function shouldBypassProxy(location) {
48075
48821
  let parsed;
48076
48822
  try {
@@ -48087,6 +48833,7 @@ function shouldBypassProxy(location) {
48087
48833
  }
48088
48834
  const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS2[parsed.protocol.split(":", 1)[0]] || 0;
48089
48835
  const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
48836
+ const hostnameBytes = ipToBytes(hostname);
48090
48837
  return noProxy.split(/[\s,]+/).some((entry) => {
48091
48838
  if (!entry) {
48092
48839
  return false;
@@ -48094,6 +48841,10 @@ function shouldBypassProxy(location) {
48094
48841
  if (entry === "*") {
48095
48842
  return true;
48096
48843
  }
48844
+ const cidr = parseCidrEntry(entry);
48845
+ if (cidr !== void 0) {
48846
+ return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet(hostnameBytes, cidr.bytes, cidr.prefix);
48847
+ }
48097
48848
  let [entryHost, entryPort] = parseNoProxyEntry(entry);
48098
48849
  entryHost = normalizeNoProxyHost(entryHost);
48099
48850
  if (!entryHost) {
@@ -48179,7 +48930,8 @@ function throttle(fn, freq) {
48179
48930
  }
48180
48931
  };
48181
48932
  const flush = () => lastArgs && invoke(lastArgs);
48182
- return [throttled, flush];
48933
+ const flushWith = (...args) => invoke(args);
48934
+ return [throttled, flush, flushWith];
48183
48935
  }
48184
48936
  var throttle_default = throttle;
48185
48937
 
@@ -48188,7 +48940,7 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
48188
48940
  let bytesNotified = 0;
48189
48941
  const _speedometer = speedometer_default(50, 250);
48190
48942
  return throttle_default((e) => {
48191
- if (!e || typeof e.loaded !== "number") {
48943
+ if (!e || !utils_default.isNumber(e.loaded)) {
48192
48944
  return;
48193
48945
  }
48194
48946
  const rawLoaded = e.loaded;
@@ -48349,6 +49101,12 @@ var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
48349
49101
  var isHttps = /https:?/;
48350
49102
  var kAxiosSocketListener = Symbol("axios.http.socketListener");
48351
49103
  var kAxiosCurrentReq = Symbol("axios.http.currentReq");
49104
+ function handleSocketError(err) {
49105
+ const current = this[kAxiosCurrentReq];
49106
+ if (current && !current.destroyed) {
49107
+ current.destroy(err);
49108
+ }
49109
+ }
48352
49110
  var kAxiosInstalledTunnel = Symbol("axios.http.installedTunnel");
48353
49111
  var tunnelingAgentCache = /* @__PURE__ */ new Map();
48354
49112
  var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
@@ -48451,10 +49209,10 @@ function isSameOriginRedirect(redirectOptions, requestDetails) {
48451
49209
  return false;
48452
49210
  }
48453
49211
  }
48454
- function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
49212
+ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
48455
49213
  let proxy = configProxy;
48456
49214
  const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
48457
- if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
49215
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
48458
49216
  const proxyUrl = getProxyForUrl(location);
48459
49217
  if (proxyUrl) {
48460
49218
  if (!shouldBypassProxy(location)) {
@@ -48551,9 +49309,13 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
48551
49309
  redirectOptions.href,
48552
49310
  true,
48553
49311
  configHttpsAgent,
48554
- configHttpAgent
49312
+ configHttpAgent,
49313
+ allowEnvProxy
48555
49314
  );
48556
49315
  };
49316
+ return Boolean(
49317
+ proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent)
49318
+ );
48557
49319
  }
48558
49320
  var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
48559
49321
  var wrapAsync = (asyncExecutor) => {
@@ -48578,7 +49340,7 @@ var wrapAsync = (asyncExecutor) => {
48578
49340
  };
48579
49341
  var resolveFamily = ({ address, family }) => {
48580
49342
  if (!utils_default.isString(address)) {
48581
- throw TypeError("address must be a string");
49343
+ throw new AxiosError_default("address must be a string", AxiosError_default.ERR_BAD_OPTION_VALUE);
48582
49344
  }
48583
49345
  return {
48584
49346
  address,
@@ -48586,6 +49348,30 @@ var resolveFamily = ({ address, family }) => {
48586
49348
  };
48587
49349
  };
48588
49350
  var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
49351
+ var normalizedLookupCache = /* @__PURE__ */ new WeakMap();
49352
+ var normalizeLookup = (lookup) => {
49353
+ let normalized = normalizedLookupCache.get(lookup);
49354
+ if (normalized) {
49355
+ return normalized;
49356
+ }
49357
+ const callbackLookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
49358
+ normalized = (hostname, opt, cb) => {
49359
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
49360
+ if (err) {
49361
+ return cb(err);
49362
+ }
49363
+ let addresses;
49364
+ try {
49365
+ addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
49366
+ } catch (error) {
49367
+ return cb(error);
49368
+ }
49369
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
49370
+ });
49371
+ };
49372
+ normalizedLookupCache.set(lookup, normalized);
49373
+ return normalized;
49374
+ };
48589
49375
  var http2Transport = {
48590
49376
  request(options, cb) {
48591
49377
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
@@ -48622,6 +49408,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48622
49408
  let family = own2("family");
48623
49409
  let httpVersion = own2("httpVersion");
48624
49410
  if (httpVersion === void 0) httpVersion = 1;
49411
+ const rawHttpVersion = httpVersion;
48625
49412
  let http2Options = own2("http2Options");
48626
49413
  const httpAgent = own2("httpAgent");
48627
49414
  const httpsAgent = own2("httpsAgent");
@@ -48638,25 +49425,32 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48638
49425
  let rejected = false;
48639
49426
  let req;
48640
49427
  let connectPhaseTimer;
48641
- httpVersion = +httpVersion;
49428
+ try {
49429
+ httpVersion = +httpVersion;
49430
+ } catch (err) {
49431
+ throw new AxiosError_default(
49432
+ "Invalid protocol version: value is not a number",
49433
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
49434
+ config
49435
+ );
49436
+ }
48642
49437
  if (Number.isNaN(httpVersion)) {
48643
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
49438
+ throw new AxiosError_default(
49439
+ `Invalid protocol version: '${rawHttpVersion}' is not a number`,
49440
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
49441
+ config
49442
+ );
48644
49443
  }
48645
49444
  if (httpVersion !== 1 && httpVersion !== 2) {
48646
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
49445
+ throw new AxiosError_default(
49446
+ `Unsupported protocol version '${httpVersion}'`,
49447
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
49448
+ config
49449
+ );
48647
49450
  }
48648
49451
  const isHttp2 = httpVersion === 2;
48649
49452
  if (lookup) {
48650
- const _lookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
48651
- lookup = (hostname, opt, cb) => {
48652
- _lookup(hostname, opt, (err, arg0, arg1) => {
48653
- if (err) {
48654
- return cb(err);
48655
- }
48656
- const addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
48657
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
48658
- });
48659
- };
49453
+ lookup = normalizeLookup(lookup);
48660
49454
  }
48661
49455
  const abortEmitter = new import_events.EventEmitter();
48662
49456
  function abort(reason) {
@@ -48899,6 +49693,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48899
49693
  utils_default.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
48900
49694
  false
48901
49695
  );
49696
+ if (isHttp2 && lookup) {
49697
+ http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, { lookup });
49698
+ }
48902
49699
  const options = Object.assign(/* @__PURE__ */ Object.create(null), {
48903
49700
  path: path5,
48904
49701
  method,
@@ -48909,9 +49706,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48909
49706
  family,
48910
49707
  beforeRedirect: dispatchBeforeRedirect,
48911
49708
  beforeRedirects: /* @__PURE__ */ Object.create(null),
48912
- http2Options
49709
+ http2Options,
49710
+ createConnection: void 0
48913
49711
  });
48914
49712
  !utils_default.isUndefined(lookup) && (options.lookup = lookup);
49713
+ let proxyApplied = false;
48915
49714
  if (socketPath) {
48916
49715
  if (typeof socketPath !== "string") {
48917
49716
  return reject(
@@ -48939,13 +49738,17 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48939
49738
  } else {
48940
49739
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
48941
49740
  options.port = parsed.port;
48942
- setProxy(
49741
+ proxyApplied = setProxy(
48943
49742
  options,
48944
49743
  configProxy,
48945
49744
  protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
48946
49745
  false,
48947
49746
  httpsAgent,
48948
- httpAgent
49747
+ httpAgent,
49748
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
49749
+ // cannot apply either axios-resolved or agent-local environment proxies.
49750
+ // Explicit proxy config is still processed and rejected below.
49751
+ !isHttp2
48949
49752
  );
48950
49753
  }
48951
49754
  let transport;
@@ -48956,6 +49759,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48956
49759
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
48957
49760
  }
48958
49761
  if (isHttp2) {
49762
+ if (proxyApplied) {
49763
+ return reject(
49764
+ new AxiosError_default(
49765
+ "HTTP/2 requests with a proxy are not supported",
49766
+ AxiosError_default.ERR_NOT_SUPPORT,
49767
+ config
49768
+ )
49769
+ );
49770
+ }
48959
49771
  transport = http2Transport;
48960
49772
  } else {
48961
49773
  const configTransport = own2("transport");
@@ -49043,7 +49855,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
49043
49855
  transformStream,
49044
49856
  progressEventDecorator(
49045
49857
  responseLength,
49046
- progressEventReducer(asyncDecorator(onDownloadProgress, scheduleProgress), true, 3)
49858
+ progressEventReducer(
49859
+ asyncDecorator(onDownloadProgress, scheduleProgress),
49860
+ true,
49861
+ 3
49862
+ )
49047
49863
  )
49048
49864
  )
49049
49865
  );
@@ -49192,12 +50008,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
49192
50008
  socket.setKeepAlive(true, 1e3 * 60);
49193
50009
  }
49194
50010
  if (!socket[kAxiosSocketListener]) {
49195
- socket.on("error", function handleSocketError(err) {
49196
- const current = socket[kAxiosCurrentReq];
49197
- if (current && !current.destroyed) {
49198
- current.destroy(err);
49199
- }
49200
- });
50011
+ socket.on("error", handleSocketError);
49201
50012
  socket[kAxiosSocketListener] = true;
49202
50013
  }
49203
50014
  socket[kAxiosCurrentReq] = req;
@@ -49442,7 +50253,7 @@ function mergeConfig(config1, config2) {
49442
50253
  transformResponse: defaultToConfig2,
49443
50254
  paramsSerializer: defaultToConfig2,
49444
50255
  timeout: defaultToConfig2,
49445
- timeoutMessage: defaultToConfig2,
50256
+ timeoutErrorMessage: defaultToConfig2,
49446
50257
  withCredentials: defaultToConfig2,
49447
50258
  withXSRFToken: defaultToConfig2,
49448
50259
  adapter: defaultToConfig2,
@@ -49519,10 +50330,11 @@ function resolveConfig(config) {
49519
50330
  }
49520
50331
  }
49521
50332
  if (utils_default.isFormData(data)) {
50333
+ const getHeaders = utils_default.getSafeProp(data, "getHeaders");
49522
50334
  if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv || utils_default.isReactNative(data)) {
49523
50335
  headers.setContentType(void 0);
49524
- } else if (utils_default.isFunction(data.getHeaders)) {
49525
- setFormDataHeaders(headers, data.getHeaders(), own2("formDataHeaderPolicy"));
50336
+ } else if (utils_default.isFunction(getHeaders)) {
50337
+ setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
49526
50338
  }
49527
50339
  }
49528
50340
  if (platform_default.hasStandardBrowserEnv) {
@@ -49551,7 +50363,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49551
50363
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
49552
50364
  let onCanceled;
49553
50365
  let uploadThrottled, downloadThrottled;
49554
- let flushUpload, flushDownload;
50366
+ let flushUpload, flushDownload, flushDownloadWithEvent;
49555
50367
  function done() {
49556
50368
  flushUpload && flushUpload();
49557
50369
  flushDownload && flushDownload();
@@ -49561,7 +50373,27 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49561
50373
  let request = new XMLHttpRequest();
49562
50374
  request.open(_config.method.toUpperCase(), _config.url, true);
49563
50375
  request.timeout = _config.timeout;
49564
- function onloadend() {
50376
+ function onloadend(event) {
50377
+ if (!request) {
50378
+ return;
50379
+ }
50380
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform_default.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
50381
+ reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
50382
+ done();
50383
+ request = null;
50384
+ return;
50385
+ }
50386
+ try {
50387
+ if (event) {
50388
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
50389
+ } else {
50390
+ flushDownload && flushDownload();
50391
+ }
50392
+ } catch (err) {
50393
+ setTimeout(() => {
50394
+ throw err;
50395
+ });
50396
+ }
49565
50397
  if (!request) {
49566
50398
  return;
49567
50399
  }
@@ -49649,7 +50481,10 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49649
50481
  request.responseType = _config.responseType;
49650
50482
  }
49651
50483
  if (onDownloadProgress) {
49652
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
50484
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
50485
+ onDownloadProgress,
50486
+ true
50487
+ );
49653
50488
  request.addEventListener("progress", downloadThrottled);
49654
50489
  }
49655
50490
  if (onUploadProgress && request.upload) {
@@ -49819,6 +50654,17 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
49819
50654
 
49820
50655
  // node_modules/axios/lib/adapters/fetch.js
49821
50656
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
50657
+ var DEFAULT_REQUEST_OPTIONS = {
50658
+ cache: "default",
50659
+ redirect: "follow",
50660
+ referrer: "about:client",
50661
+ referrerPolicy: "",
50662
+ mode: "cors",
50663
+ integrity: "",
50664
+ keepalive: false,
50665
+ priority: "auto",
50666
+ window: null
50667
+ };
49822
50668
  var { isFunction: isFunction2 } = utils_default;
49823
50669
  var encodeUTF82 = (str) => encodeURIComponent(str).replace(
49824
50670
  /%([0-9A-F]{2})/gi,
@@ -49949,7 +50795,8 @@ var factory = (env) => {
49949
50795
  withCredentials = "same-origin",
49950
50796
  fetchOptions,
49951
50797
  maxContentLength,
49952
- maxBodyLength
50798
+ maxBodyLength,
50799
+ maxRedirects
49953
50800
  } = resolveConfig_default(config);
49954
50801
  const hasMaxContentLength = utils_default.isNumber(maxContentLength) && maxContentLength > -1;
49955
50802
  const hasMaxBodyLength = utils_default.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -50079,17 +50926,44 @@ var factory = (env) => {
50079
50926
  }
50080
50927
  }
50081
50928
  headers.set("User-Agent", "axios/" + VERSION, false);
50082
- const resolvedOptions = {
50083
- ...fetchOptions,
50929
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
50930
+ if (safeFetchOptions) {
50931
+ delete safeFetchOptions.body;
50932
+ delete safeFetchOptions.headers;
50933
+ delete safeFetchOptions.method;
50934
+ delete safeFetchOptions.signal;
50935
+ delete safeFetchOptions.duplex;
50936
+ delete safeFetchOptions.credentials;
50937
+ }
50938
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
50084
50939
  signal: composedSignal,
50085
50940
  method: method.toUpperCase(),
50086
50941
  headers: toByteStringHeaderObject(headers.normalize()),
50087
50942
  body: data,
50088
50943
  duplex: "half",
50089
50944
  credentials: isCredentialsSupported ? withCredentials : void 0
50090
- };
50945
+ });
50946
+ if (isRequestSupported) {
50947
+ utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
50948
+ if (resolvedOptions[key] === void 0) {
50949
+ resolvedOptions[key] = value;
50950
+ }
50951
+ });
50952
+ if (resolvedOptions.signal === void 0) {
50953
+ resolvedOptions.signal = null;
50954
+ }
50955
+ if (resolvedOptions.body === void 0) {
50956
+ resolvedOptions.body = null;
50957
+ }
50958
+ }
50959
+ if (maxRedirects === 0) {
50960
+ resolvedOptions.redirect = "manual";
50961
+ if (safeFetchOptions) {
50962
+ safeFetchOptions.redirect = "manual";
50963
+ }
50964
+ }
50091
50965
  request = isRequestSupported && new Request(url2, resolvedOptions);
50092
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url2, resolvedOptions));
50966
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url2, resolvedOptions));
50093
50967
  const responseHeaders = AxiosHeaders_default.from(response.headers);
50094
50968
  if (hasMaxContentLength) {
50095
50969
  const declaredLength = utils_default.toFiniteNumber(responseHeaders.getContentLength());
@@ -50308,9 +51182,10 @@ function throwIfCancellationRequested(config) {
50308
51182
  throw new CanceledError_default(null, config);
50309
51183
  }
50310
51184
  }
50311
- function dispatchRequest(config) {
51185
+ function dispatchRequest(_config) {
51186
+ const config = utils_default.toSafeFlatObject(_config);
50312
51187
  throwIfCancellationRequested(config);
50313
- config.headers = AxiosHeaders_default.from(config.headers);
51188
+ config.headers = AxiosHeaders_default.from(utils_default.getSafeProp(config, "headers"));
50314
51189
  config.data = transformData.call(config, config.transformRequest);
50315
51190
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
50316
51191
  config.headers.setContentType("application/x-www-form-urlencoded", false);
@@ -50440,16 +51315,15 @@ var Axios = class {
50440
51315
  return await this._request(configOrUrl, config);
50441
51316
  } catch (err) {
50442
51317
  if (err instanceof Error) {
50443
- let dummy = {};
50444
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
50445
- const stack = (() => {
50446
- if (!dummy.stack) {
50447
- return "";
50448
- }
50449
- const firstNewlineIndex = dummy.stack.indexOf("\n");
50450
- return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
50451
- })();
50452
51318
  try {
51319
+ let dummy = {};
51320
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
51321
+ const dummyStack = dummy.stack;
51322
+ let stack = "";
51323
+ if (typeof dummyStack === "string") {
51324
+ const firstNewlineIndex = dummyStack.indexOf("\n");
51325
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
51326
+ }
50453
51327
  if (!err.stack) {
50454
51328
  err.stack = stack;
50455
51329
  } else if (stack) {
@@ -50519,9 +51393,9 @@ var Axios = class {
50519
51393
  },
50520
51394
  true
50521
51395
  );
50522
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
51396
+ config.method = (utils_default.getSafeProp(config, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
50523
51397
  let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
50524
- headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
51398
+ headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
50525
51399
  delete headers[method];
50526
51400
  });
50527
51401
  config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
@@ -50784,14 +51658,22 @@ var HttpStatusCode = {
50784
51658
  Gone: 410,
50785
51659
  LengthRequired: 411,
50786
51660
  PreconditionFailed: 412,
51661
+ /**
51662
+ * @deprecated Use `ContentTooLarge` instead.
51663
+ */
50787
51664
  PayloadTooLarge: 413,
51665
+ ContentTooLarge: 413,
50788
51666
  UriTooLong: 414,
50789
51667
  UnsupportedMediaType: 415,
50790
51668
  RangeNotSatisfiable: 416,
50791
51669
  ExpectationFailed: 417,
50792
51670
  ImATeapot: 418,
50793
51671
  MisdirectedRequest: 421,
51672
+ /**
51673
+ * @deprecated Use `UnprocessableContent` instead.
51674
+ */
50794
51675
  UnprocessableEntity: 422,
51676
+ UnprocessableContent: 422,
50795
51677
  Locked: 423,
50796
51678
  FailedDependency: 424,
50797
51679
  TooEarly: 425,
@@ -50820,7 +51702,9 @@ var HttpStatusCode = {
50820
51702
  InvalidSslCertificate: 526
50821
51703
  };
50822
51704
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
50823
- HttpStatusCode[value] = key;
51705
+ if (HttpStatusCode[value] === void 0) {
51706
+ HttpStatusCode[value] = key;
51707
+ }
50824
51708
  });
50825
51709
  var HttpStatusCode_default = HttpStatusCode;
50826
51710
 
@@ -52000,6 +52884,9 @@ var require_pkg_src2 = __commonJS2({
52000
52884
  });
52001
52885
  var index_exports = {};
52002
52886
  __export22(index_exports, {
52887
+ BORROWER_AUTHORIZATION_ENCODE_TYPES: () => BORROWER_AUTHORIZATION_ENCODE_TYPES,
52888
+ BORROWER_AUTHORIZATION_FIELDS: () => BORROWER_AUTHORIZATION_FIELDS,
52889
+ BORROWER_AUTHORIZATION_PRIMARY_TYPES: () => BORROWER_AUTHORIZATION_PRIMARY_TYPES,
52003
52890
  CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
52004
52891
  DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
52005
52892
  DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
@@ -52012,6 +52899,8 @@ var require_pkg_src2 = __commonJS2({
52012
52899
  PerformanceTracker: () => PerformanceTracker,
52013
52900
  RetryStrategy: () => RetryStrategy,
52014
52901
  analyzeError: () => analyzeError,
52902
+ borrowerAuthorizationTypes: () => borrowerAuthorizationTypes,
52903
+ buildBorrowerAuthorizationDomain: () => buildBorrowerAuthorizationDomain,
52015
52904
  calculateDelay: () => calculateDelay,
52016
52905
  cidToHex: () => cidToHex,
52017
52906
  classifyError: () => classifyError,
@@ -52258,30 +53147,30 @@ var require_pkg_src2 = __commonJS2({
52258
53147
  }
52259
53148
  },
52260
53149
  btcTransactionSigner: {
52261
- cid: "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp",
53150
+ cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
52262
53151
  authorizedCidHex: cidToHex(
52263
- "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp"
53152
+ "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
52264
53153
  ),
52265
53154
  name: "Btc Transaction Signer",
52266
53155
  description: "Production Btc Transaction Signer",
52267
53156
  version: "1.1.1",
52268
53157
  deployed: true,
52269
- deployedAt: 1786465606156,
52270
- size: 67999,
52271
- hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
53158
+ deployedAt: 1787923905597,
53159
+ size: 70646,
53160
+ hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
52272
53161
  },
52273
53162
  ucdMintValidator: {
52274
- cid: "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx",
53163
+ cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
52275
53164
  authorizedCidHex: cidToHex(
52276
- "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx"
53165
+ "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
52277
53166
  ),
52278
53167
  name: "Ucd Mint Validator",
52279
53168
  description: "Production Ucd Mint Validator",
52280
53169
  version: "1.2.1",
52281
53170
  deployed: true,
52282
- deployedAt: 1786465627201,
52283
- size: 82739,
52284
- hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
53171
+ deployedAt: 1787923919527,
53172
+ size: 86197,
53173
+ hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
52285
53174
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52286
53175
  pkp: {
52287
53176
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -52289,17 +53178,17 @@ var require_pkg_src2 = __commonJS2({
52289
53178
  }
52290
53179
  },
52291
53180
  processPaymentValidator: {
52292
- cid: "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z",
53181
+ cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
52293
53182
  authorizedCidHex: cidToHex(
52294
- "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z"
53183
+ "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
52295
53184
  ),
52296
53185
  name: "Process Payment Validator",
52297
53186
  description: "Production Process Payment Validator",
52298
53187
  version: "1.2.1",
52299
53188
  deployed: true,
52300
- deployedAt: 1786465654796,
52301
- size: 78736,
52302
- hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
53189
+ deployedAt: 1787923987153,
53190
+ size: 82217,
53191
+ hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
52303
53192
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52304
53193
  pkp: {
52305
53194
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
@@ -52307,17 +53196,17 @@ var require_pkg_src2 = __commonJS2({
52307
53196
  }
52308
53197
  },
52309
53198
  extendPositionValidator: {
52310
- cid: "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav",
53199
+ cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
52311
53200
  authorizedCidHex: cidToHex(
52312
- "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav"
53201
+ "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
52313
53202
  ),
52314
53203
  name: "Extend Position Validator",
52315
53204
  description: "Production Extend Position Validator",
52316
53205
  version: "1.2.1",
52317
53206
  deployed: true,
52318
- deployedAt: 1786465681874,
52319
- size: 76515,
52320
- hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
53207
+ deployedAt: 1787923999294,
53208
+ size: 79975,
53209
+ hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
52321
53210
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52322
53211
  pkp: {
52323
53212
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
@@ -52325,17 +53214,17 @@ var require_pkg_src2 = __commonJS2({
52325
53214
  }
52326
53215
  },
52327
53216
  btcWithdrawal: {
52328
- cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
53217
+ cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
52329
53218
  authorizedCidHex: cidToHex(
52330
- "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
53219
+ "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
52331
53220
  ),
52332
53221
  name: "Btc Withdrawal",
52333
53222
  description: "Production Btc Withdrawal",
52334
53223
  version: "1.2.7",
52335
53224
  deployed: true,
52336
- deployedAt: 1786446046614,
52337
- size: 97456,
52338
- hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
53225
+ deployedAt: 1787924017769,
53226
+ size: 100069,
53227
+ hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
52339
53228
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52340
53229
  pkp: {
52341
53230
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -52447,30 +53336,30 @@ var require_pkg_src2 = __commonJS2({
52447
53336
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
52448
53337
  },
52449
53338
  agentModuleExecutor: {
52450
- cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
53339
+ cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
52451
53340
  authorizedCidHex: cidToHex(
52452
- "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
53341
+ "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
52453
53342
  ),
52454
53343
  name: "Agent Module Executor",
52455
53344
  description: "Production Agent Module Executor",
52456
53345
  version: "1.1.1",
52457
53346
  deployed: true,
52458
- deployedAt: 1786446108348,
52459
- size: 11655,
52460
- hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
53347
+ deployedAt: 1787924032013,
53348
+ size: 13878,
53349
+ hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
52461
53350
  },
52462
53351
  staleSpendRecoveryValidator: {
52463
- cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
53352
+ cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
52464
53353
  authorizedCidHex: cidToHex(
52465
- "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm"
53354
+ "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
52466
53355
  ),
52467
53356
  name: "Stale Spend Recovery Validator",
52468
53357
  description: "Production Stale Spend Recovery Validator",
52469
53358
  version: "1.1.2",
52470
53359
  deployed: true,
52471
- deployedAt: 1785173285829,
52472
- size: 37108,
52473
- hash: "04de5fc5b6f5131dc1544e3d3d187a1f9ef9616ffd12483d119f9102b3671791",
53360
+ deployedAt: 1787924048772,
53361
+ size: 41424,
53362
+ hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
52474
53363
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52475
53364
  pkp: {
52476
53365
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
@@ -52478,17 +53367,17 @@ var require_pkg_src2 = __commonJS2({
52478
53367
  }
52479
53368
  },
52480
53369
  btcUtxoInvalidator: {
52481
- cid: "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m",
53370
+ cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
52482
53371
  authorizedCidHex: cidToHex(
52483
- "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m"
53372
+ "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
52484
53373
  ),
52485
53374
  name: "Btc Utxo Invalidator",
52486
53375
  description: "Production Btc Utxo Invalidator",
52487
53376
  version: "1.0.0",
52488
53377
  deployed: true,
52489
- deployedAt: 1786465704240,
52490
- size: 62553,
52491
- hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
53378
+ deployedAt: 1787924133241,
53379
+ size: 66026,
53380
+ hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
52492
53381
  }
52493
53382
  };
52494
53383
  function getDeploymentsForNetwork(network) {
@@ -53249,6 +54138,101 @@ ${errorReport}`);
53249
54138
  var SECONDS_PER_DAY = 86400;
53250
54139
  var DAYS_PER_MONTH = 30;
53251
54140
  var LIT_ACTION_ETH_RPC_TIMEOUT_MS = 8e3;
54141
+ var PINNED_CONTRACT_ADDRESSES = {
54142
+ 1: {
54143
+ PositionManager: "0x12A1836e56139ccaD8722B89519d84233efc224B",
54144
+ LoanOperationsManagerModule: "0x2561974A40F1AEed1251d0A090A83cF8536FB9E9",
54145
+ BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
54146
+ BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
54147
+ LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
54148
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
54149
+ },
54150
+ 11155111: {
54151
+ PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
54152
+ LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
54153
+ BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
54154
+ BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
54155
+ LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
54156
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
54157
+ }
54158
+ };
54159
+ function getPinnedContractAddresses(chainId) {
54160
+ return PINNED_CONTRACT_ADDRESSES[chainId] ?? null;
54161
+ }
54162
+ var PROTOCOL_EIP712_DOMAIN_NAME = "DiamondHands.Protocol";
54163
+ var PROTOCOL_EIP712_DOMAIN_VERSION = "1";
54164
+ var BORROWER_AUTHORIZATION_PRIMARY_TYPES = {
54165
+ MINT: "MintRequest",
54166
+ REPAY: "RepayRequest",
54167
+ RENEW: "RenewRequest",
54168
+ WITHDRAW: "WithdrawRequest"
54169
+ };
54170
+ var BORROWER_AUTHORIZATION_FIELDS = {
54171
+ MintRequest: [
54172
+ { name: "positionId", type: "bytes32" },
54173
+ { name: "mintAmount", type: "uint256" },
54174
+ { name: "quantumTimestamp", type: "uint256" }
54175
+ ],
54176
+ RepayRequest: [
54177
+ { name: "positionId", type: "bytes32" },
54178
+ { name: "paymentAmount", type: "uint256" },
54179
+ { name: "quantumTimestamp", type: "uint256" }
54180
+ ],
54181
+ RenewRequest: [
54182
+ { name: "positionId", type: "bytes32" },
54183
+ { name: "selectedTerm", type: "uint256" },
54184
+ { name: "quantumTimestamp", type: "uint256" }
54185
+ ],
54186
+ WithdrawRequest: [
54187
+ { name: "positionId", type: "bytes32" },
54188
+ { name: "totalDeduction", type: "uint256" },
54189
+ { name: "withdrawalAddress", type: "string" },
54190
+ { name: "quantumTimestamp", type: "uint256" }
54191
+ ]
54192
+ };
54193
+ var BORROWER_AUTHORIZATION_ENCODE_TYPES = {
54194
+ MintRequest: "MintRequest(bytes32 positionId,uint256 mintAmount,uint256 quantumTimestamp)",
54195
+ RepayRequest: "RepayRequest(bytes32 positionId,uint256 paymentAmount,uint256 quantumTimestamp)",
54196
+ RenewRequest: "RenewRequest(bytes32 positionId,uint256 selectedTerm,uint256 quantumTimestamp)",
54197
+ WithdrawRequest: "WithdrawRequest(bytes32 positionId,uint256 totalDeduction,string withdrawalAddress,uint256 quantumTimestamp)"
54198
+ };
54199
+ function borrowerAuthorizationTypes(primaryType) {
54200
+ const fields = BORROWER_AUTHORIZATION_FIELDS[primaryType];
54201
+ if (!fields) {
54202
+ throw new Error(
54203
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ${Object.keys(BORROWER_AUTHORIZATION_FIELDS).join(", ")}`
54204
+ );
54205
+ }
54206
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
54207
+ }
54208
+ function buildBorrowerAuthorizationDomain(chainId, verifyingContractOverride) {
54209
+ if (!Number.isInteger(chainId) || chainId <= 0) {
54210
+ throw new Error(
54211
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
54212
+ );
54213
+ }
54214
+ const pinned = getPinnedContractAddresses(chainId);
54215
+ const pinnedLom = pinned?.LoanOperationsManagerModule;
54216
+ if (pinnedLom && verifyingContractOverride) {
54217
+ if (pinnedLom.toLowerCase() !== verifyingContractOverride.toLowerCase()) {
54218
+ throw new Error(
54219
+ `Refusing a caller-supplied verifyingContract that contradicts the pin for chainId ${chainId}: caller ${verifyingContractOverride}, pinned ${pinnedLom}`
54220
+ );
54221
+ }
54222
+ }
54223
+ const verifyingContract = pinnedLom ?? verifyingContractOverride;
54224
+ if (!verifyingContract) {
54225
+ throw new Error(
54226
+ `No pinned LoanOperationsManagerModule for chainId ${chainId} and no verifyingContract supplied; refusing to build a borrower authorization domain without one`
54227
+ );
54228
+ }
54229
+ return {
54230
+ name: PROTOCOL_EIP712_DOMAIN_NAME,
54231
+ version: PROTOCOL_EIP712_DOMAIN_VERSION,
54232
+ chainId,
54233
+ verifyingContract
54234
+ };
54235
+ }
53252
54236
  var EVMChain = /* @__PURE__ */ ((EVMChain3) => {
53253
54237
  EVMChain3["SEPOLIA"] = "sepolia";
53254
54238
  EVMChain3["ETHEREUM"] = "ethereum";
@@ -57044,6 +58028,77 @@ async function awaitSafeSubmissionWindowOnChain(signatureQuantum, chainNow, slee
57044
58028
  );
57045
58029
  return { waited: waitedSeconds > 0, waitedSeconds };
57046
58030
  }
58031
+ init_deployment_addresses();
58032
+ var BORROWER_AUTHORIZATION_712_DOMAIN_NAME = "DiamondHands.Protocol";
58033
+ var BORROWER_AUTHORIZATION_712_DOMAIN_VERSION = "1";
58034
+ var BORROWER_AUTHORIZATION_712_FIELDS = {
58035
+ MintRequest: [
58036
+ { name: "positionId", type: "bytes32" },
58037
+ { name: "mintAmount", type: "uint256" },
58038
+ { name: "quantumTimestamp", type: "uint256" }
58039
+ ],
58040
+ RepayRequest: [
58041
+ { name: "positionId", type: "bytes32" },
58042
+ { name: "paymentAmount", type: "uint256" },
58043
+ { name: "quantumTimestamp", type: "uint256" }
58044
+ ],
58045
+ RenewRequest: [
58046
+ { name: "positionId", type: "bytes32" },
58047
+ { name: "selectedTerm", type: "uint256" },
58048
+ { name: "quantumTimestamp", type: "uint256" }
58049
+ ],
58050
+ WithdrawRequest: [
58051
+ { name: "positionId", type: "bytes32" },
58052
+ { name: "totalDeduction", type: "uint256" },
58053
+ { name: "withdrawalAddress", type: "string" },
58054
+ { name: "quantumTimestamp", type: "uint256" }
58055
+ ]
58056
+ };
58057
+ function borrowerAuthorization712Types(primaryType) {
58058
+ const fields = BORROWER_AUTHORIZATION_712_FIELDS[primaryType];
58059
+ if (!fields) {
58060
+ throw new Error(
58061
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ` + Object.keys(BORROWER_AUTHORIZATION_712_FIELDS).join(", ")
58062
+ );
58063
+ }
58064
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
58065
+ }
58066
+ function buildBorrowerAuthorization712Domain(chainId) {
58067
+ if (!Number.isInteger(chainId) || chainId <= 0) {
58068
+ throw new Error(
58069
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
58070
+ );
58071
+ }
58072
+ const deployment = Object.values(ALL_DEPLOYMENTS).find(
58073
+ (d) => d.chainId === chainId
58074
+ );
58075
+ const verifyingContract = deployment?.contracts?.LoanOperationsManagerModule;
58076
+ if (!verifyingContract) {
58077
+ throw new Error(
58078
+ `No LoanOperationsManagerModule deployment known for chainId ${chainId}; refusing to build a borrower authorization domain without one`
58079
+ );
58080
+ }
58081
+ return {
58082
+ name: BORROWER_AUTHORIZATION_712_DOMAIN_NAME,
58083
+ version: BORROWER_AUTHORIZATION_712_DOMAIN_VERSION,
58084
+ chainId,
58085
+ verifyingContract
58086
+ };
58087
+ }
58088
+ async function signBorrowerAuthorization712(signer, primaryType, chainId, message) {
58089
+ const signTypedData = signer.signTypedData;
58090
+ if (typeof signTypedData !== "function") {
58091
+ throw new Error(
58092
+ `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.`
58093
+ );
58094
+ }
58095
+ return signTypedData.call(
58096
+ signer,
58097
+ buildBorrowerAuthorization712Domain(chainId),
58098
+ borrowerAuthorization712Types(primaryType),
58099
+ message
58100
+ );
58101
+ }
57047
58102
  var PKP_NFT_ABI = [
57048
58103
  "function getPubkey(uint256 tokenId) external view returns (bytes memory)"
57049
58104
  ];
@@ -57056,29 +58111,11 @@ async function generateMintAuthorization(positionId, amount, chainId, signerOrPr
57056
58111
  const signer = signerOrPrecomputed;
57057
58112
  const timestamp = calculateNextQuantumTimestamp();
57058
58113
  const action = "mint-ucd";
57059
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
57060
- const types = [
57061
- "bytes32",
57062
- // positionId
57063
- "uint256",
57064
- // timestamp
57065
- "uint256",
57066
- // chainId
57067
- "uint256",
57068
- // amount
57069
- "bytes32"
57070
- // actionHash
57071
- ];
57072
- const values = [
58114
+ const signature = await signBorrowerAuthorization712(signer, "MintRequest", chainId, {
57073
58115
  positionId,
57074
- timestamp,
57075
- chainId,
57076
- amount.toString(),
57077
- actionHash
57078
- ];
57079
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
57080
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
57081
- const signature = await signer.signMessage(messageHashBytes);
58116
+ mintAmount: amount.toString(),
58117
+ quantumTimestamp: timestamp
58118
+ });
57082
58119
  return {
57083
58120
  positionId,
57084
58121
  timestamp,
@@ -57115,44 +58152,17 @@ async function generatePaymentAuthorization(positionId, amount, chainId, signerO
57115
58152
  throw new Error(`timestamp must be a number, got ${typeof timestamp}`);
57116
58153
  }
57117
58154
  const action = "make-payment";
57118
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
57119
- if (typeof actionHash !== "string") {
57120
- throw new Error(`actionHash must be a string, got ${typeof actionHash}`);
57121
- }
57122
- const types = [
57123
- "bytes32",
57124
- // positionId
57125
- "uint256",
57126
- // timestamp
57127
- "uint256",
57128
- // chainId
57129
- "uint256",
57130
- // amount
57131
- "bytes32"
57132
- // actionHash
57133
- ];
57134
58155
  const amountStr = amount.toString();
57135
- if (typeof amountStr !== "string") {
57136
- throw new Error(
57137
- `amount.toString() must return a string, got ${typeof amountStr}`
57138
- );
57139
- }
57140
- const values = [positionId, timestamp, chainId, amountStr, actionHash];
57141
- for (let i = 0; i < values.length; i++) {
57142
- if (typeof values[i] === "object" && values[i] !== null) {
57143
- throw new Error(
57144
- `Value at index ${i} is an object: ${JSON.stringify(values[i])}`
57145
- );
57146
- }
57147
- }
57148
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
57149
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
57150
- const signature = await signer.signMessage(messageHashBytes);
58156
+ const signature = await signBorrowerAuthorization712(signer, "RepayRequest", chainId, {
58157
+ positionId,
58158
+ paymentAmount: amountStr,
58159
+ quantumTimestamp: timestamp
58160
+ });
57151
58161
  return {
57152
58162
  positionId,
57153
58163
  timestamp,
57154
58164
  chainId,
57155
- amount: amount.toString(),
58165
+ amount: amountStr,
57156
58166
  action,
57157
58167
  signature
57158
58168
  };
@@ -57239,32 +58249,12 @@ async function generateWithdrawAuthorization(positionId, amount, chainId, signer
57239
58249
  const signer = signerOrPrecomputed;
57240
58250
  const timestamp = calculateNextQuantumTimestamp();
57241
58251
  const action = "withdraw-btc";
57242
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
57243
- const types = [
57244
- "bytes32",
57245
- // positionId
57246
- "uint256",
57247
- // timestamp
57248
- "uint256",
57249
- // chainId
57250
- "uint256",
57251
- // amount (in satoshis)
57252
- "string",
57253
- // destinationAddress (Bitcoin address)
57254
- "bytes32"
57255
- // actionHash
57256
- ];
57257
- const values = [
58252
+ const signature = await signBorrowerAuthorization712(signer, "WithdrawRequest", chainId, {
57258
58253
  positionId,
57259
- timestamp,
57260
- chainId,
57261
- amount.toString(),
57262
- destinationAddress,
57263
- actionHash
57264
- ];
57265
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
57266
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
57267
- const signature = await signer.signMessage(messageHashBytes);
58254
+ totalDeduction: amount.toString(),
58255
+ withdrawalAddress: destinationAddress,
58256
+ quantumTimestamp: timestamp
58257
+ });
57268
58258
  return {
57269
58259
  positionId,
57270
58260
  timestamp,
@@ -57313,29 +58303,11 @@ async function generateExtendAuthorization(positionId, newTerm, chainId, signerO
57313
58303
  const signer = signerOrPrecomputed;
57314
58304
  const timestamp = calculateNextQuantumTimestamp();
57315
58305
  const action = "extend-position";
57316
- const actionHash = (0, import_ethers17.keccak256)((0, import_ethers17.toUtf8Bytes)(action));
57317
- const types = [
57318
- "bytes32",
57319
- // positionId
57320
- "uint256",
57321
- // timestamp
57322
- "uint256",
57323
- // chainId
57324
- "uint256",
57325
- // newTerm (extension term in months)
57326
- "bytes32"
57327
- // actionHash
57328
- ];
57329
- const values = [
58306
+ const signature = await signBorrowerAuthorization712(signer, "RenewRequest", chainId, {
57330
58307
  positionId,
57331
- timestamp,
57332
- chainId,
57333
- newTerm,
57334
- actionHash
57335
- ];
57336
- const messageHash = (0, import_ethers17.solidityPackedKeccak256)(types, values);
57337
- const messageHashBytes = (0, import_ethers17.getBytes)(messageHash);
57338
- const signature = await signer.signMessage(messageHashBytes);
58308
+ selectedTerm: newTerm,
58309
+ quantumTimestamp: timestamp
58310
+ });
57339
58311
  return {
57340
58312
  positionId,
57341
58313
  timestamp,
@@ -57570,6 +58542,7 @@ var ServerSession = class {
57570
58542
  store;
57571
58543
  onSignaturePrompt;
57572
58544
  onSignatureResolved;
58545
+ onSessionRestored;
57573
58546
  now;
57574
58547
  fetchImpl;
57575
58548
  cached = null;
@@ -57610,6 +58583,7 @@ var ServerSession = class {
57610
58583
  this.store = opts.persistSession === false ? null : opts.sessionStore ?? createDefaultSessionStore();
57611
58584
  this.onSignaturePrompt = opts.onSignaturePrompt;
57612
58585
  this.onSignatureResolved = opts.onSignatureResolved;
58586
+ this.onSessionRestored = opts.onSessionRestored;
57613
58587
  this.now = opts.now ?? (() => Math.floor(Date.now() / 1e3));
57614
58588
  this.fetchImpl = opts.fetchImpl ?? ((...a) => fetch(...a));
57615
58589
  }
@@ -57690,7 +58664,7 @@ var ServerSession = class {
57690
58664
  */
57691
58665
  async logout() {
57692
58666
  const cached = this.cached;
57693
- const token = cached && cached.expiresAt > this.now() ? cached.token : await this.getValidToken({ silent: true }).catch(() => null);
58667
+ const token = cached && cached.expiresAt > this.now() ? cached.token : await this.tryResolveSilently(this.generation, false).then((session) => session?.token ?? null).catch(() => null);
57694
58668
  await this.clearPersisted();
57695
58669
  if (!token)
57696
58670
  return;
@@ -57762,8 +58736,9 @@ var ServerSession = class {
57762
58736
  *
57763
58737
  * `gen` is the caller's clear-generation snapshot: writes to `this.cached`
57764
58738
  * and the store are skipped if a `clearPersisted()` landed meanwhile.
58739
+ * `announce` gates `onSessionRestored` for the two persisted-store outcomes.
57765
58740
  */
57766
- async tryResolveSilently(gen) {
58741
+ async tryResolveSilently(gen, announce = true) {
57767
58742
  const nowSec = this.now();
57768
58743
  if (this.cached && this.cached.expiresAt - REFRESH_LEEWAY_SECONDS > nowSec) {
57769
58744
  return this.cached;
@@ -57778,6 +58753,8 @@ var ServerSession = class {
57778
58753
  };
57779
58754
  if (gen === this.generation)
57780
58755
  this.cached = adopted;
58756
+ if (announce)
58757
+ this.onSessionRestored?.();
57781
58758
  return adopted;
57782
58759
  }
57783
58760
  try {
@@ -57786,6 +58763,8 @@ var ServerSession = class {
57786
58763
  this.persist(persisted.payload, session);
57787
58764
  this.cached = session;
57788
58765
  }
58766
+ if (announce)
58767
+ this.onSessionRestored?.();
57789
58768
  return session;
57790
58769
  } catch (error) {
57791
58770
  if (!isLoginRejection(error))
@@ -60871,6 +61850,10 @@ function normalizePkpId(pkpId) {
60871
61850
  }
60872
61851
  return pkpId;
60873
61852
  }
61853
+ function isNormalizedChipotlePkpId(pkpId) {
61854
+ const rawId = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
61855
+ return rawId.length === 40;
61856
+ }
60874
61857
  function padPkpIdForSubgraph(pkpId) {
60875
61858
  const raw = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
60876
61859
  if (raw.length === 40) {
@@ -61155,7 +62138,7 @@ var LoanQuery = class {
61155
62138
  batch.map(async (loan) => {
61156
62139
  try {
61157
62140
  const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
61158
- const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
62141
+ const isChipotlePkpId2 = typeof rawId === "string" && isNormalizedChipotlePkpId(rawId);
61159
62142
  if (isChipotlePkpId2) {
61160
62143
  if (this.config.positionManagerCoreAddress && this.config.provider) {
61161
62144
  const pmContract = new import_ethers26.Contract(
@@ -61482,6 +62465,7 @@ function createLoanQuery(config) {
61482
62465
  );
61483
62466
  }
61484
62467
  }
62468
+ var STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS = 5e3;
61485
62469
  var WithdrawalAddressModule = class {
61486
62470
  config;
61487
62471
  graphClient;
@@ -61527,13 +62511,17 @@ var WithdrawalAddressModule = class {
61527
62511
  const reg = this.getRegistry();
61528
62512
  if (!reg.success)
61529
62513
  return reg;
62514
+ const normalized = normalizeBitcoinAddress(btcAddress2);
61530
62515
  try {
61531
- const tx2 = await reg.value.addAddress(
61532
- normalizeBitcoinAddress(btcAddress2)
61533
- );
62516
+ const tx2 = await reg.value.addAddress(normalized);
61534
62517
  return success(tx2);
61535
62518
  } catch (error) {
61536
- return this.txFailure("addAddress", error, btcAddress2);
62519
+ return this.txFailure(
62520
+ "addAddress",
62521
+ error,
62522
+ btcAddress2,
62523
+ await this.staticCallDiagnostic(reg.value, "addAddress", normalized)
62524
+ );
61537
62525
  }
61538
62526
  }
61539
62527
  /** Remove a Bitcoin address from the caller's allowlist (effective immediately). */
@@ -61541,13 +62529,17 @@ var WithdrawalAddressModule = class {
61541
62529
  const reg = this.getRegistry();
61542
62530
  if (!reg.success)
61543
62531
  return reg;
62532
+ const normalized = normalizeBitcoinAddress(btcAddress2);
61544
62533
  try {
61545
- const tx2 = await reg.value.removeAddress(
61546
- normalizeBitcoinAddress(btcAddress2)
61547
- );
62534
+ const tx2 = await reg.value.removeAddress(normalized);
61548
62535
  return success(tx2);
61549
62536
  } catch (error) {
61550
- return this.txFailure("removeAddress", error, btcAddress2);
62537
+ return this.txFailure(
62538
+ "removeAddress",
62539
+ error,
62540
+ btcAddress2,
62541
+ await this.staticCallDiagnostic(reg.value, "removeAddress", normalized)
62542
+ );
61551
62543
  }
61552
62544
  }
61553
62545
  /**
@@ -61643,16 +62635,59 @@ var WithdrawalAddressModule = class {
61643
62635
  }
61644
62636
  return success(void 0);
61645
62637
  }
61646
- txFailure(op, error, context) {
62638
+ /**
62639
+ * Ask the node for the reason a failed write did not carry.
62640
+ *
62641
+ * A failing `eth_estimateGas` frequently answers with NOTHING to decode — ethers renders that
62642
+ * as `missing revert data ... data=null, reason=null, revert=null`, which names no cause and
62643
+ * cannot distinguish "the contract rejected this" from "the RPC hiccuped". An `eth_call` of the
62644
+ * same calldata usually does carry the revert reason or custom-error selector, so this runs one
62645
+ * and folds the answer into the reported error.
62646
+ *
62647
+ * Three deliberate properties:
62648
+ *
62649
+ * 1. It runs ONLY after the write has already failed. Gating the write on a static call would
62650
+ * let a flaky endpoint — precisely the condition this exists to diagnose — block an add that
62651
+ * would otherwise have succeeded.
62652
+ * 2. It costs NO extra signature. `staticCall` is `eth_call`: a node read, never a wallet prompt.
62653
+ * 3. It can never throw. A diagnostic that escapes would replace the real cause with itself.
62654
+ * (The `try/catch` here is the authorized exception to CLAUDE.md's forbidden-patterns rule;
62655
+ * it swallows nothing — every branch returns text that is reported alongside the original.)
62656
+ *
62657
+ * A static call that SUCCEEDS is itself a finding: the contract accepts this call, so the
62658
+ * failure lay outside contract logic (RPC, gas, or nonce).
62659
+ */
62660
+ async staticCallDiagnostic(registry, op, normalizedAddress) {
62661
+ try {
62662
+ await Promise.race([
62663
+ registry[op].staticCall(normalizedAddress),
62664
+ // The failure being diagnosed is often an unresponsive endpoint, so the diagnostic must
62665
+ // not inherit that hang — the user is waiting on this error message.
62666
+ new Promise(
62667
+ (_, reject) => setTimeout(
62668
+ () => reject(new Error("static call timed out after 5s")),
62669
+ STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS
62670
+ )
62671
+ )
62672
+ ]);
62673
+ return "static call SUCCEEDED \u2014 the contract accepts this call, so the failure was not contract logic (RPC, gas, or nonce)";
62674
+ } catch (diagnostic) {
62675
+ const code = typeof diagnostic === "object" && diagnostic !== null ? diagnostic.code : void 0;
62676
+ const msg = diagnostic instanceof Error ? diagnostic.message : String(diagnostic);
62677
+ return typeof code === "string" ? `static call reverted [${code}]: ${msg}` : `static call failed: ${msg}`;
62678
+ }
62679
+ }
62680
+ txFailure(op, error, context, diagnostic) {
61647
62681
  const msg = error instanceof Error ? error.message : String(error);
62682
+ const detail = diagnostic ? `${msg} \u2014 ${diagnostic}` : msg;
61648
62683
  return failure(
61649
62684
  new SDKError({
61650
62685
  code: `SDK_WITHDRAWAL_REGISTRY_${op.toUpperCase()}_FAILED`,
61651
- message: `WithdrawalAddressRegistry.${op} failed: ${msg}`,
62686
+ message: `WithdrawalAddressRegistry.${op} failed: ${detail}`,
61652
62687
  category: "CONTRACT",
61653
62688
  severity: "MEDIUM",
61654
62689
  originalError: error instanceof Error ? error : new Error(String(error)),
61655
- context: { op, context }
62690
+ context: { op, context, diagnostic }
61656
62691
  })
61657
62692
  );
61658
62693
  }
@@ -62730,6 +63765,47 @@ function normalizePkpId2(pkpId) {
62730
63765
  }
62731
63766
  return pkpId;
62732
63767
  }
63768
+ function applyLoanEventsFilter(events, opts) {
63769
+ const { wantsEvent, fromTimestamp, toTimestamp, fromBlock, toBlock, limit } = opts;
63770
+ const inBounds = (e) => {
63771
+ const ts = e?.timestamp;
63772
+ const bn = e?.blockNumber;
63773
+ try {
63774
+ if (fromTimestamp !== void 0 && ts !== void 0 && BigInt(ts) < BigInt(fromTimestamp))
63775
+ return false;
63776
+ if (toTimestamp !== void 0 && ts !== void 0 && BigInt(ts) > BigInt(toTimestamp))
63777
+ return false;
63778
+ if (fromBlock !== void 0 && bn !== void 0 && BigInt(bn) < BigInt(fromBlock))
63779
+ return false;
63780
+ if (toBlock !== void 0 && bn !== void 0 && BigInt(bn) > BigInt(toBlock))
63781
+ return false;
63782
+ } catch {
63783
+ return true;
63784
+ }
63785
+ return true;
63786
+ };
63787
+ const narrow = (list, kind) => wantsEvent(kind) ? (list ?? []).filter(inBounds).slice(0, limit) : [];
63788
+ const single = (value, kind) => value && wantsEvent(kind) && inBounds(value) ? value : void 0;
63789
+ const filtered = {
63790
+ ...events,
63791
+ positionCreated: single(events.positionCreated, "positionCreated"),
63792
+ payments: narrow(events.payments, "payment"),
63793
+ statusUpdates: narrow(events.statusUpdates, "status"),
63794
+ liquidation: single(events.liquidation, "liquidation"),
63795
+ mints: narrow(events.mints, "mint"),
63796
+ withdrawals: narrow(events.withdrawals, "withdrawal"),
63797
+ renewals: narrow(events.renewals, "renewal"),
63798
+ operationFailures: narrow(events.operationFailures, "operationFailure"),
63799
+ mintRequests: narrow(events.mintRequests, "mintRequest"),
63800
+ burnRequests: narrow(events.burnRequests, "burnRequest"),
63801
+ collateralEvents: narrow(events.collateralEvents, "collateralEvent"),
63802
+ mintingFees: narrow(events.mintingFees, "mintingFee"),
63803
+ renewalFees: narrow(events.renewalFees, "renewalFee"),
63804
+ totalEvents: 0
63805
+ };
63806
+ 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;
63807
+ return filtered;
63808
+ }
62733
63809
  function hasLoanEventsFilter(filter2) {
62734
63810
  if (!filter2)
62735
63811
  return false;
@@ -63886,32 +64962,24 @@ var DiamondHandsGraph = class {
63886
64962
  limit = 1e3,
63887
64963
  orderDirection = "desc"
63888
64964
  } = filter2 || {};
64965
+ const wantsEvent = (kind) => !eventTypes || eventTypes.includes(kind);
64966
+ const hasBounds = fromTimestamp !== void 0 || toTimestamp !== void 0 || fromBlock !== void 0 || toBlock !== void 0;
64967
+ const pageSize = hasBounds ? THE_GRAPH_MAX_BATCH_SIZE : limit;
64968
+ const buildPositionWhereClause = () => `where: { position: "${positionId.toLowerCase()}" }`;
63889
64969
  const shouldQuery = {
63890
- positionCreated: !eventTypes || eventTypes.includes("positionCreated"),
63891
- payment: !eventTypes || eventTypes.includes("payment"),
63892
- status: !eventTypes || eventTypes.includes("status"),
63893
- liquidation: !eventTypes || eventTypes.includes("liquidation"),
63894
- mint: !eventTypes || eventTypes.includes("mint"),
63895
- withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
63896
- renewal: !eventTypes || eventTypes.includes("renewal"),
63897
- operationFailure: !eventTypes || eventTypes.includes("operationFailure"),
63898
- mintRequest: !eventTypes || eventTypes.includes("mintRequest"),
63899
- burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
63900
- collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
63901
- mintingFee: !eventTypes || eventTypes.includes("mintingFee"),
63902
- renewalFee: !eventTypes || eventTypes.includes("renewalFee")
63903
- };
63904
- const buildPositionWhereClause = () => {
63905
- const conditions = [`position: "${positionId.toLowerCase()}"`];
63906
- if (fromTimestamp)
63907
- conditions.push(`timestamp_gte: "${fromTimestamp}"`);
63908
- if (toTimestamp)
63909
- conditions.push(`timestamp_lte: "${toTimestamp}"`);
63910
- if (fromBlock)
63911
- conditions.push(`blockNumber_gte: "${fromBlock}"`);
63912
- if (toBlock)
63913
- conditions.push(`blockNumber_lte: "${toBlock}"`);
63914
- return `where: { ${conditions.join(", ")} }`;
64970
+ positionCreated: true,
64971
+ payment: true,
64972
+ status: true,
64973
+ liquidation: true,
64974
+ mint: true,
64975
+ withdrawal: true,
64976
+ renewal: true,
64977
+ operationFailure: true,
64978
+ mintRequest: true,
64979
+ burnRequest: true,
64980
+ collateralEvent: true,
64981
+ mintingFee: true,
64982
+ renewalFee: true
63915
64983
  };
63916
64984
  const query = `
63917
64985
  query GetLoanEvents($positionId: Bytes!, $limit: Int!, $orderDirection: OrderDirection!) {
@@ -64147,11 +65215,41 @@ var DiamondHandsGraph = class {
64147
65215
  `;
64148
65216
  const variables = {
64149
65217
  positionId: positionId.toLowerCase(),
64150
- limit,
65218
+ limit: pageSize,
64151
65219
  orderDirection
64152
65220
  };
64153
65221
  const result = await this.client.execute(query, variables);
64154
- return this.assembleLoanEvents(positionId, result);
65222
+ if (hasBounds) {
65223
+ const collections = [
65224
+ ["payments", result.position?.payments],
65225
+ ["statusUpdates", result.position?.statusUpdates],
65226
+ ["withdrawals", result.position?.withdrawals],
65227
+ ["renewals", result.position?.renewals],
65228
+ ["operationFailures", result.position?.operationFailures],
65229
+ ["mintRequests", result.position?.mintRequests],
65230
+ ["burnRequests", result.position?.burnRequests],
65231
+ ["mintingFees", result.position?.mintingFees],
65232
+ ["renewalFees", result.position?.renewalFees],
65233
+ ["mints", result.ucdmintEvents],
65234
+ ["collateralEvents", result.collateralEvents]
65235
+ ];
65236
+ const saturated = collections.filter(([, list]) => (list?.length ?? 0) >= pageSize).map(([name]) => name);
65237
+ if (saturated.length > 0) {
65238
+ log.warn(
65239
+ "[DiamondHandsGraph] bounded getLoanEvents page saturated \u2014 the filtered history may be incomplete",
65240
+ { positionId, pageSize, saturated }
65241
+ );
65242
+ }
65243
+ }
65244
+ const assembled = this.assembleLoanEvents(positionId, result);
65245
+ return applyLoanEventsFilter(assembled, {
65246
+ wantsEvent,
65247
+ fromTimestamp,
65248
+ toTimestamp,
65249
+ fromBlock,
65250
+ toBlock,
65251
+ limit
65252
+ });
64155
65253
  }
64156
65254
  /**
64157
65255
  * Map one position's raw event payload into `LoanEvents`.
@@ -69954,7 +71052,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
69954
71052
  persistSession: config.sessionPersistence?.enabled,
69955
71053
  sessionStore: config.sessionPersistence?.store,
69956
71054
  onSignaturePrompt: config.onSessionSignaturePrompt,
69957
- onSignatureResolved: config.onSessionSignatureResolved
71055
+ onSignatureResolved: config.onSessionSignatureResolved,
71056
+ onSessionRestored: config.onSessionRestored
69958
71057
  });
69959
71058
  }
69960
71059
  const contractManagerResult = createContractManager({
@@ -83597,7 +84696,7 @@ mime-types/index.js:
83597
84696
  *)
83598
84697
 
83599
84698
  axios/dist/node/axios.cjs:
83600
- (*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
84699
+ (*! Axios v1.20.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
83601
84700
 
83602
84701
  safe-buffer/index.js:
83603
84702
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)