import type { RoUint8Array, RoPair, RoArray } from "@xlabs-xyz/const-utils"; import type { Endianness, NumberSize, NumSizeToPrimitive, DeriveType, Layout, BytesItem, FixedConversion, CustomConversion } from "./layout.js"; import { defaultEndianness } from "./layout.js"; export type CustomizableBytes = undefined | Layout | RoUint8Array | FixedConversion | CustomConversion | RoPair | CustomConversion>; export type BytesBase = ({} | { readonly name: string; }) & Omit; type CombineObjects = { readonly [K in keyof T | keyof U]: K extends keyof T ? T[K] : K extends keyof U ? U[K] : never; }; export type CustomizableBytesReturn = CombineObjects | CustomConversion ? { binary: "bytes"; custom: P; } : P extends readonly [Layout, FixedConversion | CustomConversion] ? { binary: "bytes"; layout: P[0]; custom: P[1]; } : never>; export declare const customizableBytes: (base: B, spec?: C) => CustomizableBytesReturn; export declare function boolItem(permissive?: boolean): { readonly binary: "uint"; readonly size: 1; readonly custom: { readonly to: (encoded: number) => boolean; readonly from: (value: boolean) => number; }; }; export declare function enumItem>, const S extends NumberSize = 1, const EN extends Endianness = typeof defaultEndianness>(entries: E, opts?: { size?: S; endianness?: EN; }): { readonly binary: "uint"; readonly size: S; readonly endianness: EN; readonly custom: { readonly to: (encoded: number) => E[number][0]; readonly from: (name: E[number][0]) => number; }; }; declare const baseOptionItem: (someType: T) => { readonly binary: "switch"; readonly idSize: 1; readonly idTag: "isSome"; readonly layouts: readonly [readonly [readonly [0, false], readonly []], readonly [readonly [1, true], readonly [CustomizableBytesReturn<{ readonly name: "value"; }, T>]]]; }; type BaseOptionItem = DeriveType>>; type BaseOptionValue = DeriveType> | undefined; export declare function optionItem(optVal: T): { readonly binary: "bytes"; readonly layout: { readonly binary: "switch"; readonly idSize: 1; readonly idTag: "isSome"; readonly layouts: readonly [readonly [readonly [0, false], readonly []], readonly [readonly [1, true], readonly [CustomizableBytesReturn<{ readonly name: "value"; }, T>]]]; }; readonly custom: { to: (obj: BaseOptionItem) => BaseOptionValue; from: (value: BaseOptionValue) => BaseOptionItem; }; }; export type BitsetKey = string | undefined; export type Bitset> = { [K in B[number] as K extends "" | undefined ? never : K]: boolean; }; type ByteSize = [ never, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6 ]; type BitsizeToBytesize = N extends keyof ByteSize ? ByteSize[N] : number; export type BitsetItem, S extends number = BitsizeToBytesize> = { binary: "uint"; size: S; custom: { to: (encoded: NumSizeToPrimitive) => Bitset; from: (obj: Bitset) => NumSizeToPrimitive; }; }; export declare function bitsetItem, const S extends number = BitsizeToBytesize>(bitnames: B, size?: S): BitsetItem; export declare const stringConversion: { readonly to: (encoded: RoUint8Array) => string; readonly from: (decoded: string) => NodeJS.NonSharedUint8Array; }; export {}; //# sourceMappingURL=items.d.ts.map