@onekeyfe/hd-core 1.2.0-alpha.162 → 1.2.0-alpha.164

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.
Files changed (40) hide show
  1. package/__tests__/device-state-events.test.ts +2 -2
  2. package/__tests__/device-state-mapper.test.ts +2 -11
  3. package/__tests__/device-utils.test.ts +0 -6
  4. package/__tests__/firmware-memory-host.test.ts +126 -0
  5. package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +3 -13
  6. package/__tests__/protocol-v2-resources.test.ts +2 -35
  7. package/__tests__/protocol-v2.test.ts +42 -89
  8. package/__tests__/search-devices.test.ts +3 -4
  9. package/dist/api/FirmwareUpdateV4.d.ts +1 -3
  10. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  11. package/dist/api/firmware/FirmwareMemoryHost.d.ts +22 -0
  12. package/dist/api/firmware/FirmwareMemoryHost.d.ts.map +1 -0
  13. package/dist/api/firmware/FirmwareUpdatePlan.d.ts +15 -0
  14. package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -1
  15. package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -1
  16. package/dist/core/index.d.ts.map +1 -1
  17. package/dist/device/Device.d.ts.map +1 -1
  18. package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
  19. package/dist/index.d.ts +22 -2
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +298 -102
  22. package/dist/protocols/protocol-v2/resources.d.ts +0 -1
  23. package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
  24. package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -1
  25. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  26. package/package.json +4 -4
  27. package/src/api/FirmwareUpdateV4.ts +179 -75
  28. package/src/api/SearchDevices.ts +2 -2
  29. package/src/api/firmware/FirmwareMemoryHost.ts +143 -0
  30. package/src/api/firmware/FirmwareUpdatePlan.ts +41 -0
  31. package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +6 -10
  32. package/src/core/index.ts +97 -6
  33. package/src/device/Device.ts +1 -3
  34. package/src/device/DeviceStateMapper.ts +2 -2
  35. package/src/deviceProfile/buildDeviceFeatures.ts +2 -7
  36. package/src/index.ts +6 -0
  37. package/src/protocols/protocol-v2/resources.ts +12 -16
  38. package/src/types/api/firmwareUpdate.ts +1 -1
  39. package/src/utils/deviceFeaturesCompat.ts +4 -9
  40. package/src/utils/deviceInfoUtils.ts +1 -3
package/dist/index.js CHANGED
@@ -419,8 +419,7 @@ const resolveDeviceBleName = (features) => {
419
419
  if (!features)
420
420
  return null;
421
421
  const compatible = asCompatibleFeatures(features);
422
- const bleName = (_a = firstNonEmptyString(compatible.bleName, compatible.onekey_ble_name, compatible.ble_name)) !== null && _a !== void 0 ? _a : null;
423
- return bleName ? hdShared.canonicalizePro2BleAdvertisementName(bleName) : null;
422
+ return ((_a = firstNonEmptyString(compatible.bleName, compatible.onekey_ble_name, compatible.ble_name)) !== null && _a !== void 0 ? _a : null);
424
423
  };
425
424
  const resolveDeviceFirmwareVersion = (features) => {
426
425
  var _a;
@@ -468,7 +467,7 @@ const getDeviceTypeByBleName = (name) => {
468
467
  if (/^Touch/i.test(name))
469
468
  return hdShared.EDeviceType.Touch;
470
469
  const compactName = name.replace(/[\s-]/g, '');
471
- if (/\bPro\s*2\b/i.test(name) || /^(?:OneKey)?Pro2[a-f0-9]{4}$/i.test(compactName)) {
470
+ if (/\bPro\s*2\b/i.test(name) || /^Pro2/i.test(name) || /^(?:OneKey)?Pro2/i.test(compactName)) {
472
471
  return hdShared.EDeviceType.Pro2;
473
472
  }
474
473
  if (/\bNeo\b/i.test(name) || /^Neo/i.test(name) || /^(?:OneKey)?Neo/i.test(compactName)) {
@@ -930,6 +929,22 @@ const finalizeFirmwareUpdatePlan = ({ features, firmwareType, platform, artifact
930
929
  };
931
930
  return assertFirmwareUpdatePlan(Object.assign(Object.assign({}, planWithoutDigest), { planDigest: digestFirmwareUpdatePlan(planWithoutDigest) }));
932
931
  };
932
+ const buildProtocolV2LocalFirmwareUpdatePlan = ({ features, firmwareType, platform, artifacts, }) => {
933
+ if (artifacts.length === 0) {
934
+ return planError('Protocol V2 local firmware plan has no artifacts');
935
+ }
936
+ const plan = finalizeFirmwareUpdatePlan({
937
+ features,
938
+ firmwareType,
939
+ platform,
940
+ artifacts: artifacts.map(artifact => (Object.assign(Object.assign({}, artifact), { role: artifact.target === 'resource' ? 'resourceBundle' : 'component', url: `https://local-firmware.invalid/${encodeURIComponent(artifact.artifactId)}` }))),
941
+ targetsToUpdate: artifacts.map(artifact => artifact.target),
942
+ });
943
+ if (plan.executor !== 'v4') {
944
+ return planError('Protocol V2 local firmware plan requires executor v4');
945
+ }
946
+ return plan;
947
+ };
933
948
  const buildProtocolV2FirmwareUpdatePlan = ({ features, firmwareType, platform, release, targetsToUpdate, forceUpdateTargets, resourceArchive, }) => {
934
949
  const validatedForceTargets = validateFirmwareUpdatePlanForceTargets(forceUpdateTargets);
935
950
  if (validatedForceTargets.some(target => target === 'ble' || target === 'bootloader')) {
@@ -1120,10 +1135,6 @@ const getFirmwareUpdateResourceName = (value) => {
1120
1135
  }
1121
1136
  return resourceName;
1122
1137
  };
1123
- const getPreparedEntryIdentity = (entryName) => {
1124
- getFirmwareUpdateResourceName(entryName);
1125
- return entryName.toLowerCase();
1126
- };
1127
1138
  const assertPreparedEntry = (value) => {
1128
1139
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
1129
1140
  return preparedPlanError('Firmware prepared plan entry must be an object');
@@ -1176,8 +1187,7 @@ const assertPreparedArtifacts = ({ plan, artifacts, }) => {
1176
1187
  return preparedPlanError('Firmware prepared plan materialization is incomplete');
1177
1188
  }
1178
1189
  if (materializedEntries &&
1179
- new Set(materializedEntries.map(entry => getPreparedEntryIdentity(entry.entryName))).size !==
1180
- materializedEntries.length) {
1190
+ new Set(materializedEntries.map(entry => getFirmwareUpdateResourceName(entry.entryName).toLowerCase())).size !== materializedEntries.length) {
1181
1191
  return preparedPlanError('Firmware prepared plan contains duplicate entry names');
1182
1192
  }
1183
1193
  return Object.assign(Object.assign(Object.assign(Object.assign({ artifactId: planArtifact.artifactId, role: planArtifact.role, target: planArtifact.target, container: planArtifact.container }, (planArtifact.logicalName ? { logicalName: planArtifact.logicalName } : {})), (planArtifact.targetVersion ? { targetVersion: planArtifact.targetVersion } : {})), { artifact: Object.assign(Object.assign({}, artifact), { sha256: artifact.sha256.toLowerCase() }) }), ((materializedEntries === null || materializedEntries === void 0 ? void 0 : materializedEntries.length) ? { materializedEntries } : {}));
@@ -1283,7 +1293,7 @@ const validateFirmwareUpdatePreparedPlan = (value) => {
1283
1293
  assertFirmwareArtifactReference(artifact.artifact);
1284
1294
  const materializedEntryNames = (_d = (_c = artifact.materializedEntries) === null || _c === void 0 ? void 0 : _c.map(entry => {
1285
1295
  assertPreparedEntry(entry);
1286
- return getPreparedEntryIdentity(entry.entryName);
1296
+ return getFirmwareUpdateResourceName(entry.entryName).toLowerCase();
1287
1297
  })) !== null && _d !== void 0 ? _d : [];
1288
1298
  if (new Set(materializedEntryNames).size !== materializedEntryNames.length) {
1289
1299
  return preparedPlanError('Firmware prepared plan contains duplicate entry names');
@@ -40706,26 +40716,21 @@ function parseProtocolV2Resources(value) {
40706
40716
  },
40707
40717
  };
40708
40718
  }
40709
- function isProtocolV2ResourceArchiveEntryName(entryName) {
40710
- var _a;
40711
- const normalized = entryName.replace(/\\/g, '/');
40712
- if (!normalized.toLowerCase().endsWith('.okpkg')) {
40713
- return false;
40714
- }
40715
- const parts = normalized.split('/');
40716
- const fileName = (_a = parts[parts.length - 1]) !== null && _a !== void 0 ? _a : '';
40717
- return (fileName.length > 0 &&
40718
- !fileName.startsWith('.') &&
40719
- !parts.some(part => part === '__MACOSX' || part === '.' || part === '..' || part === ''));
40720
- }
40721
- function isSafeResourceDevicePath(path) {
40722
- return !(path.includes('\\') ||
40719
+ const PROTOCOL_V2_RESOURCE_DEVICE_ROOTS = ['vol0:/bundles/', 'vol0:/loaders/rom/'];
40720
+ function isAllowedResourceDevicePath(path) {
40721
+ if (path.includes('\\') ||
40723
40722
  path.includes('//') ||
40724
40723
  [...path].some(char => {
40725
40724
  const code = char.charCodeAt(0);
40726
40725
  return code <= 0x1f || code === 0x7f;
40727
40726
  }) ||
40728
- path.split('/').some(part => part === '.' || part === '..'));
40727
+ path.split('/').some(part => part === '.' || part === '..')) {
40728
+ return false;
40729
+ }
40730
+ if (path === PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH) {
40731
+ return true;
40732
+ }
40733
+ return (path.endsWith('.okpkg') && PROTOCOL_V2_RESOURCE_DEVICE_ROOTS.some(root => path.startsWith(root)));
40729
40734
  }
40730
40735
  function readAscii(bytes, offset, length) {
40731
40736
  return Array.from(bytes.slice(offset, offset + length))
@@ -40743,7 +40748,7 @@ function readResourceDevicePath(bytes) {
40743
40748
  throw new Error('Invalid Pro2 RESOURCE package device path metadata');
40744
40749
  }
40745
40750
  const path = readAscii(pathBytes, 0, pathBytes.byteLength);
40746
- if (!isSafeResourceDevicePath(path)) {
40751
+ if (!isAllowedResourceDevicePath(path)) {
40747
40752
  throw new Error(`Invalid Pro2 RESOURCE package device path: ${path}`);
40748
40753
  }
40749
40754
  return path;
@@ -44526,7 +44531,7 @@ const mapProtocolV2DeviceInfoToState = (info, mode = 'unknown') => {
44526
44531
  vendor: 'onekey.so',
44527
44532
  serialNo: (_b = info.hw) === null || _b === void 0 ? void 0 : _b.serial_no,
44528
44533
  bleName: ((_c = info.coprocessor) === null || _c === void 0 ? void 0 : _c.bt_adv_name)
44529
- ? hdShared.canonicalizePro2BleAdvertisementName(info.coprocessor.bt_adv_name)
44534
+ ? hdShared.normalizePro2FindMyAdvertisementName(info.coprocessor.bt_adv_name)
44530
44535
  : undefined,
44531
44536
  deviceId: loader ? null : undefined,
44532
44537
  }),
@@ -45407,8 +45412,7 @@ class Device extends events.exports {
45407
45412
  }
45408
45413
  getCurrentBleName() {
45409
45414
  var _a, _b;
45410
- const bleName = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.identity.bleName) !== null && _b !== void 0 ? _b : null;
45411
- return bleName ? hdShared.canonicalizePro2BleAdvertisementName(bleName) : null;
45415
+ return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.identity.bleName) !== null && _b !== void 0 ? _b : null;
45412
45416
  }
45413
45417
  getCurrentLabel() {
45414
45418
  var _a, _b;
@@ -46919,7 +46923,7 @@ class SearchDevices extends BaseMethod {
46919
46923
  if (!seenIds.has(lowerId)) {
46920
46924
  seenIds.add(lowerId);
46921
46925
  const rawBleName = (_e = (_d = device.name) !== null && _d !== void 0 ? _d : device.localName) !== null && _e !== void 0 ? _e : '';
46922
- const bleName = hdShared.canonicalizePro2BleAdvertisementName(rawBleName);
46926
+ const bleName = hdShared.normalizePro2FindMyAdvertisementName(rawBleName);
46923
46927
  devices.push(Object.assign(Object.assign({}, device), { connectId: device.id, serialNo: null, uuid: '', deviceId: null, name: bleName || device.name, deviceType: getDeviceTypeByBleName(bleName) }));
46924
46928
  }
46925
46929
  }
@@ -51703,6 +51707,86 @@ const INSTALLABLE_FIRMWARE_TARGET_IDS = new Set([
51703
51707
  ]);
51704
51708
  new Map(Object.entries(ProtocolV2FirmwareTargetType).flatMap(([key, value]) => INSTALLABLE_FIRMWARE_TARGET_IDS.has(value) ? [[key, value]] : []));
51705
51709
 
51710
+ let memoryHostSequence = 0;
51711
+ const createReference = (binary, prefix) => {
51712
+ const digest = utils.bytesToHex(sha256.sha256(new Uint8Array(binary)));
51713
+ return {
51714
+ artifactRef: `fwmem:${prefix}:${digest.slice(0, 32)}`,
51715
+ size: binary.byteLength,
51716
+ sha256: digest,
51717
+ };
51718
+ };
51719
+ function prepareFirmwareUpdateV4MemoryHost({ sdk, plan, artifacts, }) {
51720
+ if (plan.executor !== 'v4') {
51721
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Firmware memory host only supports V4 plans');
51722
+ }
51723
+ memoryHostSequence += 1;
51724
+ const hostId = `${Date.now()}:${memoryHostSequence}`;
51725
+ const binaries = new Map();
51726
+ const inputs = artifacts.map((input, artifactIndex) => {
51727
+ var _a;
51728
+ const artifactBinary = new Uint8Array(input.binary).slice();
51729
+ const artifact = createReference(artifactBinary.buffer, `${hostId}:artifact:${artifactIndex}`);
51730
+ binaries.set(artifact.artifactRef, artifactBinary);
51731
+ const materializedEntries = (_a = input.materializedEntries) === null || _a === void 0 ? void 0 : _a.map((entry, entryIndex) => {
51732
+ const entryArtifact = createReference(entry.binary, `${hostId}:entry:${artifactIndex}:${entryIndex}`);
51733
+ return {
51734
+ entryName: entry.entryName,
51735
+ artifact: entryArtifact,
51736
+ };
51737
+ });
51738
+ return Object.assign({ artifactId: input.artifactId, artifact }, ((materializedEntries === null || materializedEntries === void 0 ? void 0 : materializedEntries.length) ? { materializedEntries } : {}));
51739
+ });
51740
+ const preparedPlan = sdk.prepareFirmwareUpdatePlan({
51741
+ plan,
51742
+ leaseRef: `fwmemlease:${hostId}`,
51743
+ artifacts: inputs,
51744
+ });
51745
+ const readers = new Map();
51746
+ let readerSequence = 0;
51747
+ const artifactReader = {
51748
+ open({ artifactRef }) {
51749
+ const binary = binaries.get(artifactRef);
51750
+ if (!binary) {
51751
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Firmware memory artifact is unavailable');
51752
+ }
51753
+ readerSequence += 1;
51754
+ const readerId = `fwmemreader:${hostId}:${readerSequence}`;
51755
+ readers.set(readerId, binary);
51756
+ return Promise.resolve({ readerId, size: binary.byteLength });
51757
+ },
51758
+ read({ readerId, offset, length }) {
51759
+ const binary = readers.get(readerId);
51760
+ if (!binary || offset < 0 || length <= 0 || offset + length > binary.byteLength) {
51761
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Firmware memory artifact read is invalid');
51762
+ }
51763
+ const data = binary.slice(offset, offset + length).buffer;
51764
+ return Promise.resolve({
51765
+ data,
51766
+ bytesRead: data.byteLength,
51767
+ eof: offset + length === binary.byteLength,
51768
+ });
51769
+ },
51770
+ close({ readerId }) {
51771
+ readers.delete(readerId);
51772
+ return Promise.resolve();
51773
+ },
51774
+ };
51775
+ const hostBindingGeneration = sdk.registerFirmwareUpdateHostBinding({
51776
+ artifactReader,
51777
+ preparedPlanDigest: preparedPlan.preparedPlanDigest,
51778
+ });
51779
+ return {
51780
+ preparedPlan,
51781
+ hostBindingGeneration,
51782
+ release: () => {
51783
+ sdk.unregisterFirmwareUpdateHostBinding(hostBindingGeneration);
51784
+ readers.clear();
51785
+ binaries.clear();
51786
+ },
51787
+ };
51788
+ }
51789
+
51706
51790
  const Log$7 = getLogger(exports.LoggerNames.Method);
51707
51791
  const SESSION_ERROR$1 = 'session not found';
51708
51792
  const PROTOCOL_V2_BOOTLOADER_RECONNECT_TIMEOUT = 90 * 1000;
@@ -52171,7 +52255,16 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52171
52255
  if (!this.params.preparedPlan &&
52172
52256
  this.params.resourceArchiveBinary &&
52173
52257
  ((_c = this.params.targetsToUpdate) === null || _c === void 0 ? void 0 : _c.includes('resource'))) {
52174
- return this.runProtocolV2DirectArtifacts({});
52258
+ const localMemoryHost = yield this.prepareProtocolV2LocalMemoryHost({
52259
+ features: deviceFeatures,
52260
+ firmwareType,
52261
+ });
52262
+ try {
52263
+ return yield this.runProtocolV2PreparedArtifacts(deviceFeatures, firmwareType);
52264
+ }
52265
+ finally {
52266
+ localMemoryHost.release();
52267
+ }
52175
52268
  }
52176
52269
  const hasPreparedComponentArtifacts = Object.values((_d = this.params.componentArtifacts) !== null && _d !== void 0 ? _d : {}).some(Boolean);
52177
52270
  if (this.params.preparedPlan || hasPreparedComponentArtifacts) {
@@ -52180,12 +52273,12 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52180
52273
  let fwBinaryMap = [];
52181
52274
  let bootloaderBinary = null;
52182
52275
  let installItems;
52183
- let explicitInstallItems;
52276
+ let resourceMemoryHost;
52184
52277
  try {
52185
52278
  this.postTipMessage(exports.FirmwareUpdateTipMessage.StartDownloadFirmware);
52186
52279
  fwBinaryMap = this.collectExplicitTargetBinaries();
52187
52280
  bootloaderBinary = this.prepareBootloaderBinary();
52188
- explicitInstallItems = this.buildProtocolV2InstallItems({
52281
+ const explicitInstallItems = this.buildProtocolV2InstallItems({
52189
52282
  bootloaderBinary,
52190
52283
  fwBinaryMap,
52191
52284
  });
@@ -52227,10 +52320,16 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52227
52320
  }
52228
52321
  if (wantsResources) {
52229
52322
  this.params.resourceArchiveBinary = yield this.downloadRemoteProtocolV2ResourceArchive(deviceFeatures, firmwareType);
52323
+ resourceMemoryHost = yield this.prepareProtocolV2LocalMemoryHost({
52324
+ features: deviceFeatures,
52325
+ firmwareType,
52326
+ availableInstallItems: installItems !== null && installItems !== void 0 ? installItems : explicitInstallItems,
52327
+ });
52230
52328
  }
52231
52329
  this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
52232
52330
  }
52233
52331
  catch (err) {
52332
+ resourceMemoryHost === null || resourceMemoryHost === void 0 ? void 0 : resourceMemoryHost.release();
52234
52333
  if (typeof err === 'object' &&
52235
52334
  err !== null &&
52236
52335
  'params' in err &&
@@ -52242,11 +52341,13 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52242
52341
  }
52243
52342
  throw normalizeFirmwarePreparationError(err);
52244
52343
  }
52245
- if (wantsResources && this.params.resourceArchiveBinary) {
52246
- return this.runProtocolV2DirectArtifacts({
52247
- availableInstallItems: installItems !== null && installItems !== void 0 ? installItems : explicitInstallItems,
52248
- announceDownload: false,
52249
- });
52344
+ if (resourceMemoryHost) {
52345
+ try {
52346
+ return yield this.runProtocolV2PreparedArtifacts(deviceFeatures, firmwareType, false);
52347
+ }
52348
+ finally {
52349
+ resourceMemoryHost.release();
52350
+ }
52250
52351
  }
52251
52352
  if (!bootloaderBinary && fwBinaryMap.length === 0 && !(installItems === null || installItems === void 0 ? void 0 : installItems.length)) {
52252
52353
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, 'No firmware to update');
@@ -52347,59 +52448,95 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52347
52448
  return installSources;
52348
52449
  });
52349
52450
  }
52350
- runProtocolV2DirectArtifacts({ availableInstallItems, announceDownload = true, }) {
52451
+ prepareProtocolV2LocalMemoryHost({ features, firmwareType, availableInstallItems = this.buildProtocolV2InstallItems({
52452
+ bootloaderBinary: this.prepareBootloaderBinary(),
52453
+ fwBinaryMap: this.collectExplicitTargetBinaries(),
52454
+ }), }) {
52455
+ var _a, _b;
52351
52456
  return __awaiter(this, void 0, void 0, function* () {
52352
- try {
52353
- if (announceDownload) {
52354
- this.postTipMessage(exports.FirmwareUpdateTipMessage.StartDownloadFirmware);
52355
- }
52356
- const installItems = this.filterProtocolV2LocalInstallItems(availableInstallItems !== null && availableInstallItems !== void 0 ? availableInstallItems : this.buildProtocolV2InstallItems({
52357
- bootloaderBinary: this.prepareBootloaderBinary(),
52358
- fwBinaryMap: this.collectExplicitTargetBinaries(),
52359
- }));
52360
- const installSources = yield Promise.all(installItems.map((item) => __awaiter(this, void 0, void 0, function* () {
52361
- return ({
52362
- fileName: item.fileName,
52363
- source: yield this.openProtocolV2MemorySource(item.binary),
52364
- targetId: item.targetId,
52365
- kind: item.kind,
52366
- });
52367
- })));
52368
- const resourceSources = this.params.resourceArchiveBinary
52369
- ? yield this.createProtocolV2ResourceSourcesFromArchive(this.params.resourceArchiveBinary)
52370
- : [];
52371
- if (installSources.length === 0 && resourceSources.length === 0) {
52372
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, 'No firmware to update');
52373
- }
52374
- if (announceDownload) {
52375
- this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
52376
- }
52377
- return yield this.executeProtocolV2SourceUpdate({
52378
- installSources,
52379
- resourceSources,
52457
+ const requestedComponentTargets = new Set(((_a = this.params.targetsToUpdate) !== null && _a !== void 0 ? _a : []).filter((target) => target !== 'resource' && target !== 'boot_resources'));
52458
+ const localComponentTargets = new Set(availableInstallItems.flatMap(item => {
52459
+ const target = PROTOCOL_V2_UPDATE_TARGET_BY_TARGET_ID.get(item.targetId);
52460
+ return target ? [target] : [];
52461
+ }));
52462
+ const missingTarget = Array.from(requestedComponentTargets).find(target => !localComponentTargets.has(target));
52463
+ if (missingTarget) {
52464
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Protocol V2 local update has no binary for requested target ${missingTarget}`, {
52465
+ firmwareUpdateCode: 'FirmwareArtifactsNotPrepared',
52466
+ artifactName: missingTarget,
52380
52467
  });
52381
52468
  }
52382
- finally {
52383
- yield this.closeProtocolV2PreparedSources();
52469
+ const installItems = this.filterProtocolV2LocalInstallItems(availableInstallItems);
52470
+ const planArtifacts = [];
52471
+ const memoryArtifacts = [];
52472
+ for (const item of installItems) {
52473
+ const target = PROTOCOL_V2_UPDATE_TARGET_BY_TARGET_ID.get(item.targetId);
52474
+ if (!target || item.binary.byteLength <= 0) {
52475
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Protocol V2 local firmware artifact is invalid: ${item.fileName}`, { firmwareUpdateCode: 'FirmwareArtifactsNotPrepared' });
52476
+ }
52477
+ const artifactId = `component:${target}`;
52478
+ planArtifacts.push(Object.assign({ artifactId,
52479
+ target, container: 'raw', logicalName: item.fileName, expectedSize: item.binary.byteLength, expectedSha256: bytesToHex(sha256.sha256(new Uint8Array(item.binary))) }, (((_b = this.params.expectedTargetVersions) === null || _b === void 0 ? void 0 : _b[target])
52480
+ ? { targetVersion: this.params.expectedTargetVersions[target] }
52481
+ : {})));
52482
+ memoryArtifacts.push({ artifactId, binary: item.binary });
52384
52483
  }
52385
- });
52386
- }
52387
- createProtocolV2ResourceSourcesFromArchive(binary) {
52388
- var _a;
52389
- return __awaiter(this, void 0, void 0, function* () {
52390
- const archive = yield this.prepareProtocolV2LocalResourceArchive(binary);
52391
- const sources = [];
52392
- for (const resource of archive.resources) {
52393
- sources.push({
52394
- name: (_a = resource.entryName.split('/').pop()) !== null && _a !== void 0 ? _a : resource.entryName,
52395
- source: yield this.openProtocolV2MemorySource(resource.binary),
52396
- devicePath: resource.header.devicePath,
52397
- version: resource.header.version,
52398
- payloadHash: resource.header.payloadHash,
52399
- headerHash: resource.header.headerHash,
52484
+ const resourceArchive = yield this.prepareProtocolV2LocalResourceArchive(this.params.resourceArchiveBinary);
52485
+ const resourceArtifactId = 'resource:archive';
52486
+ planArtifacts.push({
52487
+ artifactId: resourceArtifactId,
52488
+ target: 'resource',
52489
+ container: 'zip',
52490
+ logicalName: 'protocol-v2-local-resource-archive',
52491
+ expectedSize: resourceArchive.binary.byteLength,
52492
+ expectedSha256: bytesToHex(sha256.sha256(new Uint8Array(resourceArchive.binary))),
52493
+ });
52494
+ memoryArtifacts.push({
52495
+ artifactId: resourceArtifactId,
52496
+ binary: resourceArchive.binary,
52497
+ materializedEntries: resourceArchive.materializedEntries,
52498
+ });
52499
+ const plan = buildProtocolV2LocalFirmwareUpdatePlan({
52500
+ features,
52501
+ firmwareType,
52502
+ platform: this.params.platform,
52503
+ artifacts: planArtifacts,
52504
+ });
52505
+ let memoryHost;
52506
+ try {
52507
+ memoryHost = prepareFirmwareUpdateV4MemoryHost({
52508
+ sdk: {
52509
+ prepareFirmwareUpdatePlan,
52510
+ registerFirmwareUpdateHostBinding,
52511
+ unregisterFirmwareUpdateHostBinding,
52512
+ },
52513
+ plan,
52514
+ artifacts: memoryArtifacts,
52515
+ });
52516
+ const preparedPlan = validateFirmwareUpdatePreparedPlan(memoryHost.preparedPlan);
52517
+ assertFirmwareUpdatePreparedPlanBinding({
52518
+ preparedPlan,
52519
+ executor: 'v4',
52520
+ platform: this.params.platform,
52521
+ scopeTargets: [],
52522
+ bindings: [],
52523
+ });
52524
+ assertFirmwareUpdatePreparedPlanDeviceIdentity({
52525
+ preparedPlan,
52526
+ deviceIdentity: this.protocolV2ExpectedSerialNumber,
52527
+ deviceModel: this.getProtocolV2PreparedPlanDeviceModel(features),
52400
52528
  });
52529
+ const hostBinding = resolveFirmwareUpdateHostBinding(memoryHost.hostBindingGeneration, preparedPlan.preparedPlanDigest);
52530
+ this.params.preparedPlan = preparedPlan;
52531
+ this.params.targetsToUpdate = [...preparedPlan.targetsToUpdate];
52532
+ this.params.artifactReader = hostBinding.artifactReader;
52533
+ this.params.componentArtifacts = undefined;
52534
+ return memoryHost;
52535
+ }
52536
+ catch (error) {
52537
+ memoryHost === null || memoryHost === void 0 ? void 0 : memoryHost.release();
52538
+ throw error;
52401
52539
  }
52402
- return sources;
52403
52540
  });
52404
52541
  }
52405
52542
  prepareProtocolV2LocalResourceArchive(binary) {
@@ -52415,12 +52552,13 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52415
52552
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 resource ZIP cannot be parsed', { firmwareUpdateCode: 'FirmwareArtifactsNotPrepared' });
52416
52553
  }
52417
52554
  const zipEntries = Object.values(zip.files);
52418
- const resourceEntries = zipEntries.filter(entry => !entry.dir && isProtocolV2ResourceArchiveEntryName(entry.name));
52555
+ const resourceEntries = zipEntries.filter(entry => !entry.dir && entry.name.toLowerCase().endsWith('.okpkg'));
52419
52556
  if (resourceEntries.length === 0 ||
52420
52557
  resourceEntries.length > PROTOCOL_V2_RESOURCE_FILE_MAX_COUNT) {
52421
52558
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 resource ZIP has no valid resource package set', { firmwareUpdateCode: 'FirmwareArtifactsNotPrepared' });
52422
52559
  }
52423
52560
  let totalSize = 0;
52561
+ const materializedEntries = [];
52424
52562
  const resources = [];
52425
52563
  const devicePaths = new Set();
52426
52564
  for (const entry of resourceEntries) {
@@ -52447,9 +52585,10 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52447
52585
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Protocol V2 resource ZIP contains duplicate device path: ${header.devicePath}`, { firmwareUpdateCode: 'FirmwareArtifactsNotPrepared' });
52448
52586
  }
52449
52587
  devicePaths.add(canonicalDevicePath);
52588
+ materializedEntries.push({ entryName: entry.name, binary: fileBinary });
52450
52589
  resources.push({ entryName: entry.name, binary: fileBinary, header });
52451
52590
  }
52452
- return { binary, resources };
52591
+ return { binary, materializedEntries, resources };
52453
52592
  });
52454
52593
  }
52455
52594
  prepareProtocolV2ResourceSources() {
@@ -52467,7 +52606,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52467
52606
  });
52468
52607
  }
52469
52608
  prepareProtocolV2ResourceArchiveSources() {
52470
- var _a, _b;
52609
+ var _a, _b, _c;
52471
52610
  return __awaiter(this, void 0, void 0, function* () {
52472
52611
  const archiveArtifacts = (_b = (_a = this.params.preparedPlan) === null || _a === void 0 ? void 0 : _a.artifacts.filter(artifact => artifact.role === 'resourceBundle' &&
52473
52612
  artifact.target === 'resource' &&
@@ -52494,7 +52633,20 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52494
52633
  if (archiveDigest !== archiveArtifact.artifact.sha256.toLowerCase()) {
52495
52634
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 prepared resource archive does not match its approved receipt', { firmwareUpdateCode: 'FirmwareArtifactReceiptMismatch' });
52496
52635
  }
52497
- return this.createProtocolV2ResourceSourcesFromArchive(archiveBinary);
52636
+ const verifiedArchive = yield this.prepareProtocolV2LocalResourceArchive(archiveBinary);
52637
+ const sources = [];
52638
+ for (const resource of verifiedArchive.resources) {
52639
+ const source = yield this.openProtocolV2MemorySource(resource.binary);
52640
+ sources.push({
52641
+ name: (_c = resource.entryName.split('/').pop()) !== null && _c !== void 0 ? _c : resource.entryName,
52642
+ source,
52643
+ devicePath: resource.header.devicePath,
52644
+ version: resource.header.version,
52645
+ payloadHash: resource.header.payloadHash,
52646
+ headerHash: resource.header.headerHash,
52647
+ });
52648
+ }
52649
+ return sources;
52498
52650
  });
52499
52651
  }
52500
52652
  runProtocolV2PreparedArtifacts(features, firmwareType, announceDownload = true) {
@@ -52862,11 +53014,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52862
53014
  return `vol0:${path}`;
52863
53015
  return `vol0:/${path}`;
52864
53016
  }
52865
- getProtocolV2ResourceComparePath(devicePath) {
52866
- return isProtocolV2BootResourcePackagePath(devicePath)
52867
- ? PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_PATH
52868
- : devicePath;
52869
- }
52870
53017
  readProtocolV2DeviceFileHeader(path, expectedSize) {
52871
53018
  var _a, _b, _c, _d;
52872
53019
  return __awaiter(this, void 0, void 0, function* () {
@@ -52925,7 +53072,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
52925
53072
  if (!bundle.payloadHash || !bundle.headerHash)
52926
53073
  return false;
52927
53074
  try {
52928
- const header = yield this.readProtocolV2DeviceFileHeader(this.getProtocolV2ResourceComparePath(bundle.devicePath), bundle.source.size);
53075
+ const header = yield this.readProtocolV2DeviceFileHeader(bundle.devicePath, bundle.source.size);
52929
53076
  if (!header)
52930
53077
  return false;
52931
53078
  if (bundle.version) {
@@ -53126,7 +53273,8 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
53126
53273
  let totalSize = installSources.reduce((total, item) => total + item.source.size, 0);
53127
53274
  const resourcesToSync = [];
53128
53275
  for (const resource of resourceSources) {
53129
- if (yield this.isProtocolV2ResourceBundleUpToDate(resource)) {
53276
+ const requiresFreshStaging = isProtocolV2BootResourcePackagePath(resource.devicePath);
53277
+ if (!requiresFreshStaging && (yield this.isProtocolV2ResourceBundleUpToDate(resource))) {
53130
53278
  Log$7.log(`[FirmwareUpdateV4] skip RESC bundle ${resource.name}; already up to date`);
53131
53279
  }
53132
53280
  else {
@@ -65068,6 +65216,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
65068
65216
  if ((_g = method.payload) === null || _g === void 0 ? void 0 : _g.onlyConnectBleDevice) {
65069
65217
  preWarmCallbackTask === null || preWarmCallbackTask === void 0 ? void 0 : preWarmCallbackTask.resolve();
65070
65218
  Log.debug('Call API - only connect ble device: ', device === null || device === void 0 ? void 0 : device.mainId);
65219
+ requestQueue.releaseTask(method.responseID);
65071
65220
  return createResponseMessage(method.responseID, true, null);
65072
65221
  }
65073
65222
  Log.debug('Call API - setDevice: ', device.mainId);
@@ -65443,7 +65592,31 @@ function isMissingDetectedProtocolV2Error(method, error) {
65443
65592
  typeof typedError.message === 'string' &&
65444
65593
  typedError.message.includes('Device protocol has not been detected'));
65445
65594
  }
65446
- function connectDeviceForBle(method, device, retryCount = 0) {
65595
+ const BLE_ACQUIRE_DEADLINE_MS = 60 * 1000;
65596
+ function raceBleAcquire(acquirePromise, abortSignal) {
65597
+ return new Promise((resolve, reject) => {
65598
+ let settled = false;
65599
+ const settle = (fn) => {
65600
+ if (settled)
65601
+ return;
65602
+ settled = true;
65603
+ clearTimeout(deadline);
65604
+ abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener('abort', onAbort);
65605
+ fn();
65606
+ };
65607
+ const onAbort = () => settle(() => reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallQueueActionCancelled)));
65608
+ const deadline = setTimeout(() => settle(() => reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleTimeoutError, `BLE acquire exceeded ${BLE_ACQUIRE_DEADLINE_MS}ms deadline`))), BLE_ACQUIRE_DEADLINE_MS);
65609
+ acquirePromise.then(value => settle(() => resolve(value)), error => settle(() => reject(error)));
65610
+ if (abortSignal) {
65611
+ if (abortSignal.aborted) {
65612
+ onAbort();
65613
+ return;
65614
+ }
65615
+ abortSignal.addEventListener('abort', onAbort);
65616
+ }
65617
+ });
65618
+ }
65619
+ function connectDeviceForBle(method, device, abortSignal, retryCount = 0) {
65447
65620
  var _a;
65448
65621
  return __awaiter(this, void 0, void 0, function* () {
65449
65622
  try {
@@ -65458,9 +65631,31 @@ function connectDeviceForBle(method, device, retryCount = 0) {
65458
65631
  !device.commands ||
65459
65632
  device.commands.disposed;
65460
65633
  if (shouldAcquire) {
65461
- yield device.acquire(method.payload.connectProtocol, {
65462
- forceProtocolDetection: method.payload.forceProtocolDetection,
65463
- });
65634
+ const useAcquireGuards = DataManager.getSettings('env') === 'desktop-web-ble';
65635
+ if (useAcquireGuards && (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted)) {
65636
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallQueueActionCancelled);
65637
+ }
65638
+ if (!useAcquireGuards) {
65639
+ yield device.acquire(method.payload.connectProtocol, {
65640
+ forceProtocolDetection: method.payload.forceProtocolDetection,
65641
+ });
65642
+ }
65643
+ else {
65644
+ try {
65645
+ yield raceBleAcquire(device.acquire(method.payload.connectProtocol, {
65646
+ forceProtocolDetection: method.payload.forceProtocolDetection,
65647
+ }), abortSignal);
65648
+ }
65649
+ catch (err) {
65650
+ if (err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError &&
65651
+ device.mainId &&
65652
+ device.deviceConnector) {
65653
+ yield device.deviceConnector.disconnect(device.mainId).catch(() => undefined);
65654
+ device.markTransportDisconnected();
65655
+ }
65656
+ throw err;
65657
+ }
65658
+ }
65464
65659
  }
65465
65660
  if ((_a = method.payload) === null || _a === void 0 ? void 0 : _a.onlyConnectBleDevice) {
65466
65661
  if (shouldAcquire) {
@@ -65491,7 +65686,7 @@ function connectDeviceForBle(method, device, retryCount = 0) {
65491
65686
  const nextRetry = retryCount + 1;
65492
65687
  Log.debug(`Bluetooth connection will retry, retry count: ${nextRetry}`);
65493
65688
  yield wait(3000);
65494
- yield connectDeviceForBle(method, device, nextRetry);
65689
+ yield connectDeviceForBle(method, device, abortSignal, nextRetry);
65495
65690
  }
65496
65691
  else {
65497
65692
  throw err;
@@ -65576,7 +65771,7 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
65576
65771
  if (tryCount === 1) {
65577
65772
  device.beginConnectionAttempt();
65578
65773
  }
65579
- yield connectDeviceForBle(method, device);
65774
+ yield connectDeviceForBle(method, device, abortSignal);
65580
65775
  }
65581
65776
  resolve(device);
65582
65777
  return;
@@ -66192,6 +66387,7 @@ exports.parseConnectSettings = parseConnectSettings;
66192
66387
  exports.parseMessage = parseMessage;
66193
66388
  exports.patchFeatures = patchFeatures;
66194
66389
  exports.preloadSessionCache = preloadSessionCache;
66390
+ exports.prepareFirmwareUpdateV4MemoryHost = prepareFirmwareUpdateV4MemoryHost;
66195
66391
  exports.projectDeviceStateFeatures = projectFeatures;
66196
66392
  exports.registerFirmwareUpdateHostBinding = registerFirmwareUpdateHostBinding;
66197
66393
  exports.safeThrowError = safeThrowError;
@@ -4,7 +4,6 @@ export declare const PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH: string;
4
4
  export declare const PROTOCOL_V2_ROM_PARAMS_PACKAGE_PATH = "vol0:/loaders/rom/params.okpkg";
5
5
  export declare const PROTOCOL_V2_RESOURCE_PACKAGE_HEADER_SIZE = 24464;
6
6
  export declare function parseProtocolV2Resources(value: unknown): IProtocolV2Resources | undefined;
7
- export declare function isProtocolV2ResourceArchiveEntryName(entryName: string): boolean;
8
7
  export type ProtocolV2ResourcePackageHeader = {
9
8
  version: IVersionArray;
10
9
  payloadLength: number;
@@ -1 +1 @@
1
- {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,sCAAsC,iDACH,CAAC;AACjD,eAAO,MAAM,8CAA8C,QAAsD,CAAC;AAClH,eAAO,MAAM,mCAAmC,mCAAmC,CAAC;AACpF,eAAO,MAAM,wCAAwC,QAAS,CAAC;AAW/D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CA8BzF;AAED,wBAAgB,oCAAoC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAY/E;AA0CD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,GAClB,+BAA+B,CAyCjC;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,WAAW,GAAG,UAAU,GAC/B,+BAA+B,CAGjC"}
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,sCAAsC,iDACH,CAAC;AACjD,eAAO,MAAM,8CAA8C,QAAsD,CAAC;AAClH,eAAO,MAAM,mCAAmC,mCAAmC,CAAC;AACpF,eAAO,MAAM,wCAAwC,QAAS,CAAC;AAW/D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CA8BzF;AAoDD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,GAClB,+BAA+B,CAyCjC;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,WAAW,GAAG,UAAU,GAC/B,+BAA+B,CAGjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deviceFeaturesCompat.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesCompat.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAoB5D,eAAO,MAAM,qBAAqB,cAAe,mBAAmB,KAAG,MAWtE,CAAC;AAEF,eAAO,MAAM,2BAA2B,cAAe,mBAAmB,KAAG,OAI5E,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAe,mBAAmB,KAAG,WAqDlE,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,mBAAmB,KAAG,aAsB1E,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAO9E,CAAC;AAEF,eAAO,MAAM,4BAA4B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAgBtF,CAAC;AAEF,eAAO,MAAM,8BAA8B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAiBxF,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAUnF,CAAC;AAEF,eAAO,MAAM,+BAA+B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IASzF,CAAC"}
1
+ {"version":3,"file":"deviceFeaturesCompat.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesCompat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAoB5D,eAAO,MAAM,qBAAqB,cAAe,mBAAmB,KAAG,MAWtE,CAAC;AAEF,eAAO,MAAM,2BAA2B,cAAe,mBAAmB,KAAG,OAI5E,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAe,mBAAmB,KAAG,WAqDlE,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,mBAAmB,KAAG,aAsB1E,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAM9E,CAAC;AAEF,eAAO,MAAM,4BAA4B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAgBtF,CAAC;AAEF,eAAO,MAAM,8BAA8B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAiBxF,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAUnF,CAAC;AAEF,eAAO,MAAM,+BAA+B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IASzF,CAAC"}