@metamask-previews/eth-snap-keyring 4.4.0-f9cd26b → 6.0.0-22cd5fe

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 (84) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/dist/{CaseInsensitiveMap.js → CaseInsensitiveMap.cjs} +2 -2
  3. package/dist/CaseInsensitiveMap.cjs.map +1 -0
  4. package/dist/{CaseInsensitiveMap.d.ts → CaseInsensitiveMap.d.cts} +1 -0
  5. package/dist/CaseInsensitiveMap.d.cts.map +1 -0
  6. package/dist/CaseInsensitiveMap.d.mts +63 -0
  7. package/dist/CaseInsensitiveMap.d.mts.map +1 -0
  8. package/dist/CaseInsensitiveMap.mjs +78 -0
  9. package/dist/CaseInsensitiveMap.mjs.map +1 -0
  10. package/dist/{DeferredPromise.js → DeferredPromise.cjs} +1 -1
  11. package/dist/DeferredPromise.cjs.map +1 -0
  12. package/dist/{DeferredPromise.d.ts → DeferredPromise.d.cts} +1 -0
  13. package/dist/DeferredPromise.d.cts.map +1 -0
  14. package/dist/DeferredPromise.d.mts +16 -0
  15. package/dist/DeferredPromise.d.mts.map +1 -0
  16. package/dist/DeferredPromise.mjs +26 -0
  17. package/dist/DeferredPromise.mjs.map +1 -0
  18. package/dist/{KeyringSnapControllerClient.js → KeyringSnapControllerClient.cjs} +1 -1
  19. package/dist/KeyringSnapControllerClient.cjs.map +1 -0
  20. package/dist/{KeyringSnapControllerClient.d.ts → KeyringSnapControllerClient.d.cts} +5 -4
  21. package/dist/KeyringSnapControllerClient.d.cts.map +1 -0
  22. package/dist/KeyringSnapControllerClient.d.mts +46 -0
  23. package/dist/KeyringSnapControllerClient.d.mts.map +1 -0
  24. package/dist/KeyringSnapControllerClient.mjs +100 -0
  25. package/dist/KeyringSnapControllerClient.mjs.map +1 -0
  26. package/dist/{SnapIdMap.js → SnapIdMap.cjs} +2 -2
  27. package/dist/SnapIdMap.cjs.map +1 -0
  28. package/dist/{SnapIdMap.d.ts → SnapIdMap.d.cts} +2 -1
  29. package/dist/SnapIdMap.d.cts.map +1 -0
  30. package/dist/SnapIdMap.d.mts +203 -0
  31. package/dist/SnapIdMap.d.mts.map +1 -0
  32. package/dist/SnapIdMap.mjs +237 -0
  33. package/dist/SnapIdMap.mjs.map +1 -0
  34. package/dist/{SnapKeyring.js → SnapKeyring.cjs} +33 -15
  35. package/dist/SnapKeyring.cjs.map +1 -0
  36. package/dist/{SnapKeyring.d.ts → SnapKeyring.d.cts} +10 -10
  37. package/dist/SnapKeyring.d.cts.map +1 -0
  38. package/dist/SnapKeyring.d.mts +182 -0
  39. package/dist/SnapKeyring.d.mts.map +1 -0
  40. package/dist/SnapKeyring.mjs +622 -0
  41. package/dist/SnapKeyring.mjs.map +1 -0
  42. package/dist/{index.js → index.cjs} +4 -4
  43. package/dist/index.cjs.map +1 -0
  44. package/dist/index.d.cts +4 -0
  45. package/dist/index.d.cts.map +1 -0
  46. package/dist/index.d.mts +4 -0
  47. package/dist/index.d.mts.map +1 -0
  48. package/dist/index.mjs +4 -0
  49. package/dist/index.mjs.map +1 -0
  50. package/dist/{logger.js → logger.cjs} +1 -1
  51. package/dist/logger.cjs.map +1 -0
  52. package/dist/{logger.d.ts → logger.d.cts} +2 -2
  53. package/dist/logger.d.cts.map +1 -0
  54. package/dist/logger.d.mts +4 -0
  55. package/dist/logger.d.mts.map +1 -0
  56. package/dist/logger.mjs +5 -0
  57. package/dist/logger.mjs.map +1 -0
  58. package/dist/{types.js → types.cjs} +1 -1
  59. package/dist/types.cjs.map +1 -0
  60. package/dist/{types.d.ts → types.d.cts} +2 -1
  61. package/dist/types.d.cts.map +1 -0
  62. package/dist/types.d.mts +13 -0
  63. package/dist/types.d.mts.map +1 -0
  64. package/dist/types.mjs +7 -0
  65. package/dist/types.mjs.map +1 -0
  66. package/dist/{util.js → util.cjs} +8 -9
  67. package/dist/util.cjs.map +1 -0
  68. package/dist/{util.d.ts → util.d.cts} +3 -2
  69. package/dist/util.d.cts.map +1 -0
  70. package/dist/util.d.mts +60 -0
  71. package/dist/util.d.mts.map +1 -0
  72. package/dist/util.mjs +78 -0
  73. package/dist/util.mjs.map +1 -0
  74. package/package.json +20 -9
  75. package/dist/CaseInsensitiveMap.js.map +0 -1
  76. package/dist/DeferredPromise.js.map +0 -1
  77. package/dist/KeyringSnapControllerClient.js.map +0 -1
  78. package/dist/SnapIdMap.js.map +0 -1
  79. package/dist/SnapKeyring.js.map +0 -1
  80. package/dist/index.d.ts +0 -3
  81. package/dist/index.js.map +0 -1
  82. package/dist/logger.js.map +0 -1
  83. package/dist/types.js.map +0 -1
  84. package/dist/util.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [6.0.0]
11
+
12
+ ### Added
13
+
14
+ - **BREAKING:** Add ESM build ([#40](https://github.com/MetaMask/accounts/pull/40))
15
+ - It's no longer possible to import files from `./dist` directly.
16
+ - Export type `JsonRpcRequest` ([#95](https://github.com/MetaMask/accounts/pull/95))
17
+
18
+ ## [5.0.1]
19
+
20
+ ### Fixed
21
+
22
+ - Do not lower address for non-EVM accounts during account creation ([#90](https://github.com/MetaMask/accounts/pull/90))
23
+
24
+ ## [5.0.0]
25
+
26
+ ### Changed
27
+
28
+ - Add proprietary license ([#83](https://github.com/MetaMask/accounts/pull/83))
29
+ - **BREAKING**: Bump `@metamask/eth-sig-util` dependency from `^7.0.3` to `^8.0.0` ([#79](https://github.com/MetaMask/accounts/pull/79))
30
+ - `signTypedData` no longer support `number` for addresses, see [here](https://github.com/MetaMask/eth-sig-util/blob/main/CHANGELOG.md#800).
31
+
10
32
  ## [4.4.0]
11
33
 
12
34
  ### Added
@@ -353,7 +375,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
353
375
 
354
376
  - Initial release.
355
377
 
356
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.4.0...HEAD
378
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@6.0.0...HEAD
379
+ [6.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@5.0.1...@metamask/eth-snap-keyring@6.0.0
380
+ [5.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@5.0.0...@metamask/eth-snap-keyring@5.0.1
381
+ [5.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.4.0...@metamask/eth-snap-keyring@5.0.0
357
382
  [4.4.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.6...@metamask/eth-snap-keyring@4.4.0
358
383
  [4.3.6]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.5...@metamask/eth-snap-keyring@4.3.6
359
384
  [4.3.5]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.4...@metamask/eth-snap-keyring@4.3.5
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CaseInsensitiveMap = void 0;
4
- const util_1 = require("./util");
4
+ const util_1 = require("./util.cjs");
5
5
  /**
6
6
  * A case-insensitive map that stores key-value pairs.
7
7
  */
@@ -79,4 +79,4 @@ class CaseInsensitiveMap extends Map {
79
79
  }
80
80
  }
81
81
  exports.CaseInsensitiveMap = CaseInsensitiveMap;
82
- //# sourceMappingURL=CaseInsensitiveMap.js.map
82
+ //# sourceMappingURL=CaseInsensitiveMap.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseInsensitiveMap.cjs","sourceRoot":"","sources":["../src/CaseInsensitiveMap.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAEpC;;GAEG;AACH,MAAa,kBAA0B,SAAQ,GAAkB;IAC/D;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CACf,GAA0B;QAE1B,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,GAAW,EAAE,IAAI,GAAG,KAAK;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAA,iBAAU,EAAC,GAAG,IAAI,KAAK,GAAG,aAAa,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,GAAW,EAAE,KAAY;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,GAAW;QAChB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACzC,CAAC;CACF;AAhFD,gDAgFC","sourcesContent":["import { throwError } from './util';\n\n/**\n * A case-insensitive map that stores key-value pairs.\n */\nexport class CaseInsensitiveMap<Value> extends Map<string, Value> {\n /**\n * Create a new case-insensitive map from a plain object.\n *\n * @param obj - An object with entries to initialize the map with.\n * @returns A new case-insensitive map with all entries from `obj`.\n */\n static fromObject<Value>(\n obj: Record<string, Value>,\n ): CaseInsensitiveMap<Value> {\n return new CaseInsensitiveMap(Object.entries(obj));\n }\n\n /**\n * Return a plain object with all entries from this map.\n *\n * @returns A plain object with all entries from this map.\n */\n toObject(): Record<string, Value> {\n return Object.fromEntries(this.entries());\n }\n\n /**\n * Return the value associated to the given key, or `undefined` if the key is\n * not found.\n *\n * @param key - The key to get the value for.\n * @returns The value associated to the given key, or `undefined` if the key\n * is not found.\n */\n get(key: string): Value | undefined {\n return super.get(key.toLowerCase());\n }\n\n /**\n * Return the value associated with the given key, or throw an error if the\n * key is not found.\n *\n * @param key - The key to look up in the map.\n * @param name - Optional name of the key to include in the error message.\n * @returns The value associated with the given key.\n */\n getOrThrow(key: string, name = 'Key'): Value {\n return this.get(key) ?? throwError(`${name} '${key}' not found`);\n }\n\n /**\n * Check whether the given key is present in the map.\n *\n * @param key - The key to check for.\n * @returns `true` if the key is present in the map, `false` otherwise.\n */\n has(key: string): boolean {\n return super.has(key.toLowerCase());\n }\n\n /**\n * Set the value for the given key. If the key already exists in the map, its\n * value will be updated.\n *\n * The key is converted to lowercase before being stored in the map to ensure\n * case-insensitivity.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n * @returns The map instance.\n */\n set(key: string, value: Value): this {\n return super.set(key.toLowerCase(), value);\n }\n\n /**\n * Delete the entry for the given key.\n *\n * @param key - The key to delete the entry for.\n * @returns `true` if the entry was present in the map, `false` otherwise.\n */\n delete(key: string): boolean {\n return super.delete(key.toLowerCase());\n }\n}\n"]}
@@ -60,3 +60,4 @@ export declare class CaseInsensitiveMap<Value> extends Map<string, Value> {
60
60
  */
61
61
  delete(key: string): boolean;
62
62
  }
63
+ //# sourceMappingURL=CaseInsensitiveMap.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseInsensitiveMap.d.cts","sourceRoot":"","sources":["../src/CaseInsensitiveMap.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,kBAAkB,CAAC,KAAK,CAAE,SAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;IAC/D;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACzB,kBAAkB,CAAC,KAAK,CAAC;IAI5B;;;;OAIG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAIjC;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAInC;;;;;;;OAOG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAQ,GAAG,KAAK;IAI5C;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB;;;;;;;;;;OAUG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAIpC;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAG7B"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * A case-insensitive map that stores key-value pairs.
3
+ */
4
+ export declare class CaseInsensitiveMap<Value> extends Map<string, Value> {
5
+ /**
6
+ * Create a new case-insensitive map from a plain object.
7
+ *
8
+ * @param obj - An object with entries to initialize the map with.
9
+ * @returns A new case-insensitive map with all entries from `obj`.
10
+ */
11
+ static fromObject<Value>(obj: Record<string, Value>): CaseInsensitiveMap<Value>;
12
+ /**
13
+ * Return a plain object with all entries from this map.
14
+ *
15
+ * @returns A plain object with all entries from this map.
16
+ */
17
+ toObject(): Record<string, Value>;
18
+ /**
19
+ * Return the value associated to the given key, or `undefined` if the key is
20
+ * not found.
21
+ *
22
+ * @param key - The key to get the value for.
23
+ * @returns The value associated to the given key, or `undefined` if the key
24
+ * is not found.
25
+ */
26
+ get(key: string): Value | undefined;
27
+ /**
28
+ * Return the value associated with the given key, or throw an error if the
29
+ * key is not found.
30
+ *
31
+ * @param key - The key to look up in the map.
32
+ * @param name - Optional name of the key to include in the error message.
33
+ * @returns The value associated with the given key.
34
+ */
35
+ getOrThrow(key: string, name?: string): Value;
36
+ /**
37
+ * Check whether the given key is present in the map.
38
+ *
39
+ * @param key - The key to check for.
40
+ * @returns `true` if the key is present in the map, `false` otherwise.
41
+ */
42
+ has(key: string): boolean;
43
+ /**
44
+ * Set the value for the given key. If the key already exists in the map, its
45
+ * value will be updated.
46
+ *
47
+ * The key is converted to lowercase before being stored in the map to ensure
48
+ * case-insensitivity.
49
+ *
50
+ * @param key - The key to set the value for.
51
+ * @param value - The value to set.
52
+ * @returns The map instance.
53
+ */
54
+ set(key: string, value: Value): this;
55
+ /**
56
+ * Delete the entry for the given key.
57
+ *
58
+ * @param key - The key to delete the entry for.
59
+ * @returns `true` if the entry was present in the map, `false` otherwise.
60
+ */
61
+ delete(key: string): boolean;
62
+ }
63
+ //# sourceMappingURL=CaseInsensitiveMap.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseInsensitiveMap.d.mts","sourceRoot":"","sources":["../src/CaseInsensitiveMap.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,kBAAkB,CAAC,KAAK,CAAE,SAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;IAC/D;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACzB,kBAAkB,CAAC,KAAK,CAAC;IAI5B;;;;OAIG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAIjC;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAInC;;;;;;;OAOG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAQ,GAAG,KAAK;IAI5C;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB;;;;;;;;;;OAUG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAIpC;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAG7B"}
@@ -0,0 +1,78 @@
1
+ import { throwError } from "./util.mjs";
2
+ /**
3
+ * A case-insensitive map that stores key-value pairs.
4
+ */
5
+ export class CaseInsensitiveMap extends Map {
6
+ /**
7
+ * Create a new case-insensitive map from a plain object.
8
+ *
9
+ * @param obj - An object with entries to initialize the map with.
10
+ * @returns A new case-insensitive map with all entries from `obj`.
11
+ */
12
+ static fromObject(obj) {
13
+ return new CaseInsensitiveMap(Object.entries(obj));
14
+ }
15
+ /**
16
+ * Return a plain object with all entries from this map.
17
+ *
18
+ * @returns A plain object with all entries from this map.
19
+ */
20
+ toObject() {
21
+ return Object.fromEntries(this.entries());
22
+ }
23
+ /**
24
+ * Return the value associated to the given key, or `undefined` if the key is
25
+ * not found.
26
+ *
27
+ * @param key - The key to get the value for.
28
+ * @returns The value associated to the given key, or `undefined` if the key
29
+ * is not found.
30
+ */
31
+ get(key) {
32
+ return super.get(key.toLowerCase());
33
+ }
34
+ /**
35
+ * Return the value associated with the given key, or throw an error if the
36
+ * key is not found.
37
+ *
38
+ * @param key - The key to look up in the map.
39
+ * @param name - Optional name of the key to include in the error message.
40
+ * @returns The value associated with the given key.
41
+ */
42
+ getOrThrow(key, name = 'Key') {
43
+ return this.get(key) ?? throwError(`${name} '${key}' not found`);
44
+ }
45
+ /**
46
+ * Check whether the given key is present in the map.
47
+ *
48
+ * @param key - The key to check for.
49
+ * @returns `true` if the key is present in the map, `false` otherwise.
50
+ */
51
+ has(key) {
52
+ return super.has(key.toLowerCase());
53
+ }
54
+ /**
55
+ * Set the value for the given key. If the key already exists in the map, its
56
+ * value will be updated.
57
+ *
58
+ * The key is converted to lowercase before being stored in the map to ensure
59
+ * case-insensitivity.
60
+ *
61
+ * @param key - The key to set the value for.
62
+ * @param value - The value to set.
63
+ * @returns The map instance.
64
+ */
65
+ set(key, value) {
66
+ return super.set(key.toLowerCase(), value);
67
+ }
68
+ /**
69
+ * Delete the entry for the given key.
70
+ *
71
+ * @param key - The key to delete the entry for.
72
+ * @returns `true` if the entry was present in the map, `false` otherwise.
73
+ */
74
+ delete(key) {
75
+ return super.delete(key.toLowerCase());
76
+ }
77
+ }
78
+ //# sourceMappingURL=CaseInsensitiveMap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseInsensitiveMap.mjs","sourceRoot":"","sources":["../src/CaseInsensitiveMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAe;AAEpC;;GAEG;AACH,MAAM,OAAO,kBAA0B,SAAQ,GAAkB;IAC/D;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CACf,GAA0B;QAE1B,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,GAAW,EAAE,IAAI,GAAG,KAAK;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,GAAG,IAAI,KAAK,GAAG,aAAa,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,GAAW,EAAE,KAAY;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,GAAW;QAChB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACzC,CAAC;CACF","sourcesContent":["import { throwError } from './util';\n\n/**\n * A case-insensitive map that stores key-value pairs.\n */\nexport class CaseInsensitiveMap<Value> extends Map<string, Value> {\n /**\n * Create a new case-insensitive map from a plain object.\n *\n * @param obj - An object with entries to initialize the map with.\n * @returns A new case-insensitive map with all entries from `obj`.\n */\n static fromObject<Value>(\n obj: Record<string, Value>,\n ): CaseInsensitiveMap<Value> {\n return new CaseInsensitiveMap(Object.entries(obj));\n }\n\n /**\n * Return a plain object with all entries from this map.\n *\n * @returns A plain object with all entries from this map.\n */\n toObject(): Record<string, Value> {\n return Object.fromEntries(this.entries());\n }\n\n /**\n * Return the value associated to the given key, or `undefined` if the key is\n * not found.\n *\n * @param key - The key to get the value for.\n * @returns The value associated to the given key, or `undefined` if the key\n * is not found.\n */\n get(key: string): Value | undefined {\n return super.get(key.toLowerCase());\n }\n\n /**\n * Return the value associated with the given key, or throw an error if the\n * key is not found.\n *\n * @param key - The key to look up in the map.\n * @param name - Optional name of the key to include in the error message.\n * @returns The value associated with the given key.\n */\n getOrThrow(key: string, name = 'Key'): Value {\n return this.get(key) ?? throwError(`${name} '${key}' not found`);\n }\n\n /**\n * Check whether the given key is present in the map.\n *\n * @param key - The key to check for.\n * @returns `true` if the key is present in the map, `false` otherwise.\n */\n has(key: string): boolean {\n return super.has(key.toLowerCase());\n }\n\n /**\n * Set the value for the given key. If the key already exists in the map, its\n * value will be updated.\n *\n * The key is converted to lowercase before being stored in the map to ensure\n * case-insensitivity.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n * @returns The map instance.\n */\n set(key: string, value: Value): this {\n return super.set(key.toLowerCase(), value);\n }\n\n /**\n * Delete the entry for the given key.\n *\n * @param key - The key to delete the entry for.\n * @returns `true` if the entry was present in the map, `false` otherwise.\n */\n delete(key: string): boolean {\n return super.delete(key.toLowerCase());\n }\n}\n"]}
@@ -27,4 +27,4 @@ class DeferredPromise {
27
27
  }
28
28
  }
29
29
  exports.DeferredPromise = DeferredPromise;
30
- //# sourceMappingURL=DeferredPromise.js.map
30
+ //# sourceMappingURL=DeferredPromise.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeferredPromise.cjs","sourceRoot":"","sources":["../src/DeferredPromise.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,MAAa,eAAe;IAO1B;QAJA,YAAO,GAA8C,SAAgB,CAAC;QAEtE,WAAM,GAA2B,SAAgB,CAAC;QAGhD,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,mEAAmE;QACnE,qDAAqD;QACrD,0BAA0B;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AApBD,0CAoBC","sourcesContent":["/**\n * A deferred promise can be resolved by a caller different from the one who\n * created it.\n *\n * Example:\n * - \"A\" creates a deferred promise \"P\", adds it to a list, and awaits it\n * - \"B\" gets \"P\" from the list and resolves it\n * - \"A\" gets the resolved value\n */\nexport class DeferredPromise<Type> {\n promise: Promise<Type>;\n\n resolve: (value: Type | PromiseLike<Type>) => void = undefined as any;\n\n reject: (reason?: any) => void = undefined as any;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n // This is a sanity check to make sure that the promise constructor\n // actually set the `resolve` and `reject` functions.\n /* istanbul ignore next */\n if (!this.resolve || !this.reject) {\n throw new Error('Promise constructor failed');\n }\n }\n}\n"]}
@@ -13,3 +13,4 @@ export declare class DeferredPromise<Type> {
13
13
  reject: (reason?: any) => void;
14
14
  constructor();
15
15
  }
16
+ //# sourceMappingURL=DeferredPromise.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeferredPromise.d.cts","sourceRoot":"","sources":["../src/DeferredPromise.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,eAAe,CAAC,IAAI;IAC/B,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAoB;IAEtE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAoB;;CAenD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A deferred promise can be resolved by a caller different from the one who
3
+ * created it.
4
+ *
5
+ * Example:
6
+ * - "A" creates a deferred promise "P", adds it to a list, and awaits it
7
+ * - "B" gets "P" from the list and resolves it
8
+ * - "A" gets the resolved value
9
+ */
10
+ export declare class DeferredPromise<Type> {
11
+ promise: Promise<Type>;
12
+ resolve: (value: Type | PromiseLike<Type>) => void;
13
+ reject: (reason?: any) => void;
14
+ constructor();
15
+ }
16
+ //# sourceMappingURL=DeferredPromise.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeferredPromise.d.mts","sourceRoot":"","sources":["../src/DeferredPromise.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,eAAe,CAAC,IAAI;IAC/B,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAoB;IAEtE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAoB;;CAenD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A deferred promise can be resolved by a caller different from the one who
3
+ * created it.
4
+ *
5
+ * Example:
6
+ * - "A" creates a deferred promise "P", adds it to a list, and awaits it
7
+ * - "B" gets "P" from the list and resolves it
8
+ * - "A" gets the resolved value
9
+ */
10
+ export class DeferredPromise {
11
+ constructor() {
12
+ this.resolve = undefined;
13
+ this.reject = undefined;
14
+ this.promise = new Promise((resolve, reject) => {
15
+ this.resolve = resolve;
16
+ this.reject = reject;
17
+ });
18
+ // This is a sanity check to make sure that the promise constructor
19
+ // actually set the `resolve` and `reject` functions.
20
+ /* istanbul ignore next */
21
+ if (!this.resolve || !this.reject) {
22
+ throw new Error('Promise constructor failed');
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=DeferredPromise.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeferredPromise.mjs","sourceRoot":"","sources":["../src/DeferredPromise.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IAO1B;QAJA,YAAO,GAA8C,SAAgB,CAAC;QAEtE,WAAM,GAA2B,SAAgB,CAAC;QAGhD,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,mEAAmE;QACnE,qDAAqD;QACrD,0BAA0B;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * A deferred promise can be resolved by a caller different from the one who\n * created it.\n *\n * Example:\n * - \"A\" creates a deferred promise \"P\", adds it to a list, and awaits it\n * - \"B\" gets \"P\" from the list and resolves it\n * - \"A\" gets the resolved value\n */\nexport class DeferredPromise<Type> {\n promise: Promise<Type>;\n\n resolve: (value: Type | PromiseLike<Type>) => void = undefined as any;\n\n reject: (reason?: any) => void = undefined as any;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n // This is a sanity check to make sure that the promise constructor\n // actually set the `resolve` and `reject` functions.\n /* istanbul ignore next */\n if (!this.resolve || !this.reject) {\n throw new Error('Promise constructor failed');\n }\n }\n}\n"]}
@@ -101,4 +101,4 @@ class KeyringSnapControllerClient extends keyring_api_1.KeyringClient {
101
101
  }
102
102
  exports.KeyringSnapControllerClient = KeyringSnapControllerClient;
103
103
  _KeyringSnapControllerClient_controller = new WeakMap();
104
- //# sourceMappingURL=KeyringSnapControllerClient.js.map
104
+ //# sourceMappingURL=KeyringSnapControllerClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapControllerClient.cjs","sourceRoot":"","sources":["../src/KeyringSnapControllerClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,uDAAsD;AAMtD;;;GAGG;AACH,MAAM,oBAAoB;IASxB;;;;;;;OAOG;IACH,YACE,UAAe,EACf,MAAc,EACd,MAAc,EACd,OAAoB;QApBb,+CAAgB;QAEhB,+CAAgB;QAEhB,mDAA4B;QAE5B,gDAAsB;QAgB7B,uBAAA,IAAI,oCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,wCAAY,CAAC,aAAa,CAAC;YACpC,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,OAAO,EAAE,uBAAA,IAAI,qCAAS;YACtB,OAAO;SACR,CAAkB,CAAC;IACtB,CAAC;CACF;;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,2BAAa;IAG5D;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,UAAU,EACV,MAAM,GAAG,WAAqB,EAC9B,MAAM,GAAG,UAAU,EACnB,OAAO,GAAG,kBAAiC,GAM5C;QACC,KAAK,CAAC,IAAI,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QA1B9D,0DAA4B;QA2BnC,uBAAA,IAAI,2CAAe,UAAU,MAAA,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,2BAA2B,CAAC;YACrC,UAAU,EAAE,uBAAA,IAAI,+CAAY;YAC5B,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,aAAa;QACX,OAAO,uBAAA,IAAI,+CAAY,CAAC;IAC1B,CAAC;CACF;AAtDD,kEAsDC","sourcesContent":["import type { JsonRpcRequest, Sender } from '@metamask/keyring-api';\nimport { KeyringClient } from '@metamask/keyring-api';\nimport type { SnapController } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport type { HandlerType } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through a `SnapController`.\n */\nclass SnapControllerSender implements Sender {\n readonly #snapId: SnapId;\n\n readonly #origin: string;\n\n readonly #controller: SnapController;\n\n readonly #handler: HandlerType;\n\n /**\n * Create a new instance of `SnapControllerSender`.\n *\n * @param controller - The `SnapController` instance to send requests to.\n * @param snapId - The ID of the snap to use.\n * @param origin - The sender's origin.\n * @param handler - The handler type.\n */\n constructor(\n controller: any,\n snapId: SnapId,\n origin: string,\n handler: HandlerType,\n ) {\n this.#controller = controller;\n this.#snapId = snapId;\n this.#origin = origin;\n this.#handler = handler;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#controller.handleRequest({\n snapId: this.#snapId,\n origin: this.#origin,\n handler: this.#handler,\n request,\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the\n * `SnapController`.\n */\nexport class KeyringSnapControllerClient extends KeyringClient {\n readonly #controller: SnapController;\n\n /**\n * Create a new instance of `KeyringSnapControllerClient`.\n *\n * The `handlerType` argument has a hard-coded default `string` value instead\n * of a `HandlerType` value to prevent the `@metamask/snaps-utils` module\n * from being required at runtime.\n *\n * @param args - Constructor arguments.\n * @param args.controller - The `SnapController` instance to use.\n * @param args.snapId - The ID of the snap to use (default: `'undefined'`).\n * @param args.origin - The sender's origin (default: `'metamask'`).\n * @param args.handler - The handler type (default: `'onKeyringRequest'`).\n */\n constructor({\n controller,\n snapId = 'undefined' as SnapId,\n origin = 'metamask',\n handler = 'onKeyringRequest' as HandlerType,\n }: {\n controller: SnapController;\n snapId?: SnapId;\n origin?: string;\n handler?: HandlerType;\n }) {\n super(new SnapControllerSender(controller, snapId, origin, handler));\n this.#controller = controller;\n }\n\n /**\n * Create a new instance of `KeyringSnapControllerClient` with the specified\n * `snapId`.\n *\n * @param snapId - The ID of the snap to use in the new instance.\n * @returns A new instance of `KeyringSnapControllerClient` with the\n * specified snap ID.\n */\n withSnapId(snapId: SnapId): KeyringSnapControllerClient {\n return new KeyringSnapControllerClient({\n controller: this.#controller,\n snapId,\n });\n }\n\n /**\n * Get the `SnapController` instance used by this client.\n *\n * @returns The `SnapController` instance used by this client.\n */\n getController(): SnapController {\n return this.#controller;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { KeyringClient } from '@metamask/keyring-api';
2
- import type { SnapController } from '@metamask/snaps-controllers';
3
- import type { SnapId } from '@metamask/snaps-sdk';
4
- import type { HandlerType } from '@metamask/snaps-utils';
1
+ import { KeyringClient } from "@metamask/keyring-api";
2
+ import type { SnapController } from "@metamask/snaps-controllers";
3
+ import type { SnapId } from "@metamask/snaps-sdk";
4
+ import type { HandlerType } from "@metamask/snaps-utils";
5
5
  /**
6
6
  * A `KeyringClient` that allows the communication with a snap through the
7
7
  * `SnapController`.
@@ -43,3 +43,4 @@ export declare class KeyringSnapControllerClient extends KeyringClient {
43
43
  */
44
44
  getController(): SnapController;
45
45
  }
46
+ //# sourceMappingURL=KeyringSnapControllerClient.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapControllerClient.d.cts","sourceRoot":"","sources":["../src/KeyringSnapControllerClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,8BAA8B;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,oCAAoC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,8BAA8B;AAoDzD;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,aAAa;;IAG5D;;;;;;;;;;;;OAYG;gBACS,EACV,UAAU,EACV,MAA8B,EAC9B,MAAmB,EACnB,OAA2C,GAC5C,EAAE;QACD,UAAU,EAAE,cAAc,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,WAAW,CAAC;KACvB;IAKD;;;;;;;OAOG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,2BAA2B;IAOvD;;;;OAIG;IACH,aAAa,IAAI,cAAc;CAGhC"}
@@ -0,0 +1,46 @@
1
+ import { KeyringClient } from "@metamask/keyring-api";
2
+ import type { SnapController } from "@metamask/snaps-controllers";
3
+ import type { SnapId } from "@metamask/snaps-sdk";
4
+ import type { HandlerType } from "@metamask/snaps-utils";
5
+ /**
6
+ * A `KeyringClient` that allows the communication with a snap through the
7
+ * `SnapController`.
8
+ */
9
+ export declare class KeyringSnapControllerClient extends KeyringClient {
10
+ #private;
11
+ /**
12
+ * Create a new instance of `KeyringSnapControllerClient`.
13
+ *
14
+ * The `handlerType` argument has a hard-coded default `string` value instead
15
+ * of a `HandlerType` value to prevent the `@metamask/snaps-utils` module
16
+ * from being required at runtime.
17
+ *
18
+ * @param args - Constructor arguments.
19
+ * @param args.controller - The `SnapController` instance to use.
20
+ * @param args.snapId - The ID of the snap to use (default: `'undefined'`).
21
+ * @param args.origin - The sender's origin (default: `'metamask'`).
22
+ * @param args.handler - The handler type (default: `'onKeyringRequest'`).
23
+ */
24
+ constructor({ controller, snapId, origin, handler, }: {
25
+ controller: SnapController;
26
+ snapId?: SnapId;
27
+ origin?: string;
28
+ handler?: HandlerType;
29
+ });
30
+ /**
31
+ * Create a new instance of `KeyringSnapControllerClient` with the specified
32
+ * `snapId`.
33
+ *
34
+ * @param snapId - The ID of the snap to use in the new instance.
35
+ * @returns A new instance of `KeyringSnapControllerClient` with the
36
+ * specified snap ID.
37
+ */
38
+ withSnapId(snapId: SnapId): KeyringSnapControllerClient;
39
+ /**
40
+ * Get the `SnapController` instance used by this client.
41
+ *
42
+ * @returns The `SnapController` instance used by this client.
43
+ */
44
+ getController(): SnapController;
45
+ }
46
+ //# sourceMappingURL=KeyringSnapControllerClient.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapControllerClient.d.mts","sourceRoot":"","sources":["../src/KeyringSnapControllerClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,8BAA8B;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,oCAAoC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,8BAA8B;AAoDzD;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,aAAa;;IAG5D;;;;;;;;;;;;OAYG;gBACS,EACV,UAAU,EACV,MAA8B,EAC9B,MAAmB,EACnB,OAA2C,GAC5C,EAAE;QACD,UAAU,EAAE,cAAc,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,WAAW,CAAC;KACvB;IAKD;;;;;;;OAOG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,2BAA2B;IAOvD;;;;OAIG;IACH,aAAa,IAAI,cAAc;CAGhC"}
@@ -0,0 +1,100 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _SnapControllerSender_snapId, _SnapControllerSender_origin, _SnapControllerSender_controller, _SnapControllerSender_handler, _KeyringSnapControllerClient_controller;
13
+ import { KeyringClient } from "@metamask/keyring-api";
14
+ /**
15
+ * Implementation of the `Sender` interface that can be used to send requests
16
+ * to a snap through a `SnapController`.
17
+ */
18
+ class SnapControllerSender {
19
+ /**
20
+ * Create a new instance of `SnapControllerSender`.
21
+ *
22
+ * @param controller - The `SnapController` instance to send requests to.
23
+ * @param snapId - The ID of the snap to use.
24
+ * @param origin - The sender's origin.
25
+ * @param handler - The handler type.
26
+ */
27
+ constructor(controller, snapId, origin, handler) {
28
+ _SnapControllerSender_snapId.set(this, void 0);
29
+ _SnapControllerSender_origin.set(this, void 0);
30
+ _SnapControllerSender_controller.set(this, void 0);
31
+ _SnapControllerSender_handler.set(this, void 0);
32
+ __classPrivateFieldSet(this, _SnapControllerSender_controller, controller, "f");
33
+ __classPrivateFieldSet(this, _SnapControllerSender_snapId, snapId, "f");
34
+ __classPrivateFieldSet(this, _SnapControllerSender_origin, origin, "f");
35
+ __classPrivateFieldSet(this, _SnapControllerSender_handler, handler, "f");
36
+ }
37
+ /**
38
+ * Send a request to the snap and return the response.
39
+ *
40
+ * @param request - JSON-RPC request to send to the snap.
41
+ * @returns A promise that resolves to the response of the request.
42
+ */
43
+ async send(request) {
44
+ return __classPrivateFieldGet(this, _SnapControllerSender_controller, "f").handleRequest({
45
+ snapId: __classPrivateFieldGet(this, _SnapControllerSender_snapId, "f"),
46
+ origin: __classPrivateFieldGet(this, _SnapControllerSender_origin, "f"),
47
+ handler: __classPrivateFieldGet(this, _SnapControllerSender_handler, "f"),
48
+ request,
49
+ });
50
+ }
51
+ }
52
+ _SnapControllerSender_snapId = new WeakMap(), _SnapControllerSender_origin = new WeakMap(), _SnapControllerSender_controller = new WeakMap(), _SnapControllerSender_handler = new WeakMap();
53
+ /**
54
+ * A `KeyringClient` that allows the communication with a snap through the
55
+ * `SnapController`.
56
+ */
57
+ export class KeyringSnapControllerClient extends KeyringClient {
58
+ /**
59
+ * Create a new instance of `KeyringSnapControllerClient`.
60
+ *
61
+ * The `handlerType` argument has a hard-coded default `string` value instead
62
+ * of a `HandlerType` value to prevent the `@metamask/snaps-utils` module
63
+ * from being required at runtime.
64
+ *
65
+ * @param args - Constructor arguments.
66
+ * @param args.controller - The `SnapController` instance to use.
67
+ * @param args.snapId - The ID of the snap to use (default: `'undefined'`).
68
+ * @param args.origin - The sender's origin (default: `'metamask'`).
69
+ * @param args.handler - The handler type (default: `'onKeyringRequest'`).
70
+ */
71
+ constructor({ controller, snapId = 'undefined', origin = 'metamask', handler = 'onKeyringRequest', }) {
72
+ super(new SnapControllerSender(controller, snapId, origin, handler));
73
+ _KeyringSnapControllerClient_controller.set(this, void 0);
74
+ __classPrivateFieldSet(this, _KeyringSnapControllerClient_controller, controller, "f");
75
+ }
76
+ /**
77
+ * Create a new instance of `KeyringSnapControllerClient` with the specified
78
+ * `snapId`.
79
+ *
80
+ * @param snapId - The ID of the snap to use in the new instance.
81
+ * @returns A new instance of `KeyringSnapControllerClient` with the
82
+ * specified snap ID.
83
+ */
84
+ withSnapId(snapId) {
85
+ return new KeyringSnapControllerClient({
86
+ controller: __classPrivateFieldGet(this, _KeyringSnapControllerClient_controller, "f"),
87
+ snapId,
88
+ });
89
+ }
90
+ /**
91
+ * Get the `SnapController` instance used by this client.
92
+ *
93
+ * @returns The `SnapController` instance used by this client.
94
+ */
95
+ getController() {
96
+ return __classPrivateFieldGet(this, _KeyringSnapControllerClient_controller, "f");
97
+ }
98
+ }
99
+ _KeyringSnapControllerClient_controller = new WeakMap();
100
+ //# sourceMappingURL=KeyringSnapControllerClient.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyringSnapControllerClient.mjs","sourceRoot":"","sources":["../src/KeyringSnapControllerClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,8BAA8B;AAMtD;;;GAGG;AACH,MAAM,oBAAoB;IASxB;;;;;;;OAOG;IACH,YACE,UAAe,EACf,MAAc,EACd,MAAc,EACd,OAAoB;QApBb,+CAAgB;QAEhB,+CAAgB;QAEhB,mDAA4B;QAE5B,gDAAsB;QAgB7B,uBAAA,IAAI,oCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,gCAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,iCAAY,OAAO,MAAA,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,uBAAA,IAAI,wCAAY,CAAC,aAAa,CAAC;YACpC,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,MAAM,EAAE,uBAAA,IAAI,oCAAQ;YACpB,OAAO,EAAE,uBAAA,IAAI,qCAAS;YACtB,OAAO;SACR,CAAkB,CAAC;IACtB,CAAC;CACF;;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,aAAa;IAG5D;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,UAAU,EACV,MAAM,GAAG,WAAqB,EAC9B,MAAM,GAAG,UAAU,EACnB,OAAO,GAAG,kBAAiC,GAM5C;QACC,KAAK,CAAC,IAAI,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QA1B9D,0DAA4B;QA2BnC,uBAAA,IAAI,2CAAe,UAAU,MAAA,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,2BAA2B,CAAC;YACrC,UAAU,EAAE,uBAAA,IAAI,+CAAY;YAC5B,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,aAAa;QACX,OAAO,uBAAA,IAAI,+CAAY,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import type { JsonRpcRequest, Sender } from '@metamask/keyring-api';\nimport { KeyringClient } from '@metamask/keyring-api';\nimport type { SnapController } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport type { HandlerType } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\n\n/**\n * Implementation of the `Sender` interface that can be used to send requests\n * to a snap through a `SnapController`.\n */\nclass SnapControllerSender implements Sender {\n readonly #snapId: SnapId;\n\n readonly #origin: string;\n\n readonly #controller: SnapController;\n\n readonly #handler: HandlerType;\n\n /**\n * Create a new instance of `SnapControllerSender`.\n *\n * @param controller - The `SnapController` instance to send requests to.\n * @param snapId - The ID of the snap to use.\n * @param origin - The sender's origin.\n * @param handler - The handler type.\n */\n constructor(\n controller: any,\n snapId: SnapId,\n origin: string,\n handler: HandlerType,\n ) {\n this.#controller = controller;\n this.#snapId = snapId;\n this.#origin = origin;\n this.#handler = handler;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param request - JSON-RPC request to send to the snap.\n * @returns A promise that resolves to the response of the request.\n */\n async send(request: JsonRpcRequest): Promise<Json> {\n return this.#controller.handleRequest({\n snapId: this.#snapId,\n origin: this.#origin,\n handler: this.#handler,\n request,\n }) as Promise<Json>;\n }\n}\n\n/**\n * A `KeyringClient` that allows the communication with a snap through the\n * `SnapController`.\n */\nexport class KeyringSnapControllerClient extends KeyringClient {\n readonly #controller: SnapController;\n\n /**\n * Create a new instance of `KeyringSnapControllerClient`.\n *\n * The `handlerType` argument has a hard-coded default `string` value instead\n * of a `HandlerType` value to prevent the `@metamask/snaps-utils` module\n * from being required at runtime.\n *\n * @param args - Constructor arguments.\n * @param args.controller - The `SnapController` instance to use.\n * @param args.snapId - The ID of the snap to use (default: `'undefined'`).\n * @param args.origin - The sender's origin (default: `'metamask'`).\n * @param args.handler - The handler type (default: `'onKeyringRequest'`).\n */\n constructor({\n controller,\n snapId = 'undefined' as SnapId,\n origin = 'metamask',\n handler = 'onKeyringRequest' as HandlerType,\n }: {\n controller: SnapController;\n snapId?: SnapId;\n origin?: string;\n handler?: HandlerType;\n }) {\n super(new SnapControllerSender(controller, snapId, origin, handler));\n this.#controller = controller;\n }\n\n /**\n * Create a new instance of `KeyringSnapControllerClient` with the specified\n * `snapId`.\n *\n * @param snapId - The ID of the snap to use in the new instance.\n * @returns A new instance of `KeyringSnapControllerClient` with the\n * specified snap ID.\n */\n withSnapId(snapId: SnapId): KeyringSnapControllerClient {\n return new KeyringSnapControllerClient({\n controller: this.#controller,\n snapId,\n });\n }\n\n /**\n * Get the `SnapController` instance used by this client.\n *\n * @returns The `SnapController` instance used by this client.\n */\n getController(): SnapController {\n return this.#controller;\n }\n}\n"]}
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _SnapIdMap_map;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.SnapIdMap = exports.InvalidSnapIdError = void 0;
16
- const CaseInsensitiveMap_1 = require("./CaseInsensitiveMap");
16
+ const CaseInsensitiveMap_1 = require("./CaseInsensitiveMap.cjs");
17
17
  /**
18
18
  * Error thrown when an invalid Snap ID is encountered.
19
19
  */
@@ -239,4 +239,4 @@ class SnapIdMap {
239
239
  }
240
240
  exports.SnapIdMap = SnapIdMap;
241
241
  _SnapIdMap_map = new WeakMap();
242
- //# sourceMappingURL=SnapIdMap.js.map
242
+ //# sourceMappingURL=SnapIdMap.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnapIdMap.cjs","sourceRoot":"","sources":["../src/SnapIdMap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,iEAA0D;AAE1D;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAW3C;;;;;OAKG;IACH,YAAY,MAAc,EAAE,GAAW;QACrC,KAAK,CAAC,SAAS,MAAM,4BAA4B,GAAG,GAAG,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF;AAvBD,gDAuBC;AAED;;;;;;GAMG;AACH,MAAa,SAAS;IAGpB;;;;;;;;;;;;;;;OAeG;IACH,YAAY,QAA6C;QAlBhD,iCAAgC;QAmBvC,uBAAA,IAAI,kBAAQ,IAAI,uCAAkB,CAAC,QAAQ,CAAC,MAAA,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ;QACN,OAAO,uBAAA,IAAI,sBAAK,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,UAAU,CACf,GAA0B;QAE1B,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CAAC,MAAc,EAAE,GAAW;QAC7B,MAAM,KAAK,GAAG,uBAAA,IAAI,sBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,OAAO,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,MAAc,EAAE,GAAW;QAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,SAAS,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,MAAc,EAAE,GAAW;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,uBAAA,IAAI,sBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxD,CAAC;IAED,4CAA4C;IAC5C;;;;;;;;;;;;;;;;;OAiBG;IACH,2CAA2C;IAC3C,GAAG,CAAC,GAAW,EAAE,KAAY;QAC3B,uEAAuE;QACvE,sEAAsE;QACtE,sCAAsC;QACtC,IAAI,uBAAA,IAAI,sBAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,kBAAkB,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAClD,CAAC;QACD,uBAAA,IAAI,sBAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM;QACJ,OAAO,uBAAA,IAAI,sBAAK,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,sBAAK,CAAC,IAAI,CAAC;IACxB,CAAC;CACF;AAhND,8BAgNC","sourcesContent":["import type { SnapId } from '@metamask/snaps-sdk';\n\nimport { CaseInsensitiveMap } from './CaseInsensitiveMap';\n\n/**\n * Error thrown when an invalid Snap ID is encountered.\n */\nexport class InvalidSnapIdError extends Error {\n /**\n * The ID of the Snap that caused the error.\n */\n snapId: SnapId;\n\n /**\n * The key of the element that caused the error.\n */\n key: string;\n\n /**\n * Creates an instance of `InvalidSnapIdError`.\n *\n * @param snapId - The invalid Snap ID.\n * @param key - The key associated with the invalid Snap ID.\n */\n constructor(snapId: SnapId, key: string) {\n super(`Snap \"${snapId}\" is not allowed to set \"${key}\"`);\n this.name = 'InvalidSnapIdError';\n this.snapId = snapId;\n this.key = key;\n }\n}\n\n/**\n * A map that associates a string key with a value that has a `snapId`\n * property. Note that the key is case-insensitive.\n *\n * The `snapId` property is used to ensure that only the Snap that added an\n * item to the map can modify or delete it.\n */\nexport class SnapIdMap<Value extends { snapId: SnapId }> {\n readonly #map: CaseInsensitiveMap<Value>;\n\n /**\n * Creates a new `SnapIdMap` object.\n *\n * Example:\n *\n * ```ts\n * const items = [\n * ['foo', { snapId: '1', name: 'foo' }],\n * ['bar', { snapId: '1', name: 'bar' }],\n * ];\n * const map = new SnapIdMap(items);\n * ```\n *\n * @param iterable - An iterable object whose elements are key-value pairs.\n * Each key-value pair will be added to the new map.\n */\n constructor(iterable?: Iterable<readonly [string, Value]>) {\n this.#map = new CaseInsensitiveMap(iterable);\n }\n\n /**\n * Returns a plain object with the same key-value pairs as this map.\n *\n * Example:\n *\n * ```ts\n * const items = [\n * ['foo', { snapId: '1', name: 'foo' }],\n * ['bar', { snapId: '1', name: 'bar' }],\n * ];\n * const map = new SnapIdMap(items);\n * map.toObject();\n * // Returns\n * // {\n * // foo: { snapId: '1', name: 'foo' },\n * // bar: { snapId: '1', name: 'bar' },\n * // }\n * ```\n *\n * @returns A plain object with the same key-value pairs as this map.\n */\n toObject(): Record<string, Value> {\n return this.#map.toObject();\n }\n\n /**\n * Returns a new `SnapIdMap` object from an plain object.\n *\n * Example:\n *\n * ```ts\n * const obj = {\n * foo: { snapId: '1', name: 'foo' },\n * bar: { snapId: '1', name: 'bar' },\n * };\n * const map = SnapIdMap.fromObject(obj);\n * ```\n *\n * @param obj - A plain object whose elements will be added to the new map.\n * @returns A new `SnapIdMap` containing the elements of the given object.\n */\n static fromObject<Value extends { snapId: SnapId }>(\n obj: Record<string, Value>,\n ): SnapIdMap<Value> {\n return new SnapIdMap(Object.entries(obj));\n }\n\n /**\n * Gets a value from the map.\n *\n * If the given key is not present in the map or the Snap ID of the value is\n * different from the given Snap ID, returns `undefined`.\n *\n * Example:\n *\n * ```ts\n * const map = new SnapIdMap();\n * map.set('foo', { snapId: '1', name: 'foo' });\n * map.get('1', 'foo'); // Returns { snapId: '1', name: 'foo' }\n * map.get('2', 'foo'); // Returns `undefined`\n * map.get('1', 'bar'); // Returns `undefined`\n * ```\n *\n * @param snapId - Snap ID present in the value to get.\n * @param key - Key of the element to get.\n * @returns The value associated with the given key and Snap ID.\n */\n get(snapId: SnapId, key: string): Value | undefined {\n const value = this.#map.get(key);\n return value?.snapId === snapId ? value : undefined;\n }\n\n /**\n * Checks if a key is present in the map.\n *\n * If the given key is not present in the map or the Snap ID of the value is\n * different from the given Snap ID, returns `false`.\n *\n * Example:\n *\n * ```ts\n * const map = new SnapIdMap();\n * map.set('foo', { snapId: '1', name: 'foo' });\n * map.has('1', 'foo'); // Returns `true`\n * map.has('2', 'foo'); // Returns `false`\n * map.has('1', 'bar'); // Returns `false`\n * ```\n *\n * @param snapId - Snap ID present in the value to check.\n * @param key - Key of the element to check.\n * @returns `true` if the key is present in the map and the Snap ID of the\n * value is equal to the given Snap ID, `false` otherwise.\n */\n has(snapId: SnapId, key: string): boolean {\n return this.get(snapId, key) !== undefined;\n }\n\n /**\n * Deletes a key from the map.\n *\n * If the given key is not present in the map or the Snap IDs don't match,\n * returns `false` and does nothing.\n *\n * Example:\n *\n * ```ts\n * const map = new SnapIdMap();\n * map.set('foo', { snapId: '1', name: 'foo' });\n * map.delete('2', 'foo'); // Returns `false`\n * map.delete('1', 'bar'); // Returns `false`\n * map.delete('1', 'foo'); // Returns `true`\n * ```\n *\n * @param snapId - Snap ID present in the value to delete.\n * @param key - Key of the element to delete.\n * @returns `true` if the key was present in the map and the Snap ID of the\n * value was equal to the given Snap ID, `false` otherwise.\n */\n delete(snapId: SnapId, key: string): boolean {\n return this.has(snapId, key) && this.#map.delete(key);\n }\n\n /* eslint-disable jsdoc/check-indentation */\n /**\n * Adds or updates a key-value pair in the map.\n *\n * Note that this method has a different behavior from the `Map.set`.\n *\n * - If the given key is not already present in the map, this method adds the\n * key-value pair to the map.\n *\n * - If the given key is already present in the map and the Snap IDs match,\n * this method updates the value associated with the key.\n *\n * - However, if the given key is already present in the map but the Snap IDs\n * do not match, this method throws an error.\n *\n * @param key - Key of the element to add or update.\n * @param value - Value of the element to add or update.\n * @returns The map itself.\n */\n /* eslint-enable jsdoc/check-indentation */\n set(key: string, value: Value): this {\n // If the key is present in the map but isn't associated with the given\n // Snap ID, it means that the item was added to the map by a different\n // Snap. In this case, throw an error.\n if (this.#map.has(key) && !this.has(value.snapId, key)) {\n throw new InvalidSnapIdError(value.snapId, key);\n }\n this.#map.set(key, value);\n return this;\n }\n\n /**\n * Returns an iterable of the values in the map.\n *\n * Example:\n *\n * ```ts\n * const map = new SnapIdMap([\n * ['foo', { snapId: '1', name: 'foo' }],\n * ['bar', { snapId: '1', name: 'bar' }],\n * ]);\n * const values = [...map.values()];\n * // Returns\n * // [\n * // { snapId: '1', name: 'foo' },\n * // { snapId: '1', name: 'bar' },\n * // ]\n * ```\n *\n * @returns An iterable of the values in the map.\n */\n values(): IterableIterator<Value> {\n return this.#map.values();\n }\n\n /**\n * Returns the number of key-value pairs in the map.\n *\n * @returns The number of key-value pairs in the map.\n */\n get size(): number {\n return this.#map.size;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { SnapId } from '@metamask/snaps-sdk';
1
+ import type { SnapId } from "@metamask/snaps-sdk";
2
2
  /**
3
3
  * Error thrown when an invalid Snap ID is encountered.
4
4
  */
@@ -200,3 +200,4 @@ export declare class SnapIdMap<Value extends {
200
200
  */
201
201
  get size(): number;
202
202
  }
203
+ //# sourceMappingURL=SnapIdMap.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnapIdMap.d.cts","sourceRoot":"","sources":["../src/SnapIdMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAIlD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CAMxC;AAED;;;;;;GAMG;AACH,qBAAa,SAAS,CAAC,KAAK,SAAS;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;IAGrD;;;;;;;;;;;;;;;OAeG;gBACS,QAAQ,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAIzD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAIjC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,SAAS;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAChD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACzB,SAAS,CAAC,KAAK,CAAC;IAInB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAKnD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAK5C;;;;;;;;;;;;;;;;;OAiBG;IAEH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAWpC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC;IAIjC;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}