utxo-lib 1.0.8 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/README.md +19 -16
  2. package/dist/src/address.d.ts.map +1 -1
  3. package/dist/src/address.js +11 -1
  4. package/dist/src/addressFormat.d.ts +1 -1
  5. package/dist/src/addressFormat.d.ts.map +1 -1
  6. package/dist/src/addressFormat.js +1 -1
  7. package/dist/src/base_crypto.d.ts +14 -0
  8. package/dist/src/base_crypto.d.ts.map +1 -0
  9. package/dist/src/base_crypto.js +215 -0
  10. package/dist/src/bitgo/Musig2.d.ts +115 -17
  11. package/dist/src/bitgo/Musig2.d.ts.map +1 -1
  12. package/dist/src/bitgo/Musig2.js +283 -101
  13. package/dist/src/bitgo/PsbtUtil.d.ts +59 -0
  14. package/dist/src/bitgo/PsbtUtil.d.ts.map +1 -0
  15. package/dist/src/bitgo/PsbtUtil.js +91 -0
  16. package/dist/src/bitgo/UtxoPsbt.d.ts +180 -47
  17. package/dist/src/bitgo/UtxoPsbt.d.ts.map +1 -1
  18. package/dist/src/bitgo/UtxoPsbt.js +657 -121
  19. package/dist/src/bitgo/UtxoTransaction.js +2 -2
  20. package/dist/src/bitgo/bitcoincash/address.js +2 -2
  21. package/dist/src/bitgo/index.d.ts +11 -0
  22. package/dist/src/bitgo/index.d.ts.map +1 -1
  23. package/dist/src/bitgo/index.js +6 -2
  24. package/dist/src/bitgo/legacysafe/index.d.ts +15 -0
  25. package/dist/src/bitgo/legacysafe/index.d.ts.map +1 -0
  26. package/dist/src/bitgo/legacysafe/index.js +61 -0
  27. package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts +10 -0
  28. package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts.map +1 -0
  29. package/dist/src/bitgo/litecoin/LitecoinPsbt.js +17 -0
  30. package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts +16 -0
  31. package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts.map +1 -0
  32. package/dist/src/bitgo/litecoin/LitecoinTransaction.js +46 -0
  33. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts +10 -0
  34. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts.map +1 -0
  35. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.js +15 -0
  36. package/dist/src/bitgo/litecoin/index.d.ts +4 -0
  37. package/dist/src/bitgo/litecoin/index.d.ts.map +1 -0
  38. package/dist/src/bitgo/litecoin/index.js +16 -0
  39. package/dist/src/bitgo/outputScripts.d.ts +3 -1
  40. package/dist/src/bitgo/outputScripts.d.ts.map +1 -1
  41. package/dist/src/bitgo/outputScripts.js +20 -12
  42. package/dist/src/bitgo/parseInput.d.ts +49 -20
  43. package/dist/src/bitgo/parseInput.d.ts.map +1 -1
  44. package/dist/src/bitgo/parseInput.js +110 -26
  45. package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +1 -1
  46. package/dist/src/bitgo/psbt/fromHalfSigned.js +9 -6
  47. package/dist/src/bitgo/psbt/scriptTypes.js +3 -3
  48. package/dist/src/bitgo/signature.d.ts +3 -3
  49. package/dist/src/bitgo/signature.d.ts.map +1 -1
  50. package/dist/src/bitgo/signature.js +48 -16
  51. package/dist/src/bitgo/transaction.d.ts +18 -3
  52. package/dist/src/bitgo/transaction.d.ts.map +1 -1
  53. package/dist/src/bitgo/transaction.js +28 -15
  54. package/dist/src/bitgo/types.d.ts +2 -0
  55. package/dist/src/bitgo/types.d.ts.map +1 -1
  56. package/dist/src/bitgo/types.js +1 -1
  57. package/dist/src/bitgo/wallet/Psbt.d.ts +104 -12
  58. package/dist/src/bitgo/wallet/Psbt.d.ts.map +1 -1
  59. package/dist/src/bitgo/wallet/Psbt.js +285 -70
  60. package/dist/src/bitgo/wallet/Unspent.d.ts +28 -0
  61. package/dist/src/bitgo/wallet/Unspent.d.ts.map +1 -1
  62. package/dist/src/bitgo/wallet/Unspent.js +172 -68
  63. package/dist/src/bitgo/wallet/WalletOutput.d.ts +17 -1
  64. package/dist/src/bitgo/wallet/WalletOutput.d.ts.map +1 -1
  65. package/dist/src/bitgo/wallet/WalletOutput.js +64 -23
  66. package/dist/src/bitgo/wallet/chains.d.ts +2 -2
  67. package/dist/src/bitgo/wallet/chains.d.ts.map +1 -1
  68. package/dist/src/bitgo/wallet/chains.js +1 -1
  69. package/dist/src/bitgo/zcash/ZcashPsbt.d.ts +0 -1
  70. package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +1 -1
  71. package/dist/src/bitgo/zcash/ZcashPsbt.js +7 -16
  72. package/dist/src/bitgo/zcash/ZcashTransaction.js +2 -2
  73. package/dist/src/musig.d.ts +390 -0
  74. package/dist/src/musig.d.ts.map +1 -0
  75. package/dist/src/musig.js +447 -0
  76. package/dist/src/networks.d.ts +1 -2
  77. package/dist/src/networks.d.ts.map +1 -1
  78. package/dist/src/networks.js +22 -29
  79. package/dist/src/noble_ecc.d.ts +1 -1
  80. package/dist/src/noble_ecc.d.ts.map +1 -1
  81. package/dist/src/noble_ecc.js +11 -7
  82. package/dist/src/payments/p2tr.d.ts.map +1 -1
  83. package/dist/src/payments/p2tr.js +21 -19
  84. package/dist/src/payments/p2tr_ns.js +2 -3
  85. package/dist/src/taproot.d.ts +16 -0
  86. package/dist/src/taproot.d.ts.map +1 -1
  87. package/dist/src/taproot.js +45 -4
  88. package/dist/src/testutil/index.d.ts +2 -0
  89. package/dist/src/testutil/index.d.ts.map +1 -1
  90. package/dist/src/testutil/index.js +3 -1
  91. package/dist/src/testutil/keys.d.ts +3 -0
  92. package/dist/src/testutil/keys.d.ts.map +1 -1
  93. package/dist/src/testutil/keys.js +17 -2
  94. package/dist/src/testutil/mock.d.ts +1 -1
  95. package/dist/src/testutil/mock.d.ts.map +1 -1
  96. package/dist/src/testutil/mock.js +12 -4
  97. package/dist/src/testutil/psbt.d.ts +89 -0
  98. package/dist/src/testutil/psbt.d.ts.map +1 -0
  99. package/dist/src/testutil/psbt.js +150 -0
  100. package/dist/src/testutil/transaction.d.ts +70 -0
  101. package/dist/src/testutil/transaction.d.ts.map +1 -0
  102. package/dist/src/testutil/transaction.js +107 -0
  103. package/dist/src/transaction_builder.js +2 -2
  104. package/package.json +6 -7
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSpendScriptP2trMusig2 = exports.createSpendScriptP2tr = exports.createKeyPathP2trMusig2 = exports.getLeafHash = exports.createPaymentP2trMusig2 = exports.createPaymentP2tr = exports.checkPlainPublicKey = exports.checkXOnlyPublicKey = exports.toXOnlyPublicKey = exports.createOutputScript2of3 = exports.createOutputScriptP2shP2pk = exports.scriptType2Of3AsPrevOutType = exports.isSupportedScriptType = exports.hasWitnessData = exports.isScriptType2Of3 = exports.scriptTypes2Of3 = exports.scriptTypeP2shP2pk = exports.scriptTypeForChain = void 0;
3
+ exports.createSpendScriptP2trMusig2 = exports.createSpendScriptP2tr = exports.createKeyPathP2trMusig2 = exports.getLeafHash = exports.createPaymentP2trMusig2 = exports.createPaymentP2tr = exports.checkTxHash = exports.checkTapMerkleRoot = exports.checkPlainPublicKey = exports.checkXOnlyPublicKey = exports.toXOnlyPublicKey = exports.createOutputScript2of3 = exports.createOutputScriptP2shP2pk = exports.scriptType2Of3AsPrevOutType = exports.isSupportedScriptType = exports.hasWitnessData = exports.isScriptType2Of3 = exports.scriptTypes2Of3 = exports.scriptTypeP2shP2pk = exports.scriptTypeForChain = void 0;
4
4
  const assert = require("assert");
5
5
  const bitcoinjs = require("bitcoinjs-lib");
6
6
  const __1 = require("..");
@@ -132,8 +132,8 @@ function createOutputScript2of3(pubkeys, scriptType, network) {
132
132
  assert(scriptPubKey.output);
133
133
  return {
134
134
  scriptPubKey: scriptPubKey.output,
135
- redeemScript: redeemScript === null || redeemScript === void 0 ? void 0 : redeemScript.output,
136
- witnessScript: witnessScript === null || witnessScript === void 0 ? void 0 : witnessScript.output,
135
+ redeemScript: redeemScript?.output,
136
+ witnessScript: witnessScript?.output,
137
137
  };
138
138
  }
139
139
  exports.createOutputScript2of3 = createOutputScript2of3;
@@ -147,26 +147,34 @@ function toXOnlyPublicKey(b) {
147
147
  throw new Error(`invalid key size ${b.length}`);
148
148
  }
149
149
  exports.toXOnlyPublicKey = toXOnlyPublicKey;
150
+ function checkSize(b, targetSize, name) {
151
+ if (b.length === targetSize) {
152
+ return b;
153
+ }
154
+ throw new Error(`invalid size ${b.length}. Must use ${name}.`);
155
+ }
150
156
  /**
151
157
  * Validates size of the pub key for 32 bytes and returns the same iff true.
152
158
  */
153
159
  function checkXOnlyPublicKey(b) {
154
- if (b.length === 32) {
155
- return b;
156
- }
157
- throw new Error(`invalid key size ${b.length}. Must use x-only key.`);
160
+ return checkSize(b, 32, 'x-only key');
158
161
  }
159
162
  exports.checkXOnlyPublicKey = checkXOnlyPublicKey;
160
163
  /**
161
164
  * Validates size of the pub key for 32 bytes and returns the same iff true.
162
165
  */
163
166
  function checkPlainPublicKey(b) {
164
- if (b.length === 33) {
165
- return b;
166
- }
167
- throw new Error(`invalid key size ${b.length}. Must use plain keys.`);
167
+ return checkSize(b, 33, 'plain key');
168
168
  }
169
169
  exports.checkPlainPublicKey = checkPlainPublicKey;
170
+ function checkTapMerkleRoot(b) {
171
+ return checkSize(b, 32, 'tap merkle root');
172
+ }
173
+ exports.checkTapMerkleRoot = checkTapMerkleRoot;
174
+ function checkTxHash(b) {
175
+ return checkSize(b, 32, 'tx hash');
176
+ }
177
+ exports.checkTxHash = checkTxHash;
170
178
  function getTaptreeKeyCombinations(scriptType, keys) {
171
179
  const [userKey, backupKey, bitGoKey] = keys.map((k) => toXOnlyPublicKey(k));
172
180
  return scriptType === 'p2tr'
@@ -294,4 +302,4 @@ function createTaprootScript2of3(scriptType, pubkeys) {
294
302
  scriptPubKey: output,
295
303
  };
296
304
  }
297
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0U2NyaXB0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjp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aGVcbiAqIHRyZWUuXG4gKiBAcGFyYW0gcHVia2V5cyAtIGEgcHVia2V5IGFycmF5IGNvbnRhaW5pbmcgdGhlIHVzZXIga2V5LCBiYWNrdXAga2V5LCBhbmQgYml0Z28ga2V5IGluIHRoYXQgb3JkZXJcbiAqIEByZXR1cm5zIHt7c2NyaXB0UHViS2V5fX1cbiAqL1xuZnVuY3Rpb24gY3JlYXRlVGFwcm9vdFNjcmlwdDJvZjMoc2NyaXB0VHlwZTogJ3AydHInIHwgJ3AydHJNdXNpZzInLCBwdWJrZXlzOiBUcmlwbGU8QnVmZmVyPik6IFNwZW5kYWJsZVNjcmlwdCB7XG4gIGNvbnN0IHsgb3V0cHV0IH0gPSBjcmVhdGVQYXltZW50UDJ0ckNvbW1vbihzY3JpcHRUeXBlLCBwdWJrZXlzKTtcbiAgYXNzZXJ0KEJ1ZmZlci5pc0J1ZmZlcihvdXRwdXQpKTtcbiAgcmV0dXJuIHtcbiAgICBzY3JpcHRQdWJLZXk6IG91dHB1dCxcbiAgfTtcbn1cbiJdfQ==
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import { TxInput } from 'bitcoinjs-lib';
3
- import { ScriptType, ScriptType2Of3 } from './outputScripts';
4
3
  export declare function isPlaceholderSignature(v: number | Buffer): boolean;
5
4
  /**
6
5
  * @return true iff P2TR script path's control block matches BitGo's need
@@ -13,30 +12,45 @@ export declare function calculateScriptPathLevel(controlBlock: Buffer): number;
13
12
  /**
14
13
  * @return leaf version for P2TR control block.
15
14
  */
16
- export declare function getScriptPathLevel(controlBlock: Buffer): number;
17
- interface ParsedScript {
18
- scriptType: ScriptType;
19
- }
20
- export declare type ParsedPubScript = ParsedScript;
21
- export declare type ParsedSignatureScript = ParsedScript;
15
+ export declare function getLeafVersion(controlBlock: Buffer): number;
16
+ export declare type ParsedScriptType2Of3 = 'p2sh' | 'p2shP2wsh' | 'p2wsh' | 'taprootKeyPathSpend' | 'taprootScriptPathSpend';
17
+ export declare type ParsedScriptType = ParsedScriptType2Of3 | 'p2shP2pk';
18
+ export declare type ParsedPubScript = {
19
+ scriptType: ParsedScriptType;
20
+ };
21
+ export declare type ParsedSignatureScript = {
22
+ scriptType: ParsedScriptType;
23
+ };
22
24
  export interface ParsedSignatureScriptP2shP2pk extends ParsedSignatureScript {
23
25
  scriptType: 'p2shP2pk';
24
26
  publicKeys: [Buffer];
25
27
  signatures: [Buffer];
26
28
  }
29
+ export interface ParsedPubScriptTaprootKeyPath extends ParsedPubScript {
30
+ scriptType: 'taprootKeyPathSpend';
31
+ publicKeys: [Buffer];
32
+ pubScript: Buffer;
33
+ }
27
34
  export interface ParsedPubScriptTaprootScriptPath extends ParsedPubScript {
28
- scriptType: 'p2tr';
35
+ scriptType: 'taprootScriptPathSpend';
29
36
  publicKeys: [Buffer, Buffer];
30
37
  pubScript: Buffer;
31
38
  }
32
- export interface ParsedPubScript2Of3 extends ParsedPubScript {
39
+ export declare type ParsedPubScriptTaproot = ParsedPubScriptTaprootKeyPath | ParsedPubScriptTaprootScriptPath;
40
+ export interface ParsedPubScriptP2ms extends ParsedPubScript {
33
41
  scriptType: 'p2sh' | 'p2shP2wsh' | 'p2wsh';
34
42
  publicKeys: [Buffer, Buffer, Buffer];
35
43
  pubScript: Buffer;
36
44
  redeemScript: Buffer | undefined;
37
45
  witnessScript: Buffer | undefined;
38
46
  }
39
- export interface ParsedSignatureScript2Of3 extends ParsedSignatureScript {
47
+ export interface ParsedPubScriptP2shP2pk extends ParsedPubScript {
48
+ scriptType: 'p2shP2pk';
49
+ publicKeys: [Buffer];
50
+ pubScript: Buffer;
51
+ redeemScript: Buffer;
52
+ }
53
+ export interface ParsedSignatureScriptP2ms extends ParsedSignatureScript {
40
54
  scriptType: 'p2sh' | 'p2shP2wsh' | 'p2wsh';
41
55
  publicKeys: [Buffer, Buffer, Buffer];
42
56
  signatures: [Buffer, Buffer] | [Buffer | 0, Buffer | 0, Buffer | 0];
@@ -45,20 +59,18 @@ export interface ParsedSignatureScript2Of3 extends ParsedSignatureScript {
45
59
  witnessScript: Buffer | undefined;
46
60
  }
47
61
  /**
48
- * Keypath spends only have a single pubkey and single signature
62
+ * Keypath spends only have a single signature
49
63
  */
50
64
  export interface ParsedSignatureScriptTaprootKeyPath extends ParsedSignatureScript {
51
- scriptType: 'p2tr';
52
- publicKeys: [Buffer];
65
+ scriptType: 'taprootKeyPathSpend';
53
66
  signatures: [Buffer];
54
- pubScript: Buffer;
55
67
  }
56
68
  /**
57
69
  * Taproot Scriptpath spends are more similar to regular p2ms spends and have two public keys and
58
70
  * two signatures
59
71
  */
60
72
  export interface ParsedSignatureScriptTaprootScriptPath extends ParsedSignatureScript {
61
- scriptType: 'p2tr';
73
+ scriptType: 'taprootScriptPathSpend';
62
74
  publicKeys: [Buffer, Buffer];
63
75
  signatures: [Buffer, Buffer];
64
76
  controlBlock: Buffer;
@@ -78,15 +90,32 @@ export declare type InputPubScript = Buffer;
78
90
  * @param input
79
91
  * @returns ParsedSignatureScript
80
92
  */
81
- export declare function parseSignatureScript(input: TxInput): ParsedSignatureScriptP2shP2pk | ParsedSignatureScript2Of3 | ParsedSignatureScriptTaproot;
82
- export declare function parseSignatureScript2Of3(input: TxInput): ParsedSignatureScript2Of3 | ParsedSignatureScriptTaproot;
93
+ export declare function parseSignatureScript(input: TxInput): ParsedSignatureScriptP2shP2pk | ParsedSignatureScriptP2ms | ParsedSignatureScriptTaproot;
94
+ export declare function parseSignatureScript2Of3(input: TxInput): ParsedSignatureScriptP2ms | ParsedSignatureScriptTaproot;
95
+ /**
96
+ * @return pubScript (scriptPubKey/redeemScript/witnessScript) is parsed.
97
+ * P2SH => scriptType, pubScript (redeemScript), redeemScript, public keys
98
+ * PW2SH => scriptType, pubScript (witnessScript), witnessScript, public keys.
99
+ * P2SH-PW2SH => scriptType, pubScript (witnessScript), witnessScript, public keys.
100
+ * taprootScriptPathSpend (P2TR and P2TRMUISG2 script path) => scriptType, pubScript, pub keys.
101
+ * taprootKeyPathSpend (P2TRMUISG2 key path) => scriptType, pubScript (34-byte output script), pub key (tapOutputKey).
102
+ */
103
+ export declare function parsePubScript2Of3(inputPubScript: InputPubScript, scriptType: 'taprootKeyPathSpend'): ParsedPubScriptTaprootKeyPath;
104
+ export declare function parsePubScript2Of3(inputPubScript: InputPubScript, scriptType: 'taprootScriptPathSpend'): ParsedPubScriptTaprootScriptPath;
105
+ export declare function parsePubScript2Of3(inputPubScript: InputPubScript, scriptType: 'p2sh' | 'p2shP2wsh' | 'p2wsh'): ParsedPubScriptP2ms;
106
+ export declare function parsePubScript2Of3(inputPubScript: InputPubScript, scriptType: ParsedScriptType2Of3): ParsedPubScriptP2ms | ParsedPubScriptTaproot;
83
107
  /**
84
108
  * @return pubScript (scriptPubKey/redeemScript/witnessScript) is parsed.
85
109
  * P2SH => scriptType, pubScript (redeemScript), redeemScript, public keys
86
110
  * PW2SH => scriptType, pubScript (witnessScript), witnessScript, public keys.
87
111
  * P2SH-PW2SH => scriptType, pubScript (witnessScript), witnessScript, public keys.
88
- * P2TR => scriptType, pubScript, controlBlock, scriptPathLevel, leafVersion, pub keys, signatures.
112
+ * taprootScriptPathSpend (P2TR and P2TRMUISG2 script path) => scriptType, pubScript, pub keys.
113
+ * taprootKeyPathSpend (P2TRMUISG2 key path) => scriptType, pubScript (34-byte output script), pub key (tapOutputKey).
114
+ * P2SH-P2PK => scriptType, pubScript, pub key, redeemScript.
89
115
  */
90
- export declare function parsePubScript(inputPubScript: InputPubScript, scriptType: ScriptType2Of3): ParsedPubScript2Of3 | ParsedPubScriptTaprootScriptPath;
91
- export {};
116
+ export declare function parsePubScript(inputPubScript: InputPubScript, scriptType: 'taprootKeyPathSpend'): ParsedPubScriptTaprootKeyPath;
117
+ export declare function parsePubScript(inputPubScript: InputPubScript, scriptType: 'taprootScriptPathSpend'): ParsedPubScriptTaprootScriptPath;
118
+ export declare function parsePubScript(inputPubScript: InputPubScript, scriptType: 'p2shP2pk'): ParsedPubScriptP2shP2pk;
119
+ export declare function parsePubScript(inputPubScript: InputPubScript, scriptType: 'p2sh' | 'p2shP2wsh' | 'p2wsh'): ParsedPubScriptP2ms;
120
+ export declare function parsePubScript(inputPubScript: InputPubScript, scriptType: ParsedScriptType): ParsedPubScriptP2ms | ParsedPubScriptTaproot | ParsedPubScriptP2shP2pk;
92
121
  //# sourceMappingURL=parseInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseInput.d.ts","sourceRoot":"","sources":["../../../src/bitgo/parseInput.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAqB,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAoB,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG/E,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAKlE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAGhE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAWrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,oBAAY,eAAe,GAAG,YAAY,CAAC;AAC3C,oBAAY,qBAAqB,GAAG,YAAY,CAAC;AAEjD,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,gCAAiC,SAAQ,eAAe;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;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