@stryke/capnp 0.12.41 → 0.12.43

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 (69) hide show
  1. package/bin/capnpc.cjs +224 -7
  2. package/bin/capnpc.mjs +219 -9
  3. package/bin/capnpc.mjs.map +1 -1
  4. package/dist/capnp-es.GpvEvMIK-BsgDzeBH.mjs +12 -0
  5. package/dist/capnp-es.GpvEvMIK-BsgDzeBH.mjs.map +1 -0
  6. package/dist/capnp-es.GpvEvMIK-xNDcbmgx.cjs +11 -0
  7. package/dist/compile-ChbJ-p6B.cjs +169 -0
  8. package/dist/compile-DJUj4hs3.mjs +163 -0
  9. package/dist/compile-DJUj4hs3.mjs.map +1 -0
  10. package/dist/{compile-DN7i0G3X.d.mts → compile-UkKIpqrK.d.mts} +2 -2
  11. package/dist/{compile-DN7i0G3X.d.mts.map → compile-UkKIpqrK.d.mts.map} +1 -1
  12. package/dist/compile.cjs +1 -1
  13. package/dist/compile.d.mts +2 -2
  14. package/dist/compile.mjs +1 -1
  15. package/dist/dist-C1gSYYrg.cjs +1 -0
  16. package/dist/dist-CK47iMja.mjs +2 -0
  17. package/dist/dist-CK47iMja.mjs.map +1 -0
  18. package/dist/helpers-BoKbpcuO.mjs +27 -0
  19. package/dist/helpers-BoKbpcuO.mjs.map +1 -0
  20. package/dist/helpers-DSMRKdw1.cjs +26 -0
  21. package/dist/helpers.cjs +1 -1
  22. package/dist/helpers.d.mts +1 -1
  23. package/dist/helpers.mjs +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.mts +2 -2
  26. package/dist/index.mjs +1 -1
  27. package/dist/rpc.cjs +1 -1
  28. package/dist/rpc.mjs +1 -1
  29. package/dist/rpc.mjs.map +1 -1
  30. package/dist/types-BujoAx-K.mjs +2 -0
  31. package/dist/{types-y_yfxLs5.mjs.map → types-BujoAx-K.mjs.map} +1 -1
  32. package/dist/{types-DBd3Wi0H.d.mts → types-D03SjfBL.d.mts} +1 -1
  33. package/dist/{types-DBd3Wi0H.d.mts.map → types-D03SjfBL.d.mts.map} +1 -1
  34. package/dist/types.cjs +1 -1
  35. package/dist/types.d.mts +1 -1
  36. package/dist/types.mjs +1 -1
  37. package/package.json +5 -5
  38. package/schemas/{index-CDymg4xL.d.mts → index-BAJMwFip.d.mts} +2 -2
  39. package/schemas/{index-CDymg4xL.d.mts.map → index-BAJMwFip.d.mts.map} +1 -1
  40. package/schemas/persistent.cjs +1 -1
  41. package/schemas/persistent.d.mts +1 -1
  42. package/schemas/persistent.mjs +1 -1
  43. package/schemas/rpc-twoparty.cjs +1 -1
  44. package/schemas/rpc-twoparty.d.mts +1 -1
  45. package/schemas/rpc-twoparty.mjs +1 -1
  46. package/schemas/rpc-twoparty.mjs.map +1 -1
  47. package/schemas/rpc.cjs +1 -1
  48. package/schemas/rpc.d.mts +1 -1
  49. package/schemas/rpc.mjs +1 -1
  50. package/schemas/schema.cjs +1 -1
  51. package/schemas/schema.d.mts +1 -1
  52. package/schemas/schema.mjs +1 -1
  53. package/schemas/src-CGrmR2BO.cjs +11 -0
  54. package/schemas/src-DqIy7I3p.mjs +12 -0
  55. package/schemas/src-DqIy7I3p.mjs.map +1 -0
  56. package/dist/compile-DOMgXQRn.cjs +0 -1
  57. package/dist/compile-cQ918Wl_.mjs +0 -2
  58. package/dist/compile-cQ918Wl_.mjs.map +0 -1
  59. package/dist/dist-BzGdCkHS.cjs +0 -1
  60. package/dist/dist-CvDcvswe.mjs +0 -2
  61. package/dist/dist-CvDcvswe.mjs.map +0 -1
  62. package/dist/helpers-BIiGufva.cjs +0 -6
  63. package/dist/helpers-BYBeqv2d.mjs +0 -7
  64. package/dist/helpers-BYBeqv2d.mjs.map +0 -1
  65. package/dist/types-y_yfxLs5.mjs +0 -2
  66. package/schemas/src-CtkguuVd.mjs +0 -7
  67. package/schemas/src-CtkguuVd.mjs.map +0 -1
  68. package/schemas/src-DqnIPdOg.cjs +0 -6
  69. /package/dist/{types-B2gKzfwi.cjs → types-D6FuBB1k.cjs} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-CtkguuVd.mjs","names":["isInsideString: boolean | symbol","isInsideComment: boolean | symbol","parse","startLoc: Location","endLoc: Location","i","v","#instance","parseValue","stringifyValue","errors: ParseError[]","Buffer","v","isBuffer: typeof Buffer.isBuffer","isBuffer","PointerAllocationResult","add","adopt","checkDataBounds","checkPointerBounds","copyFrom","copyFromInterface","copyFromList","copyFromStruct","disown","dump","erase","erasePointer","followFar","followFars","getAs","getBit","getCapabilityId","getContent","getData","getDataSection","getFarSegmentId","getFloat32","getFloat64","getInt16","getInt32","getInt64","getInt8","getInterfaceClientOrNull","getInterfaceClientOrNullAt","getInterfacePointer","getList","getListByteLength","getListElementByteLength","getListElementSize","getListLength","getOffsetWords","getPointer","getPointerAs","getPointerSection","getPointerType","getSize","getStruct","getStructDataWords","getStructPointerLength","getStructSize","getTargetCompositeListSize","getTargetCompositeListTag","getTargetListElementSize","getTargetListLength","getTargetPointerType","getTargetStructSize","getText","getUint16","getUint32","getUint64","getUint8","initData","initList","initPointer","initStruct","initStructAt","isDoubleFar","isNull","relocateTo","resize","setBit","setFarPointer","setFloat32","setFloat64","setInt16","setInt32","setInt64","setInt8","setInterfacePointer","setListPointer","setStructPointer","setText","setUint16","setUint32","setUint64","setUint8","testWhich","trackPointerAllocation","validate","c","v"],"sources":["../../../type-checks/src/get-object-tag.ts","../../../type-checks/src/is-plain-object.ts","../../../type-checks/src/is-object.ts","../../../type-checks/src/is-string.ts","../../../types/src/base.ts","../../../json/src/utils/strip-comments.ts","../../../json/src/utils/parse.ts","../../../json/src/utils/code-frames.ts","../../../json/src/utils/parse-error.ts","../../../type-checks/src/is-number.ts","../../../type-checks/src/is-undefined.ts","../../../json/src/utils/stringify.ts","../../../json/src/storm-json.ts","../../../type-checks/src/is-buffer.ts","../../../type-checks/src/type-detect.ts","../../../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.3/node_modules/capnp-es/dist/index.mjs"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Gets the `toStringTag` of `obj`.\n *\n * @param value - The obj to query.\n * @returns Returns the `toStringTag`.\n */\nexport const getObjectTag = (value: unknown): string => {\n if (value == null) {\n return value === undefined ? \"[object Undefined]\" : \"[object Null]\";\n }\n return Object.prototype.toString.call(value);\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { PlainObject } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @example\n * ```typescript\n * isObjectLike({})\n * // => true\n *\n * isObjectLike([1, 2, 3])\n * // => true\n *\n * isObjectLike(Function)\n * // => false\n *\n * isObjectLike(null)\n * // => false\n * ```\n *\n * @param value - The value to check.\n * @returns Returns `true` if `value` is object-like, else `false`.\n */\nexport const isObjectLike = (obj: unknown) => {\n return typeof obj === \"object\" && obj !== null;\n};\n\n/**\n * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @example\n * ```typescript\n * function Foo() {\n * this.a = 1\n * }\n *\n * isPlainObject(new Foo)\n * // => false\n *\n * isPlainObject([1, 2, 3])\n * // => false\n *\n * isPlainObject({ 'x': 0, 'y': 0 })\n * // => true\n *\n * isPlainObject(Object.create(null))\n * // => true\n * ```\n *\n * @param obj - The value to check.\n * @returns Returns `true` if `obj` is a plain object, else `false`.\n */\nexport const isPlainObject = (obj: unknown): obj is PlainObject => {\n if (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") {\n return false;\n }\n if (Object.getPrototypeOf(obj) === null) {\n return true;\n }\n let proto = obj;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(obj) === proto;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable ts/no-unsafe-function-type */\n/* eslint-disable ts/no-unsafe-call */\n\nimport type { NativeClass } from \"@stryke/types/base\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n// Prepare\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n\n/** Is ES6+ class */\nexport function isNativeClass(value?: any): value is NativeClass {\n // NOTE TO DEVELOPER: If any of this changes, isClass must also be updated\n return (\n typeof value === \"function\" && isNativeClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is a conventional class\n *\n * @remarks\n * Is Conventional Class\n * Looks for function with capital first letter MyClass\n * First letter is the 9th character\n * If changed, isClass must also be updated\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a conventional class\n */\nexport function isConventionalClass(value?: any): value is Function {\n return (\n typeof value === \"function\" &&\n isConventionalClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport function isClass(value?: any): value is Function | NativeClass; // only guarantee of truth type, not of validity\nexport function isClass(value?: any): boolean {\n return typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport const isObject = (value: unknown): value is object => {\n try {\n return (\n typeof value === \"object\" ||\n (Boolean(value) && value?.constructor === Object) ||\n isPlainObject(value)\n );\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { TypedArray } from \"./array\";\n\nexport type SerializablePrimitive =\n | null\n | undefined\n | string\n | number\n | boolean\n | bigint;\nexport type Primitive = SerializablePrimitive | symbol;\n\n/**\n * Matches any primitive, `void`, `Date`, or `RegExp` value.\n */\nexport type BuiltIns = Primitive | void | Date | RegExp;\n\n/**\n * Matches any non-primitive object\n */\n// eslint-disable-next-line ts/no-unsafe-function-type\nexport type AtomicObject = Function | Promise<any> | Date | RegExp;\n\n/** Determines if the passed value is of a specific type */\nexport type TypeTester = (value: any) => boolean;\n\n/**\n * The interface for a type mapping (key =\\> function) to use for {@link getType}.\n * export * The key represents the name of the type. The function represents the {@link TypeTester | test method}.\n * The map should be ordered by testing preference, with more specific tests first.\n * If a test returns true, it is selected, and the key is returned as the type.\n */\nexport type TypeMap = Record<string, TypeTester>;\n\ndeclare const emptyObjectSymbol: unique symbol;\n\nexport type FunctionOrValue<Value> = Value extends () => infer X ? X : Value;\n\n/**\n * A [[List]]\n *\n * @example\n * ```ts\n * type list0 = [1, 2, 3]\n * type list1 = number[]\n * ```\n *\n * @param A - its type\n * @returns [[List]]\n */\nexport type List<A = any> = ReadonlyArray<A>;\n\n/**\n * Alias to create a [[Function]]\n *\n * @example\n * ```ts\n * import { FunctionLike } from '@stryke/types'\n *\n * type test0 = FunctionLike<[string, number], boolean>\n * /// (args_0: string, args_1: number) => boolean\n * ```\n *\n * @param P - parameters\n * @param R - return type\n * @returns [[Function]]\n */\nexport type FunctionLike<P extends List = any, R = any> = (...args: P) => R;\n\nexport type AnyFunction = FunctionLike<any, any>;\nexport type Nullish = undefined | null;\nexport type Nullishable<T> = T | Nullish;\nexport type NonNullishObject = object; // not null/undefined which are Object\nexport type NativeClass = abstract new (...args: any) => any;\nexport type AnyNumber = number | number;\nexport type AnyString = string | string;\nexport type AnyBoolean = boolean | boolean;\nexport type AnyArray = any[];\nexport type PlainObject = Record<any, object>; // https://stackoverflow.com/a/75052315/130638\nexport type AnyMap = Map<any, any>;\nexport type AnyWeakMap = WeakMap<WeakKey, any>;\nexport type EmptyArray = [];\nexport interface EmptyObject {\n [emptyObjectSymbol]?: never;\n}\n\nexport type Any =\n | boolean\n | number\n | bigint\n | string\n | null\n | undefined\n | void\n | symbol\n | object\n | PlainObject\n | AnyArray\n | AnyMap\n | AnyWeakMap;\n\n/**\n * The valid types of the index for an `Indexable` type object\n */\nexport type IndexType = string | number | symbol;\n\n/**\n * The declaration of a ***dictionary-type*** object with a specific type\n *\n * @see {@link Indexable}\n * @see {@link IndexType}\n * @see {@link Dictionary}\n */\nexport type TypedIndexable<T> = Record<IndexType, T>;\n\n/**\n * The declaration of a ***dictionary-type*** object\n *\n * @see {@link TypedIndexable}\n * @see {@link IndexType}\n * @see {@link Dictionary}\n */\nexport type Indexable = TypedIndexable<any>;\n\n/**\n * The declaration of a ***dictionary-type*** object with a specific type\n *\n * @see {@link Indexable}\n * @see {@link IndexType}\n * @see {@link TypedIndexable}\n */\nexport type Dictionary<T> = Record<string, T>;\n\nexport const EMPTY_STRING = \"\";\nexport const NEWLINE_STRING = \"\\r\\n\";\nexport const EMPTY_OBJECT = {};\n\nexport type AnyCase<T extends IndexType> = string extends T\n ? string\n : T extends `${infer F1}${infer F2}${infer R}`\n ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}`\n : T extends `${infer F}${infer R}`\n ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}`\n : typeof EMPTY_STRING;\n\nexport type Newable<T> = new (..._args: never[]) => T;\n\nexport interface Abstract<T> {\n prototype: T;\n}\n\nexport interface Clonable<T> {\n clone: () => T;\n}\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type ReducerFunction<TState, TAction> = (\n state: TState,\n action: TAction\n) => TState;\n\n// NOTE: for the file size optimization\nexport const TYPE_ARGUMENTS = \"Arguments\";\nexport const TYPE_ARRAY = \"Array\";\nexport const TYPE_OBJECT = \"Object\";\nexport const TYPE_MAP = \"Map\";\nexport const TYPE_SET = \"Set\";\n\nexport type Collection =\n | IArguments\n | unknown[]\n | Map<unknown, unknown>\n | Record<string | number | symbol, unknown>\n | Set<unknown>;\n\nexport type NonUndefined<T> = T extends undefined ? never : T;\n\nexport type BrowserNativeObject = Date | File;\n\nexport type DeepPartial<T> = T extends BrowserNativeObject | NestedValue\n ? T\n : {\n [K in keyof T]?: DeepPartial<T[K]>;\n };\n\nexport type Rollback = Record<\n string,\n (initialValue: any, currentValue: any) => any\n>;\n\n/**\n * Extract all required keys from the given type.\n *\n * @remarks\n * This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...\n */\nexport type RequiredKeysOf<BaseType extends object> = Exclude<\n {\n [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]>\n ? Key\n : never;\n }[keyof BaseType],\n undefined\n>;\n\n/**\n * Returns a boolean for whether the two given types are equal.\n *\n * @remarks\n * Use-cases: If you want to make a conditional branch based on the result of a comparison of two types.\n *\n * @see https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650\n * @see https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796\n */\nexport type IsEqual<A, B> =\n (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2\n ? true\n : false;\n\nexport type Filter<KeyType, ExcludeType> =\n IsEqual<KeyType, ExcludeType> extends true\n ? never\n : KeyType extends ExcludeType\n ? never\n : KeyType;\n\ninterface ExceptOptions {\n /**\n Disallow assigning non-specified properties.\n\n Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.\n\n @defaultValue false\n */\n requireExactProps?: boolean;\n}\n\n/**\n * Create a type from an object type without certain keys.\n *\n * @remarks\n * We recommend setting the `requireExactProps` option to `true`.\n *\n * This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.\n *\n * This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).\n */\nexport type Except<\n ObjectType,\n KeysType extends keyof ObjectType,\n Options extends ExceptOptions = { requireExactProps: false }\n> = {\n [KeyType in keyof ObjectType as Filter<\n KeyType,\n KeysType\n >]: ObjectType[KeyType];\n} & (Options[\"requireExactProps\"] extends true\n ? Partial<Record<KeysType, never>>\n : Record<string, never>);\n\n/**\n * Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.\n *\n * @remarks\n * Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.\n *\n * If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.\n *\n * @see https://github.com/microsoft/TypeScript/issues/15300\n */\nexport type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};\n\n/**\n * Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.\n *\n * @remarks\n * Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.\n */\nexport type SetRequired<\n BaseType,\n Keys extends keyof BaseType\n> = BaseType extends unknown // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types). // union into a [distributive conditional // `extends unknown` is always going to be the case and is used to convert any\n ? Simplify<\n // Pick just the keys that are optional from the base type.\n Except<BaseType, Keys> &\n // Pick the keys that should be required from the base type and make them required.\n Required<Pick<BaseType, Keys>>\n >\n : never;\n\nexport const $NestedValue: unique symbol = Symbol(\"NestedValue\");\n\nexport type NestedValue<TValue extends object = object> = {\n [$NestedValue]: never;\n} & TValue;\n\nexport interface RefObject<T> {\n current: T;\n}\n\nexport interface Identity<T = string> {\n id: T;\n}\n\nexport interface Versioned {\n version: number;\n}\n\nexport interface Sequenced {\n /**\n * The sequence number (version, or event counter, etc.) of the record\n */\n sequence: number;\n}\n\nexport interface Typed {\n /**\n * The type of the record\n */\n __type: string;\n}\n\nexport interface ClassTypeCheckable<T> extends Typed {\n /**\n * Run type check on the given value\n * @param value - The value to check\n * @returns True if the value is of the type of the class\n */\n isTypeOf: (value: unknown) => value is T;\n}\n\n/**\n * Matches non-recursive types.\n */\nexport type NonRecursiveType =\n | BuiltIns\n // eslint-disable-next-line ts/no-unsafe-function-type\n | Function\n | (new (...arguments_: any[]) => unknown);\n\nexport type IsPrimitive<T> = [T] extends [Primitive] ? true : false;\nexport type IsNever<T> = [T] extends [never] ? true : false;\nexport type IsAny<T> = 0 extends 1 & T ? true : false;\nexport type IsNull<T> = [T] extends [null] ? true : false;\nexport type IsUndefined<T> = T extends undefined ? true : false;\nexport type IsUnknown<T> = unknown extends T // `T` can be `unknown` or `any`\n ? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be\n ? true\n : false\n : false;\nexport type IsNullish<T> = IsNull<T> & IsUndefined<T>;\nexport type IsFunction<T> = T extends AnyFunction ? true : false;\n\n/**\n * Declare locally scoped properties on `globalThis`.\n *\n * When defining a global variable in a declaration file is inappropriate, it can be helpful to define a `type` or `interface` (say `ExtraGlobals`) with the global variable and then cast `globalThis` via code like `globalThis as unknown as ExtraGlobals`.\n *\n * Instead of casting through `unknown`, you can update your `type` or `interface` to extend `GlobalThis` and then directly cast `globalThis`.\n *\n * @example\n * ```\n * import type { GlobalThis } from '@stryke/types';\n *\n * type ExtraGlobals = GlobalThis & {\n * readonly GLOBAL_TOKEN: string;\n * };\n *\n * (globalThis as ExtraGlobals).GLOBAL_TOKEN;\n * ```\n */\nexport type GlobalThis = typeof globalThis;\n\n/**\n * Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n */\nexport interface Class<T, Arguments extends unknown[] = any[]> {\n prototype: Pick<T, keyof T>;\n new (...arguments_: Arguments): T;\n}\n\n/**\n * Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n */\nexport type Constructor<T, Arguments extends unknown[] = any[]> = new (\n ...arguments_: Arguments\n) => T;\n\n/**\n * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).\n *\n * @privateRemarks\n * We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)\n */\n\nexport interface AbstractClass<\n T,\n Arguments extends unknown[] = any[]\n> extends AbstractConstructor<T, Arguments> {\n prototype: Pick<T, keyof T>;\n}\n\n/**\n * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.\n */\nexport type AbstractConstructor<\n T,\n Arguments extends unknown[] = any[]\n> = abstract new (...arguments_: Arguments) => T;\n\n/**\n * Create a tuple type of the given length `<L>` and fill it with the given type `<Fill>`.\n *\n * If `<Fill>` is not provided, it will default to `unknown`.\n *\n * @see https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f\n */\nexport type BuildTuple<\n L extends number,\n Fill = unknown,\n T extends readonly unknown[] = []\n> = T[\"length\"] extends L ? T : BuildTuple<L, Fill, [...T, Fill]>;\n\n/**\n * Test if the given function has multiple call signatures.\n *\n * Needed to handle the case of a single call signature with properties.\n *\n * Multiple call signatures cannot currently be supported due to a TypeScript limitation.\n * @see https://github.com/microsoft/TypeScript/issues/29732\n */\nexport type HasMultipleCallSignatures<\n T extends (...arguments_: any[]) => unknown\n> = T extends {\n (...arguments_: infer A): unknown;\n (...arguments_: infer B): unknown;\n}\n ? B extends A\n ? A extends B\n ? false\n : true\n : true\n : false;\n\ntype StructuredCloneablePrimitive =\n | string\n | number\n | bigint\n | boolean\n | null\n | undefined\n | boolean\n | number\n | string;\n\ntype StructuredCloneableData =\n | ArrayBuffer\n | DataView\n | Date\n | Error\n | RegExp\n | TypedArray\n | Blob\n | File;\n\n// DOM exclusive types\n// | AudioData\n// | CropTarget\n// | CryptoKey\n// | DOMException\n// | DOMMatrix\n// | DOMMatrixReadOnly\n// | DOMPoint\n// | DOMPointReadOnly\n// | DOMQuad\n// | DOMRect\n// | DOMRectReadOnly\n// | FileList\n// | FileSystemDirectoryHandle\n// | FileSystemFileHandle\n// | FileSystemHandle\n// | GPUCompilationInfo\n// | GPUCompilationMessage\n// | ImageBitmap\n// | ImageData\n// | RTCCertificate\n// | VideoFrame\n\ntype StructuredCloneableCollection =\n | readonly StructuredCloneable[]\n | {\n readonly [key: string]: StructuredCloneable;\n readonly [key: number]: StructuredCloneable;\n }\n | ReadonlyMap<StructuredCloneable, StructuredCloneable>\n | ReadonlySet<StructuredCloneable>;\n\n/**\n * Matches a value that can be losslessly cloned using `structuredClone`.\n *\n * Note:\n * - Custom error types will be cloned as the base `Error` type\n * - This type doesn't include types exclusive to the TypeScript DOM library (e.g. `DOMRect` and `VideoFrame`)\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n *\n * @example\n * ```\n * import type { StructuredCloneable } from '@stryke/types';\n *\n * class CustomClass {}\n *\n * // @ts-expect-error\n * const error: StructuredCloneable = {\n * custom: new CustomClass(),\n * };\n *\n * structuredClone(error);\n * //=> {custom: {}}\n *\n * const good: StructuredCloneable = {\n * number: 3,\n * date: new Date(),\n * map: new Map<string, number>(),\n * }\n *\n * good.map.set('key', 1);\n *\n * structuredClone(good);\n * //=> {number: 3, date: Date(2022-10-17 22:22:35.920), map: Map {'key' -> 1}}\n * ```\n */\nexport type StructuredCloneable =\n | StructuredCloneablePrimitive\n | StructuredCloneableData\n | StructuredCloneableCollection;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EMPTY_STRING } from \"@stryke/types/base\";\n\nconst singleComment = Symbol(\"singleComment\");\nconst multiComment = Symbol(\"multiComment\");\n\nfunction stripWithoutWhitespace() {\n return \"\";\n}\nfunction stripWithWhitespace(value: string, start?: number, end?: number) {\n return value.slice(start, end).replace(/\\S/g, \" \");\n}\n\nfunction isEscaped(value: string, quotePosition: number) {\n let index = quotePosition - 1;\n let backslashCount = 0;\n while (value[index] === \"\\\\\") {\n index -= 1;\n backslashCount += 1;\n }\n\n return Boolean(backslashCount % 2);\n}\n\nexport function stripComments(\n value: string,\n { whitespace = true, trailingCommas = false } = {}\n) {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `Expected argument \\`jsonString\\` to be a \\`string\\`, got \\`${typeof value}\\``\n );\n }\n\n const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;\n let isInsideString: boolean | symbol = false;\n let isInsideComment: boolean | symbol = false;\n let offset = 0;\n let buffer = \"\";\n let result = \"\";\n let commaIndex = -1;\n for (let index = 0; index < value.length; index++) {\n const currentCharacter = value[index];\n const nextCharacter = value[index + 1];\n if (!isInsideComment && currentCharacter === '\"') {\n const escaped = isEscaped(value, index);\n if (!escaped) {\n isInsideString = !isInsideString;\n }\n }\n if (isInsideString) {\n continue;\n }\n if (\n !isInsideComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"//\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n isInsideComment = singleComment;\n index++;\n } else if (\n isInsideComment === singleComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"\\r\\n\"\n ) {\n index++;\n isInsideComment = false;\n buffer += strip(value, offset, index);\n offset = index;\n } else if (isInsideComment === singleComment && currentCharacter === \"\\n\") {\n isInsideComment = false;\n buffer += strip(value, offset, index);\n offset = index;\n } else if (\n !isInsideComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"/*\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n isInsideComment = multiComment;\n index++;\n } else if (\n isInsideComment === multiComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"*/\"\n ) {\n index++;\n isInsideComment = false;\n buffer += strip(value, offset, index + 1);\n offset = index + 1;\n } else if (trailingCommas && !isInsideComment) {\n if (commaIndex !== -1) {\n if (currentCharacter === \"}\" || currentCharacter === \"]\") {\n buffer += value.slice(offset, index);\n result += strip(buffer, 0, 1) + buffer.slice(1);\n buffer = \"\";\n offset = index;\n commaIndex = -1;\n } else if (\n currentCharacter !== \" \" &&\n currentCharacter !== \"\t\" &&\n currentCharacter !== \"\\r\" &&\n currentCharacter !== \"\\n\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n commaIndex = -1;\n }\n } else if (currentCharacter === \",\") {\n result += buffer + value.slice(offset, index);\n buffer = \"\";\n offset = index;\n commaIndex = index;\n }\n }\n }\n\n return (\n result +\n buffer +\n (isInsideComment ? strip(value.slice(offset)) : value.slice(offset))\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { stripComments } from \"./strip-comments\";\n\n// https://github.com/fastify/secure-json-parse\n// https://github.com/hapijs/bourne\nconst suspectProtoRx =\n /\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/;\nconst suspectConstructorRx =\n /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/;\n\nconst JsonSigRx = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(?:\\.\\d{1,17})?(?:E[+-]?\\d+)?\\s*$/i;\n\nfunction jsonParseTransform(key: string, value: any): any {\n if (\n key === \"__proto__\" ||\n (key === \"constructor\" &&\n value &&\n typeof value === \"object\" &&\n \"prototype\" in value)\n ) {\n // eslint-disable-next-line no-console\n console.warn(`Dropping \"${key}\" key to prevent prototype pollution.`);\n return;\n }\n return value;\n}\n\nexport interface Options {\n strict?: boolean;\n}\n\nexport function parse<T = unknown>(value: any, options: Options = {}): T {\n if (typeof value !== \"string\") {\n return value;\n }\n\n let stripped = stripComments(value);\n\n if (\n stripped[0] === '\"' &&\n stripped[stripped.length - 1] === '\"' &&\n !stripped.includes(\"\\\\\")\n ) {\n return stripped.slice(1, -1) as T;\n }\n\n stripped = stripped.trim();\n\n if (stripped.length <= 9) {\n switch (stripped.toLowerCase()) {\n case \"true\": {\n return true as T;\n }\n case \"false\": {\n return false as T;\n }\n case \"undefined\": {\n return undefined as T;\n }\n case \"null\": {\n return null as T;\n }\n case \"nan\": {\n return Number.NaN as T;\n }\n case \"infinity\": {\n return Number.POSITIVE_INFINITY as T;\n }\n case \"-infinity\": {\n return Number.NEGATIVE_INFINITY as T;\n }\n }\n }\n\n if (!JsonSigRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Invalid JSON\");\n }\n return stripped as T;\n }\n\n try {\n if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Possible prototype pollution\");\n }\n return JSON.parse(stripped, jsonParseTransform);\n }\n\n return JSON.parse(stripped);\n } catch (error) {\n if (options.strict) {\n throw error;\n }\n return value as T;\n }\n}\n\nexport function safeParse<T = unknown>(value: any, options: Options = {}): T {\n return parse<T>(value, { ...options, strict: true });\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\ninterface Location {\n column: number;\n line: number;\n}\n\ninterface NodeLocation {\n end?: Location;\n start?: Location;\n}\n\n// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-code-frame/src/index.js\n\n/**\n * RegExp to test for newlines in terminal.\n */\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * Extract what lines should be marked and highlighted.\n */\nfunction getMarkerLines(\n loc: NodeLocation,\n source: string[],\n opts: { linesAbove?: number; linesBelow?: number } = {}\n): {\n start: number;\n end: number;\n markerLines: Record<number, boolean | [number, number]>;\n} {\n const startLoc: Location = {\n column: 0,\n line: -1,\n ...loc.start\n };\n const endLoc: Location = {\n ...startLoc,\n ...loc.end\n };\n const { linesAbove = 2, linesBelow = 3 } = opts || {};\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines = {} as Record<number, boolean | [number, number]>;\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine;\n\n if (!startColumn) {\n markerLines[lineNumber] = true;\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1]?.length ?? 0;\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - i]?.length ?? 0;\n\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else if (startColumn === endColumn) {\n markerLines[startLine] = startColumn ? [startColumn, 0] : true;\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn];\n }\n\n return {\n start,\n end,\n markerLines\n };\n}\n\nexport function codeFrameColumns(\n rawLines: string,\n loc: NodeLocation,\n opts: {\n linesAbove?: number;\n linesBelow?: number;\n highlight?: (rawLines: string) => string;\n } = {}\n): string {\n const lines = rawLines.split(NEWLINE);\n const { start, end, markerLines } = getMarkerLines(loc, lines, opts);\n\n const numberMaxWidth = String(end).length;\n const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;\n\n const frame = highlightedLines\n .split(NEWLINE)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const gutter = ` ${paddedNumber} | `;\n const hasMarker = Boolean(markerLines[number] ?? false);\n if (hasMarker) {\n let markerLine = \"\";\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line\n .slice(0, Math.max(hasMarker[0] - 1, 0))\n .replace(/[^\\t]/g, \" \");\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\n \"\\n \",\n gutter.replace(/\\d/g, \" \"),\n markerSpacing,\n \"^\".repeat(numberOfMarkers)\n ].join(\"\");\n }\n return [\">\", gutter, line, markerLine].join(\"\");\n }\n return ` ${gutter}${line}`;\n })\n .join(\"\\n\");\n\n return frame;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ParseError } from \"jsonc-parser\";\nimport { printParseErrorCode } from \"jsonc-parser\";\nimport { LinesAndColumns } from \"lines-and-columns\";\nimport { codeFrameColumns } from \"./code-frames\";\n\n/**\n * Nicely formats a JSON error with context\n *\n * @param input - JSON content as string\n * @param parseError - jsonc ParseError\n * @returns\n */\nexport function formatParseError(input: string, parseError: ParseError) {\n const { error, offset, length } = parseError;\n const result = new LinesAndColumns(input).locationForIndex(offset);\n let line = result?.line ?? 0;\n let column = result?.column ?? 0;\n\n line++;\n column++;\n\n return `${printParseErrorCode(error)} in JSON at ${line}:${column}\\n${codeFrameColumns(\n input,\n {\n start: {\n line,\n column\n },\n end: {\n line,\n column: column + length\n }\n }\n )}\\n`;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AnyNumber } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Check if the provided value's type is `number`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number`\n */\nexport const isNumber = (value: unknown): value is number => {\n try {\n return (\n value instanceof Number ||\n typeof value === \"number\" ||\n Number(value) === value\n );\n } catch {\n return false;\n }\n};\n\n/**\n * Check if the provided value's type is `AnyNumber`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `AnyNumber`\n */\nexport function isAnyNumber(value?: any): value is AnyNumber {\n return isNumber(value) || getObjectTag(value) === \"[object Number]\";\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport const invalidKeyChars = [\n \"@\",\n \"/\",\n \"#\",\n \"$\",\n \" \",\n \":\",\n \";\",\n \",\",\n \".\",\n \"!\",\n \"?\",\n \"&\",\n \"=\",\n \"+\",\n \"-\",\n \"*\",\n \"%\",\n \"^\",\n \"~\",\n \"|\",\n \"\\\\\",\n '\"',\n \"'\",\n \"`\",\n \"{\",\n \"}\",\n \"[\",\n \"]\",\n \"(\",\n \")\",\n \"<\",\n \">\"\n] as const;\n\n/**\n * Stringify a value to a JSON-like string.\n *\n * @param value - The value to stringify\n * @param spacing - The spacing to use for the stringification\n * @returns The stringified value\n */\nexport const stringify = (\n value: unknown,\n spacing: string | number = 2\n): string => {\n const space = isNumber(spacing) ? \" \".repeat(spacing) : spacing;\n\n switch (value) {\n case null: {\n return \"null\";\n }\n case undefined: {\n return '\"undefined\"';\n }\n case true: {\n return \"true\";\n }\n case false: {\n return \"false\";\n }\n case Number.POSITIVE_INFINITY: {\n return \"infinity\";\n }\n case Number.NEGATIVE_INFINITY: {\n return \"-infinity\";\n }\n }\n\n if (Array.isArray(value)) {\n return `[${space}${value.map(v => stringify(v, space)).join(`,${space}`)}${space}]`;\n }\n if (value instanceof Uint8Array) {\n return value.toString();\n }\n\n // eslint-disable-next-line ts/switch-exhaustiveness-check\n switch (typeof value) {\n case \"number\": {\n return `${value}`;\n }\n case \"string\": {\n return JSON.stringify(value);\n }\n case \"object\": {\n const keys = Object.keys(value as object).filter(\n key => !isUndefined((value as any)[key])\n );\n\n return `{${space}${keys\n .map(\n key =>\n `${invalidKeyChars.some(invalidKeyChar => key.includes(invalidKeyChar)) ? `\"${key}\"` : key}: ${space}${stringify((value as any)[key], space)}`\n )\n .join(`,${space}`)}${space}}`;\n }\n default:\n return \"null\";\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ParseError } from \"jsonc-parser\";\nimport type {\n Class,\n JsonParseOptions,\n JsonParserResult,\n JsonSerializeOptions,\n JsonValue\n} from \"./types\";\n// import { Decimal } from \"decimal.js\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { parse } from \"jsonc-parser\";\nimport { Buffer } from \"node:buffer\";\nimport SuperJSON from \"superjson\";\nimport { parse as parseValue } from \"./utils/parse\";\nimport { formatParseError } from \"./utils/parse-error\";\nimport { stringify as stringifyValue } from \"./utils/stringify\";\n\n/**\n * A static JSON parser class used by Storm Software to serialize and deserialize JSON data\n *\n * @remarks\n * This class uses the [SuperJSON](https://github.com/blitz-js/superjson) library under the hood.\n */\nexport class StormJSON extends SuperJSON {\n static #instance: StormJSON;\n\n public static get instance(): StormJSON {\n if (!StormJSON.#instance) {\n StormJSON.#instance = new StormJSON();\n }\n\n return StormJSON.#instance;\n }\n\n /**\n * Deserialize the given value with superjson using the given metadata\n */\n public static override deserialize<TData = unknown>(\n payload: JsonParserResult\n ): TData {\n return StormJSON.instance.deserialize(payload);\n }\n\n /**\n * Serialize the given value with superjson\n */\n public static override serialize(object: JsonValue): JsonParserResult {\n return StormJSON.instance.serialize(object);\n }\n\n /**\n * Parse the given string value with superjson using the given metadata\n *\n * @param value - The string value to parse\n * @returns The parsed data\n */\n public static override parse<TData = unknown>(value: string): TData {\n return parseValue(value);\n }\n\n /**\n * Serializes the given data to a JSON string.\n * By default the JSON string is formatted with a 2 space indentation to be easy readable.\n *\n * @param value - Object which should be serialized to JSON\n * @param _options - JSON serialize options\n * @returns the formatted JSON representation of the object\n */\n public static override stringify<T>(\n value: T,\n _options?: JsonSerializeOptions\n ): string {\n const customTransformer =\n StormJSON.instance.customTransformerRegistry.findApplicable(value);\n\n let result = value;\n if (customTransformer && customTransformer.isApplicable(value)) {\n result = customTransformer.serialize(result) as T;\n }\n\n return stringifyValue(result);\n }\n\n /**\n * Parses the given JSON string and returns the object the JSON content represents.\n * By default javascript-style comments and trailing commas are allowed.\n *\n * @param strData - JSON content as string\n * @param options - JSON parse options\n * @returns Object the JSON content represents\n */\n public static parseJson<TData = unknown>(\n strData: string,\n options?: JsonParseOptions\n ): TData {\n try {\n if (options?.expectComments === false) {\n return StormJSON.instance.parse(strData);\n }\n } catch {\n // Do nothing\n }\n\n const errors: ParseError[] = [];\n const opts = {\n allowTrailingComma: true,\n ...options\n };\n const result = parse(strData, errors, opts) as TData;\n\n if (errors.length > 0 && errors[0]) {\n throw new Error(formatParseError(strData, errors[0]));\n }\n\n return result;\n }\n\n /**\n * Register a custom schema with superjson\n *\n * @param name - The name of the schema\n * @param serialize - The function to serialize the schema\n * @param deserialize - The function to deserialize the schema\n * @param isApplicable - The function to check if the schema is applicable\n */\n public static register<\n TData = any,\n TJsonObject extends JsonValue = JsonValue\n >(\n name: string,\n serialize: (data: TData) => TJsonObject,\n deserialize: (json: TJsonObject) => TData,\n isApplicable: (data: any) => data is TData\n ) {\n StormJSON.instance.registerCustom<TData, TJsonObject>(\n {\n isApplicable,\n serialize,\n deserialize\n },\n name\n );\n }\n\n /**\n * Register a class with superjson\n *\n * @param classConstructor - The class constructor to register\n */\n public static override registerClass(\n classConstructor: Class,\n options?: { identifier?: string; allowProps?: string[] } | string\n ) {\n StormJSON.instance.registerClass(classConstructor, {\n identifier: isString(options)\n ? options\n : options?.identifier || classConstructor.name,\n allowProps:\n options &&\n isObject(options) &&\n options?.allowProps &&\n Array.isArray(options.allowProps)\n ? options.allowProps\n : [\"__typename\"]\n });\n }\n\n private constructor() {\n super({ dedupe: true });\n }\n}\n\nStormJSON.instance.registerCustom<Buffer, string>(\n {\n isApplicable: (v): v is Buffer => Buffer.isBuffer(v),\n serialize: v => v.toString(\"base64\"),\n deserialize: v => Buffer.from(v, \"base64\")\n },\n \"Bytes\"\n);\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isBufferExists = typeof Buffer !== \"undefined\";\n\n/**\n * Check if the provided value's type is `Buffer`\n */\nexport const isBuffer: typeof Buffer.isBuffer = isBufferExists\n ? Buffer.isBuffer.bind(Buffer)\n : /**\n * Check if the provided value's type is `Buffer`\n\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Buffer`\n */\n function isBuffer(\n value: Parameters<typeof Buffer.isBuffer>[0]\n ): value is Buffer {\n return false;\n };\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBuffer } from \"./is-buffer\";\n\nconst globalObject = (Obj => {\n if (typeof globalThis === \"object\") {\n return globalThis;\n }\n Object.defineProperty(Obj, \"typeDetectGlobalObject\", {\n get() {\n return this;\n },\n configurable: true\n });\n\n // // biome-ignore lint/correctness/noUndeclaredVariables: <explanation>\n // const global = typeDetectGlobalObject;\n\n // // biome-ignore lint/performance/noDelete: <explanation>\n // delete Obj.typeDetectGlobalObject;\n return globalThis;\n})(Object.prototype);\n\nexport function typeDetect(obj: unknown): string {\n // NOTE: isBuffer must execute before type-detect,\n // because type-detect returns 'Uint8Array'.\n if (isBuffer(obj)) {\n return \"Buffer\";\n }\n\n const typeofObj = typeof obj;\n if (typeofObj !== \"object\") {\n return typeofObj;\n }\n\n if (obj === null) {\n return \"null\";\n }\n\n if (obj === globalObject) {\n return \"global\";\n }\n\n if (\n Array.isArray(obj) &&\n (Symbol.toStringTag === undefined || !(Symbol.toStringTag in obj))\n ) {\n return \"Array\";\n }\n\n // https://html.spec.whatwg.org/multipage/browsers.html#location\n if (typeof globalThis === \"object\" && globalThis !== null) {\n if (\n typeof (globalThis as any).location === \"object\" &&\n obj === (globalThis as any).location\n ) {\n return \"Location\";\n }\n\n // https://html.spec.whatwg.org/#document\n if (\n typeof (globalThis as any).document === \"object\" &&\n obj === (globalThis as any).document\n ) {\n return \"Document\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray\n if (typeof (globalThis as any).navigator === \"object\") {\n if (\n typeof (globalThis as any).navigator.mimeTypes === \"object\" &&\n obj === (globalThis as any).navigator.mimeTypes\n ) {\n return \"MimeTypeArray\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n typeof (globalThis as any).navigator.plugins === \"object\" &&\n obj === (globalThis as any).navigator.plugins\n ) {\n return \"PluginArray\";\n }\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n (typeof (globalThis as any).HTMLElement === \"function\" ||\n typeof (globalThis as any).HTMLElement === \"object\") &&\n obj instanceof (globalThis as any).HTMLElement\n ) {\n if ((obj as any).tagName === \"BLOCKQUOTE\") {\n return \"HTMLQuoteElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltabledatacellelement\n if ((obj as any).tagName === \"TD\") {\n return \"HTMLTableDataCellElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltableheadercellelement\n if ((obj as any).tagName === \"TH\") {\n return \"HTMLTableHeaderCellElement\";\n }\n }\n }\n\n const stringTag =\n Symbol.toStringTag !== undefined && (obj as any)[Symbol.toStringTag];\n if (typeof stringTag === \"string\") {\n return stringTag;\n }\n\n const objPrototype = Object.getPrototypeOf(obj);\n if (objPrototype === RegExp.prototype) {\n return \"RegExp\";\n }\n\n if (objPrototype === Date.prototype) {\n return \"Date\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag\n if (typeof Promise !== \"undefined\" && objPrototype === Promise.prototype) {\n return \"Promise\";\n }\n\n if (typeof Set !== \"undefined\" && objPrototype === Set.prototype) {\n return \"Set\";\n }\n\n if (typeof Map !== \"undefined\" && objPrototype === Map.prototype) {\n return \"Map\";\n }\n\n if (typeof WeakSet !== \"undefined\" && objPrototype === WeakSet.prototype) {\n return \"WeakSet\";\n }\n\n if (typeof WeakMap !== \"undefined\" && objPrototype === WeakMap.prototype) {\n return \"WeakMap\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag\n if (typeof DataView !== \"undefined\" && objPrototype === DataView.prototype) {\n return \"DataView\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag\n if (\n typeof Map !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Map().entries())\n ) {\n return \"Map Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag\n if (\n typeof Set !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Set().entries())\n ) {\n return \"Set Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag\n if (\n typeof Array.prototype[Symbol.iterator] === \"function\" &&\n objPrototype === Object.getPrototypeOf([][Symbol.iterator]())\n ) {\n return \"Array Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag\n if (\n Symbol.iterator !== undefined &&\n typeof String.prototype[Symbol.iterator] === \"function\" &&\n Object.getPrototypeOf(\"\"[Symbol.iterator]()) &&\n objPrototype === Object.getPrototypeOf(\"\"[Symbol.iterator]())\n ) {\n return \"String Iterator\";\n }\n\n if (objPrototype === null) {\n return \"Object\";\n }\n\n return Object.prototype.toString.call(obj).slice(8, -1);\n}\n","import { S as Struct, O as ObjectSize, ao as PointerAllocationResult, ap as add, a as adopt, aq as checkDataBounds, ar as checkPointerBounds, c as copyFrom, as as copyFromInterface, at as copyFromList, au as copyFromStruct, d as disown, av as dump, aw as erase, ax as erasePointer, ay as followFar, az as followFars, w as getAs, h as getBit, aA as getCapabilityId, aB as getContent, J as getData, aC as getDataSection, aD as getFarSegmentId, F as getFloat32, H as getFloat64, z as getInt16, B as getInt32, D as getInt64, x as getInt8, af as getInterfaceClientOrNull, aE as getInterfaceClientOrNullAt, aF as getInterfacePointer, m as getList, aG as getListByteLength, aH as getListElementByteLength, aI as getListElementSize, aJ as getListLength, aK as getOffsetWords, g as getPointer, aL as getPointerAs, aM as getPointerSection, aN as getPointerType, aO as getSize, k as getStruct, aP as getStructDataWords, aQ as getStructPointerLength, aR as getStructSize, aS as getTargetCompositeListSize, aT as getTargetCompositeListTag, aU as getTargetListElementSize, aV as getTargetListLength, ad as getTargetPointerType, a9 as getTargetStructSize, q as getText, b as getUint16, e as getUint32, u as getUint64, o as getUint8, K as initData, n as initList, aW as initPointer, ab as initStruct, l as initStructAt, aX as isDoubleFar, i as isNull, aY as relocateTo, aa as resize, j as setBit, aZ as setFarPointer, G as setFloat32, I as setFloat64, A as setInt16, C as setInt32, E as setInt64, y as setInt8, a_ as setInterfacePointer, a$ as setListPointer, b0 as setStructPointer, r as setText, s as setUint16, f as setUint32, v as setUint64, p as setUint8, t as testWhich, b1 as trackPointerAllocation, a7 as validate, L as List, M as ListElementSize, $ as Pointer, b2 as Data, b3 as Text, b4 as ErrorClient, b5 as RPC_ZERO_REF, N as format, b6 as RPC_ERROR, ai as INVARIANT_UNREACHABLE_CODE, b7 as RPC_FULFILL_ALREADY_CALLED, b8 as NOT_IMPLEMENTED, ag as ErrorAnswer, ah as RPC_CALL_QUEUE_FULL, ak as RPC_NULL_CLIENT, b9 as RPC_IMPORT_CLOSED, ba as AnyStruct, bb as RPC_QUESTION_ID_REUSED, bc as RPC_NO_MAIN_INTERFACE, bd as RPC_BAD_TARGET, be as RPC_UNKNOWN_CAP_DESCRIPTOR, ae as FixedAnswer, bf as RPC_FINISH_UNKNOWN_ANSWER, bg as RPC_RETURN_FOR_UNKNOWN_QUESTION, bh as RPC_UNKNOWN_ANSWER_ID, bi as RPC_UNKNOWN_EXPORT_ID } from './shared/capnp-es.0-_cOx6D.mjs';\nexport { bj as Orphan, a8 as PointerType, bk as clientOrNull } from './shared/capnp-es.0-_cOx6D.mjs';\nimport { M as Message } from './shared/capnp-es.GpvEvMIK.mjs';\nexport { r as readRawPointer } from './shared/capnp-es.GpvEvMIK.mjs';\nexport { C as CompositeList, g as getBitMask, c as getFloat32Mask, d as getFloat64Mask, e as getInt16Mask, f as getInt32Mask, h as getInt64Mask, i as getInt8Mask, b as getUint16Mask, j as getUint32Mask, k as getUint64Mask, a as getUint8Mask } from './shared/capnp-es.BvfUH5E6.mjs';\nimport { I as Interface, t as transformPtr, D as Deferred, Q as Queue, c as copyCall, F as Fulfiller, P as Pipeline, M as MethodError, R as Registry, p as placeParams, a as PipelineClient } from './shared/capnp-es.UAt3nLGq.mjs';\nexport { S as Server, b as isDataCall, i as isFuncCall } from './shared/capnp-es.UAt3nLGq.mjs';\nimport { Exception, Message as Message$1, Disembargo_Context_Which, PromisedAnswer_Op, Return, MessageTarget, CapDescriptor } from './capnp/rpc.mjs';\n\nclass Void extends Struct {\n static _capnp = {\n displayName: \"Void\",\n id: \"0\",\n size: new ObjectSize(0, 0)\n };\n}\n\nconst utils = {\n __proto__: null,\n PointerAllocationResult: PointerAllocationResult,\n add: add,\n adopt: adopt,\n checkDataBounds: checkDataBounds,\n checkPointerBounds: checkPointerBounds,\n copyFrom: copyFrom,\n copyFromInterface: copyFromInterface,\n copyFromList: copyFromList,\n copyFromStruct: copyFromStruct,\n disown: disown,\n dump: dump,\n erase: erase,\n erasePointer: erasePointer,\n followFar: followFar,\n followFars: followFars,\n getAs: getAs,\n getBit: getBit,\n getCapabilityId: getCapabilityId,\n getContent: getContent,\n getData: getData,\n getDataSection: getDataSection,\n getFarSegmentId: getFarSegmentId,\n getFloat32: getFloat32,\n getFloat64: getFloat64,\n getInt16: getInt16,\n getInt32: getInt32,\n getInt64: getInt64,\n getInt8: getInt8,\n getInterfaceClientOrNull: getInterfaceClientOrNull,\n getInterfaceClientOrNullAt: getInterfaceClientOrNullAt,\n getInterfacePointer: getInterfacePointer,\n getList: getList,\n getListByteLength: getListByteLength,\n getListElementByteLength: getListElementByteLength,\n getListElementSize: getListElementSize,\n getListLength: getListLength,\n getOffsetWords: getOffsetWords,\n getPointer: getPointer,\n getPointerAs: getPointerAs,\n getPointerSection: getPointerSection,\n getPointerType: getPointerType,\n getSize: getSize,\n getStruct: getStruct,\n getStructDataWords: getStructDataWords,\n getStructPointerLength: getStructPointerLength,\n getStructSize: getStructSize,\n getTargetCompositeListSize: getTargetCompositeListSize,\n getTargetCompositeListTag: getTargetCompositeListTag,\n getTargetListElementSize: getTargetListElementSize,\n getTargetListLength: getTargetListLength,\n getTargetPointerType: getTargetPointerType,\n getTargetStructSize: getTargetStructSize,\n getText: getText,\n getUint16: getUint16,\n getUint32: getUint32,\n getUint64: getUint64,\n getUint8: getUint8,\n initData: initData,\n initList: initList,\n initPointer: initPointer,\n initStruct: initStruct,\n initStructAt: initStructAt,\n isDoubleFar: isDoubleFar,\n isNull: isNull,\n relocateTo: relocateTo,\n resize: resize,\n setBit: setBit,\n setFarPointer: setFarPointer,\n setFloat32: setFloat32,\n setFloat64: setFloat64,\n setInt16: setInt16,\n setInt32: setInt32,\n setInt64: setInt64,\n setInt8: setInt8,\n setInterfacePointer: setInterfacePointer,\n setListPointer: setListPointer,\n setStructPointer: setStructPointer,\n setText: setText,\n setUint16: setUint16,\n setUint32: setUint32,\n setUint64: setUint64,\n setUint8: setUint8,\n testWhich: testWhich,\n trackPointerAllocation: trackPointerAllocation,\n validate: validate\n};\n\nfunction PointerList(PointerClass) {\n return class extends List {\n static _capnp = {\n displayName: `List<${PointerClass._capnp.displayName}>`,\n size: ListElementSize.POINTER\n };\n get(index) {\n const c = getContent(this);\n return new PointerClass(\n c.segment,\n c.byteOffset + index * 8,\n this._capnp.depthLimit - 1\n );\n }\n set(index, value) {\n copyFrom(value, this.get(index));\n }\n [Symbol.toStringTag]() {\n return `Pointer_${super.toString()},cls:${PointerClass.toString()}`;\n }\n };\n}\n\nconst AnyPointerList = PointerList(Pointer);\n\nclass BoolList extends List {\n static _capnp = {\n displayName: \"List<boolean>\",\n size: ListElementSize.BIT\n };\n get(index) {\n const bitMask = 1 << index % 8;\n const byteOffset = index >>> 3;\n const c = getContent(this);\n const v = c.segment.getUint8(c.byteOffset + byteOffset);\n return (v & bitMask) !== 0;\n }\n set(index, value) {\n const bitMask = 1 << index % 8;\n const c = getContent(this);\n const byteOffset = c.byteOffset + (index >>> 3);\n const v = c.segment.getUint8(byteOffset);\n c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask);\n }\n [Symbol.toStringTag]() {\n return `Bool_${super.toString()}`;\n }\n}\n\nconst DataList = PointerList(Data);\n\nclass Float32List extends List {\n static _capnp = {\n displayName: \"List<Float32>\",\n size: ListElementSize.BYTE_4\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getFloat32(c.byteOffset + index * 4);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setFloat32(c.byteOffset + index * 4, value);\n }\n [Symbol.toStringTag]() {\n return `Float32_${super.toString()}`;\n }\n}\n\nclass Float64List extends List {\n static _capnp = {\n displayName: \"List<Float64>\",\n size: ListElementSize.BYTE_8\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getFloat64(c.byteOffset + index * 8);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setFloat64(c.byteOffset + index * 8, value);\n }\n [Symbol.toStringTag]() {\n return `Float64_${super.toString()}`;\n }\n}\n\nclass Int8List extends List {\n static _capnp = {\n displayName: \"List<Int8>\",\n size: ListElementSize.BYTE\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getInt8(c.byteOffset + index);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setInt8(c.byteOffset + index, value);\n }\n [Symbol.toStringTag]() {\n return `Int8_${super.toString()}`;\n }\n}\n\nclass Int16List extends List {\n static _capnp = {\n displayName: \"List<Int16>\",\n size: ListElementSize.BYTE_2\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getInt16(c.byteOffset + index * 2);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setInt16(c.byteOffset + index * 2, value);\n }\n [Symbol.toStringTag]() {\n return `Int16_${super.toString()}`;\n }\n}\n\nclass Int32List extends List {\n static _capnp = {\n displayName: \"List<Int32>\",\n size: ListElementSize.BYTE_4\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getInt32(c.byteOffset + index * 4);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setInt32(c.byteOffset + index * 4, value);\n }\n [Symbol.toStringTag]() {\n return `Int32_${super.toString()}`;\n }\n}\n\nclass Int64List extends List {\n static _capnp = {\n displayName: \"List<Int64>\",\n size: ListElementSize.BYTE_8\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getInt64(c.byteOffset + index * 8);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setInt64(c.byteOffset + index * 8, value);\n }\n [Symbol.toStringTag]() {\n return `Int64_${super.toString()}`;\n }\n}\n\nconst InterfaceList = PointerList(Interface);\n\nclass TextList extends List {\n static _capnp = {\n displayName: \"List<Text>\",\n size: ListElementSize.POINTER\n };\n get(index) {\n const c = getContent(this);\n c.byteOffset += index * 8;\n return Text.fromPointer(c).get(0);\n }\n set(index, value) {\n const c = getContent(this);\n c.byteOffset += index * 8;\n Text.fromPointer(c).set(0, value);\n }\n [Symbol.toStringTag]() {\n return `Text_${super.toString()}`;\n }\n}\n\nclass Uint8List extends List {\n static _capnp = {\n displayName: \"List<Uint8>\",\n size: ListElementSize.BYTE\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getUint8(c.byteOffset + index);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setUint8(c.byteOffset + index, value);\n }\n [Symbol.toStringTag]() {\n return `Uint8_${super.toString()}`;\n }\n}\n\nclass Uint16List extends List {\n static _capnp = {\n displayName: \"List<Uint16>\",\n size: ListElementSize.BYTE_2\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getUint16(c.byteOffset + index * 2);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setUint16(c.byteOffset + index * 2, value);\n }\n [Symbol.toStringTag]() {\n return `Uint16_${super.toString()}`;\n }\n}\n\nclass Uint32List extends List {\n static _capnp = {\n displayName: \"List<Uint32>\",\n size: ListElementSize.BYTE_4\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getUint32(c.byteOffset + index * 4);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setUint32(c.byteOffset + index * 4, value);\n }\n [Symbol.toStringTag]() {\n return `Uint32_${super.toString()}`;\n }\n}\n\nclass Uint64List extends List {\n static _capnp = {\n displayName: \"List<Uint64>\",\n size: ListElementSize.BYTE_8\n };\n get(index) {\n const c = getContent(this);\n return c.segment.getUint64(c.byteOffset + index * 8);\n }\n set(index, value) {\n const c = getContent(this);\n c.segment.setUint64(c.byteOffset + index * 8, value);\n }\n [Symbol.toStringTag]() {\n return `Uint64_${super.toString()}`;\n }\n}\n\nconst VoidList = PointerList(Void);\n\nfunction isSameClient(c, d) {\n const norm = (c2) => {\n return c2;\n };\n return norm(c) === norm(d);\n}\nfunction clientFromResolution(transform, obj, err) {\n if (err) {\n return new ErrorClient(err);\n }\n if (!obj) {\n return new ErrorClient(new Error(`null obj!`));\n }\n const out = transformPtr(obj, transform);\n return getInterfaceClientOrNull(out);\n}\n\nclass IDGen {\n i = 0;\n free = [];\n next() {\n return this.free.pop() ?? this.i++;\n }\n remove(i) {\n this.free.push(i);\n }\n}\n\nclass Ref {\n constructor(rc, finalize) {\n this.rc = rc;\n const closeState = { closed: false };\n this.closeState = closeState;\n finalize(this, () => {\n if (!closeState.closed) {\n closeState.closed = true;\n rc.decref();\n }\n });\n }\n closeState;\n call(cl) {\n return this.rc.call(cl);\n }\n client() {\n return this.rc._client;\n }\n close() {\n if (!this.closeState.closed) {\n this.closeState.closed = true;\n this.rc.decref();\n }\n }\n}\n\nclass RefCount {\n refs;\n finalize;\n _client;\n constructor(c, _finalize) {\n this._client = c;\n this.finalize = _finalize;\n this.refs = 1;\n }\n // New creates a reference counter and the first client reference.\n static new(c, finalize) {\n const rc = new RefCount(c, finalize);\n const ref = rc.newRef();\n return [rc, ref];\n }\n call(cl) {\n return this._client.call(cl);\n }\n client() {\n return this._client;\n }\n close() {\n this._client.close();\n }\n ref() {\n if (this.refs <= 0) {\n return new ErrorClient(new Error(RPC_ZERO_REF));\n }\n this.refs++;\n return this.newRef();\n }\n newRef() {\n return new Ref(this, this.finalize);\n }\n decref() {\n this.refs--;\n if (this.refs === 0) {\n this._client.close();\n }\n }\n}\n\nclass RPCError extends Error {\n constructor(exception) {\n super(format(RPC_ERROR, exception.reason));\n this.exception = exception;\n }\n}\nfunction toException(exc, err) {\n if (err instanceof RPCError) {\n exc.reason = err.exception.reason;\n exc.type = err.exception.type;\n return;\n }\n exc.reason = err.message;\n exc.type = Exception.Type.FAILED;\n}\n\nfunction newMessage() {\n return new Message().initRoot(Message$1);\n}\nfunction newFinishMessage(questionID, release) {\n const m = newMessage();\n const f = m._initFinish();\n f.questionId = questionID;\n f.releaseResultCaps = release;\n return m;\n}\nfunction newUnimplementedMessage(m) {\n const n = newMessage();\n n.unimplemented = m;\n return n;\n}\nfunction newReturnMessage(id) {\n const m = newMessage();\n const ret = m._initReturn();\n ret.answerId = id;\n return m;\n}\nfunction setReturnException(ret, err) {\n const exc = ret._initException();\n toException(exc, err);\n return exc;\n}\nfunction newDisembargoMessage(which, id) {\n const m = newMessage();\n const dis = m._initDisembargo();\n const ctx = dis._initContext();\n switch (which) {\n case Disembargo_Context_Which.SENDER_LOOPBACK: {\n ctx.senderLoopback = id;\n break;\n }\n case Disembargo_Context_Which.RECEIVER_LOOPBACK: {\n ctx.receiverLoopback = id;\n break;\n }\n default: {\n throw new Error(INVARIANT_UNREACHABLE_CODE);\n }\n }\n return m;\n}\n\nfunction transformToPromisedAnswer(answer, transform) {\n const opList = answer._initTransform(transform.length);\n for (const [i, op] of transform.entries()) {\n opList.get(i).getPointerField = op.field;\n }\n}\nfunction promisedAnswerOpsToTransform(list) {\n const transform = [];\n for (const op of list) {\n switch (op.which()) {\n case PromisedAnswer_Op.GET_POINTER_FIELD: {\n transform.push({\n field: op.getPointerField\n });\n break;\n }\n case PromisedAnswer_Op.NOOP: {\n break;\n }\n }\n }\n return transform;\n}\n\nvar QuestionState = /* @__PURE__ */ ((QuestionState2) => {\n QuestionState2[QuestionState2[\"IN_PROGRESS\"] = 0] = \"IN_PROGRESS\";\n QuestionState2[QuestionState2[\"RESOLVED\"] = 1] = \"RESOLVED\";\n QuestionState2[QuestionState2[\"CANCELED\"] = 2] = \"CANCELED\";\n return QuestionState2;\n})(QuestionState || {});\nclass Question {\n constructor(conn, id, method) {\n this.conn = conn;\n this.id = id;\n this.method = method;\n }\n paramCaps = [];\n state = 0 /* IN_PROGRESS */;\n obj;\n err;\n derived = [];\n deferred = new Deferred();\n async struct() {\n return await this.deferred.promise;\n }\n // start signals the question has been sent\n start() {\n }\n // fulfill is called to resolve a question successfully.\n // The caller must be holding onto q.conn.mu.\n fulfill(obj) {\n if (this.state !== 0 /* IN_PROGRESS */) {\n throw new Error(RPC_FULFILL_ALREADY_CALLED);\n }\n if (this.method) {\n this.obj = getAs(this.method.ResultsClass, obj);\n } else {\n this.obj = obj;\n }\n this.state = 1 /* RESOLVED */;\n this.deferred.resolve(this.obj);\n }\n // reject is called to resolve a question with failure\n reject(err) {\n if (!err) {\n throw new Error(`Question.reject called with null`);\n }\n if (this.state !== 0 /* IN_PROGRESS */) {\n throw new Error(`Question.reject called more than once`);\n }\n this.err = err;\n this.state = 1 /* RESOLVED */;\n this.deferred.reject(err);\n }\n // cancel is called to resolve a question with cancellation.\n cancel(err) {\n if (this.state === 0 /* IN_PROGRESS */) {\n this.err = err;\n this.state = 2 /* CANCELED */;\n this.deferred.reject(err);\n return true;\n }\n return false;\n }\n pipelineCall(transform, call) {\n if (this.conn.findQuestion(this.id) !== this) {\n if (this.state === 0 /* IN_PROGRESS */) {\n throw new Error(`question popped but not done`);\n }\n const client = clientFromResolution(transform, this.obj, this.err);\n return client.call(call);\n }\n const pipeq = this.conn.newQuestion(call.method);\n const msg = newMessage();\n const msgCall = msg._initCall();\n msgCall.questionId = pipeq.id;\n msgCall.interfaceId = call.method.interfaceId;\n msgCall.methodId = call.method.methodId;\n const target = msgCall._initTarget();\n const a = target._initPromisedAnswer();\n a.questionId = this.id;\n transformToPromisedAnswer(a, transform);\n const payload = msgCall._initParams();\n this.conn.fillParams(payload, call);\n this.conn.sendMessage(msg);\n this.addPromise(transform);\n return pipeq;\n }\n addPromise(transform) {\n for (const d of this.derived) {\n if (transformsEqual(transform, d)) {\n return;\n }\n }\n this.derived.push(transform);\n }\n pipelineClose() {\n throw new Error(NOT_IMPLEMENTED);\n }\n}\nfunction transformsEqual(t, u) {\n if (t.length !== u.length) {\n return false;\n }\n for (const [i, element_] of t.entries()) {\n if (element_.field !== u[i].field) {\n return false;\n }\n }\n return true;\n}\n\nclass Qcalls {\n constructor(data) {\n this.data = data;\n }\n static copyOf(data) {\n return new Qcalls([...data]);\n }\n len() {\n return this.data.length;\n }\n clear(i) {\n this.data[i] = null;\n }\n copy() {\n return Qcalls.copyOf(this.data);\n }\n}\n\nfunction joinAnswer(fl, answer) {\n answer.struct().then((obj) => {\n fl.fulfill(obj);\n }).catch((error_) => {\n fl.reject(error_);\n });\n}\n\nconst callQueueSize = 64;\nclass QueueClient {\n constructor(conn, client, calls) {\n this.conn = conn;\n this._client = client;\n this.calls = Qcalls.copyOf(calls);\n this.q = new Queue(this.calls, callQueueSize);\n }\n _client;\n calls;\n q;\n pushCall(call) {\n const f = new Fulfiller();\n try {\n call = copyCall(call);\n } catch (error_) {\n return new ErrorAnswer(error_);\n }\n const i = this.q.push();\n if (i === -1) {\n return new ErrorAnswer(new Error(RPC_CALL_QUEUE_FULL));\n }\n this.calls.data[i] = {\n call,\n f\n };\n return f;\n }\n pushEmbargo(id, tgt) {\n const i = this.q.push();\n if (i === -1) {\n throw new Error(RPC_CALL_QUEUE_FULL);\n }\n this.calls.data[i] = {\n embargoID: id,\n embargoTarget: tgt\n };\n }\n flushQueue() {\n let c = null;\n {\n const i = this.q.front();\n if (i !== -1) {\n c = this.calls.data[i];\n }\n }\n while (c) {\n this.handle(c);\n this.q.pop();\n {\n const i = this.q.front();\n c = i === -1 ? null : this.calls.data[i];\n }\n }\n }\n handle(c) {\n if (!c) {\n return;\n }\n if (isRemoteCall(c)) {\n const answer = this._client.call(c.call);\n joinAnswer(c.a, answer);\n } else if (isLocalCall(c)) {\n const answer = this._client.call(c.call);\n joinAnswer(c.f, answer);\n } else if (isDisembargo(c)) {\n const msg = newDisembargoMessage(\n Disembargo_Context_Which.RECEIVER_LOOPBACK,\n c.embargoID\n );\n msg.disembargo.target = c.embargoTarget;\n this.conn.sendMessage(msg);\n }\n }\n isPassthrough() {\n return this.q.len() === 0;\n }\n call(call) {\n if (this.isPassthrough()) {\n return this._client.call(call);\n }\n return this.pushCall(call);\n }\n // close releases any resources associated with this client.\n // No further calls to the client should be made after calling Close.\n close() {\n }\n}\n\nclass AnswerEntry {\n id;\n conn;\n resultCaps = [];\n done = false;\n obj;\n err;\n deferred = new Deferred();\n queue = [];\n constructor(conn, id) {\n this.conn = conn;\n this.id = id;\n }\n // fulfill is called to resolve an answer successfully.\n fulfill(obj) {\n if (this.done) {\n throw new Error(`answer.fulfill called more than once`);\n }\n this.done = true;\n this.obj = obj;\n const retmsg = newReturnMessage(this.id);\n const ret = retmsg.return;\n const payload = ret._initResults();\n payload.content = obj;\n let firstErr;\n try {\n this.conn.makeCapTable(ret.segment, (len) => payload._initCapTable(len));\n this.deferred.resolve(obj);\n this.conn.sendMessage(retmsg);\n } catch (error_) {\n if (!firstErr) {\n firstErr = error_;\n }\n }\n const [queues, queuesErr] = this.emptyQueue(obj);\n if (queuesErr && !firstErr) {\n firstErr = queuesErr;\n }\n const objcap = obj.segment.message._capnp;\n if (!objcap.capTable) {\n objcap.capTable = [];\n }\n for (const capIdxStr of Object.keys(queues)) {\n const capIdx = Number(capIdxStr);\n const q = queues[capIdx];\n if (objcap.capTable === null) throw new Error(INVARIANT_UNREACHABLE_CODE);\n objcap.capTable[capIdx] = new QueueClient(\n this.conn,\n objcap.capTable[capIdx],\n q\n );\n }\n if (firstErr) {\n throw firstErr;\n }\n }\n // reject is called to resolve an answer with failure.\n reject(err) {\n if (!err) {\n throw new Error(`answer.reject called with nil`);\n }\n if (this.done) {\n throw new Error(`answer.reject claled more than once`);\n }\n const m = newReturnMessage(this.id);\n const mret = m.return;\n setReturnException(mret, err);\n this.err = err;\n this.done = true;\n this.deferred.reject(err);\n let firstErr;\n try {\n this.conn.sendMessage(m);\n } catch (error_) {\n firstErr = error_;\n }\n for (let i = 0; i < this.queue.length; i++) {\n const qa = this.queue[i];\n try {\n if (qa.qcall && isRemoteCall(qa.qcall)) {\n qa.qcall.a.reject(err);\n }\n } catch (error_) {\n if (!firstErr) {\n firstErr = error_;\n }\n }\n }\n this.queue = [];\n if (firstErr) {\n throw firstErr;\n }\n }\n // emptyQueue splits the queue by which capability it targets\n // and drops any invalid calls. Once this function returns,\n // this.queue will be empty.\n emptyQueue(obj) {\n let firstErr;\n const qs = {};\n for (let i = 0; i < this.queue.length; i++) {\n const pc = this.queue[i];\n if (!isRemoteCall(pc.qcall)) {\n continue;\n }\n if (!pc.qcall.a) {\n continue;\n }\n let c;\n try {\n c = transformPtr(obj, pc.transform);\n } catch (error_) {\n try {\n pc.qcall.a.reject(error_);\n } catch (error_2) {\n if (!firstErr) {\n firstErr = error_2;\n }\n }\n continue;\n }\n const ci = Interface.fromPointer(c);\n if (!ci) {\n try {\n pc.qcall.a.reject(new Error(RPC_NULL_CLIENT));\n } catch (error_) {\n if (!firstErr) {\n firstErr = error_;\n }\n }\n continue;\n }\n const cn = ci.getCapId();\n if (!qs[cn]) {\n qs[cn] = [];\n }\n qs[cn].push(pc.qcall);\n }\n this.queue = [];\n return [qs, firstErr];\n }\n queueCall(call, transform, a) {\n if (this.queue.length >= callQueueSize) {\n throw new Error(RPC_CALL_QUEUE_FULL);\n }\n const qcall = {\n a,\n call: copyCall(call)\n };\n const pcall = {\n qcall,\n transform\n };\n this.queue.push(pcall);\n }\n}\nfunction isRemoteCall(a) {\n return !!a.a;\n}\nfunction isLocalCall(a) {\n return !!a.f;\n}\nfunction isDisembargo(a) {\n return !!a.embargoTarget;\n}\n\nclass ImportClient {\n constructor(conn, id) {\n this.conn = conn;\n this.id = id;\n }\n closed = false;\n call(cl) {\n if (this.closed) {\n return new ErrorAnswer(new Error(RPC_IMPORT_CLOSED));\n }\n const q = this.conn.newQuestion(cl.method);\n const msg = newMessage();\n const msgCall = msg._initCall();\n msgCall.questionId = q.id;\n msgCall.interfaceId = cl.method.interfaceId;\n msgCall.methodId = cl.method.methodId;\n const target = msgCall._initTarget();\n target.importedCap = this.id;\n const payload = msgCall._initParams();\n this.conn.fillParams(payload, cl);\n this.conn.sendMessage(msg);\n return q;\n }\n close() {\n }\n}\n\nclass LocalAnswerClient {\n constructor(a, transform) {\n this.a = a;\n this.transform = transform;\n }\n call(call) {\n if (this.a.done) {\n return clientFromResolution(this.transform, this.a.obj, this.a.err).call(\n call\n );\n }\n return new Fulfiller();\n }\n close() {\n throw new Error(NOT_IMPLEMENTED);\n }\n}\n\nconst ConnWeakRefRegistry = globalThis.FinalizationRegistry ? new FinalizationRegistry((cb) => cb()) : undefined;\nconst ConDefaultFinalize = (obj, finalizer) => {\n ConnWeakRefRegistry?.register(obj, finalizer);\n};\nclass Conn {\n /**\n * Create a new connection\n * @param transport The transport used to receive/send messages.\n * @param finalize Weak reference implementation. Compatible with\n * the 'weak' module on node.js (just add weak as a dependency and pass\n * require(\"weak\")), but alternative implementations can be provided for\n * other platforms like Electron. Defaults to using FinalizationRegistry if\n * available.\n * @returns A new connection.\n */\n constructor(transport, finalize = ConDefaultFinalize) {\n this.transport = transport;\n this.finalize = finalize;\n this.startWork();\n }\n questionID = new IDGen();\n questions = [];\n answers = {};\n exportID = new IDGen();\n exports = [];\n imports = {};\n onError;\n main;\n working = false;\n bootstrap(InterfaceClass) {\n const q = this.newQuestion();\n const msg = newMessage();\n const boot = msg._initBootstrap();\n boot.questionId = q.id;\n this.sendMessage(msg);\n return new InterfaceClass.Client(new Pipeline(AnyStruct, q).client());\n }\n initMain(InterfaceClass, target) {\n this.main = new InterfaceClass.Server(target);\n this.addExport(this.main);\n }\n startWork() {\n this.work().catch((error_) => {\n if (this.onError) {\n this.onError(error_);\n } else if (error_ !== undefined) {\n throw error_;\n }\n });\n }\n sendReturnException(id, err) {\n const m = newReturnMessage(id);\n setReturnException(m.return, err);\n this.sendMessage(m);\n }\n handleBootstrapMessage(m) {\n const boot = m.bootstrap;\n const id = boot.questionId;\n const ret = newReturnMessage(id);\n ret.return.releaseParamCaps = false;\n const a = this.insertAnswer(id);\n if (a === null) {\n return this.sendReturnException(id, new Error(RPC_QUESTION_ID_REUSED));\n }\n if (this.main === undefined) {\n return a.reject(new Error(RPC_NO_MAIN_INTERFACE));\n }\n const msg = new Message();\n msg.addCap(this.main);\n a.fulfill(new Interface(msg.getSegment(0), 0));\n }\n handleFinishMessage(m) {\n const { finish } = m;\n const id = finish.questionId;\n const a = this.popAnswer(id);\n if (a === null) {\n throw new Error(format(RPC_FINISH_UNKNOWN_ANSWER, id));\n }\n if (finish.releaseResultCaps) {\n const caps = a.resultCaps;\n let i = caps.length;\n while (--i >= 0) {\n this.releaseExport(i, 1);\n }\n }\n }\n handleMessage(m) {\n switch (m.which()) {\n case Message$1.UNIMPLEMENTED: {\n break;\n }\n case Message$1.BOOTSTRAP: {\n this.handleBootstrapMessage(m);\n break;\n }\n case Message$1.ABORT: {\n this.shutdown(new RPCError(m.abort));\n break;\n }\n case Message$1.FINISH: {\n this.handleFinishMessage(m);\n break;\n }\n case Message$1.RETURN: {\n this.handleReturnMessage(m);\n break;\n }\n case Message$1.CALL: {\n this.handleCallMessage(m);\n break;\n }\n }\n }\n handleReturnMessage(m) {\n const ret = m.return;\n const id = ret.answerId;\n const q = this.popQuestion(id);\n if (!q) {\n throw new Error(format(RPC_RETURN_FOR_UNKNOWN_QUESTION, id));\n }\n if (ret.releaseParamCaps) {\n for (let i = 0; i < q.paramCaps.length; i++) {\n this.releaseExport(id, 1);\n }\n }\n let releaseResultCaps = true;\n switch (ret.which()) {\n case Return.RESULTS: {\n releaseResultCaps = false;\n const { results } = ret;\n this.populateMessageCapTable(results);\n const { content } = results;\n q.fulfill(content);\n break;\n }\n case Return.EXCEPTION: {\n const exc = ret.exception;\n const err = q.method ? new MethodError(q.method, exc.reason) : new RPCError(exc);\n q.reject(err);\n break;\n }\n }\n const fin = newFinishMessage(id, releaseResultCaps);\n this.sendMessage(fin);\n }\n handleCallMessage(m) {\n const mcall = m.call;\n const mt = mcall.target;\n if (mt.which() !== MessageTarget.IMPORTED_CAP && mt.which() !== MessageTarget.PROMISED_ANSWER) {\n const um = newUnimplementedMessage(m);\n this.sendMessage(um);\n return;\n }\n const mparams = mcall.params;\n try {\n this.populateMessageCapTable(mparams);\n } catch {\n const um = newUnimplementedMessage(m);\n this.sendMessage(um);\n return;\n }\n const id = mcall.questionId;\n const a = this.insertAnswer(id);\n if (!a) {\n throw new Error(format(RPC_QUESTION_ID_REUSED, id));\n }\n const interfaceDef = Registry.lookup(mcall.interfaceId);\n if (!interfaceDef) {\n const um = newUnimplementedMessage(m);\n this.sendMessage(um);\n return;\n }\n const method = interfaceDef.methods[mcall.methodId];\n if (!method) {\n const um = newUnimplementedMessage(m);\n this.sendMessage(um);\n return;\n }\n const paramContent = mparams.content;\n const call = {\n method,\n params: getAs(method.ParamsClass, paramContent)\n };\n try {\n this.routeCallMessage(a, mt, call);\n } catch (error_) {\n a.reject(error_);\n }\n }\n routeCallMessage(result, mt, cl) {\n switch (mt.which()) {\n case MessageTarget.IMPORTED_CAP: {\n const id = mt.importedCap;\n const e = this.findExport(id);\n if (!e) {\n throw new Error(RPC_BAD_TARGET);\n }\n const answer = this.call(e.client, cl);\n joinAnswer(result, answer);\n break;\n }\n case MessageTarget.PROMISED_ANSWER: {\n const mpromise = mt.promisedAnswer;\n const id = mpromise.questionId;\n if (id === result.id) {\n throw new Error(RPC_BAD_TARGET);\n }\n const pa = this.answers[id];\n if (!pa) {\n throw new Error(RPC_BAD_TARGET);\n }\n const mtrans = mpromise.transform;\n const transform = promisedAnswerOpsToTransform(mtrans);\n if (pa.done) {\n const { obj, err } = pa;\n const client = clientFromResolution(transform, obj, err);\n const answer = this.call(client, cl);\n joinAnswer(result, answer);\n } else {\n pa.queueCall(cl, transform, result);\n }\n break;\n }\n default: {\n throw new Error(INVARIANT_UNREACHABLE_CODE);\n }\n }\n }\n populateMessageCapTable(payload) {\n const msg = payload.segment.message;\n const ctab = payload.capTable;\n for (const desc of ctab) {\n switch (desc.which()) {\n case CapDescriptor.NONE: {\n msg.addCap(null);\n break;\n }\n case CapDescriptor.SENDER_HOSTED: {\n const id = desc.senderHosted;\n const client = this.addImport(id);\n msg.addCap(client);\n break;\n }\n case CapDescriptor.SENDER_PROMISE: {\n const id = desc.senderPromise;\n const client = this.addImport(id);\n msg.addCap(client);\n break;\n }\n case CapDescriptor.RECEIVER_HOSTED: {\n const id = desc.receiverHosted;\n const e = this.findExport(id);\n if (!e) {\n throw new Error(format(RPC_UNKNOWN_EXPORT_ID, id));\n }\n msg.addCap(e.rc.ref());\n break;\n }\n case CapDescriptor.RECEIVER_ANSWER: {\n const recvAns = desc.receiverAnswer;\n const id = recvAns.questionId;\n const a = this.answers[id];\n if (!a) {\n throw new Error(format(RPC_UNKNOWN_ANSWER_ID, id));\n }\n const recvTransform = recvAns.transform;\n const transform = promisedAnswerOpsToTransform(recvTransform);\n msg.addCap(answerPipelineClient(a, transform));\n break;\n }\n default: {\n throw new Error(format(RPC_UNKNOWN_CAP_DESCRIPTOR, desc.which()));\n }\n }\n }\n }\n addImport(id) {\n const importEntry = this.imports[id];\n if (importEntry) {\n importEntry.refs++;\n return importEntry.rc.ref();\n }\n const client = new ImportClient(this, id);\n const [rc, ref] = RefCount.new(client, this.finalize);\n this.imports[id] = {\n rc,\n refs: 1\n };\n return ref;\n }\n findExport(id) {\n if (id > this.exports.length) {\n return null;\n }\n return this.exports[id];\n }\n addExport(client) {\n for (let i = 0; i < this.exports.length; i++) {\n const e = this.exports[i];\n if (e && isSameClient(e.rc._client, client)) {\n e.wireRefs++;\n return i;\n }\n }\n const id = this.exportID.next();\n const [rc, ref] = RefCount.new(client, this.finalize);\n const _export = {\n client: ref,\n id,\n rc,\n wireRefs: 1\n };\n if (id === this.exports.length) {\n this.exports.push(_export);\n } else {\n this.exports[id] = _export;\n }\n return id;\n }\n releaseExport(id, refs) {\n const e = this.findExport(id);\n if (!e) {\n return;\n }\n e.wireRefs -= refs;\n if (e.wireRefs > 0) {\n return;\n }\n if (e.wireRefs < 0) {\n this.error(`warning: export ${id} has negative refcount (${e.wireRefs})`);\n }\n e.client.close();\n this.exports[id] = null;\n this.exportID.remove(id);\n }\n error(s) {\n console.error(s);\n }\n newQuestion(method) {\n const id = this.questionID.next();\n const q = new Question(this, id, method);\n if (id === this.questions.length) {\n this.questions.push(q);\n } else {\n this.questions[id] = q;\n }\n return q;\n }\n findQuestion(id) {\n if (id > this.questions.length) {\n return null;\n }\n return this.questions[id];\n }\n popQuestion(id) {\n const q = this.findQuestion(id);\n if (!q) {\n return q;\n }\n this.questions[id] = null;\n this.questionID.remove(id);\n return q;\n }\n // TODO: cancel context?\n insertAnswer(id) {\n if (this.answers[id]) {\n return null;\n }\n const a = new AnswerEntry(this, id);\n this.answers[id] = a;\n return a;\n }\n popAnswer(id) {\n const a = this.answers[id];\n delete this.answers[id];\n return a;\n }\n shutdown(_err) {\n this.transport.close();\n }\n call(client, call) {\n return client.call(call);\n }\n fillParams(payload, cl) {\n const params = placeParams(cl, payload.content);\n payload.content = params;\n this.makeCapTable(\n payload.segment,\n (length) => payload._initCapTable(length)\n );\n }\n makeCapTable(s, init) {\n const msgtab = s.message._capnp.capTable;\n if (!msgtab) {\n return;\n }\n const t = init(msgtab.length);\n for (const [i, client] of msgtab.entries()) {\n const desc = t.get(i);\n if (!client) {\n desc.none = true;\n continue;\n }\n this.descriptorForClient(desc, client);\n }\n }\n // descriptorForClient fills desc for client, adding it to the export\n // table if necessary. The caller must be holding onto c.mu.\n descriptorForClient(desc, _client) {\n {\n dig: for (let client = _client; ; ) {\n if (client instanceof ImportClient) {\n if (client.conn !== this) {\n break dig;\n }\n desc.receiverHosted = client.id;\n return;\n } else if (client instanceof Ref) {\n client = client.client();\n } else if (client instanceof PipelineClient) {\n const p = client.pipeline;\n const ans = p.answer;\n const transform = p.transform();\n if (ans instanceof FixedAnswer) {\n let s;\n let err;\n try {\n s = ans.structSync();\n } catch (error_) {\n err = error_;\n }\n client = clientFromResolution(transform, s, err);\n } else if (ans instanceof Question) {\n if (ans.state !== QuestionState.IN_PROGRESS) {\n client = clientFromResolution(transform, ans.obj, ans.err);\n continue;\n }\n if (ans.conn !== this) {\n break dig;\n }\n const a = desc._initReceiverAnswer();\n a.questionId = ans.id;\n transformToPromisedAnswer(a, p.transform());\n return;\n } else {\n break dig;\n }\n } else {\n break dig;\n }\n }\n }\n const id = this.addExport(_client);\n desc.senderHosted = id;\n }\n sendMessage(msg) {\n this.transport.sendMessage(msg);\n }\n async work() {\n this.working = true;\n while (this.working) {\n try {\n const m = await this.transport.recvMessage();\n this.handleMessage(m);\n } catch (error_) {\n if (error_ !== undefined) {\n throw error_;\n }\n this.working = false;\n }\n }\n }\n}\nfunction answerPipelineClient(a, transform) {\n return new LocalAnswerClient(a, transform);\n}\n\nclass DeferredTransport {\n d;\n closed = false;\n close() {\n this.closed = true;\n this.d?.reject();\n }\n recvMessage() {\n if (this.closed) {\n return Promise.reject();\n }\n if (this.d) {\n this.d.reject();\n }\n this.d = new Deferred();\n return this.d.promise;\n }\n reject = (err) => {\n this.d?.reject(err);\n };\n resolve = (buf) => {\n try {\n this.d?.resolve(new Message(buf, false).getRoot(Message$1));\n } catch (error_) {\n this.d?.reject(error_);\n }\n };\n}\n\nexport { AnyPointerList, BoolList, Conn, Data, DataList, Deferred, DeferredTransport, ErrorClient, Float32List, Float64List, Int16List, Int32List, Int64List, Int8List, Interface, InterfaceList, List, ListElementSize, Message, ObjectSize, Pipeline, Pointer, PointerList, Registry, Struct, Text, TextList, Uint16List, Uint32List, Uint64List, Uint8List, Void, VoidList, answerPipelineClient, clientFromResolution, copyCall, isSameClient, placeParams, utils };\n"],"x_google_ignoreList":[15],"mappings":"qyCAwBA,MAAa,GAAgB,GACvB,GAAS,KACJ,IAAU,IAAA,GAAY,qBAAuB,gBAE/C,OAAO,UAAU,SAAS,KAAK,EAAM,CCejC,GAAgB,GACpB,OAAO,GAAQ,YAAY,EA4BvB,GAAiB,GAAqC,CACjE,GAAI,CAAC,GAAa,EAAI,EAAI,GAAa,EAAI,GAAK,kBAC9C,MAAO,GAET,GAAI,OAAO,eAAe,EAAI,GAAK,KACjC,MAAO,GAET,IAAI,EAAQ,EACZ,KAAO,OAAO,eAAe,EAAM,GAAK,MACtC,EAAQ,OAAO,eAAe,EAAM,CAEtC,OAAO,OAAO,eAAe,EAAI,GAAK,GCV3B,GAAY,GAAoC,CAC3D,GAAI,CACF,OACE,OAAO,GAAU,UAChB,EAAQ,GAAU,GAAO,cAAgB,QAC1C,GAAc,EAAM,MAEhB,CACN,MAAO,KC/DE,GAAY,GAAoC,CAC3D,GAAI,CACF,OAAO,OAAO,GAAU,cAClB,CACN,MAAO,KEFL,EAAgB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A0mBN,WAAW,sBAAuB,IAAI,qBAAsB,GAAO,GAAI,CAAC"}
@@ -1,6 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));require(`@storm-software/config-tools/logger/console`),require(`capnp-es/compiler`),require(`defu`);let c=require(`node:buffer`),l=require(`jsonc-parser`),u=require(`superjson`);u=s(u);let d=require(`lines-and-columns`);require(`nanotar`),require(`glob`),require(`typescript`);let f=require(`./shared/capnp-es.0-_cOx6D.mjs`);require(`./shared/capnp-es.GpvEvMIK.mjs`);let p=require(`./shared/capnp-es.BvfUH5E6.mjs`),m=require(`./shared/capnp-es.UAt3nLGq.mjs`);require(`./capnp/rpc.mjs`);const h=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e),g=e=>typeof e==`object`&&!!e,_=e=>{if(!g(e)||h(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},v=e=>{try{return typeof e==`object`||!!e&&e?.constructor===Object||_(e)}catch{return!1}},y=e=>{try{return typeof e==`string`}catch{return!1}},ee=``,b=Symbol(`singleComment`),x=Symbol(`multiComment`);function S(){return``}function C(e,t,n){return e.slice(t,n).replace(/\S/g,` `)}function w(e,t){let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)}function T(e,{whitespace:t=!0,trailingCommas:n=!1}={}){if(typeof e!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);let r=t?C:S,i=!1,a=!1,o=0,s=``,c=``,l=-1;for(let t=0;t<e.length;t++){let u=e[t],d=e[t+1];!a&&u===`"`&&(w(e,t)||(i=!i)),!i&&(!a&&u+(d??``)===`//`?(s+=e.slice(o,t),o=t,a=b,t++):a===b&&u+(d??``)===`\r
2
- `?(t++,a=!1,s+=r(e,o,t),o=t):a===b&&u===`
3
- `?(a=!1,s+=r(e,o,t),o=t):!a&&u+(d??``)===`/*`?(s+=e.slice(o,t),o=t,a=x,t++):a===x&&u+(d??``)===`*/`?(t++,a=!1,s+=r(e,o,t+1),o=t+1):n&&!a&&(l===-1?u===`,`&&(c+=s+e.slice(o,t),s=``,o=t,l=t):u===`}`||u===`]`?(s+=e.slice(o,t),c+=r(s,0,1)+s.slice(1),s=``,o=t,l=-1):u!==` `&&u!==` `&&u!==`\r`&&u!==`
4
- `&&(s+=e.slice(o,t),o=t,l=-1)))}return c+s+(a?r(e.slice(o)):e.slice(o))}const E=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,D=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,O=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function k(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){console.warn(`Dropping "${e}" key to prevent prototype pollution.`);return}return t}function A(e,t={}){if(typeof e!=`string`)return e;let n=T(e);if(n[0]===`"`&&n[n.length-1]===`"`&&!n.includes(`\\`))return n.slice(1,-1);if(n=n.trim(),n.length<=9)switch(n.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!O.test(n)){if(t.strict)throw Error(`Invalid JSON`);return n}try{if(E.test(n)||D.test(n)){if(t.strict)throw Error(`Possible prototype pollution`);return JSON.parse(n,k)}return JSON.parse(n)}catch(n){if(t.strict)throw n;return e}}const j=/\r\n|[\n\r\u2028\u2029]/;function M(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function N(e,t,n={}){let{start:r,end:i,markerLines:a}=M(t,e.split(j),n),o=String(i).length;return(n.highlight?n.highlight(e):e).split(j).slice(r,i).map((e,t)=>{let n=r+1+t,i=` ${` ${n}`.slice(-o)} | `,s=!!(a[n]??!1);if(s){let t=``;if(Array.isArray(s)){let n=e.slice(0,Math.max(s[0]-1,0)).replace(/[^\t]/g,` `),r=s[1]||1;t=[`
5
- `,i.replace(/\d/g,` `),n,`^`.repeat(r)].join(``)}return[`>`,i,e,t].join(``)}return` ${i}${e}`}).join(`
6
- `)}function P(e,t){let{error:n,offset:r,length:i}=t,a=new d.LinesAndColumns(e).locationForIndex(r),o=a?.line??0,s=a?.column??0;return o++,s++,`${(0,l.printParseErrorCode)(n)} in JSON at ${o}:${s}\n${N(e,{start:{line:o,column:s},end:{line:o,column:s+i}})}\n`}const F=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}},I=e=>e===void 0,L=`@/#$ :;,.!?&=+-*%^~|\\"'\`{}[]()<>`.split(``),R=(e,t=2)=>{let n=F(t)?` `.repeat(t):t;switch(e){case null:return`null`;case void 0:return`"undefined"`;case!0:return`true`;case!1:return`false`;case 1/0:return`infinity`;case-1/0:return`-infinity`}if(Array.isArray(e))return`[${n}${e.map(e=>R(e,n)).join(`,${n}`)}${n}]`;if(e instanceof Uint8Array)return e.toString();switch(typeof e){case`number`:return`${e}`;case`string`:return JSON.stringify(e);case`object`:return`{${n}${Object.keys(e).filter(t=>!I(e[t])).map(t=>`${L.some(e=>t.includes(e))?`"${t}"`:t}: ${n}${R(e[t],n)}`).join(`,${n}`)}${n}}`;default:return`null`}};var z=class e extends u.default{static#e;static get instance(){return e.#e||=new e,e.#e}static deserialize(t){return e.instance.deserialize(t)}static serialize(t){return e.instance.serialize(t)}static parse(e){return A(e)}static stringify(t,n){let r=e.instance.customTransformerRegistry.findApplicable(t),i=t;return r&&r.isApplicable(t)&&(i=r.serialize(i)),R(i)}static parseJson(t,n){try{if(n?.expectComments===!1)return e.instance.parse(t)}catch{}let r=[],i=(0,l.parse)(t,r,{allowTrailingComma:!0,...n});if(r.length>0&&r[0])throw Error(P(t,r[0]));return i}static register(t,n,r,i){e.instance.registerCustom({isApplicable:i,serialize:n,deserialize:r},t)}static registerClass(t,n){e.instance.registerClass(t,{identifier:y(n)?n:n?.identifier||t.name,allowProps:n&&v(n)&&n?.allowProps&&Array.isArray(n.allowProps)?n.allowProps:[`__typename`]})}constructor(){super({dedupe:!0})}};z.instance.registerCustom({isApplicable:e=>c.Buffer.isBuffer(e),serialize:e=>e.toString(`base64`),deserialize:e=>c.Buffer.from(e,`base64`)},`Bytes`);const B=typeof Buffer<`u`,V=B?Buffer.isBuffer.bind(Buffer):function(e){return!1},H=(e=>(typeof globalThis==`object`||Object.defineProperty(e,`typeDetectGlobalObject`,{get(){return this},configurable:!0}),globalThis))(Object.prototype);var U=class extends f.S{static _capnp={displayName:`Void`,id:`0`,size:new f.O(0,0)}};const W={__proto__:null,PointerAllocationResult:f.ao,add:f.ap,adopt:f.a,checkDataBounds:f.aq,checkPointerBounds:f.ar,copyFrom:f.c,copyFromInterface:f.as,copyFromList:f.at,copyFromStruct:f.au,disown:f.d,dump:f.av,erase:f.aw,erasePointer:f.ax,followFar:f.ay,followFars:f.az,getAs:f.w,getBit:f.h,getCapabilityId:f.aA,getContent:f.aB,getData:f.J,getDataSection:f.aC,getFarSegmentId:f.aD,getFloat32:f.F,getFloat64:f.H,getInt16:f.z,getInt32:f.B,getInt64:f.D,getInt8:f.x,getInterfaceClientOrNull:f.af,getInterfaceClientOrNullAt:f.aE,getInterfacePointer:f.aF,getList:f.m,getListByteLength:f.aG,getListElementByteLength:f.aH,getListElementSize:f.aI,getListLength:f.aJ,getOffsetWords:f.aK,getPointer:f.g,getPointerAs:f.aL,getPointerSection:f.aM,getPointerType:f.aN,getSize:f.aO,getStruct:f.k,getStructDataWords:f.aP,getStructPointerLength:f.aQ,getStructSize:f.aR,getTargetCompositeListSize:f.aS,getTargetCompositeListTag:f.aT,getTargetListElementSize:f.aU,getTargetListLength:f.aV,getTargetPointerType:f.ad,getTargetStructSize:f.a9,getText:f.q,getUint16:f.b,getUint32:f.e,getUint64:f.u,getUint8:f.o,initData:f.K,initList:f.n,initPointer:f.aW,initStruct:f.ab,initStructAt:f.l,isDoubleFar:f.aX,isNull:f.i,relocateTo:f.aY,resize:f.aa,setBit:f.j,setFarPointer:f.aZ,setFloat32:f.G,setFloat64:f.I,setInt16:f.A,setInt32:f.C,setInt64:f.E,setInt8:f.y,setInterfacePointer:f.a_,setListPointer:f.a$,setStructPointer:f.b0,setText:f.r,setUint16:f.s,setUint32:f.f,setUint64:f.v,setUint8:f.p,testWhich:f.t,trackPointerAllocation:f.b1,validate:f.a7};function G(e){return class extends f.L{static _capnp={displayName:`List<${e._capnp.displayName}>`,size:f.M.POINTER};get(t){let n=(0,f.aB)(this);return new e(n.segment,n.byteOffset+t*8,this._capnp.depthLimit-1)}set(e,t){(0,f.c)(t,this.get(e))}[Symbol.toStringTag](){return`Pointer_${super.toString()},cls:${e.toString()}`}}}const K=G(f.$);var q=class extends f.L{static _capnp={displayName:`List<boolean>`,size:f.M.BIT};get(e){let t=1<<e%8,n=e>>>3,r=(0,f.aB)(this);return(r.segment.getUint8(r.byteOffset+n)&t)!==0}set(e,t){let n=1<<e%8,r=(0,f.aB)(this),i=r.byteOffset+(e>>>3),a=r.segment.getUint8(i);r.segment.setUint8(i,t?a|n:a&~n)}[Symbol.toStringTag](){return`Bool_${super.toString()}`}};const J=G(f.b2);var Y=class extends f.L{static _capnp={displayName:`List<Float32>`,size:f.M.BYTE_4};get(e){let t=(0,f.aB)(this);return t.segment.getFloat32(t.byteOffset+e*4)}set(e,t){let n=(0,f.aB)(this);n.segment.setFloat32(n.byteOffset+e*4,t)}[Symbol.toStringTag](){return`Float32_${super.toString()}`}},X=class extends f.L{static _capnp={displayName:`List<Float64>`,size:f.M.BYTE_8};get(e){let t=(0,f.aB)(this);return t.segment.getFloat64(t.byteOffset+e*8)}set(e,t){let n=(0,f.aB)(this);n.segment.setFloat64(n.byteOffset+e*8,t)}[Symbol.toStringTag](){return`Float64_${super.toString()}`}},Z=class extends f.L{static _capnp={displayName:`List<Int8>`,size:f.M.BYTE};get(e){let t=(0,f.aB)(this);return t.segment.getInt8(t.byteOffset+e)}set(e,t){let n=(0,f.aB)(this);n.segment.setInt8(n.byteOffset+e,t)}[Symbol.toStringTag](){return`Int8_${super.toString()}`}},Q=class extends f.L{static _capnp={displayName:`List<Int16>`,size:f.M.BYTE_2};get(e){let t=(0,f.aB)(this);return t.segment.getInt16(t.byteOffset+e*2)}set(e,t){let n=(0,f.aB)(this);n.segment.setInt16(n.byteOffset+e*2,t)}[Symbol.toStringTag](){return`Int16_${super.toString()}`}},te=class extends f.L{static _capnp={displayName:`List<Int32>`,size:f.M.BYTE_4};get(e){let t=(0,f.aB)(this);return t.segment.getInt32(t.byteOffset+e*4)}set(e,t){let n=(0,f.aB)(this);n.segment.setInt32(n.byteOffset+e*4,t)}[Symbol.toStringTag](){return`Int32_${super.toString()}`}},ne=class extends f.L{static _capnp={displayName:`List<Int64>`,size:f.M.BYTE_8};get(e){let t=(0,f.aB)(this);return t.segment.getInt64(t.byteOffset+e*8)}set(e,t){let n=(0,f.aB)(this);n.segment.setInt64(n.byteOffset+e*8,t)}[Symbol.toStringTag](){return`Int64_${super.toString()}`}};const $=G(m.I);var re=class extends f.L{static _capnp={displayName:`List<Text>`,size:f.M.POINTER};get(e){let t=(0,f.aB)(this);return t.byteOffset+=e*8,f.b3.fromPointer(t).get(0)}set(e,t){let n=(0,f.aB)(this);n.byteOffset+=e*8,f.b3.fromPointer(n).set(0,t)}[Symbol.toStringTag](){return`Text_${super.toString()}`}},ie=class extends f.L{static _capnp={displayName:`List<Uint8>`,size:f.M.BYTE};get(e){let t=(0,f.aB)(this);return t.segment.getUint8(t.byteOffset+e)}set(e,t){let n=(0,f.aB)(this);n.segment.setUint8(n.byteOffset+e,t)}[Symbol.toStringTag](){return`Uint8_${super.toString()}`}},ae=class extends f.L{static _capnp={displayName:`List<Uint16>`,size:f.M.BYTE_2};get(e){let t=(0,f.aB)(this);return t.segment.getUint16(t.byteOffset+e*2)}set(e,t){let n=(0,f.aB)(this);n.segment.setUint16(n.byteOffset+e*2,t)}[Symbol.toStringTag](){return`Uint16_${super.toString()}`}},oe=class extends f.L{static _capnp={displayName:`List<Uint32>`,size:f.M.BYTE_4};get(e){let t=(0,f.aB)(this);return t.segment.getUint32(t.byteOffset+e*4)}set(e,t){let n=(0,f.aB)(this);n.segment.setUint32(n.byteOffset+e*4,t)}[Symbol.toStringTag](){return`Uint32_${super.toString()}`}},se=class extends f.L{static _capnp={displayName:`List<Uint64>`,size:f.M.BYTE_8};get(e){let t=(0,f.aB)(this);return t.segment.getUint64(t.byteOffset+e*8)}set(e,t){let n=(0,f.aB)(this);n.segment.setUint64(n.byteOffset+e*8,t)}[Symbol.toStringTag](){return`Uint64_${super.toString()}`}};const ce=G(U),le=globalThis.FinalizationRegistry?new FinalizationRegistry(e=>e()):void 0;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return W}});
File without changes