{"version":3,"file":"utility-types.mjs","sources":["../../src/client/utility-types.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* utilityTypes(): DocumentParts {\n  yield `\n  /**\n   * A state record containing binary data\n   */\n  export interface BinaryState {\n    /**\n     * Gets the state value as a Uint8Array\n     */\n    asByteArray(): Uint8Array | undefined\n    /**\n     * Gets the state value as a string\n     */\n    asString(): string | undefined\n  }\n\n  class BinaryStateValue implements BinaryState {\n    constructor(private value: Uint8Array | undefined) {}\n\n    asByteArray(): Uint8Array | undefined {\n      return this.value\n    }\n\n    asString(): string | undefined {\n      return this.value !== undefined ? Buffer.from(this.value).toString('utf-8') : undefined\n    }\n  }\n\n  /**\n   * Expands types for IntelliSense so they are more human readable\n   * See https://stackoverflow.com/a/69288824\n   */\n  export type Expand<T> = T extends (...args: infer A) => infer R\n    ? (...args: Expand<A>) => Expand<R>\n    : T extends infer O\n      ? { [K in keyof O]: O[K] }\n      : never\n  `\n}\n"],"names":[],"mappings":"AAEM,UAAW,YAAY,GAAA;IAC3B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCL;AACH;;;;"}