@sip-protocol/sdk 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/TransportWebUSB-TQ7WZ4LE.mjs +3098 -0
- package/dist/browser.d.mts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +3216 -35
- package/dist/browser.mjs +2 -1
- package/dist/chunk-KBS3OMSZ.mjs +14737 -0
- package/dist/chunk-TK3FWQNC.mjs +14737 -0
- package/dist/chunk-UJCSKKID.mjs +30 -0
- package/dist/index-05W_S8A7.d.mts +9237 -0
- package/dist/index-C5ehlFhR.d.mts +9443 -0
- package/dist/index-CNzhx-WH.d.mts +9316 -0
- package/dist/index-CqSppS4i.d.ts +9237 -0
- package/dist/index-DBa_jiZF.d.mts +9606 -0
- package/dist/index-DLNdSQFQ.d.ts +9316 -0
- package/dist/index-Ink8HnKW.d.ts +9606 -0
- package/dist/index-h7B23m5b.d.ts +9443 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3209 -28
- package/dist/index.mjs +2 -1
- package/dist/proofs/noir.mjs +1 -0
- package/package.json +15 -15
- package/src/crypto.ts +79 -9
- package/src/intent.ts +82 -4
- package/src/privacy.ts +88 -2
- package/src/sip.ts +324 -25
- package/src/stealth.ts +120 -9
- package/src/wallet/hardware/ledger.ts +1 -2
package/dist/browser.js
CHANGED
|
@@ -5,6 +5,12 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
8
14
|
var __export = (target, all) => {
|
|
9
15
|
for (var name in all)
|
|
10
16
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,17 +21,3167 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
21
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
22
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
23
|
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
// ../../node_modules/.pnpm/@ledgerhq+errors@6.27.0/node_modules/@ledgerhq/errors/lib-es/helpers.js
|
|
37
|
+
function isObject(value) {
|
|
38
|
+
return typeof value === "object";
|
|
39
|
+
}
|
|
40
|
+
var errorClasses, deserializers, addCustomErrorDeserializer, createCustomErrorClass;
|
|
41
|
+
var init_helpers = __esm({
|
|
42
|
+
"../../node_modules/.pnpm/@ledgerhq+errors@6.27.0/node_modules/@ledgerhq/errors/lib-es/helpers.js"() {
|
|
43
|
+
"use strict";
|
|
44
|
+
errorClasses = {};
|
|
45
|
+
deserializers = {};
|
|
46
|
+
addCustomErrorDeserializer = (name, deserializer) => {
|
|
47
|
+
deserializers[name] = deserializer;
|
|
48
|
+
};
|
|
49
|
+
createCustomErrorClass = (name) => {
|
|
50
|
+
class CustomErrorClass extends Error {
|
|
51
|
+
cause;
|
|
52
|
+
constructor(message, fields, options) {
|
|
53
|
+
super(message || name, options);
|
|
54
|
+
Object.setPrototypeOf(this, CustomErrorClass.prototype);
|
|
55
|
+
this.name = name;
|
|
56
|
+
if (fields) {
|
|
57
|
+
for (const k in fields) {
|
|
58
|
+
this[k] = fields[k];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (options && isObject(options) && "cause" in options && !this.cause) {
|
|
62
|
+
const cause = options.cause;
|
|
63
|
+
this.cause = cause;
|
|
64
|
+
if ("stack" in cause) {
|
|
65
|
+
this.stack = this.stack + "\nCAUSE: " + cause.stack;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
errorClasses[name] = CustomErrorClass;
|
|
71
|
+
return CustomErrorClass;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/.pnpm/@ledgerhq+errors@6.27.0/node_modules/@ledgerhq/errors/lib-es/index.js
|
|
77
|
+
function getAltStatusMessage(code) {
|
|
78
|
+
switch (code) {
|
|
79
|
+
// improve text of most common errors
|
|
80
|
+
case 26368:
|
|
81
|
+
return "Incorrect length";
|
|
82
|
+
case 26624:
|
|
83
|
+
return "Missing critical parameter";
|
|
84
|
+
case 27010:
|
|
85
|
+
return "Security not satisfied (dongle locked or have invalid access rights)";
|
|
86
|
+
case 27013:
|
|
87
|
+
return "Condition of use not satisfied (denied by the user?)";
|
|
88
|
+
case 27264:
|
|
89
|
+
return "Invalid data received";
|
|
90
|
+
case 27392:
|
|
91
|
+
return "Invalid parameter received";
|
|
92
|
+
case 21781:
|
|
93
|
+
return "Locked device";
|
|
94
|
+
}
|
|
95
|
+
if (28416 <= code && code <= 28671) {
|
|
96
|
+
return "Internal error, please report";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
var AccountNameRequiredError, AccountNotSupported, AccountAwaitingSendPendingOperations, AmountRequired, BluetoothRequired, BtcUnmatchedApp, CantOpenDevice, CashAddrNotSupported, ClaimRewardsFeesWarning, CurrencyNotSupported, DeviceAppVerifyNotSupported, DeviceGenuineSocketEarlyClose, DeviceNotGenuineError, DeviceOnDashboardExpected, DeviceOnDashboardUnexpected, DeviceInOSUExpected, DeviceHalted, DeviceNameInvalid, DeviceSocketFail, DeviceSocketNoBulkStatus, DeviceNeedsRestart, UnresponsiveDeviceError, DisconnectedDevice, DisconnectedDeviceDuringOperation, DeviceExtractOnboardingStateError, DeviceOnboardingStatePollingError, EnpointConfigError, EthAppPleaseEnableContractData, CeloAppPleaseEnableContractData, FeeEstimationFailed, FirmwareNotRecognized, HardResetFail, InvalidXRPTag, InvalidAddress, InvalidNonce, InvalidAddressBecauseDestinationIsAlsoSource, LatestMCUInstalledError, LatestFirmwareVersionRequired, UnknownMCU, LedgerAPIError, LedgerAPIErrorWithMessage, LedgerAPINotAvailable, ManagerAppAlreadyInstalledError, ManagerAppRelyOnBTCError, ManagerAppDepInstallRequired, ManagerAppDepUninstallRequired, ManagerDeviceLockedError, ManagerFirmwareNotEnoughSpaceError, ManagerNotEnoughSpaceError, ManagerUninstallBTCDep, NetworkDown, NetworkError2, NoAddressesFound, NotEnoughBalance, NotEnoughBalanceFees, NotEnoughBalanceSwap, NotEnoughBalanceToDelegate, UnstakeNotEnoughStakedBalanceLeft, RestakeNotEnoughStakedBalanceLeft, NotEnoughToRestake, NotEnoughToUnstake, NotEnoughBalanceInParentAccount, NotEnoughSpendableBalance, NotEnoughBalanceBecauseDestinationNotCreated, NotEnoughToStake, NoAccessToCamera, NotEnoughGas, NotEnoughGasSwap, TronEmptyAccount, MaybeKeepTronAccountAlive, NotSupportedLegacyAddress, GasLessThanEstimate, PriorityFeeTooLow, PriorityFeeTooHigh, PriorityFeeHigherThanMaxFee, MaxFeeTooLow, PasswordsDontMatchError, PasswordIncorrectError, RecommendSubAccountsToEmpty, RecommendUndelegation, TimeoutTagged, UnexpectedBootloader, MCUNotGenuineToDashboard, RecipientRequired, UnavailableTezosOriginatedAccountReceive, UnavailableTezosOriginatedAccountSend, UpdateFetchFileFail, UpdateIncorrectHash, UpdateIncorrectSig, UpdateYourApp, UserRefusedDeviceNameChange, UserRefusedAddress, UserRefusedFirmwareUpdate, UserRefusedAllowManager, UserRefusedOnDevice, PinNotSet, ExpertModeRequired, TransportOpenUserCancelled, TransportInterfaceNotAvailable, TransportRaceCondition, TransportWebUSBGestureRequired, TransactionHasBeenValidatedError, TransportExchangeTimeoutError, DeviceShouldStayInApp, WebsocketConnectionError, WebsocketConnectionFailed, WrongDeviceForAccount, WrongDeviceForAccountPayout, MissingSwapPayloadParamaters, WrongDeviceForAccountRefund, WrongAppForCurrency, ETHAddressNonEIP, CantScanQRCode, FeeNotLoaded, FeeNotLoadedSwap, FeeRequired, FeeTooHigh, PendingOperation, SyncError, PairingFailed, PeerRemovedPairing, GenuineCheckFailed, LedgerAPI4xx, LedgerAPI5xx, FirmwareOrAppUpdateRequired, ReplacementTransactionUnderpriced, OpReturnDataSizeLimit, DustLimit, LanguageNotFound, NoDBPathGiven, DBWrongPassword, DBNotReset, SequenceNumberError, DisabledTransactionBroadcastError, HwTransportErrorType, TransportError, StatusCodes, TransportStatusError, LockedDeviceError;
|
|
100
|
+
var init_lib_es = __esm({
|
|
101
|
+
"../../node_modules/.pnpm/@ledgerhq+errors@6.27.0/node_modules/@ledgerhq/errors/lib-es/index.js"() {
|
|
102
|
+
"use strict";
|
|
103
|
+
init_helpers();
|
|
104
|
+
AccountNameRequiredError = createCustomErrorClass("AccountNameRequired");
|
|
105
|
+
AccountNotSupported = createCustomErrorClass("AccountNotSupported");
|
|
106
|
+
AccountAwaitingSendPendingOperations = createCustomErrorClass("AccountAwaitingSendPendingOperations");
|
|
107
|
+
AmountRequired = createCustomErrorClass("AmountRequired");
|
|
108
|
+
BluetoothRequired = createCustomErrorClass("BluetoothRequired");
|
|
109
|
+
BtcUnmatchedApp = createCustomErrorClass("BtcUnmatchedApp");
|
|
110
|
+
CantOpenDevice = createCustomErrorClass("CantOpenDevice");
|
|
111
|
+
CashAddrNotSupported = createCustomErrorClass("CashAddrNotSupported");
|
|
112
|
+
ClaimRewardsFeesWarning = createCustomErrorClass("ClaimRewardsFeesWarning");
|
|
113
|
+
CurrencyNotSupported = createCustomErrorClass("CurrencyNotSupported");
|
|
114
|
+
DeviceAppVerifyNotSupported = createCustomErrorClass("DeviceAppVerifyNotSupported");
|
|
115
|
+
DeviceGenuineSocketEarlyClose = createCustomErrorClass("DeviceGenuineSocketEarlyClose");
|
|
116
|
+
DeviceNotGenuineError = createCustomErrorClass("DeviceNotGenuine");
|
|
117
|
+
DeviceOnDashboardExpected = createCustomErrorClass("DeviceOnDashboardExpected");
|
|
118
|
+
DeviceOnDashboardUnexpected = createCustomErrorClass("DeviceOnDashboardUnexpected");
|
|
119
|
+
DeviceInOSUExpected = createCustomErrorClass("DeviceInOSUExpected");
|
|
120
|
+
DeviceHalted = createCustomErrorClass("DeviceHalted");
|
|
121
|
+
DeviceNameInvalid = createCustomErrorClass("DeviceNameInvalid");
|
|
122
|
+
DeviceSocketFail = createCustomErrorClass("DeviceSocketFail");
|
|
123
|
+
DeviceSocketNoBulkStatus = createCustomErrorClass("DeviceSocketNoBulkStatus");
|
|
124
|
+
DeviceNeedsRestart = createCustomErrorClass("DeviceSocketNoBulkStatus");
|
|
125
|
+
UnresponsiveDeviceError = createCustomErrorClass("UnresponsiveDeviceError");
|
|
126
|
+
DisconnectedDevice = createCustomErrorClass("DisconnectedDevice");
|
|
127
|
+
DisconnectedDeviceDuringOperation = createCustomErrorClass("DisconnectedDeviceDuringOperation");
|
|
128
|
+
DeviceExtractOnboardingStateError = createCustomErrorClass("DeviceExtractOnboardingStateError");
|
|
129
|
+
DeviceOnboardingStatePollingError = createCustomErrorClass("DeviceOnboardingStatePollingError");
|
|
130
|
+
EnpointConfigError = createCustomErrorClass("EnpointConfig");
|
|
131
|
+
EthAppPleaseEnableContractData = createCustomErrorClass("EthAppPleaseEnableContractData");
|
|
132
|
+
CeloAppPleaseEnableContractData = createCustomErrorClass("CeloAppPleaseEnableContractData");
|
|
133
|
+
FeeEstimationFailed = createCustomErrorClass("FeeEstimationFailed");
|
|
134
|
+
FirmwareNotRecognized = createCustomErrorClass("FirmwareNotRecognized");
|
|
135
|
+
HardResetFail = createCustomErrorClass("HardResetFail");
|
|
136
|
+
InvalidXRPTag = createCustomErrorClass("InvalidXRPTag");
|
|
137
|
+
InvalidAddress = createCustomErrorClass("InvalidAddress");
|
|
138
|
+
InvalidNonce = createCustomErrorClass("InvalidNonce");
|
|
139
|
+
InvalidAddressBecauseDestinationIsAlsoSource = createCustomErrorClass("InvalidAddressBecauseDestinationIsAlsoSource");
|
|
140
|
+
LatestMCUInstalledError = createCustomErrorClass("LatestMCUInstalledError");
|
|
141
|
+
LatestFirmwareVersionRequired = createCustomErrorClass("LatestFirmwareVersionRequired");
|
|
142
|
+
UnknownMCU = createCustomErrorClass("UnknownMCU");
|
|
143
|
+
LedgerAPIError = createCustomErrorClass("LedgerAPIError");
|
|
144
|
+
LedgerAPIErrorWithMessage = createCustomErrorClass("LedgerAPIErrorWithMessage");
|
|
145
|
+
LedgerAPINotAvailable = createCustomErrorClass("LedgerAPINotAvailable");
|
|
146
|
+
ManagerAppAlreadyInstalledError = createCustomErrorClass("ManagerAppAlreadyInstalled");
|
|
147
|
+
ManagerAppRelyOnBTCError = createCustomErrorClass("ManagerAppRelyOnBTC");
|
|
148
|
+
ManagerAppDepInstallRequired = createCustomErrorClass("ManagerAppDepInstallRequired");
|
|
149
|
+
ManagerAppDepUninstallRequired = createCustomErrorClass("ManagerAppDepUninstallRequired");
|
|
150
|
+
ManagerDeviceLockedError = createCustomErrorClass("ManagerDeviceLocked");
|
|
151
|
+
ManagerFirmwareNotEnoughSpaceError = createCustomErrorClass("ManagerFirmwareNotEnoughSpace");
|
|
152
|
+
ManagerNotEnoughSpaceError = createCustomErrorClass("ManagerNotEnoughSpace");
|
|
153
|
+
ManagerUninstallBTCDep = createCustomErrorClass("ManagerUninstallBTCDep");
|
|
154
|
+
NetworkDown = createCustomErrorClass("NetworkDown");
|
|
155
|
+
NetworkError2 = createCustomErrorClass("NetworkError");
|
|
156
|
+
NoAddressesFound = createCustomErrorClass("NoAddressesFound");
|
|
157
|
+
NotEnoughBalance = createCustomErrorClass("NotEnoughBalance");
|
|
158
|
+
NotEnoughBalanceFees = createCustomErrorClass("NotEnoughBalanceFees");
|
|
159
|
+
NotEnoughBalanceSwap = createCustomErrorClass("NotEnoughBalanceSwap");
|
|
160
|
+
NotEnoughBalanceToDelegate = createCustomErrorClass("NotEnoughBalanceToDelegate");
|
|
161
|
+
UnstakeNotEnoughStakedBalanceLeft = createCustomErrorClass("UnstakeNotEnoughStakedBalanceLeft");
|
|
162
|
+
RestakeNotEnoughStakedBalanceLeft = createCustomErrorClass("RestakeNotEnoughStakedBalanceLeft");
|
|
163
|
+
NotEnoughToRestake = createCustomErrorClass("NotEnoughToRestake");
|
|
164
|
+
NotEnoughToUnstake = createCustomErrorClass("NotEnoughToUnstake");
|
|
165
|
+
NotEnoughBalanceInParentAccount = createCustomErrorClass("NotEnoughBalanceInParentAccount");
|
|
166
|
+
NotEnoughSpendableBalance = createCustomErrorClass("NotEnoughSpendableBalance");
|
|
167
|
+
NotEnoughBalanceBecauseDestinationNotCreated = createCustomErrorClass("NotEnoughBalanceBecauseDestinationNotCreated");
|
|
168
|
+
NotEnoughToStake = createCustomErrorClass("NotEnoughToStake");
|
|
169
|
+
NoAccessToCamera = createCustomErrorClass("NoAccessToCamera");
|
|
170
|
+
NotEnoughGas = createCustomErrorClass("NotEnoughGas");
|
|
171
|
+
NotEnoughGasSwap = createCustomErrorClass("NotEnoughGasSwap");
|
|
172
|
+
TronEmptyAccount = createCustomErrorClass("TronEmptyAccount");
|
|
173
|
+
MaybeKeepTronAccountAlive = createCustomErrorClass("MaybeKeepTronAccountAlive");
|
|
174
|
+
NotSupportedLegacyAddress = createCustomErrorClass("NotSupportedLegacyAddress");
|
|
175
|
+
GasLessThanEstimate = createCustomErrorClass("GasLessThanEstimate");
|
|
176
|
+
PriorityFeeTooLow = createCustomErrorClass("PriorityFeeTooLow");
|
|
177
|
+
PriorityFeeTooHigh = createCustomErrorClass("PriorityFeeTooHigh");
|
|
178
|
+
PriorityFeeHigherThanMaxFee = createCustomErrorClass("PriorityFeeHigherThanMaxFee");
|
|
179
|
+
MaxFeeTooLow = createCustomErrorClass("MaxFeeTooLow");
|
|
180
|
+
PasswordsDontMatchError = createCustomErrorClass("PasswordsDontMatch");
|
|
181
|
+
PasswordIncorrectError = createCustomErrorClass("PasswordIncorrect");
|
|
182
|
+
RecommendSubAccountsToEmpty = createCustomErrorClass("RecommendSubAccountsToEmpty");
|
|
183
|
+
RecommendUndelegation = createCustomErrorClass("RecommendUndelegation");
|
|
184
|
+
TimeoutTagged = createCustomErrorClass("TimeoutTagged");
|
|
185
|
+
UnexpectedBootloader = createCustomErrorClass("UnexpectedBootloader");
|
|
186
|
+
MCUNotGenuineToDashboard = createCustomErrorClass("MCUNotGenuineToDashboard");
|
|
187
|
+
RecipientRequired = createCustomErrorClass("RecipientRequired");
|
|
188
|
+
UnavailableTezosOriginatedAccountReceive = createCustomErrorClass("UnavailableTezosOriginatedAccountReceive");
|
|
189
|
+
UnavailableTezosOriginatedAccountSend = createCustomErrorClass("UnavailableTezosOriginatedAccountSend");
|
|
190
|
+
UpdateFetchFileFail = createCustomErrorClass("UpdateFetchFileFail");
|
|
191
|
+
UpdateIncorrectHash = createCustomErrorClass("UpdateIncorrectHash");
|
|
192
|
+
UpdateIncorrectSig = createCustomErrorClass("UpdateIncorrectSig");
|
|
193
|
+
UpdateYourApp = createCustomErrorClass("UpdateYourApp");
|
|
194
|
+
UserRefusedDeviceNameChange = createCustomErrorClass("UserRefusedDeviceNameChange");
|
|
195
|
+
UserRefusedAddress = createCustomErrorClass("UserRefusedAddress");
|
|
196
|
+
UserRefusedFirmwareUpdate = createCustomErrorClass("UserRefusedFirmwareUpdate");
|
|
197
|
+
UserRefusedAllowManager = createCustomErrorClass("UserRefusedAllowManager");
|
|
198
|
+
UserRefusedOnDevice = createCustomErrorClass("UserRefusedOnDevice");
|
|
199
|
+
PinNotSet = createCustomErrorClass("PinNotSet");
|
|
200
|
+
ExpertModeRequired = createCustomErrorClass("ExpertModeRequired");
|
|
201
|
+
TransportOpenUserCancelled = createCustomErrorClass("TransportOpenUserCancelled");
|
|
202
|
+
TransportInterfaceNotAvailable = createCustomErrorClass("TransportInterfaceNotAvailable");
|
|
203
|
+
TransportRaceCondition = createCustomErrorClass("TransportRaceCondition");
|
|
204
|
+
TransportWebUSBGestureRequired = createCustomErrorClass("TransportWebUSBGestureRequired");
|
|
205
|
+
TransactionHasBeenValidatedError = createCustomErrorClass("TransactionHasBeenValidatedError");
|
|
206
|
+
TransportExchangeTimeoutError = createCustomErrorClass("TransportExchangeTimeoutError");
|
|
207
|
+
DeviceShouldStayInApp = createCustomErrorClass("DeviceShouldStayInApp");
|
|
208
|
+
WebsocketConnectionError = createCustomErrorClass("WebsocketConnectionError");
|
|
209
|
+
WebsocketConnectionFailed = createCustomErrorClass("WebsocketConnectionFailed");
|
|
210
|
+
WrongDeviceForAccount = createCustomErrorClass("WrongDeviceForAccount");
|
|
211
|
+
WrongDeviceForAccountPayout = createCustomErrorClass("WrongDeviceForAccountPayout");
|
|
212
|
+
MissingSwapPayloadParamaters = createCustomErrorClass("MissingSwapPayloadParamaters");
|
|
213
|
+
WrongDeviceForAccountRefund = createCustomErrorClass("WrongDeviceForAccountRefund");
|
|
214
|
+
WrongAppForCurrency = createCustomErrorClass("WrongAppForCurrency");
|
|
215
|
+
ETHAddressNonEIP = createCustomErrorClass("ETHAddressNonEIP");
|
|
216
|
+
CantScanQRCode = createCustomErrorClass("CantScanQRCode");
|
|
217
|
+
FeeNotLoaded = createCustomErrorClass("FeeNotLoaded");
|
|
218
|
+
FeeNotLoadedSwap = createCustomErrorClass("FeeNotLoadedSwap");
|
|
219
|
+
FeeRequired = createCustomErrorClass("FeeRequired");
|
|
220
|
+
FeeTooHigh = createCustomErrorClass("FeeTooHigh");
|
|
221
|
+
PendingOperation = createCustomErrorClass("PendingOperation");
|
|
222
|
+
SyncError = createCustomErrorClass("SyncError");
|
|
223
|
+
PairingFailed = createCustomErrorClass("PairingFailed");
|
|
224
|
+
PeerRemovedPairing = createCustomErrorClass("PeerRemovedPairing");
|
|
225
|
+
GenuineCheckFailed = createCustomErrorClass("GenuineCheckFailed");
|
|
226
|
+
LedgerAPI4xx = createCustomErrorClass("LedgerAPI4xx");
|
|
227
|
+
LedgerAPI5xx = createCustomErrorClass("LedgerAPI5xx");
|
|
228
|
+
FirmwareOrAppUpdateRequired = createCustomErrorClass("FirmwareOrAppUpdateRequired");
|
|
229
|
+
ReplacementTransactionUnderpriced = createCustomErrorClass("ReplacementTransactionUnderpriced");
|
|
230
|
+
OpReturnDataSizeLimit = createCustomErrorClass("OpReturnSizeLimit");
|
|
231
|
+
DustLimit = createCustomErrorClass("DustLimit");
|
|
232
|
+
LanguageNotFound = createCustomErrorClass("LanguageNotFound");
|
|
233
|
+
NoDBPathGiven = createCustomErrorClass("NoDBPathGiven");
|
|
234
|
+
DBWrongPassword = createCustomErrorClass("DBWrongPassword");
|
|
235
|
+
DBNotReset = createCustomErrorClass("DBNotReset");
|
|
236
|
+
SequenceNumberError = createCustomErrorClass("SequenceNumberError");
|
|
237
|
+
DisabledTransactionBroadcastError = createCustomErrorClass("DisabledTransactionBroadcastError");
|
|
238
|
+
(function(HwTransportErrorType2) {
|
|
239
|
+
HwTransportErrorType2["Unknown"] = "Unknown";
|
|
240
|
+
HwTransportErrorType2["LocationServicesDisabled"] = "LocationServicesDisabled";
|
|
241
|
+
HwTransportErrorType2["LocationServicesUnauthorized"] = "LocationServicesUnauthorized";
|
|
242
|
+
HwTransportErrorType2["BluetoothScanStartFailed"] = "BluetoothScanStartFailed";
|
|
243
|
+
})(HwTransportErrorType || (HwTransportErrorType = {}));
|
|
244
|
+
TransportError = class extends Error {
|
|
245
|
+
id;
|
|
246
|
+
constructor(message, id2) {
|
|
247
|
+
const name = "TransportError";
|
|
248
|
+
super(message || name);
|
|
249
|
+
this.name = name;
|
|
250
|
+
this.message = message;
|
|
251
|
+
this.stack = new Error(message).stack;
|
|
252
|
+
this.id = id2;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
addCustomErrorDeserializer("TransportError", (e) => new TransportError(e.message, e.id));
|
|
256
|
+
StatusCodes = {
|
|
257
|
+
ACCESS_CONDITION_NOT_FULFILLED: 38916,
|
|
258
|
+
ALGORITHM_NOT_SUPPORTED: 38020,
|
|
259
|
+
CLA_NOT_SUPPORTED: 28160,
|
|
260
|
+
CODE_BLOCKED: 38976,
|
|
261
|
+
CODE_NOT_INITIALIZED: 38914,
|
|
262
|
+
COMMAND_INCOMPATIBLE_FILE_STRUCTURE: 27009,
|
|
263
|
+
CONDITIONS_OF_USE_NOT_SATISFIED: 27013,
|
|
264
|
+
CONTRADICTION_INVALIDATION: 38928,
|
|
265
|
+
CONTRADICTION_SECRET_CODE_STATUS: 38920,
|
|
266
|
+
DEVICE_IN_RECOVERY_MODE: 26159,
|
|
267
|
+
CUSTOM_IMAGE_EMPTY: 26158,
|
|
268
|
+
FILE_ALREADY_EXISTS: 27273,
|
|
269
|
+
FILE_NOT_FOUND: 37892,
|
|
270
|
+
GP_AUTH_FAILED: 25344,
|
|
271
|
+
HALTED: 28586,
|
|
272
|
+
INCONSISTENT_FILE: 37896,
|
|
273
|
+
INCORRECT_DATA: 27264,
|
|
274
|
+
INCORRECT_LENGTH: 26368,
|
|
275
|
+
INCORRECT_P1_P2: 27392,
|
|
276
|
+
INS_NOT_SUPPORTED: 27904,
|
|
277
|
+
DEVICE_NOT_ONBOARDED: 27911,
|
|
278
|
+
DEVICE_NOT_ONBOARDED_2: 26129,
|
|
279
|
+
INVALID_KCV: 38021,
|
|
280
|
+
INVALID_OFFSET: 37890,
|
|
281
|
+
LICENSING: 28482,
|
|
282
|
+
LOCKED_DEVICE: 21781,
|
|
283
|
+
MAX_VALUE_REACHED: 38992,
|
|
284
|
+
MEMORY_PROBLEM: 37440,
|
|
285
|
+
MISSING_CRITICAL_PARAMETER: 26624,
|
|
286
|
+
NO_EF_SELECTED: 37888,
|
|
287
|
+
NOT_ENOUGH_MEMORY_SPACE: 27268,
|
|
288
|
+
OK: 36864,
|
|
289
|
+
PIN_REMAINING_ATTEMPTS: 25536,
|
|
290
|
+
REFERENCED_DATA_NOT_FOUND: 27272,
|
|
291
|
+
SECURITY_STATUS_NOT_SATISFIED: 27010,
|
|
292
|
+
TECHNICAL_PROBLEM: 28416,
|
|
293
|
+
UNKNOWN_APDU: 27906,
|
|
294
|
+
USER_REFUSED_ON_DEVICE: 21761,
|
|
295
|
+
NOT_ENOUGH_SPACE: 20738,
|
|
296
|
+
APP_NOT_FOUND_OR_INVALID_CONTEXT: 20771,
|
|
297
|
+
INVALID_APP_NAME_LENGTH: 26378,
|
|
298
|
+
GEN_AES_KEY_FAILED: 21529,
|
|
299
|
+
INTERNAL_CRYPTO_OPERATION_FAILED: 21530,
|
|
300
|
+
INTERNAL_COMPUTE_AES_CMAC_FAILED: 21531,
|
|
301
|
+
ENCRYPT_APP_STORAGE_FAILED: 21532,
|
|
302
|
+
INVALID_BACKUP_STATE: 26178,
|
|
303
|
+
PIN_NOT_SET: 21762,
|
|
304
|
+
INVALID_BACKUP_LENGTH: 26419,
|
|
305
|
+
INVALID_RESTORE_STATE: 26179,
|
|
306
|
+
INVALID_CHUNK_LENGTH: 26420,
|
|
307
|
+
INVALID_BACKUP_HEADER: 26698,
|
|
308
|
+
// Not documented:
|
|
309
|
+
TRUSTCHAIN_WRONG_SEED: 45063
|
|
310
|
+
};
|
|
311
|
+
TransportStatusError = class _TransportStatusError extends Error {
|
|
312
|
+
statusCode;
|
|
313
|
+
statusText;
|
|
314
|
+
/**
|
|
315
|
+
* @param statusCode The error status code coming from a Transport implementation
|
|
316
|
+
* @param options containing:
|
|
317
|
+
* - canBeMappedToChildError: enable the mapping of TransportStatusError to an error extending/inheriting from it
|
|
318
|
+
* . Ex: LockedDeviceError. Default to true.
|
|
319
|
+
*/
|
|
320
|
+
constructor(statusCode, { canBeMappedToChildError = true } = {}) {
|
|
321
|
+
const statusText = Object.keys(StatusCodes).find((k) => StatusCodes[k] === statusCode) || "UNKNOWN_ERROR";
|
|
322
|
+
const smsg = getAltStatusMessage(statusCode) || statusText;
|
|
323
|
+
const statusCodeStr = statusCode.toString(16);
|
|
324
|
+
const message = `Ledger device: ${smsg} (0x${statusCodeStr})`;
|
|
325
|
+
super(message);
|
|
326
|
+
this.name = "TransportStatusError";
|
|
327
|
+
this.statusCode = statusCode;
|
|
328
|
+
this.statusText = statusText;
|
|
329
|
+
Object.setPrototypeOf(this, _TransportStatusError.prototype);
|
|
330
|
+
if (canBeMappedToChildError && statusCode === StatusCodes.LOCKED_DEVICE) {
|
|
331
|
+
return new LockedDeviceError(message);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
LockedDeviceError = class _LockedDeviceError extends TransportStatusError {
|
|
336
|
+
constructor(message) {
|
|
337
|
+
super(StatusCodes.LOCKED_DEVICE, { canBeMappedToChildError: false });
|
|
338
|
+
if (message) {
|
|
339
|
+
this.message = message;
|
|
340
|
+
}
|
|
341
|
+
this.name = "LockedDeviceError";
|
|
342
|
+
Object.setPrototypeOf(this, _LockedDeviceError.prototype);
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
addCustomErrorDeserializer("TransportStatusError", (e) => new TransportStatusError(e.statusCode));
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// ../../node_modules/.pnpm/@ledgerhq+logs@6.13.0/node_modules/@ledgerhq/logs/lib-es/index.js
|
|
350
|
+
function dispatch(log2) {
|
|
351
|
+
for (let i = 0; i < subscribers.length; i++) {
|
|
352
|
+
try {
|
|
353
|
+
subscribers[i](log2);
|
|
354
|
+
} catch (e) {
|
|
355
|
+
console.error(e);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
var id, subscribers, log, trace, LocalTracer, listen;
|
|
360
|
+
var init_lib_es2 = __esm({
|
|
361
|
+
"../../node_modules/.pnpm/@ledgerhq+logs@6.13.0/node_modules/@ledgerhq/logs/lib-es/index.js"() {
|
|
362
|
+
"use strict";
|
|
363
|
+
id = 0;
|
|
364
|
+
subscribers = [];
|
|
365
|
+
log = (type, message, data) => {
|
|
366
|
+
const obj = {
|
|
367
|
+
type,
|
|
368
|
+
id: String(++id),
|
|
369
|
+
date: /* @__PURE__ */ new Date()
|
|
370
|
+
};
|
|
371
|
+
if (message)
|
|
372
|
+
obj.message = message;
|
|
373
|
+
if (data)
|
|
374
|
+
obj.data = data;
|
|
375
|
+
dispatch(obj);
|
|
376
|
+
};
|
|
377
|
+
trace = ({ type, message, data, context }) => {
|
|
378
|
+
const obj = {
|
|
379
|
+
type,
|
|
380
|
+
id: String(++id),
|
|
381
|
+
date: /* @__PURE__ */ new Date()
|
|
382
|
+
};
|
|
383
|
+
if (message)
|
|
384
|
+
obj.message = message;
|
|
385
|
+
if (data)
|
|
386
|
+
obj.data = data;
|
|
387
|
+
if (context)
|
|
388
|
+
obj.context = context;
|
|
389
|
+
dispatch(obj);
|
|
390
|
+
};
|
|
391
|
+
LocalTracer = class _LocalTracer {
|
|
392
|
+
type;
|
|
393
|
+
context;
|
|
394
|
+
constructor(type, context) {
|
|
395
|
+
this.type = type;
|
|
396
|
+
this.context = context;
|
|
397
|
+
}
|
|
398
|
+
trace(message, data) {
|
|
399
|
+
trace({
|
|
400
|
+
type: this.type,
|
|
401
|
+
message,
|
|
402
|
+
data,
|
|
403
|
+
context: this.context
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
getContext() {
|
|
407
|
+
return this.context;
|
|
408
|
+
}
|
|
409
|
+
setContext(context) {
|
|
410
|
+
this.context = context;
|
|
411
|
+
}
|
|
412
|
+
updateContext(contextToAdd) {
|
|
413
|
+
this.context = { ...this.context, ...contextToAdd };
|
|
414
|
+
}
|
|
415
|
+
getType() {
|
|
416
|
+
return this.type;
|
|
417
|
+
}
|
|
418
|
+
setType(type) {
|
|
419
|
+
this.type = type;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Create a new instance of the LocalTracer with an updated `type`
|
|
423
|
+
*
|
|
424
|
+
* It does not mutate the calling instance, but returns a new LocalTracer,
|
|
425
|
+
* following a simple builder pattern.
|
|
426
|
+
*/
|
|
427
|
+
withType(type) {
|
|
428
|
+
return new _LocalTracer(type, this.context);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Create a new instance of the LocalTracer with a new `context`
|
|
432
|
+
*
|
|
433
|
+
* It does not mutate the calling instance, but returns a new LocalTracer,
|
|
434
|
+
* following a simple builder pattern.
|
|
435
|
+
*
|
|
436
|
+
* @param context A TraceContext, that can undefined to reset the context
|
|
437
|
+
*/
|
|
438
|
+
withContext(context) {
|
|
439
|
+
return new _LocalTracer(this.type, context);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Create a new instance of the LocalTracer with an updated `context`,
|
|
443
|
+
* on which an additional context is merged with the existing one.
|
|
444
|
+
*
|
|
445
|
+
* It does not mutate the calling instance, but returns a new LocalTracer,
|
|
446
|
+
* following a simple builder pattern.
|
|
447
|
+
*/
|
|
448
|
+
withUpdatedContext(contextToAdd) {
|
|
449
|
+
return new _LocalTracer(this.type, { ...this.context, ...contextToAdd });
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
listen = (cb) => {
|
|
453
|
+
subscribers.push(cb);
|
|
454
|
+
return () => {
|
|
455
|
+
const i = subscribers.indexOf(cb);
|
|
456
|
+
if (i !== -1) {
|
|
457
|
+
subscribers[i] = subscribers[subscribers.length - 1];
|
|
458
|
+
subscribers.pop();
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
if (typeof window !== "undefined") {
|
|
463
|
+
window.__ledgerLogsListen = listen;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// ../../node_modules/.pnpm/@ledgerhq+hw-transport@6.31.13/node_modules/@ledgerhq/hw-transport/lib-es/Transport.js
|
|
469
|
+
var import_events, DEFAULT_LOG_TYPE, Transport;
|
|
470
|
+
var init_Transport = __esm({
|
|
471
|
+
"../../node_modules/.pnpm/@ledgerhq+hw-transport@6.31.13/node_modules/@ledgerhq/hw-transport/lib-es/Transport.js"() {
|
|
472
|
+
"use strict";
|
|
473
|
+
import_events = __toESM(require("events"));
|
|
474
|
+
init_lib_es();
|
|
475
|
+
init_lib_es2();
|
|
476
|
+
DEFAULT_LOG_TYPE = "transport";
|
|
477
|
+
Transport = class {
|
|
478
|
+
exchangeTimeout = 3e4;
|
|
479
|
+
unresponsiveTimeout = 15e3;
|
|
480
|
+
deviceModel = null;
|
|
481
|
+
tracer;
|
|
482
|
+
constructor({ context, logType } = {}) {
|
|
483
|
+
this.tracer = new LocalTracer(logType ?? DEFAULT_LOG_TYPE, context);
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Check if the transport is supported on the current platform/browser.
|
|
487
|
+
* @returns {Promise<boolean>} A promise that resolves with a boolean indicating support.
|
|
488
|
+
*/
|
|
489
|
+
static isSupported;
|
|
490
|
+
/**
|
|
491
|
+
* List all available descriptors for the transport.
|
|
492
|
+
* For a better granularity, checkout `listen()`.
|
|
493
|
+
*
|
|
494
|
+
* @returns {Promise<Array<any>>} A promise that resolves with an array of descriptors.
|
|
495
|
+
* @example
|
|
496
|
+
* TransportFoo.list().then(descriptors => ...)
|
|
497
|
+
*/
|
|
498
|
+
static list;
|
|
499
|
+
/**
|
|
500
|
+
* Listen for device events for the transport. The method takes an observer of DescriptorEvent and returns a Subscription.
|
|
501
|
+
* A DescriptorEvent is an object containing a "descriptor" and a "type" field. The "type" field can be "add" or "remove", and the "descriptor" field can be passed to the "open" method.
|
|
502
|
+
* The "listen" method will first emit all currently connected devices and then will emit events as they occur, such as when a USB device is plugged in or a Bluetooth device becomes discoverable.
|
|
503
|
+
* @param {Observer<DescriptorEvent<any>>} observer - An object with "next", "error", and "complete" functions, following the observer pattern.
|
|
504
|
+
* @returns {Subscription} A Subscription object on which you can call ".unsubscribe()" to stop listening to descriptors.
|
|
505
|
+
* @example
|
|
506
|
+
const sub = TransportFoo.listen({
|
|
507
|
+
next: e => {
|
|
508
|
+
if (e.type==="add") {
|
|
509
|
+
sub.unsubscribe();
|
|
510
|
+
const transport = await TransportFoo.open(e.descriptor);
|
|
511
|
+
...
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
error: error => {},
|
|
515
|
+
complete: () => {}
|
|
516
|
+
})
|
|
517
|
+
*/
|
|
518
|
+
static listen;
|
|
519
|
+
/**
|
|
520
|
+
* Attempt to create a Transport instance with a specific descriptor.
|
|
521
|
+
* @param {any} descriptor - The descriptor to open the transport with.
|
|
522
|
+
* @param {number} timeout - An optional timeout for the transport connection.
|
|
523
|
+
* @param {TraceContext} context Optional tracing/log context
|
|
524
|
+
* @returns {Promise<Transport>} A promise that resolves with a Transport instance.
|
|
525
|
+
* @example
|
|
526
|
+
TransportFoo.open(descriptor).then(transport => ...)
|
|
527
|
+
*/
|
|
528
|
+
static open;
|
|
529
|
+
/**
|
|
530
|
+
* Send data to the device using a low level API.
|
|
531
|
+
* It's recommended to use the "send" method for a higher level API.
|
|
532
|
+
* @param {Buffer} apdu - The data to send.
|
|
533
|
+
* @param {Object} options - Contains optional options for the exchange function
|
|
534
|
+
* - abortTimeoutMs: stop the exchange after a given timeout. Another timeout exists
|
|
535
|
+
* to detect unresponsive device (see `unresponsiveTimeout`). This timeout aborts the exchange.
|
|
536
|
+
* @returns {Promise<Buffer>} A promise that resolves with the response data from the device.
|
|
537
|
+
*/
|
|
538
|
+
exchange(_apdu, { abortTimeoutMs: _abortTimeoutMs } = {}) {
|
|
539
|
+
throw new Error("exchange not implemented");
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Send apdus in batch to the device using a low level API.
|
|
543
|
+
* The default implementation is to call exchange for each apdu.
|
|
544
|
+
* @param {Array<Buffer>} apdus - array of apdus to send.
|
|
545
|
+
* @param {Observer<Buffer>} observer - an observer that will receive the response of each apdu.
|
|
546
|
+
* @returns {Subscription} A Subscription object on which you can call ".unsubscribe()" to stop sending apdus.
|
|
547
|
+
*/
|
|
548
|
+
exchangeBulk(apdus, observer) {
|
|
549
|
+
let unsubscribed = false;
|
|
550
|
+
const unsubscribe = () => {
|
|
551
|
+
unsubscribed = true;
|
|
552
|
+
};
|
|
553
|
+
const main = async () => {
|
|
554
|
+
if (unsubscribed)
|
|
555
|
+
return;
|
|
556
|
+
for (const apdu of apdus) {
|
|
557
|
+
const r = await this.exchange(apdu);
|
|
558
|
+
if (unsubscribed)
|
|
559
|
+
return;
|
|
560
|
+
const status = r.readUInt16BE(r.length - 2);
|
|
561
|
+
if (status !== StatusCodes.OK) {
|
|
562
|
+
throw new TransportStatusError(status);
|
|
563
|
+
}
|
|
564
|
+
observer.next(r);
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
main().then(() => !unsubscribed && observer.complete(), (e) => !unsubscribed && observer.error(e));
|
|
568
|
+
return { unsubscribe };
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Set the "scramble key" for the next data exchanges with the device.
|
|
572
|
+
* Each app can have a different scramble key and it is set internally during instantiation.
|
|
573
|
+
* @param {string} key - The scramble key to set.
|
|
574
|
+
* deprecated This method is no longer needed for modern transports and should be migrated away from.
|
|
575
|
+
* no @ before deprecated as it breaks documentationjs on version 14.0.2
|
|
576
|
+
* https://github.com/documentationjs/documentation/issues/1596
|
|
577
|
+
*/
|
|
578
|
+
setScrambleKey(_key) {
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Close the connection with the device.
|
|
582
|
+
*
|
|
583
|
+
* Note: for certain transports (hw-transport-node-hid-singleton for ex), once the promise resolved,
|
|
584
|
+
* the transport instance is actually still cached, and the device is disconnected only after a defined timeout.
|
|
585
|
+
* But for the consumer of the Transport, this does not matter and it can consider the transport to be closed.
|
|
586
|
+
*
|
|
587
|
+
* @returns {Promise<void>} A promise that resolves when the transport is closed.
|
|
588
|
+
*/
|
|
589
|
+
close() {
|
|
590
|
+
return Promise.resolve();
|
|
591
|
+
}
|
|
592
|
+
_events = new import_events.default();
|
|
593
|
+
/**
|
|
594
|
+
* Listen for an event on the transport instance.
|
|
595
|
+
* Transport implementations may have specific events. Common events include:
|
|
596
|
+
* "disconnect" : triggered when the transport is disconnected.
|
|
597
|
+
* @param {string} eventName - The name of the event to listen for.
|
|
598
|
+
* @param {(...args: Array<any>) => any} cb - The callback function to be invoked when the event occurs.
|
|
599
|
+
*/
|
|
600
|
+
on(eventName, cb) {
|
|
601
|
+
this._events.on(eventName, cb);
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Stop listening to an event on an instance of transport.
|
|
605
|
+
*/
|
|
606
|
+
off(eventName, cb) {
|
|
607
|
+
this._events.removeListener(eventName, cb);
|
|
608
|
+
}
|
|
609
|
+
emit(event, ...args) {
|
|
610
|
+
this._events.emit(event, ...args);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Enable or not logs of the binary exchange
|
|
614
|
+
*/
|
|
615
|
+
setDebugMode() {
|
|
616
|
+
console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.");
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Set a timeout (in milliseconds) for the exchange call. Only some transport might implement it. (e.g. U2F)
|
|
620
|
+
*/
|
|
621
|
+
setExchangeTimeout(exchangeTimeout) {
|
|
622
|
+
this.exchangeTimeout = exchangeTimeout;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Define the delay before emitting "unresponsive" on an exchange that does not respond
|
|
626
|
+
*/
|
|
627
|
+
setExchangeUnresponsiveTimeout(unresponsiveTimeout) {
|
|
628
|
+
this.unresponsiveTimeout = unresponsiveTimeout;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Send data to the device using the higher level API.
|
|
632
|
+
*
|
|
633
|
+
* @param {number} cla - The instruction class for the command.
|
|
634
|
+
* @param {number} ins - The instruction code for the command.
|
|
635
|
+
* @param {number} p1 - The first parameter for the instruction.
|
|
636
|
+
* @param {number} p2 - The second parameter for the instruction.
|
|
637
|
+
* @param {Buffer} data - The data to be sent. Defaults to an empty buffer.
|
|
638
|
+
* @param {Array<number>} statusList - A list of acceptable status codes for the response. Defaults to [StatusCodes.OK].
|
|
639
|
+
* @param {Object} options - Contains optional options for the exchange function
|
|
640
|
+
* - abortTimeoutMs: stop the send after a given timeout. Another timeout exists
|
|
641
|
+
* to detect unresponsive device (see `unresponsiveTimeout`). This timeout aborts the exchange.
|
|
642
|
+
* @returns {Promise<Buffer>} A promise that resolves with the response data from the device.
|
|
643
|
+
*/
|
|
644
|
+
send = async (cla, ins, p1, p2, data = Buffer.alloc(0), statusList = [StatusCodes.OK], { abortTimeoutMs } = {}) => {
|
|
645
|
+
const tracer = this.tracer.withUpdatedContext({ function: "send" });
|
|
646
|
+
if (data.length >= 256) {
|
|
647
|
+
tracer.trace("data.length exceeded 256 bytes limit", { dataLength: data.length });
|
|
648
|
+
throw new TransportError("data.length exceed 256 bytes limit. Got: " + data.length, "DataLengthTooBig");
|
|
649
|
+
}
|
|
650
|
+
const response = await this.exchange(
|
|
651
|
+
// The size of the data is added in 1 byte just before `data`
|
|
652
|
+
Buffer.concat([Buffer.from([cla, ins, p1, p2]), Buffer.from([data.length]), data]),
|
|
653
|
+
{ abortTimeoutMs }
|
|
654
|
+
);
|
|
655
|
+
const sw = response.readUInt16BE(response.length - 2);
|
|
656
|
+
if (!statusList.some((s) => s === sw)) {
|
|
657
|
+
throw new TransportStatusError(sw);
|
|
658
|
+
}
|
|
659
|
+
return response;
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
662
|
+
* create() allows to open the first descriptor available or
|
|
663
|
+
* throw if there is none or if timeout is reached.
|
|
664
|
+
* This is a light helper, alternative to using listen() and open() (that you may need for any more advanced usecase)
|
|
665
|
+
* @example
|
|
666
|
+
TransportFoo.create().then(transport => ...)
|
|
667
|
+
*/
|
|
668
|
+
static create(openTimeout = 3e3, listenTimeout) {
|
|
669
|
+
return new Promise((resolve, reject) => {
|
|
670
|
+
let found = false;
|
|
671
|
+
const sub = this.listen({
|
|
672
|
+
next: (e) => {
|
|
673
|
+
found = true;
|
|
674
|
+
if (sub)
|
|
675
|
+
sub.unsubscribe();
|
|
676
|
+
if (listenTimeoutId)
|
|
677
|
+
clearTimeout(listenTimeoutId);
|
|
678
|
+
this.open(e.descriptor, openTimeout).then(resolve, reject);
|
|
679
|
+
},
|
|
680
|
+
error: (e) => {
|
|
681
|
+
if (listenTimeoutId)
|
|
682
|
+
clearTimeout(listenTimeoutId);
|
|
683
|
+
reject(e);
|
|
684
|
+
},
|
|
685
|
+
complete: () => {
|
|
686
|
+
if (listenTimeoutId)
|
|
687
|
+
clearTimeout(listenTimeoutId);
|
|
688
|
+
if (!found) {
|
|
689
|
+
reject(new TransportError(this.ErrorMessage_NoDeviceFound, "NoDeviceFound"));
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
const listenTimeoutId = listenTimeout ? setTimeout(() => {
|
|
694
|
+
sub.unsubscribe();
|
|
695
|
+
reject(new TransportError(this.ErrorMessage_ListenTimeout, "ListenTimeout"));
|
|
696
|
+
}, listenTimeout) : null;
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
// Blocks other exchange to happen concurrently
|
|
700
|
+
exchangeBusyPromise;
|
|
701
|
+
/**
|
|
702
|
+
* Wrapper to make an exchange "atomic" (blocking any other exchange)
|
|
703
|
+
*
|
|
704
|
+
* It also handles "unresponsiveness" by emitting "unresponsive" and "responsive" events.
|
|
705
|
+
*
|
|
706
|
+
* @param f The exchange job, using the transport to run
|
|
707
|
+
* @returns a Promise resolving with the output of the given job
|
|
708
|
+
*/
|
|
709
|
+
async exchangeAtomicImpl(f) {
|
|
710
|
+
const tracer = this.tracer.withUpdatedContext({
|
|
711
|
+
function: "exchangeAtomicImpl",
|
|
712
|
+
unresponsiveTimeout: this.unresponsiveTimeout
|
|
713
|
+
});
|
|
714
|
+
if (this.exchangeBusyPromise) {
|
|
715
|
+
tracer.trace("Atomic exchange is already busy");
|
|
716
|
+
throw new TransportRaceCondition("An action was already pending on the Ledger device. Please deny or reconnect.");
|
|
717
|
+
}
|
|
718
|
+
let resolveBusy;
|
|
719
|
+
const busyPromise = new Promise((r) => {
|
|
720
|
+
resolveBusy = r;
|
|
721
|
+
});
|
|
722
|
+
this.exchangeBusyPromise = busyPromise;
|
|
723
|
+
let unresponsiveReached = false;
|
|
724
|
+
const timeout = setTimeout(() => {
|
|
725
|
+
tracer.trace(`Timeout reached, emitting Transport event "unresponsive"`, {
|
|
726
|
+
unresponsiveTimeout: this.unresponsiveTimeout
|
|
727
|
+
});
|
|
728
|
+
unresponsiveReached = true;
|
|
729
|
+
this.emit("unresponsive");
|
|
730
|
+
}, this.unresponsiveTimeout);
|
|
731
|
+
try {
|
|
732
|
+
const res = await f();
|
|
733
|
+
if (unresponsiveReached) {
|
|
734
|
+
tracer.trace("Device was unresponsive, emitting responsive");
|
|
735
|
+
this.emit("responsive");
|
|
736
|
+
}
|
|
737
|
+
return res;
|
|
738
|
+
} finally {
|
|
739
|
+
tracer.trace("Finalize, clearing busy guard");
|
|
740
|
+
clearTimeout(timeout);
|
|
741
|
+
if (resolveBusy)
|
|
742
|
+
resolveBusy();
|
|
743
|
+
this.exchangeBusyPromise = null;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
decorateAppAPIMethods(self, methods, scrambleKey) {
|
|
747
|
+
for (const methodName of methods) {
|
|
748
|
+
self[methodName] = this.decorateAppAPIMethod(methodName, self[methodName], self, scrambleKey);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
_appAPIlock = null;
|
|
752
|
+
decorateAppAPIMethod(methodName, f, ctx, scrambleKey) {
|
|
753
|
+
return async (...args) => {
|
|
754
|
+
const { _appAPIlock } = this;
|
|
755
|
+
if (_appAPIlock) {
|
|
756
|
+
return Promise.reject(new TransportError("Ledger Device is busy (lock " + _appAPIlock + ")", "TransportLocked"));
|
|
757
|
+
}
|
|
758
|
+
try {
|
|
759
|
+
this._appAPIlock = methodName;
|
|
760
|
+
this.setScrambleKey(scrambleKey);
|
|
761
|
+
return await f.apply(ctx, args);
|
|
762
|
+
} finally {
|
|
763
|
+
this._appAPIlock = null;
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Sets the context used by the logging/tracing mechanism
|
|
769
|
+
*
|
|
770
|
+
* Useful when re-using (cached) the same Transport instance,
|
|
771
|
+
* but with a new tracing context.
|
|
772
|
+
*
|
|
773
|
+
* @param context A TraceContext, that can undefined to reset the context
|
|
774
|
+
*/
|
|
775
|
+
setTraceContext(context) {
|
|
776
|
+
this.tracer = this.tracer.withContext(context);
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Updates the context used by the logging/tracing mechanism
|
|
780
|
+
*
|
|
781
|
+
* The update only overrides the key-value that are already defined in the current context.
|
|
782
|
+
*
|
|
783
|
+
* @param contextToAdd A TraceContext that will be added to the current context
|
|
784
|
+
*/
|
|
785
|
+
updateTraceContext(contextToAdd) {
|
|
786
|
+
this.tracer.updateContext(contextToAdd);
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Gets the tracing context of the transport instance
|
|
790
|
+
*/
|
|
791
|
+
getTraceContext() {
|
|
792
|
+
return this.tracer.getContext();
|
|
793
|
+
}
|
|
794
|
+
static ErrorMessage_ListenTimeout = "No Ledger device found (timeout)";
|
|
795
|
+
static ErrorMessage_NoDeviceFound = "No Ledger device found";
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
// ../../node_modules/.pnpm/@ledgerhq+devices@8.7.0/node_modules/@ledgerhq/devices/lib-es/hid-framing.js
|
|
801
|
+
function asUInt16BE(value) {
|
|
802
|
+
const b = Buffer.alloc(2);
|
|
803
|
+
b.writeUInt16BE(value, 0);
|
|
804
|
+
return b;
|
|
805
|
+
}
|
|
806
|
+
var Tag, initialAcc, createHIDframing, hid_framing_default;
|
|
807
|
+
var init_hid_framing = __esm({
|
|
808
|
+
"../../node_modules/.pnpm/@ledgerhq+devices@8.7.0/node_modules/@ledgerhq/devices/lib-es/hid-framing.js"() {
|
|
809
|
+
"use strict";
|
|
810
|
+
init_lib_es();
|
|
811
|
+
Tag = 5;
|
|
812
|
+
initialAcc = {
|
|
813
|
+
data: Buffer.alloc(0),
|
|
814
|
+
dataLength: 0,
|
|
815
|
+
sequence: 0
|
|
816
|
+
};
|
|
817
|
+
createHIDframing = (channel, packetSize) => {
|
|
818
|
+
return {
|
|
819
|
+
/**
|
|
820
|
+
* Frames/encodes an APDU message into HID USB packets/frames
|
|
821
|
+
*
|
|
822
|
+
* @param apdu The APDU message to send, in a Buffer containing [cla, ins, p1, p2, data length, data(if not empty)]
|
|
823
|
+
* @returns an array of HID USB frames ready to be sent
|
|
824
|
+
*/
|
|
825
|
+
makeBlocks(apdu) {
|
|
826
|
+
let data = Buffer.concat([asUInt16BE(apdu.length), apdu]);
|
|
827
|
+
const blockSize = packetSize - 5;
|
|
828
|
+
const nbBlocks = Math.ceil(data.length / blockSize);
|
|
829
|
+
data = Buffer.concat([data, Buffer.alloc(nbBlocks * blockSize - data.length + 1).fill(0)]);
|
|
830
|
+
const blocks = [];
|
|
831
|
+
for (let i = 0; i < nbBlocks; i++) {
|
|
832
|
+
const head = Buffer.alloc(5);
|
|
833
|
+
head.writeUInt16BE(channel, 0);
|
|
834
|
+
head.writeUInt8(Tag, 2);
|
|
835
|
+
head.writeUInt16BE(i, 3);
|
|
836
|
+
const chunk = data.slice(i * blockSize, (i + 1) * blockSize);
|
|
837
|
+
blocks.push(Buffer.concat([head, chunk]));
|
|
838
|
+
}
|
|
839
|
+
return blocks;
|
|
840
|
+
},
|
|
841
|
+
/**
|
|
842
|
+
* Reduces HID USB packets/frames to one response.
|
|
843
|
+
*
|
|
844
|
+
* @param acc The value resulting from (accumulating) the previous call of reduceResponse.
|
|
845
|
+
* On first call initialized to `initialAcc`. The accumulator enables handling multi-frames messages.
|
|
846
|
+
* @param chunk Current chunk to reduce into accumulator
|
|
847
|
+
* @returns An accumulator value updated with the current chunk
|
|
848
|
+
*/
|
|
849
|
+
reduceResponse(acc, chunk) {
|
|
850
|
+
let { data, dataLength, sequence } = acc || initialAcc;
|
|
851
|
+
if (chunk.readUInt16BE(0) !== channel) {
|
|
852
|
+
throw new TransportError("Invalid channel", "InvalidChannel");
|
|
853
|
+
}
|
|
854
|
+
if (chunk.readUInt8(2) !== Tag) {
|
|
855
|
+
throw new TransportError("Invalid tag", "InvalidTag");
|
|
856
|
+
}
|
|
857
|
+
if (chunk.readUInt16BE(3) !== sequence) {
|
|
858
|
+
throw new TransportError("Invalid sequence", "InvalidSequence");
|
|
859
|
+
}
|
|
860
|
+
if (!acc) {
|
|
861
|
+
dataLength = chunk.readUInt16BE(5);
|
|
862
|
+
}
|
|
863
|
+
sequence++;
|
|
864
|
+
const chunkData = chunk.slice(acc ? 5 : 7);
|
|
865
|
+
data = Buffer.concat([data, chunkData]);
|
|
866
|
+
if (data.length > dataLength) {
|
|
867
|
+
data = data.slice(0, dataLength);
|
|
868
|
+
}
|
|
869
|
+
return {
|
|
870
|
+
data,
|
|
871
|
+
dataLength,
|
|
872
|
+
sequence
|
|
873
|
+
};
|
|
874
|
+
},
|
|
875
|
+
/**
|
|
876
|
+
* Returns the response message that has been reduced from the HID USB frames
|
|
877
|
+
*
|
|
878
|
+
* @param acc The accumulator
|
|
879
|
+
* @returns A Buffer containing the cleaned response message, or null if no response message, or undefined if the
|
|
880
|
+
* accumulator is incorrect (message length is not valid)
|
|
881
|
+
*/
|
|
882
|
+
getReducedResult(acc) {
|
|
883
|
+
if (acc && acc.dataLength === acc.data.length) {
|
|
884
|
+
return acc.data;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
hid_framing_default = createHIDframing;
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js
|
|
894
|
+
var require_constants = __commonJS({
|
|
895
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js"(exports2, module2) {
|
|
896
|
+
"use strict";
|
|
897
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
898
|
+
var MAX_LENGTH = 256;
|
|
899
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
900
|
+
9007199254740991;
|
|
901
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
902
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
903
|
+
var RELEASE_TYPES = [
|
|
904
|
+
"major",
|
|
905
|
+
"premajor",
|
|
906
|
+
"minor",
|
|
907
|
+
"preminor",
|
|
908
|
+
"patch",
|
|
909
|
+
"prepatch",
|
|
910
|
+
"prerelease"
|
|
911
|
+
];
|
|
912
|
+
module2.exports = {
|
|
913
|
+
MAX_LENGTH,
|
|
914
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
915
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
916
|
+
MAX_SAFE_INTEGER,
|
|
917
|
+
RELEASE_TYPES,
|
|
918
|
+
SEMVER_SPEC_VERSION,
|
|
919
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
920
|
+
FLAG_LOOSE: 2
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
|
|
926
|
+
var require_debug = __commonJS({
|
|
927
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js"(exports2, module2) {
|
|
928
|
+
"use strict";
|
|
929
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
930
|
+
};
|
|
931
|
+
module2.exports = debug;
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js
|
|
936
|
+
var require_re = __commonJS({
|
|
937
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js"(exports2, module2) {
|
|
938
|
+
"use strict";
|
|
939
|
+
var {
|
|
940
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
941
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
942
|
+
MAX_LENGTH
|
|
943
|
+
} = require_constants();
|
|
944
|
+
var debug = require_debug();
|
|
945
|
+
exports2 = module2.exports = {};
|
|
946
|
+
var re = exports2.re = [];
|
|
947
|
+
var safeRe = exports2.safeRe = [];
|
|
948
|
+
var src = exports2.src = [];
|
|
949
|
+
var safeSrc = exports2.safeSrc = [];
|
|
950
|
+
var t = exports2.t = {};
|
|
951
|
+
var R = 0;
|
|
952
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
953
|
+
var safeRegexReplacements = [
|
|
954
|
+
["\\s", 1],
|
|
955
|
+
["\\d", MAX_LENGTH],
|
|
956
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
957
|
+
];
|
|
958
|
+
var makeSafeRegex = (value) => {
|
|
959
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
960
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
961
|
+
}
|
|
962
|
+
return value;
|
|
963
|
+
};
|
|
964
|
+
var createToken = (name, value, isGlobal) => {
|
|
965
|
+
const safe = makeSafeRegex(value);
|
|
966
|
+
const index = R++;
|
|
967
|
+
debug(name, index, value);
|
|
968
|
+
t[name] = index;
|
|
969
|
+
src[index] = value;
|
|
970
|
+
safeSrc[index] = safe;
|
|
971
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
972
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
973
|
+
};
|
|
974
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
975
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
976
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
977
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
978
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
979
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
980
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
981
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
982
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
983
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
984
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
985
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
986
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
987
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
988
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
989
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
990
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
991
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
992
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
993
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
994
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
995
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
996
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
997
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
998
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
999
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
1000
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
1001
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
1002
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
1003
|
+
exports2.tildeTrimReplace = "$1~";
|
|
1004
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
1005
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1006
|
+
createToken("LONECARET", "(?:\\^)");
|
|
1007
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
1008
|
+
exports2.caretTrimReplace = "$1^";
|
|
1009
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
1010
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1011
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
1012
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
1013
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
1014
|
+
exports2.comparatorTrimReplace = "$1$2$3";
|
|
1015
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
1016
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
1017
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
1018
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
1019
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js
|
|
1024
|
+
var require_parse_options = __commonJS({
|
|
1025
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js"(exports2, module2) {
|
|
1026
|
+
"use strict";
|
|
1027
|
+
var looseOption = Object.freeze({ loose: true });
|
|
1028
|
+
var emptyOpts = Object.freeze({});
|
|
1029
|
+
var parseOptions = (options) => {
|
|
1030
|
+
if (!options) {
|
|
1031
|
+
return emptyOpts;
|
|
1032
|
+
}
|
|
1033
|
+
if (typeof options !== "object") {
|
|
1034
|
+
return looseOption;
|
|
1035
|
+
}
|
|
1036
|
+
return options;
|
|
1037
|
+
};
|
|
1038
|
+
module2.exports = parseOptions;
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js
|
|
1043
|
+
var require_identifiers = __commonJS({
|
|
1044
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js"(exports2, module2) {
|
|
1045
|
+
"use strict";
|
|
1046
|
+
var numeric = /^[0-9]+$/;
|
|
1047
|
+
var compareIdentifiers = (a, b) => {
|
|
1048
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
1049
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
1050
|
+
}
|
|
1051
|
+
const anum = numeric.test(a);
|
|
1052
|
+
const bnum = numeric.test(b);
|
|
1053
|
+
if (anum && bnum) {
|
|
1054
|
+
a = +a;
|
|
1055
|
+
b = +b;
|
|
1056
|
+
}
|
|
1057
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
1058
|
+
};
|
|
1059
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
1060
|
+
module2.exports = {
|
|
1061
|
+
compareIdentifiers,
|
|
1062
|
+
rcompareIdentifiers
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
|
|
1067
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js
|
|
1068
|
+
var require_semver = __commonJS({
|
|
1069
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js"(exports2, module2) {
|
|
1070
|
+
"use strict";
|
|
1071
|
+
var debug = require_debug();
|
|
1072
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
1073
|
+
var { safeRe: re, t } = require_re();
|
|
1074
|
+
var parseOptions = require_parse_options();
|
|
1075
|
+
var { compareIdentifiers } = require_identifiers();
|
|
1076
|
+
var SemVer = class _SemVer {
|
|
1077
|
+
constructor(version, options) {
|
|
1078
|
+
options = parseOptions(options);
|
|
1079
|
+
if (version instanceof _SemVer) {
|
|
1080
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
1081
|
+
return version;
|
|
1082
|
+
} else {
|
|
1083
|
+
version = version.version;
|
|
1084
|
+
}
|
|
1085
|
+
} else if (typeof version !== "string") {
|
|
1086
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
1087
|
+
}
|
|
1088
|
+
if (version.length > MAX_LENGTH) {
|
|
1089
|
+
throw new TypeError(
|
|
1090
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
debug("SemVer", version, options);
|
|
1094
|
+
this.options = options;
|
|
1095
|
+
this.loose = !!options.loose;
|
|
1096
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1097
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
1098
|
+
if (!m) {
|
|
1099
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
1100
|
+
}
|
|
1101
|
+
this.raw = version;
|
|
1102
|
+
this.major = +m[1];
|
|
1103
|
+
this.minor = +m[2];
|
|
1104
|
+
this.patch = +m[3];
|
|
1105
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
1106
|
+
throw new TypeError("Invalid major version");
|
|
1107
|
+
}
|
|
1108
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
1109
|
+
throw new TypeError("Invalid minor version");
|
|
1110
|
+
}
|
|
1111
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
1112
|
+
throw new TypeError("Invalid patch version");
|
|
1113
|
+
}
|
|
1114
|
+
if (!m[4]) {
|
|
1115
|
+
this.prerelease = [];
|
|
1116
|
+
} else {
|
|
1117
|
+
this.prerelease = m[4].split(".").map((id2) => {
|
|
1118
|
+
if (/^[0-9]+$/.test(id2)) {
|
|
1119
|
+
const num = +id2;
|
|
1120
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
1121
|
+
return num;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
return id2;
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
1128
|
+
this.format();
|
|
1129
|
+
}
|
|
1130
|
+
format() {
|
|
1131
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
1132
|
+
if (this.prerelease.length) {
|
|
1133
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
1134
|
+
}
|
|
1135
|
+
return this.version;
|
|
1136
|
+
}
|
|
1137
|
+
toString() {
|
|
1138
|
+
return this.version;
|
|
1139
|
+
}
|
|
1140
|
+
compare(other) {
|
|
1141
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
1142
|
+
if (!(other instanceof _SemVer)) {
|
|
1143
|
+
if (typeof other === "string" && other === this.version) {
|
|
1144
|
+
return 0;
|
|
1145
|
+
}
|
|
1146
|
+
other = new _SemVer(other, this.options);
|
|
1147
|
+
}
|
|
1148
|
+
if (other.version === this.version) {
|
|
1149
|
+
return 0;
|
|
1150
|
+
}
|
|
1151
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
1152
|
+
}
|
|
1153
|
+
compareMain(other) {
|
|
1154
|
+
if (!(other instanceof _SemVer)) {
|
|
1155
|
+
other = new _SemVer(other, this.options);
|
|
1156
|
+
}
|
|
1157
|
+
if (this.major < other.major) {
|
|
1158
|
+
return -1;
|
|
1159
|
+
}
|
|
1160
|
+
if (this.major > other.major) {
|
|
1161
|
+
return 1;
|
|
1162
|
+
}
|
|
1163
|
+
if (this.minor < other.minor) {
|
|
1164
|
+
return -1;
|
|
1165
|
+
}
|
|
1166
|
+
if (this.minor > other.minor) {
|
|
1167
|
+
return 1;
|
|
1168
|
+
}
|
|
1169
|
+
if (this.patch < other.patch) {
|
|
1170
|
+
return -1;
|
|
1171
|
+
}
|
|
1172
|
+
if (this.patch > other.patch) {
|
|
1173
|
+
return 1;
|
|
1174
|
+
}
|
|
1175
|
+
return 0;
|
|
1176
|
+
}
|
|
1177
|
+
comparePre(other) {
|
|
1178
|
+
if (!(other instanceof _SemVer)) {
|
|
1179
|
+
other = new _SemVer(other, this.options);
|
|
1180
|
+
}
|
|
1181
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
1182
|
+
return -1;
|
|
1183
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
1184
|
+
return 1;
|
|
1185
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
1186
|
+
return 0;
|
|
1187
|
+
}
|
|
1188
|
+
let i = 0;
|
|
1189
|
+
do {
|
|
1190
|
+
const a = this.prerelease[i];
|
|
1191
|
+
const b = other.prerelease[i];
|
|
1192
|
+
debug("prerelease compare", i, a, b);
|
|
1193
|
+
if (a === void 0 && b === void 0) {
|
|
1194
|
+
return 0;
|
|
1195
|
+
} else if (b === void 0) {
|
|
1196
|
+
return 1;
|
|
1197
|
+
} else if (a === void 0) {
|
|
1198
|
+
return -1;
|
|
1199
|
+
} else if (a === b) {
|
|
1200
|
+
continue;
|
|
1201
|
+
} else {
|
|
1202
|
+
return compareIdentifiers(a, b);
|
|
1203
|
+
}
|
|
1204
|
+
} while (++i);
|
|
1205
|
+
}
|
|
1206
|
+
compareBuild(other) {
|
|
1207
|
+
if (!(other instanceof _SemVer)) {
|
|
1208
|
+
other = new _SemVer(other, this.options);
|
|
1209
|
+
}
|
|
1210
|
+
let i = 0;
|
|
1211
|
+
do {
|
|
1212
|
+
const a = this.build[i];
|
|
1213
|
+
const b = other.build[i];
|
|
1214
|
+
debug("build compare", i, a, b);
|
|
1215
|
+
if (a === void 0 && b === void 0) {
|
|
1216
|
+
return 0;
|
|
1217
|
+
} else if (b === void 0) {
|
|
1218
|
+
return 1;
|
|
1219
|
+
} else if (a === void 0) {
|
|
1220
|
+
return -1;
|
|
1221
|
+
} else if (a === b) {
|
|
1222
|
+
continue;
|
|
1223
|
+
} else {
|
|
1224
|
+
return compareIdentifiers(a, b);
|
|
1225
|
+
}
|
|
1226
|
+
} while (++i);
|
|
1227
|
+
}
|
|
1228
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
1229
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
1230
|
+
inc(release, identifier, identifierBase) {
|
|
1231
|
+
if (release.startsWith("pre")) {
|
|
1232
|
+
if (!identifier && identifierBase === false) {
|
|
1233
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
1234
|
+
}
|
|
1235
|
+
if (identifier) {
|
|
1236
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
1237
|
+
if (!match || match[1] !== identifier) {
|
|
1238
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
switch (release) {
|
|
1243
|
+
case "premajor":
|
|
1244
|
+
this.prerelease.length = 0;
|
|
1245
|
+
this.patch = 0;
|
|
1246
|
+
this.minor = 0;
|
|
1247
|
+
this.major++;
|
|
1248
|
+
this.inc("pre", identifier, identifierBase);
|
|
1249
|
+
break;
|
|
1250
|
+
case "preminor":
|
|
1251
|
+
this.prerelease.length = 0;
|
|
1252
|
+
this.patch = 0;
|
|
1253
|
+
this.minor++;
|
|
1254
|
+
this.inc("pre", identifier, identifierBase);
|
|
1255
|
+
break;
|
|
1256
|
+
case "prepatch":
|
|
1257
|
+
this.prerelease.length = 0;
|
|
1258
|
+
this.inc("patch", identifier, identifierBase);
|
|
1259
|
+
this.inc("pre", identifier, identifierBase);
|
|
1260
|
+
break;
|
|
1261
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
1262
|
+
// prepatch.
|
|
1263
|
+
case "prerelease":
|
|
1264
|
+
if (this.prerelease.length === 0) {
|
|
1265
|
+
this.inc("patch", identifier, identifierBase);
|
|
1266
|
+
}
|
|
1267
|
+
this.inc("pre", identifier, identifierBase);
|
|
1268
|
+
break;
|
|
1269
|
+
case "release":
|
|
1270
|
+
if (this.prerelease.length === 0) {
|
|
1271
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
1272
|
+
}
|
|
1273
|
+
this.prerelease.length = 0;
|
|
1274
|
+
break;
|
|
1275
|
+
case "major":
|
|
1276
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
1277
|
+
this.major++;
|
|
1278
|
+
}
|
|
1279
|
+
this.minor = 0;
|
|
1280
|
+
this.patch = 0;
|
|
1281
|
+
this.prerelease = [];
|
|
1282
|
+
break;
|
|
1283
|
+
case "minor":
|
|
1284
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
1285
|
+
this.minor++;
|
|
1286
|
+
}
|
|
1287
|
+
this.patch = 0;
|
|
1288
|
+
this.prerelease = [];
|
|
1289
|
+
break;
|
|
1290
|
+
case "patch":
|
|
1291
|
+
if (this.prerelease.length === 0) {
|
|
1292
|
+
this.patch++;
|
|
1293
|
+
}
|
|
1294
|
+
this.prerelease = [];
|
|
1295
|
+
break;
|
|
1296
|
+
// This probably shouldn't be used publicly.
|
|
1297
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
1298
|
+
case "pre": {
|
|
1299
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
1300
|
+
if (this.prerelease.length === 0) {
|
|
1301
|
+
this.prerelease = [base];
|
|
1302
|
+
} else {
|
|
1303
|
+
let i = this.prerelease.length;
|
|
1304
|
+
while (--i >= 0) {
|
|
1305
|
+
if (typeof this.prerelease[i] === "number") {
|
|
1306
|
+
this.prerelease[i]++;
|
|
1307
|
+
i = -2;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
if (i === -1) {
|
|
1311
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
1312
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
1313
|
+
}
|
|
1314
|
+
this.prerelease.push(base);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
if (identifier) {
|
|
1318
|
+
let prerelease = [identifier, base];
|
|
1319
|
+
if (identifierBase === false) {
|
|
1320
|
+
prerelease = [identifier];
|
|
1321
|
+
}
|
|
1322
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
1323
|
+
if (isNaN(this.prerelease[1])) {
|
|
1324
|
+
this.prerelease = prerelease;
|
|
1325
|
+
}
|
|
1326
|
+
} else {
|
|
1327
|
+
this.prerelease = prerelease;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
break;
|
|
1331
|
+
}
|
|
1332
|
+
default:
|
|
1333
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
1334
|
+
}
|
|
1335
|
+
this.raw = this.format();
|
|
1336
|
+
if (this.build.length) {
|
|
1337
|
+
this.raw += `+${this.build.join(".")}`;
|
|
1338
|
+
}
|
|
1339
|
+
return this;
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
module2.exports = SemVer;
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
|
|
1346
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js
|
|
1347
|
+
var require_parse = __commonJS({
|
|
1348
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js"(exports2, module2) {
|
|
1349
|
+
"use strict";
|
|
1350
|
+
var SemVer = require_semver();
|
|
1351
|
+
var parse = (version, options, throwErrors = false) => {
|
|
1352
|
+
if (version instanceof SemVer) {
|
|
1353
|
+
return version;
|
|
1354
|
+
}
|
|
1355
|
+
try {
|
|
1356
|
+
return new SemVer(version, options);
|
|
1357
|
+
} catch (er) {
|
|
1358
|
+
if (!throwErrors) {
|
|
1359
|
+
return null;
|
|
1360
|
+
}
|
|
1361
|
+
throw er;
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
module2.exports = parse;
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js
|
|
1369
|
+
var require_valid = __commonJS({
|
|
1370
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js"(exports2, module2) {
|
|
1371
|
+
"use strict";
|
|
1372
|
+
var parse = require_parse();
|
|
1373
|
+
var valid = (version, options) => {
|
|
1374
|
+
const v = parse(version, options);
|
|
1375
|
+
return v ? v.version : null;
|
|
1376
|
+
};
|
|
1377
|
+
module2.exports = valid;
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js
|
|
1382
|
+
var require_clean = __commonJS({
|
|
1383
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js"(exports2, module2) {
|
|
1384
|
+
"use strict";
|
|
1385
|
+
var parse = require_parse();
|
|
1386
|
+
var clean = (version, options) => {
|
|
1387
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
1388
|
+
return s ? s.version : null;
|
|
1389
|
+
};
|
|
1390
|
+
module2.exports = clean;
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
|
|
1394
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js
|
|
1395
|
+
var require_inc = __commonJS({
|
|
1396
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js"(exports2, module2) {
|
|
1397
|
+
"use strict";
|
|
1398
|
+
var SemVer = require_semver();
|
|
1399
|
+
var inc = (version, release, options, identifier, identifierBase) => {
|
|
1400
|
+
if (typeof options === "string") {
|
|
1401
|
+
identifierBase = identifier;
|
|
1402
|
+
identifier = options;
|
|
1403
|
+
options = void 0;
|
|
1404
|
+
}
|
|
1405
|
+
try {
|
|
1406
|
+
return new SemVer(
|
|
1407
|
+
version instanceof SemVer ? version.version : version,
|
|
1408
|
+
options
|
|
1409
|
+
).inc(release, identifier, identifierBase).version;
|
|
1410
|
+
} catch (er) {
|
|
1411
|
+
return null;
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
module2.exports = inc;
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js
|
|
1419
|
+
var require_diff = __commonJS({
|
|
1420
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js"(exports2, module2) {
|
|
1421
|
+
"use strict";
|
|
1422
|
+
var parse = require_parse();
|
|
1423
|
+
var diff = (version1, version2) => {
|
|
1424
|
+
const v1 = parse(version1, null, true);
|
|
1425
|
+
const v2 = parse(version2, null, true);
|
|
1426
|
+
const comparison = v1.compare(v2);
|
|
1427
|
+
if (comparison === 0) {
|
|
1428
|
+
return null;
|
|
1429
|
+
}
|
|
1430
|
+
const v1Higher = comparison > 0;
|
|
1431
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
1432
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
1433
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
1434
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
1435
|
+
if (lowHasPre && !highHasPre) {
|
|
1436
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
1437
|
+
return "major";
|
|
1438
|
+
}
|
|
1439
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
1440
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
1441
|
+
return "minor";
|
|
1442
|
+
}
|
|
1443
|
+
return "patch";
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
const prefix = highHasPre ? "pre" : "";
|
|
1447
|
+
if (v1.major !== v2.major) {
|
|
1448
|
+
return prefix + "major";
|
|
1449
|
+
}
|
|
1450
|
+
if (v1.minor !== v2.minor) {
|
|
1451
|
+
return prefix + "minor";
|
|
1452
|
+
}
|
|
1453
|
+
if (v1.patch !== v2.patch) {
|
|
1454
|
+
return prefix + "patch";
|
|
1455
|
+
}
|
|
1456
|
+
return "prerelease";
|
|
1457
|
+
};
|
|
1458
|
+
module2.exports = diff;
|
|
1459
|
+
}
|
|
1460
|
+
});
|
|
1461
|
+
|
|
1462
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js
|
|
1463
|
+
var require_major = __commonJS({
|
|
1464
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js"(exports2, module2) {
|
|
1465
|
+
"use strict";
|
|
1466
|
+
var SemVer = require_semver();
|
|
1467
|
+
var major = (a, loose) => new SemVer(a, loose).major;
|
|
1468
|
+
module2.exports = major;
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js
|
|
1473
|
+
var require_minor = __commonJS({
|
|
1474
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js"(exports2, module2) {
|
|
1475
|
+
"use strict";
|
|
1476
|
+
var SemVer = require_semver();
|
|
1477
|
+
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
1478
|
+
module2.exports = minor;
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1481
|
+
|
|
1482
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js
|
|
1483
|
+
var require_patch = __commonJS({
|
|
1484
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js"(exports2, module2) {
|
|
1485
|
+
"use strict";
|
|
1486
|
+
var SemVer = require_semver();
|
|
1487
|
+
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
1488
|
+
module2.exports = patch;
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js
|
|
1493
|
+
var require_prerelease = __commonJS({
|
|
1494
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js"(exports2, module2) {
|
|
1495
|
+
"use strict";
|
|
1496
|
+
var parse = require_parse();
|
|
1497
|
+
var prerelease = (version, options) => {
|
|
1498
|
+
const parsed = parse(version, options);
|
|
1499
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
1500
|
+
};
|
|
1501
|
+
module2.exports = prerelease;
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js
|
|
1506
|
+
var require_compare = __commonJS({
|
|
1507
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js"(exports2, module2) {
|
|
1508
|
+
"use strict";
|
|
1509
|
+
var SemVer = require_semver();
|
|
1510
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
1511
|
+
module2.exports = compare;
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1514
|
+
|
|
1515
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js
|
|
1516
|
+
var require_rcompare = __commonJS({
|
|
1517
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js"(exports2, module2) {
|
|
1518
|
+
"use strict";
|
|
1519
|
+
var compare = require_compare();
|
|
1520
|
+
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
1521
|
+
module2.exports = rcompare;
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js
|
|
1526
|
+
var require_compare_loose = __commonJS({
|
|
1527
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
|
|
1528
|
+
"use strict";
|
|
1529
|
+
var compare = require_compare();
|
|
1530
|
+
var compareLoose = (a, b) => compare(a, b, true);
|
|
1531
|
+
module2.exports = compareLoose;
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1534
|
+
|
|
1535
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js
|
|
1536
|
+
var require_compare_build = __commonJS({
|
|
1537
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js"(exports2, module2) {
|
|
1538
|
+
"use strict";
|
|
1539
|
+
var SemVer = require_semver();
|
|
1540
|
+
var compareBuild = (a, b, loose) => {
|
|
1541
|
+
const versionA = new SemVer(a, loose);
|
|
1542
|
+
const versionB = new SemVer(b, loose);
|
|
1543
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
1544
|
+
};
|
|
1545
|
+
module2.exports = compareBuild;
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
|
|
1549
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js
|
|
1550
|
+
var require_sort = __commonJS({
|
|
1551
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js"(exports2, module2) {
|
|
1552
|
+
"use strict";
|
|
1553
|
+
var compareBuild = require_compare_build();
|
|
1554
|
+
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
1555
|
+
module2.exports = sort;
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
|
|
1559
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js
|
|
1560
|
+
var require_rsort = __commonJS({
|
|
1561
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js"(exports2, module2) {
|
|
1562
|
+
"use strict";
|
|
1563
|
+
var compareBuild = require_compare_build();
|
|
1564
|
+
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
1565
|
+
module2.exports = rsort;
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
|
|
1569
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js
|
|
1570
|
+
var require_gt = __commonJS({
|
|
1571
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js"(exports2, module2) {
|
|
1572
|
+
"use strict";
|
|
1573
|
+
var compare = require_compare();
|
|
1574
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
1575
|
+
module2.exports = gt;
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
|
|
1579
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js
|
|
1580
|
+
var require_lt = __commonJS({
|
|
1581
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js"(exports2, module2) {
|
|
1582
|
+
"use strict";
|
|
1583
|
+
var compare = require_compare();
|
|
1584
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
1585
|
+
module2.exports = lt;
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
|
|
1589
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js
|
|
1590
|
+
var require_eq = __commonJS({
|
|
1591
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js"(exports2, module2) {
|
|
1592
|
+
"use strict";
|
|
1593
|
+
var compare = require_compare();
|
|
1594
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
1595
|
+
module2.exports = eq;
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js
|
|
1600
|
+
var require_neq = __commonJS({
|
|
1601
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js"(exports2, module2) {
|
|
1602
|
+
"use strict";
|
|
1603
|
+
var compare = require_compare();
|
|
1604
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
1605
|
+
module2.exports = neq;
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
|
|
1609
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js
|
|
1610
|
+
var require_gte = __commonJS({
|
|
1611
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js"(exports2, module2) {
|
|
1612
|
+
"use strict";
|
|
1613
|
+
var compare = require_compare();
|
|
1614
|
+
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
1615
|
+
module2.exports = gte;
|
|
1616
|
+
}
|
|
1617
|
+
});
|
|
1618
|
+
|
|
1619
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js
|
|
1620
|
+
var require_lte = __commonJS({
|
|
1621
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js"(exports2, module2) {
|
|
1622
|
+
"use strict";
|
|
1623
|
+
var compare = require_compare();
|
|
1624
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
1625
|
+
module2.exports = lte;
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
|
|
1629
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js
|
|
1630
|
+
var require_cmp = __commonJS({
|
|
1631
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js"(exports2, module2) {
|
|
1632
|
+
"use strict";
|
|
1633
|
+
var eq = require_eq();
|
|
1634
|
+
var neq = require_neq();
|
|
1635
|
+
var gt = require_gt();
|
|
1636
|
+
var gte = require_gte();
|
|
1637
|
+
var lt = require_lt();
|
|
1638
|
+
var lte = require_lte();
|
|
1639
|
+
var cmp = (a, op, b, loose) => {
|
|
1640
|
+
switch (op) {
|
|
1641
|
+
case "===":
|
|
1642
|
+
if (typeof a === "object") {
|
|
1643
|
+
a = a.version;
|
|
1644
|
+
}
|
|
1645
|
+
if (typeof b === "object") {
|
|
1646
|
+
b = b.version;
|
|
1647
|
+
}
|
|
1648
|
+
return a === b;
|
|
1649
|
+
case "!==":
|
|
1650
|
+
if (typeof a === "object") {
|
|
1651
|
+
a = a.version;
|
|
1652
|
+
}
|
|
1653
|
+
if (typeof b === "object") {
|
|
1654
|
+
b = b.version;
|
|
1655
|
+
}
|
|
1656
|
+
return a !== b;
|
|
1657
|
+
case "":
|
|
1658
|
+
case "=":
|
|
1659
|
+
case "==":
|
|
1660
|
+
return eq(a, b, loose);
|
|
1661
|
+
case "!=":
|
|
1662
|
+
return neq(a, b, loose);
|
|
1663
|
+
case ">":
|
|
1664
|
+
return gt(a, b, loose);
|
|
1665
|
+
case ">=":
|
|
1666
|
+
return gte(a, b, loose);
|
|
1667
|
+
case "<":
|
|
1668
|
+
return lt(a, b, loose);
|
|
1669
|
+
case "<=":
|
|
1670
|
+
return lte(a, b, loose);
|
|
1671
|
+
default:
|
|
1672
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
module2.exports = cmp;
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
|
|
1679
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js
|
|
1680
|
+
var require_coerce = __commonJS({
|
|
1681
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js"(exports2, module2) {
|
|
1682
|
+
"use strict";
|
|
1683
|
+
var SemVer = require_semver();
|
|
1684
|
+
var parse = require_parse();
|
|
1685
|
+
var { safeRe: re, t } = require_re();
|
|
1686
|
+
var coerce = (version, options) => {
|
|
1687
|
+
if (version instanceof SemVer) {
|
|
1688
|
+
return version;
|
|
1689
|
+
}
|
|
1690
|
+
if (typeof version === "number") {
|
|
1691
|
+
version = String(version);
|
|
1692
|
+
}
|
|
1693
|
+
if (typeof version !== "string") {
|
|
1694
|
+
return null;
|
|
1695
|
+
}
|
|
1696
|
+
options = options || {};
|
|
1697
|
+
let match = null;
|
|
1698
|
+
if (!options.rtl) {
|
|
1699
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
1700
|
+
} else {
|
|
1701
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
1702
|
+
let next;
|
|
1703
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
1704
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
1705
|
+
match = next;
|
|
1706
|
+
}
|
|
1707
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
1708
|
+
}
|
|
1709
|
+
coerceRtlRegex.lastIndex = -1;
|
|
1710
|
+
}
|
|
1711
|
+
if (match === null) {
|
|
1712
|
+
return null;
|
|
1713
|
+
}
|
|
1714
|
+
const major = match[2];
|
|
1715
|
+
const minor = match[3] || "0";
|
|
1716
|
+
const patch = match[4] || "0";
|
|
1717
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
1718
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
1719
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
1720
|
+
};
|
|
1721
|
+
module2.exports = coerce;
|
|
1722
|
+
}
|
|
1723
|
+
});
|
|
1724
|
+
|
|
1725
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js
|
|
1726
|
+
var require_lrucache = __commonJS({
|
|
1727
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js"(exports2, module2) {
|
|
1728
|
+
"use strict";
|
|
1729
|
+
var LRUCache = class {
|
|
1730
|
+
constructor() {
|
|
1731
|
+
this.max = 1e3;
|
|
1732
|
+
this.map = /* @__PURE__ */ new Map();
|
|
1733
|
+
}
|
|
1734
|
+
get(key) {
|
|
1735
|
+
const value = this.map.get(key);
|
|
1736
|
+
if (value === void 0) {
|
|
1737
|
+
return void 0;
|
|
1738
|
+
} else {
|
|
1739
|
+
this.map.delete(key);
|
|
1740
|
+
this.map.set(key, value);
|
|
1741
|
+
return value;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
delete(key) {
|
|
1745
|
+
return this.map.delete(key);
|
|
1746
|
+
}
|
|
1747
|
+
set(key, value) {
|
|
1748
|
+
const deleted = this.delete(key);
|
|
1749
|
+
if (!deleted && value !== void 0) {
|
|
1750
|
+
if (this.map.size >= this.max) {
|
|
1751
|
+
const firstKey = this.map.keys().next().value;
|
|
1752
|
+
this.delete(firstKey);
|
|
1753
|
+
}
|
|
1754
|
+
this.map.set(key, value);
|
|
1755
|
+
}
|
|
1756
|
+
return this;
|
|
1757
|
+
}
|
|
1758
|
+
};
|
|
1759
|
+
module2.exports = LRUCache;
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
|
|
1763
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js
|
|
1764
|
+
var require_range = __commonJS({
|
|
1765
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js"(exports2, module2) {
|
|
1766
|
+
"use strict";
|
|
1767
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
1768
|
+
var Range = class _Range {
|
|
1769
|
+
constructor(range, options) {
|
|
1770
|
+
options = parseOptions(options);
|
|
1771
|
+
if (range instanceof _Range) {
|
|
1772
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
1773
|
+
return range;
|
|
1774
|
+
} else {
|
|
1775
|
+
return new _Range(range.raw, options);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
if (range instanceof Comparator) {
|
|
1779
|
+
this.raw = range.value;
|
|
1780
|
+
this.set = [[range]];
|
|
1781
|
+
this.formatted = void 0;
|
|
1782
|
+
return this;
|
|
1783
|
+
}
|
|
1784
|
+
this.options = options;
|
|
1785
|
+
this.loose = !!options.loose;
|
|
1786
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1787
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
1788
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1789
|
+
if (!this.set.length) {
|
|
1790
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1791
|
+
}
|
|
1792
|
+
if (this.set.length > 1) {
|
|
1793
|
+
const first = this.set[0];
|
|
1794
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1795
|
+
if (this.set.length === 0) {
|
|
1796
|
+
this.set = [first];
|
|
1797
|
+
} else if (this.set.length > 1) {
|
|
1798
|
+
for (const c of this.set) {
|
|
1799
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
1800
|
+
this.set = [c];
|
|
1801
|
+
break;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
this.formatted = void 0;
|
|
1807
|
+
}
|
|
1808
|
+
get range() {
|
|
1809
|
+
if (this.formatted === void 0) {
|
|
1810
|
+
this.formatted = "";
|
|
1811
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
1812
|
+
if (i > 0) {
|
|
1813
|
+
this.formatted += "||";
|
|
1814
|
+
}
|
|
1815
|
+
const comps = this.set[i];
|
|
1816
|
+
for (let k = 0; k < comps.length; k++) {
|
|
1817
|
+
if (k > 0) {
|
|
1818
|
+
this.formatted += " ";
|
|
1819
|
+
}
|
|
1820
|
+
this.formatted += comps[k].toString().trim();
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
return this.formatted;
|
|
1825
|
+
}
|
|
1826
|
+
format() {
|
|
1827
|
+
return this.range;
|
|
1828
|
+
}
|
|
1829
|
+
toString() {
|
|
1830
|
+
return this.range;
|
|
1831
|
+
}
|
|
1832
|
+
parseRange(range) {
|
|
1833
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
1834
|
+
const memoKey = memoOpts + ":" + range;
|
|
1835
|
+
const cached = cache.get(memoKey);
|
|
1836
|
+
if (cached) {
|
|
1837
|
+
return cached;
|
|
1838
|
+
}
|
|
1839
|
+
const loose = this.options.loose;
|
|
1840
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1841
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1842
|
+
debug("hyphen replace", range);
|
|
1843
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1844
|
+
debug("comparator trim", range);
|
|
1845
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1846
|
+
debug("tilde trim", range);
|
|
1847
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1848
|
+
debug("caret trim", range);
|
|
1849
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1850
|
+
if (loose) {
|
|
1851
|
+
rangeList = rangeList.filter((comp) => {
|
|
1852
|
+
debug("loose invalid filter", comp, this.options);
|
|
1853
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
debug("range list", rangeList);
|
|
1857
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
1858
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1859
|
+
for (const comp of comparators) {
|
|
1860
|
+
if (isNullSet(comp)) {
|
|
1861
|
+
return [comp];
|
|
1862
|
+
}
|
|
1863
|
+
rangeMap.set(comp.value, comp);
|
|
1864
|
+
}
|
|
1865
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1866
|
+
rangeMap.delete("");
|
|
1867
|
+
}
|
|
1868
|
+
const result = [...rangeMap.values()];
|
|
1869
|
+
cache.set(memoKey, result);
|
|
1870
|
+
return result;
|
|
1871
|
+
}
|
|
1872
|
+
intersects(range, options) {
|
|
1873
|
+
if (!(range instanceof _Range)) {
|
|
1874
|
+
throw new TypeError("a Range is required");
|
|
1875
|
+
}
|
|
1876
|
+
return this.set.some((thisComparators) => {
|
|
1877
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1878
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1879
|
+
return rangeComparators.every((rangeComparator) => {
|
|
1880
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
1881
|
+
});
|
|
1882
|
+
});
|
|
1883
|
+
});
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
1887
|
+
test(version) {
|
|
1888
|
+
if (!version) {
|
|
1889
|
+
return false;
|
|
1890
|
+
}
|
|
1891
|
+
if (typeof version === "string") {
|
|
1892
|
+
try {
|
|
1893
|
+
version = new SemVer(version, this.options);
|
|
1894
|
+
} catch (er) {
|
|
1895
|
+
return false;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
1899
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
1900
|
+
return true;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
return false;
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1906
|
+
module2.exports = Range;
|
|
1907
|
+
var LRU = require_lrucache();
|
|
1908
|
+
var cache = new LRU();
|
|
1909
|
+
var parseOptions = require_parse_options();
|
|
1910
|
+
var Comparator = require_comparator();
|
|
1911
|
+
var debug = require_debug();
|
|
1912
|
+
var SemVer = require_semver();
|
|
1913
|
+
var {
|
|
1914
|
+
safeRe: re,
|
|
1915
|
+
t,
|
|
1916
|
+
comparatorTrimReplace,
|
|
1917
|
+
tildeTrimReplace,
|
|
1918
|
+
caretTrimReplace
|
|
1919
|
+
} = require_re();
|
|
1920
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1921
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
1922
|
+
var isAny = (c) => c.value === "";
|
|
1923
|
+
var isSatisfiable = (comparators, options) => {
|
|
1924
|
+
let result = true;
|
|
1925
|
+
const remainingComparators = comparators.slice();
|
|
1926
|
+
let testComparator = remainingComparators.pop();
|
|
1927
|
+
while (result && remainingComparators.length) {
|
|
1928
|
+
result = remainingComparators.every((otherComparator) => {
|
|
1929
|
+
return testComparator.intersects(otherComparator, options);
|
|
1930
|
+
});
|
|
1931
|
+
testComparator = remainingComparators.pop();
|
|
1932
|
+
}
|
|
1933
|
+
return result;
|
|
1934
|
+
};
|
|
1935
|
+
var parseComparator = (comp, options) => {
|
|
1936
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
1937
|
+
debug("comp", comp, options);
|
|
1938
|
+
comp = replaceCarets(comp, options);
|
|
1939
|
+
debug("caret", comp);
|
|
1940
|
+
comp = replaceTildes(comp, options);
|
|
1941
|
+
debug("tildes", comp);
|
|
1942
|
+
comp = replaceXRanges(comp, options);
|
|
1943
|
+
debug("xrange", comp);
|
|
1944
|
+
comp = replaceStars(comp, options);
|
|
1945
|
+
debug("stars", comp);
|
|
1946
|
+
return comp;
|
|
1947
|
+
};
|
|
1948
|
+
var isX = (id2) => !id2 || id2.toLowerCase() === "x" || id2 === "*";
|
|
1949
|
+
var replaceTildes = (comp, options) => {
|
|
1950
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
1951
|
+
};
|
|
1952
|
+
var replaceTilde = (comp, options) => {
|
|
1953
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1954
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1955
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
1956
|
+
let ret;
|
|
1957
|
+
if (isX(M)) {
|
|
1958
|
+
ret = "";
|
|
1959
|
+
} else if (isX(m)) {
|
|
1960
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
1961
|
+
} else if (isX(p)) {
|
|
1962
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
1963
|
+
} else if (pr) {
|
|
1964
|
+
debug("replaceTilde pr", pr);
|
|
1965
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1966
|
+
} else {
|
|
1967
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1968
|
+
}
|
|
1969
|
+
debug("tilde return", ret);
|
|
1970
|
+
return ret;
|
|
1971
|
+
});
|
|
1972
|
+
};
|
|
1973
|
+
var replaceCarets = (comp, options) => {
|
|
1974
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1975
|
+
};
|
|
1976
|
+
var replaceCaret = (comp, options) => {
|
|
1977
|
+
debug("caret", comp, options);
|
|
1978
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1979
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1980
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1981
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
1982
|
+
let ret;
|
|
1983
|
+
if (isX(M)) {
|
|
1984
|
+
ret = "";
|
|
1985
|
+
} else if (isX(m)) {
|
|
1986
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1987
|
+
} else if (isX(p)) {
|
|
1988
|
+
if (M === "0") {
|
|
1989
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1990
|
+
} else {
|
|
1991
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1992
|
+
}
|
|
1993
|
+
} else if (pr) {
|
|
1994
|
+
debug("replaceCaret pr", pr);
|
|
1995
|
+
if (M === "0") {
|
|
1996
|
+
if (m === "0") {
|
|
1997
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
1998
|
+
} else {
|
|
1999
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2000
|
+
}
|
|
2001
|
+
} else {
|
|
2002
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
2003
|
+
}
|
|
2004
|
+
} else {
|
|
2005
|
+
debug("no pr");
|
|
2006
|
+
if (M === "0") {
|
|
2007
|
+
if (m === "0") {
|
|
2008
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
2009
|
+
} else {
|
|
2010
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
2011
|
+
}
|
|
2012
|
+
} else {
|
|
2013
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
debug("caret return", ret);
|
|
2017
|
+
return ret;
|
|
2018
|
+
});
|
|
2019
|
+
};
|
|
2020
|
+
var replaceXRanges = (comp, options) => {
|
|
2021
|
+
debug("replaceXRanges", comp, options);
|
|
2022
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
2023
|
+
};
|
|
2024
|
+
var replaceXRange = (comp, options) => {
|
|
2025
|
+
comp = comp.trim();
|
|
2026
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
2027
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
2028
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
2029
|
+
const xM = isX(M);
|
|
2030
|
+
const xm = xM || isX(m);
|
|
2031
|
+
const xp = xm || isX(p);
|
|
2032
|
+
const anyX = xp;
|
|
2033
|
+
if (gtlt === "=" && anyX) {
|
|
2034
|
+
gtlt = "";
|
|
2035
|
+
}
|
|
2036
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
2037
|
+
if (xM) {
|
|
2038
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
2039
|
+
ret = "<0.0.0-0";
|
|
2040
|
+
} else {
|
|
2041
|
+
ret = "*";
|
|
2042
|
+
}
|
|
2043
|
+
} else if (gtlt && anyX) {
|
|
2044
|
+
if (xm) {
|
|
2045
|
+
m = 0;
|
|
2046
|
+
}
|
|
2047
|
+
p = 0;
|
|
2048
|
+
if (gtlt === ">") {
|
|
2049
|
+
gtlt = ">=";
|
|
2050
|
+
if (xm) {
|
|
2051
|
+
M = +M + 1;
|
|
2052
|
+
m = 0;
|
|
2053
|
+
p = 0;
|
|
2054
|
+
} else {
|
|
2055
|
+
m = +m + 1;
|
|
2056
|
+
p = 0;
|
|
2057
|
+
}
|
|
2058
|
+
} else if (gtlt === "<=") {
|
|
2059
|
+
gtlt = "<";
|
|
2060
|
+
if (xm) {
|
|
2061
|
+
M = +M + 1;
|
|
2062
|
+
} else {
|
|
2063
|
+
m = +m + 1;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
if (gtlt === "<") {
|
|
2067
|
+
pr = "-0";
|
|
2068
|
+
}
|
|
2069
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
2070
|
+
} else if (xm) {
|
|
2071
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
2072
|
+
} else if (xp) {
|
|
2073
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
2074
|
+
}
|
|
2075
|
+
debug("xRange return", ret);
|
|
2076
|
+
return ret;
|
|
2077
|
+
});
|
|
2078
|
+
};
|
|
2079
|
+
var replaceStars = (comp, options) => {
|
|
2080
|
+
debug("replaceStars", comp, options);
|
|
2081
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
2082
|
+
};
|
|
2083
|
+
var replaceGTE0 = (comp, options) => {
|
|
2084
|
+
debug("replaceGTE0", comp, options);
|
|
2085
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
2086
|
+
};
|
|
2087
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
2088
|
+
if (isX(fM)) {
|
|
2089
|
+
from = "";
|
|
2090
|
+
} else if (isX(fm)) {
|
|
2091
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
2092
|
+
} else if (isX(fp)) {
|
|
2093
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
2094
|
+
} else if (fpr) {
|
|
2095
|
+
from = `>=${from}`;
|
|
2096
|
+
} else {
|
|
2097
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
2098
|
+
}
|
|
2099
|
+
if (isX(tM)) {
|
|
2100
|
+
to = "";
|
|
2101
|
+
} else if (isX(tm)) {
|
|
2102
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
2103
|
+
} else if (isX(tp)) {
|
|
2104
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
2105
|
+
} else if (tpr) {
|
|
2106
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
2107
|
+
} else if (incPr) {
|
|
2108
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
2109
|
+
} else {
|
|
2110
|
+
to = `<=${to}`;
|
|
2111
|
+
}
|
|
2112
|
+
return `${from} ${to}`.trim();
|
|
2113
|
+
};
|
|
2114
|
+
var testSet = (set, version, options) => {
|
|
2115
|
+
for (let i = 0; i < set.length; i++) {
|
|
2116
|
+
if (!set[i].test(version)) {
|
|
2117
|
+
return false;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
2121
|
+
for (let i = 0; i < set.length; i++) {
|
|
2122
|
+
debug(set[i].semver);
|
|
2123
|
+
if (set[i].semver === Comparator.ANY) {
|
|
2124
|
+
continue;
|
|
2125
|
+
}
|
|
2126
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
2127
|
+
const allowed = set[i].semver;
|
|
2128
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
2129
|
+
return true;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
return false;
|
|
2134
|
+
}
|
|
2135
|
+
return true;
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
});
|
|
2139
|
+
|
|
2140
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js
|
|
2141
|
+
var require_comparator = __commonJS({
|
|
2142
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js"(exports2, module2) {
|
|
2143
|
+
"use strict";
|
|
2144
|
+
var ANY = Symbol("SemVer ANY");
|
|
2145
|
+
var Comparator = class _Comparator {
|
|
2146
|
+
static get ANY() {
|
|
2147
|
+
return ANY;
|
|
2148
|
+
}
|
|
2149
|
+
constructor(comp, options) {
|
|
2150
|
+
options = parseOptions(options);
|
|
2151
|
+
if (comp instanceof _Comparator) {
|
|
2152
|
+
if (comp.loose === !!options.loose) {
|
|
2153
|
+
return comp;
|
|
2154
|
+
} else {
|
|
2155
|
+
comp = comp.value;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
2159
|
+
debug("comparator", comp, options);
|
|
2160
|
+
this.options = options;
|
|
2161
|
+
this.loose = !!options.loose;
|
|
2162
|
+
this.parse(comp);
|
|
2163
|
+
if (this.semver === ANY) {
|
|
2164
|
+
this.value = "";
|
|
2165
|
+
} else {
|
|
2166
|
+
this.value = this.operator + this.semver.version;
|
|
2167
|
+
}
|
|
2168
|
+
debug("comp", this);
|
|
2169
|
+
}
|
|
2170
|
+
parse(comp) {
|
|
2171
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
2172
|
+
const m = comp.match(r);
|
|
2173
|
+
if (!m) {
|
|
2174
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
2175
|
+
}
|
|
2176
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
2177
|
+
if (this.operator === "=") {
|
|
2178
|
+
this.operator = "";
|
|
2179
|
+
}
|
|
2180
|
+
if (!m[2]) {
|
|
2181
|
+
this.semver = ANY;
|
|
2182
|
+
} else {
|
|
2183
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
toString() {
|
|
2187
|
+
return this.value;
|
|
2188
|
+
}
|
|
2189
|
+
test(version) {
|
|
2190
|
+
debug("Comparator.test", version, this.options.loose);
|
|
2191
|
+
if (this.semver === ANY || version === ANY) {
|
|
2192
|
+
return true;
|
|
2193
|
+
}
|
|
2194
|
+
if (typeof version === "string") {
|
|
2195
|
+
try {
|
|
2196
|
+
version = new SemVer(version, this.options);
|
|
2197
|
+
} catch (er) {
|
|
2198
|
+
return false;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
2202
|
+
}
|
|
2203
|
+
intersects(comp, options) {
|
|
2204
|
+
if (!(comp instanceof _Comparator)) {
|
|
2205
|
+
throw new TypeError("a Comparator is required");
|
|
2206
|
+
}
|
|
2207
|
+
if (this.operator === "") {
|
|
2208
|
+
if (this.value === "") {
|
|
2209
|
+
return true;
|
|
2210
|
+
}
|
|
2211
|
+
return new Range(comp.value, options).test(this.value);
|
|
2212
|
+
} else if (comp.operator === "") {
|
|
2213
|
+
if (comp.value === "") {
|
|
2214
|
+
return true;
|
|
2215
|
+
}
|
|
2216
|
+
return new Range(this.value, options).test(comp.semver);
|
|
2217
|
+
}
|
|
2218
|
+
options = parseOptions(options);
|
|
2219
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
2220
|
+
return false;
|
|
2221
|
+
}
|
|
2222
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
2223
|
+
return false;
|
|
2224
|
+
}
|
|
2225
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
2226
|
+
return true;
|
|
2227
|
+
}
|
|
2228
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
2229
|
+
return true;
|
|
2230
|
+
}
|
|
2231
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
2232
|
+
return true;
|
|
2233
|
+
}
|
|
2234
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
2235
|
+
return true;
|
|
2236
|
+
}
|
|
2237
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
2238
|
+
return true;
|
|
2239
|
+
}
|
|
2240
|
+
return false;
|
|
2241
|
+
}
|
|
2242
|
+
};
|
|
2243
|
+
module2.exports = Comparator;
|
|
2244
|
+
var parseOptions = require_parse_options();
|
|
2245
|
+
var { safeRe: re, t } = require_re();
|
|
2246
|
+
var cmp = require_cmp();
|
|
2247
|
+
var debug = require_debug();
|
|
2248
|
+
var SemVer = require_semver();
|
|
2249
|
+
var Range = require_range();
|
|
2250
|
+
}
|
|
2251
|
+
});
|
|
2252
|
+
|
|
2253
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js
|
|
2254
|
+
var require_satisfies = __commonJS({
|
|
2255
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js"(exports2, module2) {
|
|
2256
|
+
"use strict";
|
|
2257
|
+
var Range = require_range();
|
|
2258
|
+
var satisfies = (version, range, options) => {
|
|
2259
|
+
try {
|
|
2260
|
+
range = new Range(range, options);
|
|
2261
|
+
} catch (er) {
|
|
2262
|
+
return false;
|
|
2263
|
+
}
|
|
2264
|
+
return range.test(version);
|
|
2265
|
+
};
|
|
2266
|
+
module2.exports = satisfies;
|
|
2267
|
+
}
|
|
2268
|
+
});
|
|
2269
|
+
|
|
2270
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js
|
|
2271
|
+
var require_to_comparators = __commonJS({
|
|
2272
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
|
|
2273
|
+
"use strict";
|
|
2274
|
+
var Range = require_range();
|
|
2275
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
2276
|
+
module2.exports = toComparators;
|
|
2277
|
+
}
|
|
2278
|
+
});
|
|
2279
|
+
|
|
2280
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js
|
|
2281
|
+
var require_max_satisfying = __commonJS({
|
|
2282
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
|
|
2283
|
+
"use strict";
|
|
2284
|
+
var SemVer = require_semver();
|
|
2285
|
+
var Range = require_range();
|
|
2286
|
+
var maxSatisfying = (versions, range, options) => {
|
|
2287
|
+
let max = null;
|
|
2288
|
+
let maxSV = null;
|
|
2289
|
+
let rangeObj = null;
|
|
2290
|
+
try {
|
|
2291
|
+
rangeObj = new Range(range, options);
|
|
2292
|
+
} catch (er) {
|
|
2293
|
+
return null;
|
|
2294
|
+
}
|
|
2295
|
+
versions.forEach((v) => {
|
|
2296
|
+
if (rangeObj.test(v)) {
|
|
2297
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
2298
|
+
max = v;
|
|
2299
|
+
maxSV = new SemVer(max, options);
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
});
|
|
2303
|
+
return max;
|
|
2304
|
+
};
|
|
2305
|
+
module2.exports = maxSatisfying;
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2308
|
+
|
|
2309
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js
|
|
2310
|
+
var require_min_satisfying = __commonJS({
|
|
2311
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
|
|
2312
|
+
"use strict";
|
|
2313
|
+
var SemVer = require_semver();
|
|
2314
|
+
var Range = require_range();
|
|
2315
|
+
var minSatisfying = (versions, range, options) => {
|
|
2316
|
+
let min = null;
|
|
2317
|
+
let minSV = null;
|
|
2318
|
+
let rangeObj = null;
|
|
2319
|
+
try {
|
|
2320
|
+
rangeObj = new Range(range, options);
|
|
2321
|
+
} catch (er) {
|
|
2322
|
+
return null;
|
|
2323
|
+
}
|
|
2324
|
+
versions.forEach((v) => {
|
|
2325
|
+
if (rangeObj.test(v)) {
|
|
2326
|
+
if (!min || minSV.compare(v) === 1) {
|
|
2327
|
+
min = v;
|
|
2328
|
+
minSV = new SemVer(min, options);
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
return min;
|
|
2333
|
+
};
|
|
2334
|
+
module2.exports = minSatisfying;
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
|
|
2338
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js
|
|
2339
|
+
var require_min_version = __commonJS({
|
|
2340
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js"(exports2, module2) {
|
|
2341
|
+
"use strict";
|
|
2342
|
+
var SemVer = require_semver();
|
|
2343
|
+
var Range = require_range();
|
|
2344
|
+
var gt = require_gt();
|
|
2345
|
+
var minVersion = (range, loose) => {
|
|
2346
|
+
range = new Range(range, loose);
|
|
2347
|
+
let minver = new SemVer("0.0.0");
|
|
2348
|
+
if (range.test(minver)) {
|
|
2349
|
+
return minver;
|
|
2350
|
+
}
|
|
2351
|
+
minver = new SemVer("0.0.0-0");
|
|
2352
|
+
if (range.test(minver)) {
|
|
2353
|
+
return minver;
|
|
2354
|
+
}
|
|
2355
|
+
minver = null;
|
|
2356
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
2357
|
+
const comparators = range.set[i];
|
|
2358
|
+
let setMin = null;
|
|
2359
|
+
comparators.forEach((comparator) => {
|
|
2360
|
+
const compver = new SemVer(comparator.semver.version);
|
|
2361
|
+
switch (comparator.operator) {
|
|
2362
|
+
case ">":
|
|
2363
|
+
if (compver.prerelease.length === 0) {
|
|
2364
|
+
compver.patch++;
|
|
2365
|
+
} else {
|
|
2366
|
+
compver.prerelease.push(0);
|
|
2367
|
+
}
|
|
2368
|
+
compver.raw = compver.format();
|
|
2369
|
+
/* fallthrough */
|
|
2370
|
+
case "":
|
|
2371
|
+
case ">=":
|
|
2372
|
+
if (!setMin || gt(compver, setMin)) {
|
|
2373
|
+
setMin = compver;
|
|
2374
|
+
}
|
|
2375
|
+
break;
|
|
2376
|
+
case "<":
|
|
2377
|
+
case "<=":
|
|
2378
|
+
break;
|
|
2379
|
+
/* istanbul ignore next */
|
|
2380
|
+
default:
|
|
2381
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2384
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
2385
|
+
minver = setMin;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
if (minver && range.test(minver)) {
|
|
2389
|
+
return minver;
|
|
2390
|
+
}
|
|
2391
|
+
return null;
|
|
2392
|
+
};
|
|
2393
|
+
module2.exports = minVersion;
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
|
|
2397
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js
|
|
2398
|
+
var require_valid2 = __commonJS({
|
|
2399
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js"(exports2, module2) {
|
|
2400
|
+
"use strict";
|
|
2401
|
+
var Range = require_range();
|
|
2402
|
+
var validRange = (range, options) => {
|
|
2403
|
+
try {
|
|
2404
|
+
return new Range(range, options).range || "*";
|
|
2405
|
+
} catch (er) {
|
|
2406
|
+
return null;
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
module2.exports = validRange;
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
|
|
2413
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js
|
|
2414
|
+
var require_outside = __commonJS({
|
|
2415
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js"(exports2, module2) {
|
|
2416
|
+
"use strict";
|
|
2417
|
+
var SemVer = require_semver();
|
|
2418
|
+
var Comparator = require_comparator();
|
|
2419
|
+
var { ANY } = Comparator;
|
|
2420
|
+
var Range = require_range();
|
|
2421
|
+
var satisfies = require_satisfies();
|
|
2422
|
+
var gt = require_gt();
|
|
2423
|
+
var lt = require_lt();
|
|
2424
|
+
var lte = require_lte();
|
|
2425
|
+
var gte = require_gte();
|
|
2426
|
+
var outside = (version, range, hilo, options) => {
|
|
2427
|
+
version = new SemVer(version, options);
|
|
2428
|
+
range = new Range(range, options);
|
|
2429
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2430
|
+
switch (hilo) {
|
|
2431
|
+
case ">":
|
|
2432
|
+
gtfn = gt;
|
|
2433
|
+
ltefn = lte;
|
|
2434
|
+
ltfn = lt;
|
|
2435
|
+
comp = ">";
|
|
2436
|
+
ecomp = ">=";
|
|
2437
|
+
break;
|
|
2438
|
+
case "<":
|
|
2439
|
+
gtfn = lt;
|
|
2440
|
+
ltefn = gte;
|
|
2441
|
+
ltfn = gt;
|
|
2442
|
+
comp = "<";
|
|
2443
|
+
ecomp = "<=";
|
|
2444
|
+
break;
|
|
2445
|
+
default:
|
|
2446
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2447
|
+
}
|
|
2448
|
+
if (satisfies(version, range, options)) {
|
|
2449
|
+
return false;
|
|
2450
|
+
}
|
|
2451
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
2452
|
+
const comparators = range.set[i];
|
|
2453
|
+
let high = null;
|
|
2454
|
+
let low = null;
|
|
2455
|
+
comparators.forEach((comparator) => {
|
|
2456
|
+
if (comparator.semver === ANY) {
|
|
2457
|
+
comparator = new Comparator(">=0.0.0");
|
|
2458
|
+
}
|
|
2459
|
+
high = high || comparator;
|
|
2460
|
+
low = low || comparator;
|
|
2461
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
2462
|
+
high = comparator;
|
|
2463
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
2464
|
+
low = comparator;
|
|
2465
|
+
}
|
|
2466
|
+
});
|
|
2467
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
2468
|
+
return false;
|
|
2469
|
+
}
|
|
2470
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
2471
|
+
return false;
|
|
2472
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
2473
|
+
return false;
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
return true;
|
|
2477
|
+
};
|
|
2478
|
+
module2.exports = outside;
|
|
2479
|
+
}
|
|
2480
|
+
});
|
|
2481
|
+
|
|
2482
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js
|
|
2483
|
+
var require_gtr = __commonJS({
|
|
2484
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js"(exports2, module2) {
|
|
2485
|
+
"use strict";
|
|
2486
|
+
var outside = require_outside();
|
|
2487
|
+
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
2488
|
+
module2.exports = gtr;
|
|
2489
|
+
}
|
|
2490
|
+
});
|
|
2491
|
+
|
|
2492
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js
|
|
2493
|
+
var require_ltr = __commonJS({
|
|
2494
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js"(exports2, module2) {
|
|
2495
|
+
"use strict";
|
|
2496
|
+
var outside = require_outside();
|
|
2497
|
+
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
2498
|
+
module2.exports = ltr;
|
|
2499
|
+
}
|
|
2500
|
+
});
|
|
2501
|
+
|
|
2502
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js
|
|
2503
|
+
var require_intersects = __commonJS({
|
|
2504
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js"(exports2, module2) {
|
|
2505
|
+
"use strict";
|
|
2506
|
+
var Range = require_range();
|
|
2507
|
+
var intersects = (r1, r2, options) => {
|
|
2508
|
+
r1 = new Range(r1, options);
|
|
2509
|
+
r2 = new Range(r2, options);
|
|
2510
|
+
return r1.intersects(r2, options);
|
|
2511
|
+
};
|
|
2512
|
+
module2.exports = intersects;
|
|
2513
|
+
}
|
|
2514
|
+
});
|
|
2515
|
+
|
|
2516
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js
|
|
2517
|
+
var require_simplify = __commonJS({
|
|
2518
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js"(exports2, module2) {
|
|
2519
|
+
"use strict";
|
|
2520
|
+
var satisfies = require_satisfies();
|
|
2521
|
+
var compare = require_compare();
|
|
2522
|
+
module2.exports = (versions, range, options) => {
|
|
2523
|
+
const set = [];
|
|
2524
|
+
let first = null;
|
|
2525
|
+
let prev = null;
|
|
2526
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2527
|
+
for (const version of v) {
|
|
2528
|
+
const included = satisfies(version, range, options);
|
|
2529
|
+
if (included) {
|
|
2530
|
+
prev = version;
|
|
2531
|
+
if (!first) {
|
|
2532
|
+
first = version;
|
|
2533
|
+
}
|
|
2534
|
+
} else {
|
|
2535
|
+
if (prev) {
|
|
2536
|
+
set.push([first, prev]);
|
|
2537
|
+
}
|
|
2538
|
+
prev = null;
|
|
2539
|
+
first = null;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
if (first) {
|
|
2543
|
+
set.push([first, null]);
|
|
2544
|
+
}
|
|
2545
|
+
const ranges = [];
|
|
2546
|
+
for (const [min, max] of set) {
|
|
2547
|
+
if (min === max) {
|
|
2548
|
+
ranges.push(min);
|
|
2549
|
+
} else if (!max && min === v[0]) {
|
|
2550
|
+
ranges.push("*");
|
|
2551
|
+
} else if (!max) {
|
|
2552
|
+
ranges.push(`>=${min}`);
|
|
2553
|
+
} else if (min === v[0]) {
|
|
2554
|
+
ranges.push(`<=${max}`);
|
|
2555
|
+
} else {
|
|
2556
|
+
ranges.push(`${min} - ${max}`);
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
const simplified = ranges.join(" || ");
|
|
2560
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
2561
|
+
return simplified.length < original.length ? simplified : range;
|
|
2562
|
+
};
|
|
2563
|
+
}
|
|
2564
|
+
});
|
|
2565
|
+
|
|
2566
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js
|
|
2567
|
+
var require_subset = __commonJS({
|
|
2568
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js"(exports2, module2) {
|
|
2569
|
+
"use strict";
|
|
2570
|
+
var Range = require_range();
|
|
2571
|
+
var Comparator = require_comparator();
|
|
2572
|
+
var { ANY } = Comparator;
|
|
2573
|
+
var satisfies = require_satisfies();
|
|
2574
|
+
var compare = require_compare();
|
|
2575
|
+
var subset = (sub, dom, options = {}) => {
|
|
2576
|
+
if (sub === dom) {
|
|
2577
|
+
return true;
|
|
2578
|
+
}
|
|
2579
|
+
sub = new Range(sub, options);
|
|
2580
|
+
dom = new Range(dom, options);
|
|
2581
|
+
let sawNonNull = false;
|
|
2582
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
2583
|
+
for (const simpleDom of dom.set) {
|
|
2584
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2585
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
2586
|
+
if (isSub) {
|
|
2587
|
+
continue OUTER;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
if (sawNonNull) {
|
|
2591
|
+
return false;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
return true;
|
|
2595
|
+
};
|
|
2596
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
2597
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
2598
|
+
var simpleSubset = (sub, dom, options) => {
|
|
2599
|
+
if (sub === dom) {
|
|
2600
|
+
return true;
|
|
2601
|
+
}
|
|
2602
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2603
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2604
|
+
return true;
|
|
2605
|
+
} else if (options.includePrerelease) {
|
|
2606
|
+
sub = minimumVersionWithPreRelease;
|
|
2607
|
+
} else {
|
|
2608
|
+
sub = minimumVersion;
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2612
|
+
if (options.includePrerelease) {
|
|
2613
|
+
return true;
|
|
2614
|
+
} else {
|
|
2615
|
+
dom = minimumVersion;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
2619
|
+
let gt, lt;
|
|
2620
|
+
for (const c of sub) {
|
|
2621
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2622
|
+
gt = higherGT(gt, c, options);
|
|
2623
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
2624
|
+
lt = lowerLT(lt, c, options);
|
|
2625
|
+
} else {
|
|
2626
|
+
eqSet.add(c.semver);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
if (eqSet.size > 1) {
|
|
2630
|
+
return null;
|
|
2631
|
+
}
|
|
2632
|
+
let gtltComp;
|
|
2633
|
+
if (gt && lt) {
|
|
2634
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2635
|
+
if (gtltComp > 0) {
|
|
2636
|
+
return null;
|
|
2637
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
2638
|
+
return null;
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
for (const eq of eqSet) {
|
|
2642
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
2643
|
+
return null;
|
|
2644
|
+
}
|
|
2645
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
2646
|
+
return null;
|
|
2647
|
+
}
|
|
2648
|
+
for (const c of dom) {
|
|
2649
|
+
if (!satisfies(eq, String(c), options)) {
|
|
2650
|
+
return false;
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
return true;
|
|
2654
|
+
}
|
|
2655
|
+
let higher, lower;
|
|
2656
|
+
let hasDomLT, hasDomGT;
|
|
2657
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
2658
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
2659
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
2660
|
+
needDomLTPre = false;
|
|
2661
|
+
}
|
|
2662
|
+
for (const c of dom) {
|
|
2663
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
2664
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
2665
|
+
if (gt) {
|
|
2666
|
+
if (needDomGTPre) {
|
|
2667
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
2668
|
+
needDomGTPre = false;
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2672
|
+
higher = higherGT(gt, c, options);
|
|
2673
|
+
if (higher === c && higher !== gt) {
|
|
2674
|
+
return false;
|
|
2675
|
+
}
|
|
2676
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
|
|
2677
|
+
return false;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
if (lt) {
|
|
2681
|
+
if (needDomLTPre) {
|
|
2682
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
2683
|
+
needDomLTPre = false;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
2687
|
+
lower = lowerLT(lt, c, options);
|
|
2688
|
+
if (lower === c && lower !== lt) {
|
|
2689
|
+
return false;
|
|
2690
|
+
}
|
|
2691
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
|
|
2692
|
+
return false;
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
2696
|
+
return false;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2700
|
+
return false;
|
|
2701
|
+
}
|
|
2702
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2703
|
+
return false;
|
|
2704
|
+
}
|
|
2705
|
+
if (needDomGTPre || needDomLTPre) {
|
|
2706
|
+
return false;
|
|
2707
|
+
}
|
|
2708
|
+
return true;
|
|
2709
|
+
};
|
|
2710
|
+
var higherGT = (a, b, options) => {
|
|
2711
|
+
if (!a) {
|
|
2712
|
+
return b;
|
|
2713
|
+
}
|
|
2714
|
+
const comp = compare(a.semver, b.semver, options);
|
|
2715
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2716
|
+
};
|
|
2717
|
+
var lowerLT = (a, b, options) => {
|
|
2718
|
+
if (!a) {
|
|
2719
|
+
return b;
|
|
2720
|
+
}
|
|
2721
|
+
const comp = compare(a.semver, b.semver, options);
|
|
2722
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2723
|
+
};
|
|
2724
|
+
module2.exports = subset;
|
|
2725
|
+
}
|
|
2726
|
+
});
|
|
2727
|
+
|
|
2728
|
+
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js
|
|
2729
|
+
var require_semver2 = __commonJS({
|
|
2730
|
+
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js"(exports2, module2) {
|
|
2731
|
+
"use strict";
|
|
2732
|
+
var internalRe = require_re();
|
|
2733
|
+
var constants = require_constants();
|
|
2734
|
+
var SemVer = require_semver();
|
|
2735
|
+
var identifiers = require_identifiers();
|
|
2736
|
+
var parse = require_parse();
|
|
2737
|
+
var valid = require_valid();
|
|
2738
|
+
var clean = require_clean();
|
|
2739
|
+
var inc = require_inc();
|
|
2740
|
+
var diff = require_diff();
|
|
2741
|
+
var major = require_major();
|
|
2742
|
+
var minor = require_minor();
|
|
2743
|
+
var patch = require_patch();
|
|
2744
|
+
var prerelease = require_prerelease();
|
|
2745
|
+
var compare = require_compare();
|
|
2746
|
+
var rcompare = require_rcompare();
|
|
2747
|
+
var compareLoose = require_compare_loose();
|
|
2748
|
+
var compareBuild = require_compare_build();
|
|
2749
|
+
var sort = require_sort();
|
|
2750
|
+
var rsort = require_rsort();
|
|
2751
|
+
var gt = require_gt();
|
|
2752
|
+
var lt = require_lt();
|
|
2753
|
+
var eq = require_eq();
|
|
2754
|
+
var neq = require_neq();
|
|
2755
|
+
var gte = require_gte();
|
|
2756
|
+
var lte = require_lte();
|
|
2757
|
+
var cmp = require_cmp();
|
|
2758
|
+
var coerce = require_coerce();
|
|
2759
|
+
var Comparator = require_comparator();
|
|
2760
|
+
var Range = require_range();
|
|
2761
|
+
var satisfies = require_satisfies();
|
|
2762
|
+
var toComparators = require_to_comparators();
|
|
2763
|
+
var maxSatisfying = require_max_satisfying();
|
|
2764
|
+
var minSatisfying = require_min_satisfying();
|
|
2765
|
+
var minVersion = require_min_version();
|
|
2766
|
+
var validRange = require_valid2();
|
|
2767
|
+
var outside = require_outside();
|
|
2768
|
+
var gtr = require_gtr();
|
|
2769
|
+
var ltr = require_ltr();
|
|
2770
|
+
var intersects = require_intersects();
|
|
2771
|
+
var simplifyRange = require_simplify();
|
|
2772
|
+
var subset = require_subset();
|
|
2773
|
+
module2.exports = {
|
|
2774
|
+
parse,
|
|
2775
|
+
valid,
|
|
2776
|
+
clean,
|
|
2777
|
+
inc,
|
|
2778
|
+
diff,
|
|
2779
|
+
major,
|
|
2780
|
+
minor,
|
|
2781
|
+
patch,
|
|
2782
|
+
prerelease,
|
|
2783
|
+
compare,
|
|
2784
|
+
rcompare,
|
|
2785
|
+
compareLoose,
|
|
2786
|
+
compareBuild,
|
|
2787
|
+
sort,
|
|
2788
|
+
rsort,
|
|
2789
|
+
gt,
|
|
2790
|
+
lt,
|
|
2791
|
+
eq,
|
|
2792
|
+
neq,
|
|
2793
|
+
gte,
|
|
2794
|
+
lte,
|
|
2795
|
+
cmp,
|
|
2796
|
+
coerce,
|
|
2797
|
+
Comparator,
|
|
2798
|
+
Range,
|
|
2799
|
+
satisfies,
|
|
2800
|
+
toComparators,
|
|
2801
|
+
maxSatisfying,
|
|
2802
|
+
minSatisfying,
|
|
2803
|
+
minVersion,
|
|
2804
|
+
validRange,
|
|
2805
|
+
outside,
|
|
2806
|
+
gtr,
|
|
2807
|
+
ltr,
|
|
2808
|
+
intersects,
|
|
2809
|
+
simplifyRange,
|
|
2810
|
+
subset,
|
|
2811
|
+
SemVer,
|
|
2812
|
+
re: internalRe.re,
|
|
2813
|
+
src: internalRe.src,
|
|
2814
|
+
tokens: internalRe.t,
|
|
2815
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
2816
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
2817
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2818
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2819
|
+
};
|
|
2820
|
+
}
|
|
2821
|
+
});
|
|
2822
|
+
|
|
2823
|
+
// ../../node_modules/.pnpm/@ledgerhq+devices@8.7.0/node_modules/@ledgerhq/devices/lib-es/index.js
|
|
2824
|
+
var import_semver, DeviceModelId, devices, productMap, devicesList, ledgerUSBVendorId, identifyUSBProductId, bluetoothServices, serviceUuidToInfos;
|
|
2825
|
+
var init_lib_es3 = __esm({
|
|
2826
|
+
"../../node_modules/.pnpm/@ledgerhq+devices@8.7.0/node_modules/@ledgerhq/devices/lib-es/index.js"() {
|
|
2827
|
+
"use strict";
|
|
2828
|
+
import_semver = __toESM(require_semver2());
|
|
2829
|
+
(function(DeviceModelId2) {
|
|
2830
|
+
DeviceModelId2["blue"] = "blue";
|
|
2831
|
+
DeviceModelId2["nanoS"] = "nanoS";
|
|
2832
|
+
DeviceModelId2["nanoSP"] = "nanoSP";
|
|
2833
|
+
DeviceModelId2["nanoX"] = "nanoX";
|
|
2834
|
+
DeviceModelId2["stax"] = "stax";
|
|
2835
|
+
DeviceModelId2["europa"] = "europa";
|
|
2836
|
+
DeviceModelId2["apex"] = "apex";
|
|
2837
|
+
})(DeviceModelId || (DeviceModelId = {}));
|
|
2838
|
+
devices = {
|
|
2839
|
+
[DeviceModelId.blue]: {
|
|
2840
|
+
id: DeviceModelId.blue,
|
|
2841
|
+
productName: "Ledger\xA0Blue",
|
|
2842
|
+
productIdMM: 0,
|
|
2843
|
+
legacyUsbProductId: 0,
|
|
2844
|
+
usbOnly: true,
|
|
2845
|
+
memorySize: 480 * 1024,
|
|
2846
|
+
masks: [822083584, 822149120],
|
|
2847
|
+
getBlockSize: (_firwareVersion) => 4 * 1024
|
|
2848
|
+
},
|
|
2849
|
+
[DeviceModelId.nanoS]: {
|
|
2850
|
+
id: DeviceModelId.nanoS,
|
|
2851
|
+
productName: "Ledger\xA0Nano\xA0S",
|
|
2852
|
+
productIdMM: 16,
|
|
2853
|
+
legacyUsbProductId: 1,
|
|
2854
|
+
usbOnly: true,
|
|
2855
|
+
memorySize: 320 * 1024,
|
|
2856
|
+
masks: [823132160],
|
|
2857
|
+
getBlockSize: (firmwareVersion) => import_semver.default.lt(import_semver.default.coerce(firmwareVersion) ?? "", "2.0.0") ? 4 * 1024 : 2 * 1024
|
|
2858
|
+
},
|
|
2859
|
+
[DeviceModelId.nanoX]: {
|
|
2860
|
+
id: DeviceModelId.nanoX,
|
|
2861
|
+
productName: "Ledger\xA0Nano\xA0X",
|
|
2862
|
+
productIdMM: 64,
|
|
2863
|
+
legacyUsbProductId: 4,
|
|
2864
|
+
usbOnly: false,
|
|
2865
|
+
memorySize: 2 * 1024 * 1024,
|
|
2866
|
+
masks: [855638016],
|
|
2867
|
+
getBlockSize: (_firwareVersion) => 4 * 1024,
|
|
2868
|
+
bluetoothSpec: [
|
|
2869
|
+
{
|
|
2870
|
+
serviceUuid: "13d63400-2c97-0004-0000-4c6564676572",
|
|
2871
|
+
notifyUuid: "13d63400-2c97-0004-0001-4c6564676572",
|
|
2872
|
+
writeUuid: "13d63400-2c97-0004-0002-4c6564676572",
|
|
2873
|
+
writeCmdUuid: "13d63400-2c97-0004-0003-4c6564676572"
|
|
2874
|
+
}
|
|
2875
|
+
]
|
|
2876
|
+
},
|
|
2877
|
+
[DeviceModelId.nanoSP]: {
|
|
2878
|
+
id: DeviceModelId.nanoSP,
|
|
2879
|
+
productName: "Ledger Nano S Plus",
|
|
2880
|
+
productIdMM: 80,
|
|
2881
|
+
legacyUsbProductId: 5,
|
|
2882
|
+
usbOnly: true,
|
|
2883
|
+
memorySize: 1533 * 1024,
|
|
2884
|
+
masks: [856686592],
|
|
2885
|
+
getBlockSize: (_firmwareVersion) => 32
|
|
2886
|
+
},
|
|
2887
|
+
[DeviceModelId.apex]: {
|
|
2888
|
+
id: DeviceModelId.apex,
|
|
2889
|
+
productName: "Ledger\xA0Nano\xA0Gen5",
|
|
2890
|
+
productIdMM: 128,
|
|
2891
|
+
legacyUsbProductId: 8,
|
|
2892
|
+
usbOnly: false,
|
|
2893
|
+
memorySize: 1533 * 1024,
|
|
2894
|
+
masks: [859832320],
|
|
2895
|
+
getBlockSize: (_firmwareVersion) => 32,
|
|
2896
|
+
bluetoothSpec: [
|
|
2897
|
+
{
|
|
2898
|
+
serviceUuid: "13d63400-2c97-8004-0000-4c6564676572",
|
|
2899
|
+
notifyUuid: "13d63400-2c97-8004-0001-4c6564676572",
|
|
2900
|
+
writeUuid: "13d63400-2c97-8004-0002-4c6564676572",
|
|
2901
|
+
writeCmdUuid: "13d63400-2c97-8004-0003-4c6564676572"
|
|
2902
|
+
}
|
|
2903
|
+
]
|
|
2904
|
+
},
|
|
2905
|
+
[DeviceModelId.stax]: {
|
|
2906
|
+
id: DeviceModelId.stax,
|
|
2907
|
+
productName: "Ledger\xA0Stax",
|
|
2908
|
+
productIdMM: 96,
|
|
2909
|
+
legacyUsbProductId: 6,
|
|
2910
|
+
usbOnly: false,
|
|
2911
|
+
memorySize: 1533 * 1024,
|
|
2912
|
+
masks: [857735168],
|
|
2913
|
+
getBlockSize: (_firmwareVersion) => 32,
|
|
2914
|
+
bluetoothSpec: [
|
|
2915
|
+
{
|
|
2916
|
+
serviceUuid: "13d63400-2c97-6004-0000-4c6564676572",
|
|
2917
|
+
notifyUuid: "13d63400-2c97-6004-0001-4c6564676572",
|
|
2918
|
+
writeUuid: "13d63400-2c97-6004-0002-4c6564676572",
|
|
2919
|
+
writeCmdUuid: "13d63400-2c97-6004-0003-4c6564676572"
|
|
2920
|
+
}
|
|
2921
|
+
]
|
|
2922
|
+
},
|
|
2923
|
+
[DeviceModelId.europa]: {
|
|
2924
|
+
id: DeviceModelId.europa,
|
|
2925
|
+
productName: "Ledger\xA0Flex",
|
|
2926
|
+
productIdMM: 112,
|
|
2927
|
+
legacyUsbProductId: 7,
|
|
2928
|
+
usbOnly: false,
|
|
2929
|
+
memorySize: 1533 * 1024,
|
|
2930
|
+
masks: [858783744],
|
|
2931
|
+
getBlockSize: (_firmwareVersion) => 32,
|
|
2932
|
+
bluetoothSpec: [
|
|
2933
|
+
{
|
|
2934
|
+
serviceUuid: "13d63400-2c97-3004-0000-4c6564676572",
|
|
2935
|
+
notifyUuid: "13d63400-2c97-3004-0001-4c6564676572",
|
|
2936
|
+
writeUuid: "13d63400-2c97-3004-0002-4c6564676572",
|
|
2937
|
+
writeCmdUuid: "13d63400-2c97-3004-0003-4c6564676572"
|
|
2938
|
+
}
|
|
2939
|
+
]
|
|
2940
|
+
}
|
|
2941
|
+
};
|
|
2942
|
+
productMap = {
|
|
2943
|
+
Blue: DeviceModelId.blue,
|
|
2944
|
+
"Nano S": DeviceModelId.nanoS,
|
|
2945
|
+
"Nano S Plus": DeviceModelId.nanoSP,
|
|
2946
|
+
"Nano X": DeviceModelId.nanoX,
|
|
2947
|
+
Stax: DeviceModelId.stax,
|
|
2948
|
+
Europa: DeviceModelId.europa
|
|
2949
|
+
};
|
|
2950
|
+
devicesList = Object.values(devices);
|
|
2951
|
+
ledgerUSBVendorId = 11415;
|
|
2952
|
+
identifyUSBProductId = (usbProductId) => {
|
|
2953
|
+
const legacy = devicesList.find((d) => d.legacyUsbProductId === usbProductId);
|
|
2954
|
+
if (legacy)
|
|
2955
|
+
return legacy;
|
|
2956
|
+
const mm = usbProductId >> 8;
|
|
2957
|
+
const deviceModel = devicesList.find((d) => d.productIdMM === mm);
|
|
2958
|
+
return deviceModel;
|
|
2959
|
+
};
|
|
2960
|
+
bluetoothServices = [];
|
|
2961
|
+
serviceUuidToInfos = {};
|
|
2962
|
+
for (const id2 in devices) {
|
|
2963
|
+
const deviceModel = devices[id2];
|
|
2964
|
+
const { bluetoothSpec } = deviceModel;
|
|
2965
|
+
if (bluetoothSpec) {
|
|
2966
|
+
for (let i = 0; i < bluetoothSpec.length; i++) {
|
|
2967
|
+
const spec = bluetoothSpec[i];
|
|
2968
|
+
bluetoothServices.push(spec.serviceUuid);
|
|
2969
|
+
serviceUuidToInfos[spec.serviceUuid] = serviceUuidToInfos[spec.serviceUuid.replace(/-/g, "")] = {
|
|
2970
|
+
deviceModel,
|
|
2971
|
+
...spec
|
|
2972
|
+
};
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
});
|
|
2978
|
+
|
|
2979
|
+
// ../../node_modules/.pnpm/@ledgerhq+hw-transport-webusb@6.29.13/node_modules/@ledgerhq/hw-transport-webusb/lib-es/webusb.js
|
|
2980
|
+
async function requestLedgerDevice() {
|
|
2981
|
+
const device = await navigator.usb.requestDevice({
|
|
2982
|
+
filters: ledgerDevices
|
|
2983
|
+
});
|
|
2984
|
+
return device;
|
|
2985
|
+
}
|
|
2986
|
+
async function getLedgerDevices() {
|
|
2987
|
+
const devices2 = await navigator.usb.getDevices();
|
|
2988
|
+
return devices2.filter((d) => d.vendorId === ledgerUSBVendorId);
|
|
2989
|
+
}
|
|
2990
|
+
async function getFirstLedgerDevice() {
|
|
2991
|
+
const existingDevices = await getLedgerDevices();
|
|
2992
|
+
if (existingDevices.length > 0)
|
|
2993
|
+
return existingDevices[0];
|
|
2994
|
+
return requestLedgerDevice();
|
|
2995
|
+
}
|
|
2996
|
+
var ledgerDevices, isSupported;
|
|
2997
|
+
var init_webusb = __esm({
|
|
2998
|
+
"../../node_modules/.pnpm/@ledgerhq+hw-transport-webusb@6.29.13/node_modules/@ledgerhq/hw-transport-webusb/lib-es/webusb.js"() {
|
|
2999
|
+
"use strict";
|
|
3000
|
+
init_lib_es3();
|
|
3001
|
+
ledgerDevices = [
|
|
3002
|
+
{
|
|
3003
|
+
vendorId: ledgerUSBVendorId
|
|
3004
|
+
}
|
|
3005
|
+
];
|
|
3006
|
+
isSupported = () => Promise.resolve(!!navigator && !!navigator.usb && typeof navigator.usb.getDevices === "function");
|
|
3007
|
+
}
|
|
3008
|
+
});
|
|
3009
|
+
|
|
3010
|
+
// ../../node_modules/.pnpm/@ledgerhq+hw-transport-webusb@6.29.13/node_modules/@ledgerhq/hw-transport-webusb/lib-es/TransportWebUSB.js
|
|
3011
|
+
var TransportWebUSB_exports = {};
|
|
3012
|
+
__export(TransportWebUSB_exports, {
|
|
3013
|
+
default: () => TransportWebUSB
|
|
3014
|
+
});
|
|
3015
|
+
async function gracefullyResetDevice(device) {
|
|
3016
|
+
try {
|
|
3017
|
+
await device.reset();
|
|
3018
|
+
} catch (err) {
|
|
3019
|
+
console.warn(err);
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
var configurationValue, endpointNumber, TransportWebUSB;
|
|
3023
|
+
var init_TransportWebUSB = __esm({
|
|
3024
|
+
"../../node_modules/.pnpm/@ledgerhq+hw-transport-webusb@6.29.13/node_modules/@ledgerhq/hw-transport-webusb/lib-es/TransportWebUSB.js"() {
|
|
3025
|
+
"use strict";
|
|
3026
|
+
init_Transport();
|
|
3027
|
+
init_hid_framing();
|
|
3028
|
+
init_lib_es3();
|
|
3029
|
+
init_lib_es2();
|
|
3030
|
+
init_lib_es();
|
|
3031
|
+
init_webusb();
|
|
3032
|
+
configurationValue = 1;
|
|
3033
|
+
endpointNumber = 3;
|
|
3034
|
+
TransportWebUSB = class _TransportWebUSB extends Transport {
|
|
3035
|
+
device;
|
|
3036
|
+
deviceModel;
|
|
3037
|
+
channel = Math.floor(Math.random() * 65535);
|
|
3038
|
+
packetSize = 64;
|
|
3039
|
+
interfaceNumber;
|
|
3040
|
+
constructor(device, interfaceNumber) {
|
|
3041
|
+
super();
|
|
3042
|
+
this.device = device;
|
|
3043
|
+
this.interfaceNumber = interfaceNumber;
|
|
3044
|
+
this.deviceModel = identifyUSBProductId(device.productId);
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Check if WebUSB transport is supported.
|
|
3048
|
+
*/
|
|
3049
|
+
static isSupported = isSupported;
|
|
3050
|
+
/**
|
|
3051
|
+
* List the WebUSB devices that was previously authorized by the user.
|
|
3052
|
+
*/
|
|
3053
|
+
static list = getLedgerDevices;
|
|
3054
|
+
/**
|
|
3055
|
+
* Actively listen to WebUSB devices and emit ONE device
|
|
3056
|
+
* that was either accepted before, if not it will trigger the native permission UI.
|
|
3057
|
+
*
|
|
3058
|
+
* Important: it must be called in the context of a UI click!
|
|
3059
|
+
*/
|
|
3060
|
+
static listen = (observer) => {
|
|
3061
|
+
let unsubscribed = false;
|
|
3062
|
+
getFirstLedgerDevice().then((device) => {
|
|
3063
|
+
if (!unsubscribed) {
|
|
3064
|
+
const deviceModel = identifyUSBProductId(device.productId);
|
|
3065
|
+
observer.next({
|
|
3066
|
+
type: "add",
|
|
3067
|
+
descriptor: device,
|
|
3068
|
+
deviceModel
|
|
3069
|
+
});
|
|
3070
|
+
observer.complete();
|
|
3071
|
+
}
|
|
3072
|
+
}, (error) => {
|
|
3073
|
+
if (window.DOMException && error instanceof window.DOMException && error.code === 18) {
|
|
3074
|
+
observer.error(new TransportWebUSBGestureRequired(error.message));
|
|
3075
|
+
} else {
|
|
3076
|
+
observer.error(new TransportOpenUserCancelled(error.message));
|
|
3077
|
+
}
|
|
3078
|
+
});
|
|
3079
|
+
function unsubscribe() {
|
|
3080
|
+
unsubscribed = true;
|
|
3081
|
+
}
|
|
3082
|
+
return {
|
|
3083
|
+
unsubscribe
|
|
3084
|
+
};
|
|
3085
|
+
};
|
|
3086
|
+
/**
|
|
3087
|
+
* Similar to create() except it will always display the device permission (even if some devices are already accepted).
|
|
3088
|
+
*/
|
|
3089
|
+
static async request() {
|
|
3090
|
+
const device = await requestLedgerDevice();
|
|
3091
|
+
return _TransportWebUSB.open(device);
|
|
3092
|
+
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Similar to create() except it will never display the device permission (it returns a Promise<?Transport>, null if it fails to find a device).
|
|
3095
|
+
*/
|
|
3096
|
+
static async openConnected() {
|
|
3097
|
+
const devices2 = await getLedgerDevices();
|
|
3098
|
+
if (devices2.length === 0)
|
|
3099
|
+
return null;
|
|
3100
|
+
return _TransportWebUSB.open(devices2[0]);
|
|
3101
|
+
}
|
|
3102
|
+
/**
|
|
3103
|
+
* Create a Ledger transport with a USBDevice
|
|
3104
|
+
*/
|
|
3105
|
+
static async open(device) {
|
|
3106
|
+
await device.open();
|
|
3107
|
+
if (device.configuration === null) {
|
|
3108
|
+
await device.selectConfiguration(configurationValue);
|
|
3109
|
+
}
|
|
3110
|
+
await gracefullyResetDevice(device);
|
|
3111
|
+
const iface = device.configurations[0].interfaces.find(({ alternates }) => alternates.some((a) => a.interfaceClass === 255));
|
|
3112
|
+
if (!iface) {
|
|
3113
|
+
throw new TransportInterfaceNotAvailable("No WebUSB interface found for your Ledger device. Please upgrade firmware or contact techsupport.");
|
|
3114
|
+
}
|
|
3115
|
+
const interfaceNumber = iface.interfaceNumber;
|
|
3116
|
+
try {
|
|
3117
|
+
await device.claimInterface(interfaceNumber);
|
|
3118
|
+
} catch (e) {
|
|
3119
|
+
await device.close();
|
|
3120
|
+
throw new TransportInterfaceNotAvailable(e.message);
|
|
3121
|
+
}
|
|
3122
|
+
const transport = new _TransportWebUSB(device, interfaceNumber);
|
|
3123
|
+
const onDisconnect = (e) => {
|
|
3124
|
+
if (device === e.device) {
|
|
3125
|
+
navigator.usb.removeEventListener("disconnect", onDisconnect);
|
|
3126
|
+
transport._emitDisconnect(new DisconnectedDevice());
|
|
3127
|
+
}
|
|
3128
|
+
};
|
|
3129
|
+
navigator.usb.addEventListener("disconnect", onDisconnect);
|
|
3130
|
+
return transport;
|
|
3131
|
+
}
|
|
3132
|
+
_disconnectEmitted = false;
|
|
3133
|
+
_emitDisconnect = (e) => {
|
|
3134
|
+
if (this._disconnectEmitted)
|
|
3135
|
+
return;
|
|
3136
|
+
this._disconnectEmitted = true;
|
|
3137
|
+
this.emit("disconnect", e);
|
|
3138
|
+
};
|
|
3139
|
+
/**
|
|
3140
|
+
* Release the transport device
|
|
3141
|
+
*/
|
|
3142
|
+
async close() {
|
|
3143
|
+
await this.exchangeBusyPromise;
|
|
3144
|
+
await this.device.releaseInterface(this.interfaceNumber);
|
|
3145
|
+
await gracefullyResetDevice(this.device);
|
|
3146
|
+
await this.device.close();
|
|
3147
|
+
}
|
|
3148
|
+
/**
|
|
3149
|
+
* Exchange with the device using APDU protocol.
|
|
3150
|
+
* @param apdu
|
|
3151
|
+
* @returns a promise of apdu response
|
|
3152
|
+
*/
|
|
3153
|
+
async exchange(apdu) {
|
|
3154
|
+
const b = await this.exchangeAtomicImpl(async () => {
|
|
3155
|
+
const { channel, packetSize } = this;
|
|
3156
|
+
log("apdu", "=> " + apdu.toString("hex"));
|
|
3157
|
+
const framing = hid_framing_default(channel, packetSize);
|
|
3158
|
+
const blocks = framing.makeBlocks(apdu);
|
|
3159
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
3160
|
+
await this.device.transferOut(endpointNumber, blocks[i]);
|
|
3161
|
+
}
|
|
3162
|
+
let result;
|
|
3163
|
+
let acc;
|
|
3164
|
+
while (!(result = framing.getReducedResult(acc))) {
|
|
3165
|
+
const r = await this.device.transferIn(endpointNumber, packetSize);
|
|
3166
|
+
const buffer = Buffer.from(r.data.buffer);
|
|
3167
|
+
acc = framing.reduceResponse(acc, buffer);
|
|
3168
|
+
}
|
|
3169
|
+
log("apdu", "<= " + result.toString("hex"));
|
|
3170
|
+
return result;
|
|
3171
|
+
}).catch((e) => {
|
|
3172
|
+
if (e && e.message && e.message.includes("disconnected")) {
|
|
3173
|
+
this._emitDisconnect(e);
|
|
3174
|
+
throw new DisconnectedDeviceDuringOperation(e.message);
|
|
3175
|
+
}
|
|
3176
|
+
throw e;
|
|
3177
|
+
});
|
|
3178
|
+
return b;
|
|
3179
|
+
}
|
|
3180
|
+
setScrambleKey() {
|
|
3181
|
+
}
|
|
3182
|
+
};
|
|
3183
|
+
}
|
|
3184
|
+
});
|
|
29
3185
|
|
|
30
3186
|
// src/browser.ts
|
|
31
3187
|
var browser_exports = {};
|
|
@@ -2952,6 +6108,31 @@ var SIP = class {
|
|
|
2952
6108
|
intentsAdapter;
|
|
2953
6109
|
/** Cache of pending swaps by intent ID */
|
|
2954
6110
|
pendingSwaps = /* @__PURE__ */ new Map();
|
|
6111
|
+
/**
|
|
6112
|
+
* Create a new SIP SDK client
|
|
6113
|
+
*
|
|
6114
|
+
* @param config - Configuration options for the client
|
|
6115
|
+
* @throws {ValidationError} If configuration is invalid
|
|
6116
|
+
*
|
|
6117
|
+
* @example Minimal configuration
|
|
6118
|
+
* ```typescript
|
|
6119
|
+
* const sip = new SIP({ network: 'testnet' })
|
|
6120
|
+
* ```
|
|
6121
|
+
*
|
|
6122
|
+
* @example Full configuration
|
|
6123
|
+
* ```typescript
|
|
6124
|
+
* const sip = new SIP({
|
|
6125
|
+
* network: 'mainnet',
|
|
6126
|
+
* mode: 'production',
|
|
6127
|
+
* defaultPrivacy: PrivacyLevel.COMPLIANT,
|
|
6128
|
+
* proofProvider: await NoirProofProvider.create(),
|
|
6129
|
+
* intentsAdapter: { jwtToken: process.env.JWT },
|
|
6130
|
+
* rpcEndpoints: {
|
|
6131
|
+
* ethereum: 'https://eth-mainnet.g.alchemy.com/v2/KEY',
|
|
6132
|
+
* },
|
|
6133
|
+
* })
|
|
6134
|
+
* ```
|
|
6135
|
+
*/
|
|
2955
6136
|
constructor(config) {
|
|
2956
6137
|
if (!config || typeof config !== "object") {
|
|
2957
6138
|
throw new ValidationError("config must be an object");
|
|
@@ -4435,11 +7616,11 @@ function computeAttestationHash(message) {
|
|
|
4435
7616
|
return (0, import_sha2569.sha256)(toHash);
|
|
4436
7617
|
}
|
|
4437
7618
|
function getChainNumericId(chain) {
|
|
4438
|
-
const
|
|
4439
|
-
if (
|
|
7619
|
+
const id2 = CHAIN_NUMERIC_IDS[chain];
|
|
7620
|
+
if (id2 === void 0) {
|
|
4440
7621
|
throw new ValidationError(`Unknown chain: ${chain}`, "chain");
|
|
4441
7622
|
}
|
|
4442
|
-
return
|
|
7623
|
+
return id2;
|
|
4443
7624
|
}
|
|
4444
7625
|
function normalizeToBytes(hex, length, field) {
|
|
4445
7626
|
const stripped = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
@@ -11632,8 +14813,8 @@ var WalletRegistry = class {
|
|
|
11632
14813
|
*
|
|
11633
14814
|
* @param id - The wallet identifier
|
|
11634
14815
|
*/
|
|
11635
|
-
unregister(
|
|
11636
|
-
this.entries.delete(
|
|
14816
|
+
unregister(id2) {
|
|
14817
|
+
this.entries.delete(id2);
|
|
11637
14818
|
}
|
|
11638
14819
|
/**
|
|
11639
14820
|
* Get wallet info by ID
|
|
@@ -11641,8 +14822,8 @@ var WalletRegistry = class {
|
|
|
11641
14822
|
* @param id - The wallet identifier
|
|
11642
14823
|
* @returns The wallet info or undefined
|
|
11643
14824
|
*/
|
|
11644
|
-
getInfo(
|
|
11645
|
-
return this.entries.get(
|
|
14825
|
+
getInfo(id2) {
|
|
14826
|
+
return this.entries.get(id2)?.info;
|
|
11646
14827
|
}
|
|
11647
14828
|
/**
|
|
11648
14829
|
* Get all registered wallet infos
|
|
@@ -11693,8 +14874,8 @@ var WalletRegistry = class {
|
|
|
11693
14874
|
* @param id - The wallet identifier
|
|
11694
14875
|
* @returns True if wallet is detected
|
|
11695
14876
|
*/
|
|
11696
|
-
isAvailable(
|
|
11697
|
-
const entry = this.entries.get(
|
|
14877
|
+
isAvailable(id2) {
|
|
14878
|
+
const entry = this.entries.get(id2);
|
|
11698
14879
|
return entry ? entry.detect() : false;
|
|
11699
14880
|
}
|
|
11700
14881
|
/**
|
|
@@ -11704,10 +14885,10 @@ var WalletRegistry = class {
|
|
|
11704
14885
|
* @returns A new wallet adapter instance
|
|
11705
14886
|
* @throws If wallet is not registered
|
|
11706
14887
|
*/
|
|
11707
|
-
create(
|
|
11708
|
-
const entry = this.entries.get(
|
|
14888
|
+
create(id2) {
|
|
14889
|
+
const entry = this.entries.get(id2);
|
|
11709
14890
|
if (!entry) {
|
|
11710
|
-
throw new Error(`Wallet '${
|
|
14891
|
+
throw new Error(`Wallet '${id2}' is not registered`);
|
|
11711
14892
|
}
|
|
11712
14893
|
return entry.factory();
|
|
11713
14894
|
}
|
|
@@ -11718,8 +14899,8 @@ var WalletRegistry = class {
|
|
|
11718
14899
|
* @returns A connected wallet adapter
|
|
11719
14900
|
* @throws If wallet is not registered or connection fails
|
|
11720
14901
|
*/
|
|
11721
|
-
async connect(
|
|
11722
|
-
const wallet = this.create(
|
|
14902
|
+
async connect(id2) {
|
|
14903
|
+
const wallet = this.create(id2);
|
|
11723
14904
|
await wallet.connect();
|
|
11724
14905
|
return wallet;
|
|
11725
14906
|
}
|
|
@@ -13593,8 +16774,8 @@ var LedgerWalletAdapter = class extends BaseWalletAdapter {
|
|
|
13593
16774
|
}
|
|
13594
16775
|
this._connectionState = "connecting";
|
|
13595
16776
|
try {
|
|
13596
|
-
const
|
|
13597
|
-
this.transport = await
|
|
16777
|
+
const TransportWebUSB2 = await this.loadTransport();
|
|
16778
|
+
this.transport = await TransportWebUSB2.create();
|
|
13598
16779
|
this.app = await this.loadApp();
|
|
13599
16780
|
this._account = await this.getAccountFromDevice();
|
|
13600
16781
|
this._deviceInfo = {
|
|
@@ -13743,7 +16924,7 @@ var LedgerWalletAdapter = class extends BaseWalletAdapter {
|
|
|
13743
16924
|
*/
|
|
13744
16925
|
async loadTransport() {
|
|
13745
16926
|
try {
|
|
13746
|
-
const module2 = await
|
|
16927
|
+
const module2 = await Promise.resolve().then(() => (init_TransportWebUSB(), TransportWebUSB_exports));
|
|
13747
16928
|
return module2.default;
|
|
13748
16929
|
} catch {
|
|
13749
16930
|
throw new HardwareWalletError(
|
|
@@ -16053,9 +19234,9 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
16053
19234
|
};
|
|
16054
19235
|
this.worker.onerror = (error) => {
|
|
16055
19236
|
console.error("[BrowserNoirProvider] Worker error:", error);
|
|
16056
|
-
for (const [
|
|
19237
|
+
for (const [id2, { reject }] of this.workerPending) {
|
|
16057
19238
|
reject(new Error(`Worker error: ${error.message}`));
|
|
16058
|
-
this.workerPending.delete(
|
|
19239
|
+
this.workerPending.delete(id2);
|
|
16059
19240
|
}
|
|
16060
19241
|
this.worker?.terminate();
|
|
16061
19242
|
this.worker = null;
|
|
@@ -17021,9 +20202,9 @@ var ProofWorker = class _ProofWorker {
|
|
|
17021
20202
|
};
|
|
17022
20203
|
this.worker.onerror = (error) => {
|
|
17023
20204
|
console.error("[ProofWorker] Worker error:", error);
|
|
17024
|
-
for (const [
|
|
20205
|
+
for (const [id2, { reject }] of this.pendingRequests) {
|
|
17025
20206
|
reject(new Error(`Worker error: ${error.message}`));
|
|
17026
|
-
this.pendingRequests.delete(
|
|
20207
|
+
this.pendingRequests.delete(id2);
|
|
17027
20208
|
}
|
|
17028
20209
|
};
|
|
17029
20210
|
await this.sendRequest("init", void 0, config);
|
|
@@ -17064,9 +20245,9 @@ var ProofWorker = class _ProofWorker {
|
|
|
17064
20245
|
reject(new Error("Worker not available"));
|
|
17065
20246
|
return;
|
|
17066
20247
|
}
|
|
17067
|
-
const
|
|
17068
|
-
this.pendingRequests.set(
|
|
17069
|
-
const request = { id, type, params, config };
|
|
20248
|
+
const id2 = `req_${++this.requestCounter}_${Date.now()}`;
|
|
20249
|
+
this.pendingRequests.set(id2, { resolve, reject, onProgress });
|
|
20250
|
+
const request = { id: id2, type, params, config };
|
|
17070
20251
|
this.worker.postMessage(request);
|
|
17071
20252
|
});
|
|
17072
20253
|
}
|