@interop/was-client 0.40.2 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/Collection.d.ts.map +1 -1
  2. package/dist/Collection.js +27 -83
  3. package/dist/Collection.js.map +1 -1
  4. package/dist/Resource.d.ts +10 -7
  5. package/dist/Resource.d.ts.map +1 -1
  6. package/dist/Resource.js +32 -99
  7. package/dist/Resource.js.map +1 -1
  8. package/dist/codec.d.ts +12 -3
  9. package/dist/codec.d.ts.map +1 -1
  10. package/dist/codec.js.map +1 -1
  11. package/dist/edv/EdvCodec.d.ts +35 -4
  12. package/dist/edv/EdvCodec.d.ts.map +1 -1
  13. package/dist/edv/EdvCodec.js +296 -200
  14. package/dist/edv/EdvCodec.js.map +1 -1
  15. package/dist/edv/WasTransport.js +2 -2
  16. package/dist/edv/WasTransport.js.map +1 -1
  17. package/dist/edv/descriptorStore.d.ts +10 -6
  18. package/dist/edv/descriptorStore.d.ts.map +1 -1
  19. package/dist/edv/descriptorStore.js +5 -3
  20. package/dist/edv/descriptorStore.js.map +1 -1
  21. package/dist/edv/didKeyRecipient.d.ts.map +1 -1
  22. package/dist/edv/didKeyRecipient.js +1 -1
  23. package/dist/edv/didKeyRecipient.js.map +1 -1
  24. package/dist/edv/docCipher.d.ts.map +1 -1
  25. package/dist/edv/docCipher.js +11 -30
  26. package/dist/edv/docCipher.js.map +1 -1
  27. package/dist/edv/epochCrypto.d.ts +7 -0
  28. package/dist/edv/epochCrypto.d.ts.map +1 -1
  29. package/dist/edv/epochCrypto.js +12 -5
  30. package/dist/edv/epochCrypto.js.map +1 -1
  31. package/dist/edv/epochKeys.d.ts.map +1 -1
  32. package/dist/edv/epochKeys.js +21 -37
  33. package/dist/edv/epochKeys.js.map +1 -1
  34. package/dist/edv/epochRoster.d.ts +24 -0
  35. package/dist/edv/epochRoster.d.ts.map +1 -1
  36. package/dist/edv/epochRoster.js +26 -0
  37. package/dist/edv/epochRoster.js.map +1 -1
  38. package/dist/edv/recipients.d.ts +12 -10
  39. package/dist/edv/recipients.d.ts.map +1 -1
  40. package/dist/edv/recipients.js +254 -199
  41. package/dist/edv/recipients.js.map +1 -1
  42. package/dist/internal/codec.d.ts.map +1 -1
  43. package/dist/internal/codec.js +5 -18
  44. package/dist/internal/codec.js.map +1 -1
  45. package/dist/internal/conditional.d.ts +33 -2
  46. package/dist/internal/conditional.d.ts.map +1 -1
  47. package/dist/internal/conditional.js +52 -0
  48. package/dist/internal/conditional.js.map +1 -1
  49. package/dist/internal/content.d.ts +7 -0
  50. package/dist/internal/content.d.ts.map +1 -1
  51. package/dist/internal/content.js +7 -0
  52. package/dist/internal/content.js.map +1 -1
  53. package/dist/internal/features.d.ts.map +1 -1
  54. package/dist/internal/features.js +9 -9
  55. package/dist/internal/features.js.map +1 -1
  56. package/dist/internal/indexSchema.d.ts +0 -10
  57. package/dist/internal/indexSchema.d.ts.map +1 -1
  58. package/dist/internal/indexSchema.js +1 -1
  59. package/dist/internal/indexSchema.js.map +1 -1
  60. package/dist/internal/memo.d.ts +39 -0
  61. package/dist/internal/memo.d.ts.map +1 -0
  62. package/dist/internal/memo.js +59 -0
  63. package/dist/internal/memo.js.map +1 -0
  64. package/dist/internal/meta.d.ts +92 -0
  65. package/dist/internal/meta.d.ts.map +1 -0
  66. package/dist/internal/meta.js +126 -0
  67. package/dist/internal/meta.js.map +1 -0
  68. package/dist/internal/pagination.js +1 -1
  69. package/dist/internal/pagination.js.map +1 -1
  70. package/dist/internal/withCodec.d.ts +26 -0
  71. package/dist/internal/withCodec.d.ts.map +1 -0
  72. package/dist/internal/withCodec.js +15 -0
  73. package/dist/internal/withCodec.js.map +1 -0
  74. package/dist/internal/write.d.ts +5 -8
  75. package/dist/internal/write.d.ts.map +1 -1
  76. package/dist/internal/write.js +25 -11
  77. package/dist/internal/write.js.map +1 -1
  78. package/dist/log/logStore.d.ts +6 -3
  79. package/dist/log/logStore.d.ts.map +1 -1
  80. package/dist/log/logStore.js +6 -3
  81. package/dist/log/logStore.js.map +1 -1
  82. package/dist/sync/cid.d.ts.map +1 -1
  83. package/dist/sync/cid.js +1 -6
  84. package/dist/sync/cid.js.map +1 -1
  85. package/dist/sync/index.d.ts +2 -1
  86. package/dist/sync/index.d.ts.map +1 -1
  87. package/dist/sync/index.js +5 -1
  88. package/dist/sync/index.js.map +1 -1
  89. package/dist/sync/port.d.ts +0 -14
  90. package/dist/sync/port.d.ts.map +1 -1
  91. package/dist/sync/port.js +6 -19
  92. package/dist/sync/port.js.map +1 -1
  93. package/dist/sync/provisioning.d.ts.map +1 -1
  94. package/dist/sync/provisioning.js +23 -2
  95. package/dist/sync/provisioning.js.map +1 -1
  96. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"epochKeys.js","sourceRoot":"","sources":["../../src/edv/epochKeys.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAK7C,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AAuBzB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,UAAU,EACV,eAAe,EAIhB;IACC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA;IAChC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,yEAAyE;IACzE,sEAAsE;IACtE,6EAA6E;IAC7E,8DAA8D;IAC9D,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACxC,KAAK,CAAC,UAAU,CAAC,IAAI,CACnB,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,eAAe,CAAC,EAAE,CACzD,CACF,CAAA;IACD,IAAI,WAAW,CAAC,MAAM,KAA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EAAE,CACzD,CAAA;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAA;IAClE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,uBAAuB,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;AAC/D,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,YAAY,CAAC,EACpB,KAAK,EACL,eAAe,EAIhB;IACC,6EAA6E;IAC7E,0EAA0E;IAC1E,uEAAuE;IACvE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE;QAC/B,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAA;QAC5D,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,0EAA0E;YAC1E,wEAAwE;YACxE,mEAAmE;YACnE,WAAW;YACX,MAAM,IAAI,cAAc,CACtB,4CAA4C,KAAK,CAAC,EAAE,YAAY;gBAC9D,2BAA2B,CAC9B,CAAA;QACH,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC,CAAA;IACF,OAAO;QACL,EAAE,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,YAAY,CAAC,OAA+B;YAChD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAA;YAC5B,OAAO,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAClC,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -50,4 +50,28 @@ export declare function hasKeyEpochs(encryption?: CollectionEncryption): encrypt
50
50
  * @returns {boolean}
51
51
  */
52
52
  export declare function epochRostersEqual(current?: CollectionEncryption, next?: CollectionEncryption): boolean;
53
+ /**
54
+ * Picks the epoch to write under from a roster: the entry named by
55
+ * `currentEpoch` when the list holds it, otherwise the LAST entry in the
56
+ * list's canonical order.
57
+ *
58
+ * The fallback is defined against the list's own order rather than against the
59
+ * incidental order in which secrets happened to unwrap, so the choice is
60
+ * deterministic for every caller. Callers pass the list they are entitled to
61
+ * write under -- the full roster during a rotation, or only the epochs a given
62
+ * reader names -- and the rule itself does not vary between them. A reader that
63
+ * does not hold `currentEpoch` is a removed/archive reader whose writes the
64
+ * server rejects via its revoked zcap anyway; the fallback only keeps the
65
+ * selection well-defined instead of assuming the list is append-ordered
66
+ * newest-last.
67
+ *
68
+ * The list must be non-empty -- every caller has already established that it
69
+ * holds at least one epoch, so an empty list is a programming error rather than
70
+ * a state this can report on.
71
+ *
72
+ * @param epochs {CollectionEncryptionEpoch[]} the non-empty list to pick from
73
+ * @param [currentEpoch] {string} the descriptor's declared write epoch
74
+ * @returns {CollectionEncryptionEpoch}
75
+ */
76
+ export declare function pickEpoch(epochs: CollectionEncryptionEpoch[], currentEpoch?: string): CollectionEncryptionEpoch;
53
77
  //# sourceMappingURL=epochRoster.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"epochRoster.d.ts","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,UAAU,CAAC,EAAE,oBAAoB,GAChC,UAAU,IAAI,oBAAoB,GAAG;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,yBAAyB,EAAE,CAAA;CACpC,CAOA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,oBAAoB,EAC9B,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAaT"}
1
+ {"version":3,"file":"epochRoster.d.ts","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,UAAU,CAAC,EAAE,oBAAoB,GAChC,UAAU,IAAI,oBAAoB,GAAG;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,yBAAyB,EAAE,CAAA;CACpC,CAOA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,oBAAoB,EAC9B,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAaT;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,yBAAyB,EAAE,EACnC,YAAY,CAAC,EAAE,MAAM,GACpB,yBAAyB,CAE3B"}
@@ -46,4 +46,30 @@ export function epochRostersEqual(current, next) {
46
46
  return (currentIds.length === nextIds.length &&
47
47
  currentIds.every((id, index) => id === nextIds[index]));
48
48
  }
49
+ /**
50
+ * Picks the epoch to write under from a roster: the entry named by
51
+ * `currentEpoch` when the list holds it, otherwise the LAST entry in the
52
+ * list's canonical order.
53
+ *
54
+ * The fallback is defined against the list's own order rather than against the
55
+ * incidental order in which secrets happened to unwrap, so the choice is
56
+ * deterministic for every caller. Callers pass the list they are entitled to
57
+ * write under -- the full roster during a rotation, or only the epochs a given
58
+ * reader names -- and the rule itself does not vary between them. A reader that
59
+ * does not hold `currentEpoch` is a removed/archive reader whose writes the
60
+ * server rejects via its revoked zcap anyway; the fallback only keeps the
61
+ * selection well-defined instead of assuming the list is append-ordered
62
+ * newest-last.
63
+ *
64
+ * The list must be non-empty -- every caller has already established that it
65
+ * holds at least one epoch, so an empty list is a programming error rather than
66
+ * a state this can report on.
67
+ *
68
+ * @param epochs {CollectionEncryptionEpoch[]} the non-empty list to pick from
69
+ * @param [currentEpoch] {string} the descriptor's declared write epoch
70
+ * @returns {CollectionEncryptionEpoch}
71
+ */
72
+ export function pickEpoch(epochs, currentEpoch) {
73
+ return epochs.find(epoch => epoch.id === currentEpoch) ?? epochs.at(-1);
74
+ }
49
75
  //# sourceMappingURL=epochRoster.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"epochRoster.js","sourceRoot":"","sources":["../../src/edv/epochRoster.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,UAAiC;IAKjC,OAAO,CACL,UAAU,KAAK,SAAS;QACxB,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ;QAC3C,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;QAChC,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAC7B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA8B,EAC9B,IAA2B;IAE3B,IAAI,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAChD,OAAO,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,CAAA;IACpD,CAAC;IACD,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAChE,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CA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C,KAAK,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CACvD,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,SAAS,CACvB,MAAmC,EACnC,YAAqB;IAErB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,YAAY,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAA;AAC1E,CAAC"}
@@ -227,20 +227,21 @@ export declare function removeRecipient({ collection, store, space, recipientId,
227
227
  resolveRecipientKey?: (kid: string) => Promise<RecipientPublicKey | null>;
228
228
  }): Promise<CollectionEncryption>;
229
229
  /**
230
- * Replaces one reader (or several) with another in ONE descriptor write -- the
230
+ * Replaces one reader (or several) with another (or several) in ONE
231
+ * descriptor write -- the
231
232
  * shape of a key rotation cascading over a collection (e.g. a per-user key
232
- * replaced by its successor): the incoming recipient is escrowed into EVERY
233
+ * replaced by its successor): each incoming recipient is escrowed into EVERY
233
234
  * epoch (history included, {@link addRecipient}'s semantics) and the current
234
235
  * epoch is rotated off the retiring recipient(s) ({@link removeRecipient}'s
235
236
  * semantics), in a single compare-and-swap. Two requests total (the read and
236
237
  * the CAS write) against the four a compose of addRecipient + removeRecipient
237
238
  * would cost, and no intermediate state in which both keys are current.
238
239
  *
239
- * Idempotent to convergence like its two halves: an epoch already carrying the
240
+ * Idempotent to convergence like its two halves: an epoch already carrying an
240
241
  * incoming recipient is left untouched; when additionally no retiring
241
242
  * recipient remains in the current epoch, nothing is written at all -- a naive
242
243
  * re-run after a crash appends zero redundant epochs. An escrow-only state
243
- * (the incoming recipient missing from some epoch but no retiring recipient
244
+ * (an incoming recipient missing from some epoch but no retiring recipient
244
245
  * current) writes the escrow wraps without minting an epoch.
245
246
  *
246
247
  * The pull-axis contract is {@link removeRecipient}'s verbatim: the default
@@ -249,8 +250,8 @@ export declare function removeRecipient({ collection, store, space, recipientId,
249
250
  * already run elsewhere (e.g. a DID-document edit under a current-key-set
250
251
  * rule) passes a no-op `pull`.
251
252
  *
252
- * The rotation ceiling is unchanged: nothing is re-encrypted, so a retired
253
- * key still opens every pre-rotation epoch it was a recipient of.
253
+ * The limits of the rotation are unchanged: nothing is re-encrypted, so a
254
+ * retired key still opens every pre-rotation epoch it was a recipient of.
254
255
  *
255
256
  * A blinded-index HMAC key on the descriptor follows the same shape in the same
256
257
  * write: the incoming recipient gains a wrap entry, the retiring kid(s) lose
@@ -263,8 +264,9 @@ export declare function removeRecipient({ collection, store, space, recipientId,
263
264
  * @param [options.space] {Space} the default pull axis, with `revoke`
264
265
  * @param options.retire {string | string[]} the retiring recipient kid(s),
265
266
  * dropped from the fresh epoch's roster
266
- * @param options.recipient {RecipientPublicKey} the incoming reader's public
267
- * key-agreement key, escrowed into every epoch and wrapped into the fresh one
267
+ * @param options.recipient {RecipientPublicKey | RecipientPublicKey[]} the
268
+ * incoming reader(s)' public key-agreement key(s), each escrowed into every
269
+ * epoch and wrapped into the fresh one
268
270
  * @param options.owner {object} the caller's own key material
269
271
  * @param options.owner.keyAgreementKey {IKeyAgreementKey} unwraps each epoch
270
272
  * key for the escrow -- it must be a recipient of every epoch (a retiring
@@ -275,7 +277,7 @@ export declare function removeRecipient({ collection, store, space, recipientId,
275
277
  * exclusive with `space` / `revoke`
276
278
  * @param [options.resolveRecipientKey] {function} resolves a remaining
277
279
  * recipient's kid for the fresh epoch, `null` to drop it -- the
278
- * {@link removeRecipient} contract (the incoming recipient never routes
280
+ * {@link removeRecipient} contract (the incoming recipients never route
279
281
  * through it)
280
282
  * @returns {Promise<CollectionEncryption>} the new descriptor
281
283
  */
@@ -284,7 +286,7 @@ export declare function replaceRecipient({ collection, store, space, retire, rec
284
286
  store?: EncryptionDescriptorStore;
285
287
  space?: Space;
286
288
  retire: string | string[];
287
- recipient: RecipientPublicKey;
289
+ recipient: RecipientPublicKey | RecipientPublicKey[];
288
290
  owner: {
289
291
  keyAgreementKey: IKeyAgreementKey;
290
292
  };
@@ -1 +1 @@
1
- {"version":3,"file":"recipients.d.ts","sourceRoot":"","sources":["../../src/edv/recipients.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAQxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EACV,oBAAoB,EAIpB,cAAc,EACf,MAAM,aAAa,CAAA;AAOpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AA0T1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,KAAK,EACL,UAAU,EACV,YAAoB,EACrB,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,UAAU,EAAE,kBAAkB,EAAE,CAAA;IAChC,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,oBAAoB,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CA4CpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,cAAc,CAAC,EACnC,UAAU,EACV,KAAK,EACL,UAAU,EACV,KAAK,EAAE,cAAc,EACtB,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,KAAK,CAAC,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