{"version":3,"file":"arktype.modern.mjs","sources":["../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/arrays.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/errors.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/flatMorph.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/records.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/functions.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/domain.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/objectKinds.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/primitive.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/registry.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/compilation.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/hkt.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/numericLiterals.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/serialize.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/utils.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/implement.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/config.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/errors.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/traversal.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/node.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/clone.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/disjoint.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/intersections.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/constraint.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/predicate.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/divisor.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/range.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/after.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/before.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/exactLength.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/max.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/maxLength.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/kinds.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/min.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/minLength.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/refinements/regex.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/root.js","../../node_modules/.pnpm/@arktype+util@0.0.44/node_modules/@arktype/util/out/strings.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/utils.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/alias.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/basis.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/domain.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/declare.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/intersection.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/morph.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/proto.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/union.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/roots/unit.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/structure/index.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/structure/prop.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/structure/optional.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/structure/required.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/structure/sequence.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/structure/shared.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/structure/structure.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/kinds.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/module.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/parse.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/shared/compile.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/scope.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/generic.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/tsKeywords.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/internal.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/jsObjects.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/utils/regex.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/parsing.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/utils/date.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/utils/ip.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/validation.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/utils/creditCard.js","../../node_modules/.pnpm/@arktype+schema@0.1.6/node_modules/@arktype/schema/out/keywords/keywords.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/generic.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/scanner.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/objectLiteral.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/reduce/shared.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operand/genericArgs.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operand/unenclosed.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/tuple.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/definition.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operand/date.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operator/bounds.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operator/divisor.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operator/operator.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/generic.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operand/enclosed.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/shift/operand/operand.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/semantic/validate.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/string.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/parser/string/reduce/dynamic.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/type.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/scope.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/match.js","../../node_modules/.pnpm/arktype@2.0.0-dev.14/node_modules/arktype/out/ark.js","../src/arktype.ts"],"sourcesContent":["export const getPath = (root, path) => {\n    let result = root;\n    for (const segment of path) {\n        if (typeof result !== \"object\" || result === null)\n            return undefined;\n        result = result[segment];\n    }\n    return result;\n};\nexport const intersectUniqueLists = (l, r) => {\n    const intersection = [...l];\n    for (const item of r)\n        if (!l.includes(item))\n            intersection.push(item);\n    return intersection;\n};\nexport const arrayFrom = (data) => (Array.isArray(data) ? data : [data]);\nexport const spliterate = (list, by) => {\n    const result = [[], []];\n    for (const item of list) {\n        if (by(item))\n            result[0].push(item);\n        else\n            result[1].push(item);\n    }\n    return result;\n};\nexport const ReadonlyArray = Array;\nexport const includes = (array, element) => array.includes(element);\nexport const range = (length, offset = 0) => [...new Array(length)].map((_, i) => i + offset);\n/**\n * Adds a value or array to an array, returning the concatenated result\n *\n * @param to The array to which `value` is to be added. If `to` is `undefined`, a new array\n * is created as `[value]` if value was not undefined, otherwise `[]`.\n * @param value The value to add to the array. If `value` is `undefined`, does nothing.\n * @param opts\n * \t\tprepend: If true, adds the element to the beginning of the array instead of the end\n */\nexport const append = (to, value, opts) => {\n    if (value === undefined)\n        return to ?? [];\n    if (to === undefined) {\n        return (value === undefined ? []\n            : Array.isArray(value) ? value\n                : [value]);\n    }\n    if (opts?.prepend)\n        Array.isArray(value) ? to.unshift(...value) : to.unshift(value);\n    else\n        Array.isArray(value) ? to.push(...value) : to.push(value);\n    return to;\n};\n/**\n * Concatenates an element or list with a readonly list\n *\n * @param {to} to - The base list.\n * @param {elementOrList} elementOrList - The element or list to concatenate.\n */\nexport const conflatenate = (to, elementOrList) => {\n    if (elementOrList === undefined || elementOrList === null)\n        return to ?? [];\n    if (to === undefined || to === null)\n        return arrayFrom(elementOrList);\n    return to.concat(elementOrList);\n};\n/**\n * Concatenates a variadic list of elements or lists with a readonly list\n *\n * @param {to} to - The base list.\n * @param {elementsOrLists} elementsOrLists - The elements or lists to concatenate.\n */\nexport const conflatenateAll = (...elementsOrLists) => elementsOrLists.reduce(conflatenate, []);\n/**\n * Appends a value to an array if it is not already included, returning the array\n *\n * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array\n * is created including only `value`.\n * @param value The value to append to the array. If `to` includes `value`, nothing is appended.\n */\nexport const appendUnique = (to, value) => {\n    if (to === undefined)\n        return [value];\n    if (!to.includes(value))\n        to.push(value);\n    return to;\n};\nexport const groupBy = (array, discriminant) => array.reduce((result, item) => {\n    const key = item[discriminant];\n    result[key] ??= [];\n    result[key].push(item);\n    return result;\n}, {});\n","export class InternalArktypeError extends Error {\n}\nexport const throwInternalError = message => throwError(message, InternalArktypeError);\nexport const throwError = (message, ctor = Error) => {\n    throw new ctor(message);\n};\nexport class ParseError extends Error {\n    name = \"ParseError\";\n}\nexport const throwParseError = message => throwError(message, ParseError);\n","// eslint-disable-next-line prefer-arrow-functions/prefer-arrow-functions\nexport function flatMorph(o, flatMapEntry) {\n    const inputIsArray = Array.isArray(o);\n    const entries = Object.entries(o).flatMap((entry, i) => {\n        const result = inputIsArray ? flatMapEntry(i, entry[1]) : flatMapEntry(...entry, i);\n        const entrySet = Array.isArray(result[0]) || result.length === 0 ?\n            // if we have an empty array (for filtering) or an array with\n            // another array as its first element, treat it as a list of\n            result\n            // otherwise, it should be a single entry, so nest it in a tuple\n            // so it doesn't get spread when the result is flattened\n            : [result];\n        return entrySet;\n    });\n    const objectResult = Object.fromEntries(entries);\n    return typeof entries[0]?.[0] === \"number\" ?\n        Object.values(objectResult)\n        : objectResult;\n}\n","import { flatMorph } from \"./flatMorph.js\";\nexport const entriesOf = (o) => Object.entries(o);\nexport const fromEntries = (entries) => Object.fromEntries(entries);\nexport const keysOf = (o) => Object.keys(o);\nexport const isKeyOf = (k, o) => k in o;\nexport const hasKey = (o, k) => k in o;\n// must be defined this way to avoid https://github.com/microsoft/TypeScript/issues/55049\nexport const hasDefinedKey = (o, k) => o[k] !== undefined;\nexport const InnerDynamicBase = class {\n    constructor(properties) {\n        Object.assign(this, properties);\n    }\n};\n/** @ts-expect-error (needed to extend `t`, but safe given ShallowClone's implementation) **/\nexport class DynamicBase extends InnerDynamicBase {\n}\nexport const NoopBase = class {\n};\n/** @ts-expect-error (see DynamicBase) **/\nexport class CastableBase extends NoopBase {\n}\nexport const splitByKeys = (o, leftKeys) => {\n    const l = {};\n    const r = {};\n    let k;\n    for (k in o) {\n        if (k in leftKeys)\n            l[k] = o[k];\n        else\n            r[k] = o[k];\n    }\n    return [l, r];\n};\nexport const pick = (o, keys) => splitByKeys(o, keys)[0];\nexport const omit = (o, keys) => splitByKeys(o, keys)[1];\nexport const isEmptyObject = (o) => Object.keys(o).length === 0;\nexport const stringAndSymbolicEntriesOf = (o) => [\n    ...Object.entries(o),\n    ...Object.getOwnPropertySymbols(o).map(k => [k, o[k]])\n];\n/** Like Object.assign, but it will preserve getters instead of evaluating them. */\nexport const defineProperties = (base, merged) => \n// declared like this to avoid https://github.com/microsoft/TypeScript/issues/55049\nObject.defineProperties(base, Object.getOwnPropertyDescriptors(merged));\nexport const invert = (t) => flatMorph(t, (k, v) => [v, k]);\nexport const unset = Symbol(\"represents an uninitialized value\");\n","import { throwInternalError } from \"./errors.js\";\nimport { NoopBase, unset } from \"./records.js\";\nexport const bound = (target, ctx) => {\n    ctx.addInitializer(function () {\n        this[ctx.name] = this[ctx.name].bind(this);\n    });\n};\nexport const cached = (target, context) => function () {\n    const value = target.call(this);\n    Object.defineProperty(this, context.name, context.kind === \"getter\" ?\n        { value }\n        : {\n            value: () => value,\n            enumerable: false\n        });\n    return value;\n};\nexport const cachedThunk = (thunk) => {\n    let result = unset;\n    return () => (result === unset ? (result = thunk()) : result);\n};\nexport const isThunk = (value) => typeof value === \"function\" && value.length === 0;\nexport const tryCatch = (fn, onError) => {\n    try {\n        return fn();\n    }\n    catch (e) {\n        return onError?.(e);\n    }\n};\nexport const DynamicFunction = class extends Function {\n    constructor(...args) {\n        const params = args.slice(0, -1);\n        const body = args.at(-1);\n        try {\n            super(...params, body);\n        }\n        catch (e) {\n            return throwInternalError(`Encountered an unexpected error while compiling your definition:\n                Message: ${e} \n                Source: (${args.slice(0, -1)}) => {\n                    ${args.at(-1)}\n                }`);\n        }\n    }\n};\n/** @ts-expect-error required to cast function type */\nexport class Callable extends NoopBase {\n    constructor(f, opts) {\n        super();\n        return Object.assign(Object.setPrototypeOf(f.bind(opts?.bind ?? this), this.constructor.prototype), opts?.attach);\n    }\n}\n/**\n * Checks if the environment has Content Security Policy (CSP) enabled,\n * preventing JIT-optimized code from being compiled via new Function().\n *\n * @returns `true` if a function created using new Function() can be\n * successfully invoked in the environment, `false` otherwise.\n *\n * The result is cached for subsequent invocations.\n */\nexport const envHasCsp = cachedThunk(() => {\n    try {\n        return new Function(\"return false\")();\n    }\n    catch (e) {\n        return true;\n    }\n});\n","export const hasDomain = (data, kind) => domainOf(data) === kind;\nexport const domainOf = (data) => {\n    const builtinType = typeof data;\n    return (builtinType === \"object\" ?\n        data === null ?\n            \"null\"\n            : \"object\"\n        : builtinType === \"function\" ? \"object\"\n            : builtinType);\n};\nconst enumerableDomainDescriptions = {\n    boolean: \"boolean\",\n    null: \"null\",\n    undefined: \"undefined\"\n};\nconst nonEnumerableDomainDescriptions = {\n    bigint: \"a bigint\",\n    number: \"a number\",\n    object: \"an object\",\n    string: \"a string\",\n    symbol: \"a symbol\"\n};\n/** Each domain's completion for the phrase \"must be _____\" */\nexport const domainDescriptions = {\n    ...nonEnumerableDomainDescriptions,\n    ...enumerableDomainDescriptions\n};\n","import { domainOf } from \"./domain.js\";\nimport { isKeyOf } from \"./records.js\";\n// Built-in object constructors based on a subset of:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nexport const builtinConstructors = {\n    Array,\n    Date,\n    Error,\n    Function,\n    Map,\n    RegExp,\n    Set,\n    String,\n    Number,\n    Boolean,\n    WeakMap,\n    WeakSet,\n    Promise\n};\nexport const objectKindOf = (data) => {\n    let prototype = Object.getPrototypeOf(data);\n    while (prototype?.constructor &&\n        (!isKeyOf(prototype.constructor.name, builtinConstructors) ||\n            !(data instanceof builtinConstructors[prototype.constructor.name])))\n        prototype = Object.getPrototypeOf(prototype);\n    const name = prototype?.constructor?.name;\n    if (name === undefined || name === \"Object\")\n        return undefined;\n    return name;\n};\nexport const objectKindOrDomainOf = (data) => (typeof data === \"object\" && data !== null ?\n    objectKindOf(data) ?? \"object\"\n    : domainOf(data));\nexport const hasObjectKind = (data, kind) => objectKindOf(data) === kind;\nexport const isArray = (data) => Array.isArray(data);\n/** Each defaultObjectKind's completion for the phrase \"must be _____\" */\nexport const objectKindDescriptions = {\n    Array: \"an array\",\n    Function: \"a function\",\n    Date: \"a Date\",\n    RegExp: \"a RegExp\",\n    Error: \"an Error\",\n    Map: \"a Map\",\n    Set: \"a Set\",\n    String: \"a String object\",\n    Number: \"a Number object\",\n    Boolean: \"a Boolean object\",\n    Promise: \"a Promise\",\n    WeakMap: \"a WeakMap\",\n    WeakSet: \"a WeakSet\"\n};\n// this will only return an object kind if it's the root constructor\n// example TypeError would return undefined not 'Error'\nexport const getExactBuiltinConstructorName = (ctor) => {\n    const constructorName = Object(ctor).name ?? null;\n    return (constructorName &&\n        isKeyOf(constructorName, builtinConstructors) &&\n        builtinConstructors[constructorName] === ctor) ?\n        constructorName\n        : null;\n};\n/**\n * Returns an array of constructors for all ancestors (i.e., prototypes) of a given object.\n *\n * @param {object} o - The object to find the ancestors of.\n * @returns {Function[]} An array of constructors for all ancestors of the object.\n */\nexport const ancestorsOf = (o) => {\n    let proto = Object.getPrototypeOf(o);\n    const result = [];\n    while (proto !== null) {\n        result.push(proto.constructor);\n        proto = Object.getPrototypeOf(proto);\n    }\n    return result;\n};\n/** Mimics output of TS's keyof operator at runtime */\nexport const prototypeKeysOf = (value) => {\n    const result = [];\n    let curr = value;\n    while (curr !== Object.prototype && curr !== null && curr !== undefined) {\n        for (const k of Object.getOwnPropertyNames(curr))\n            if (k !== \"constructor\" && !result.includes(k))\n                result.push(k);\n        for (const symbol of Object.getOwnPropertySymbols(curr))\n            if (!result.includes(symbol))\n                result.push(symbol);\n        curr = Object.getPrototypeOf(curr);\n    }\n    return result;\n};\nconst baseKeysByDomain = {\n    bigint: prototypeKeysOf(0n),\n    boolean: prototypeKeysOf(false),\n    null: [],\n    number: prototypeKeysOf(0),\n    // TS doesn't include the Object prototype in keyof, so keyof object is never\n    object: [],\n    string: prototypeKeysOf(\"\"),\n    symbol: prototypeKeysOf(Symbol()),\n    undefined: []\n};\nexport const getBaseDomainKeys = (domain) => [...baseKeysByDomain[domain]];\nexport const constructorExtends = (ctor, base) => {\n    let current = ctor.prototype;\n    while (current !== null) {\n        if (current === base.prototype)\n            return true;\n        current = Object.getPrototypeOf(current);\n    }\n    return false;\n};\n","export const serializePrimitive = (value) => (typeof value === \"string\" ? JSON.stringify(value)\n    : typeof value === \"bigint\" ? `${value}n`\n        : `${value}`);\n","import { domainOf, hasDomain } from \"./domain.js\";\nimport { throwInternalError } from \"./errors.js\";\nimport { objectKindOf } from \"./objectKinds.js\";\nimport { serializePrimitive } from \"./primitive.js\";\nexport const registry = {};\nglobalThis.$ark = registry;\nconst namesByResolution = new WeakMap();\nconst nameCounts = {};\nexport const register = (value) => {\n    const existingName = namesByResolution.get(value);\n    if (existingName)\n        return existingName;\n    let name = baseNameFor(value);\n    if (nameCounts[name])\n        name = `${name}${nameCounts[name]++}`;\n    else\n        nameCounts[name] = 1;\n    registry[name] = value;\n    namesByResolution.set(value, name);\n    return name;\n};\nexport const reference = (name) => `$ark.${name}`;\nexport const registeredReference = (value) => reference(register(value));\nexport const isDotAccessible = (keyName) => /^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(keyName);\nexport const compileSerializedValue = (value) => hasDomain(value, \"object\") || typeof value === \"symbol\" ?\n    registeredReference(value)\n    : serializePrimitive(value);\nconst baseNameFor = (value) => {\n    switch (typeof value) {\n        case \"object\": {\n            if (value === null)\n                break;\n            const prefix = objectKindOf(value) ?? \"object\";\n            // convert to camelCase\n            return prefix[0].toLowerCase() + prefix.slice(1);\n        }\n        case \"function\":\n            return isDotAccessible(value.name) ? value.name : \"fn\";\n        case \"symbol\":\n            return value.description && isDotAccessible(value.description) ?\n                value.description\n                : \"symbol\";\n    }\n    return throwInternalError(`Unexpected attempt to register serializable value of type ${domainOf(value)}`);\n};\n","import { DynamicFunction } from \"./functions.js\";\nimport { CastableBase } from \"./records.js\";\nimport { isDotAccessible, registeredReference } from \"./registry.js\";\nexport class CompiledFunction extends CastableBase {\n    argNames;\n    body = \"\";\n    constructor(...args) {\n        super();\n        this.argNames = args;\n        for (const arg of args) {\n            if (arg in this) {\n                throw new Error(`Arg name '${arg}' would overwrite an existing property on FunctionBody`);\n            }\n            ;\n            this[arg] = arg;\n        }\n    }\n    indentation = 0;\n    indent() {\n        this.indentation += 4;\n        return this;\n    }\n    dedent() {\n        this.indentation -= 4;\n        return this;\n    }\n    prop(key, optional = false) {\n        return compileLiteralPropAccess(key, optional);\n    }\n    index(key, optional = false) {\n        return indexPropAccess(`${key}`, optional);\n    }\n    line(statement) {\n        ;\n        this.body += `${\" \".repeat(this.indentation)}${statement}\\n`;\n        return this;\n    }\n    const(identifier, expression) {\n        this.line(`const ${identifier} = ${expression}`);\n        return this;\n    }\n    let(identifier, expression) {\n        return this.line(`let ${identifier} = ${expression}`);\n    }\n    set(identifier, expression) {\n        return this.line(`${identifier} = ${expression}`);\n    }\n    if(condition, then) {\n        return this.block(`if (${condition})`, then);\n    }\n    elseIf(condition, then) {\n        return this.block(`else if (${condition})`, then);\n    }\n    else(then) {\n        return this.block(\"else\", then);\n    }\n    /** Current index is \"i\" */\n    for(until, body, initialValue = 0) {\n        return this.block(`for (let i = ${initialValue}; ${until}; i++)`, body);\n    }\n    /** Current key is \"k\" */\n    forIn(object, body) {\n        return this.block(`for (const k in ${object})`, body);\n    }\n    block(prefix, contents, suffix = \"\") {\n        this.line(`${prefix} {`);\n        this.indent();\n        contents(this);\n        this.dedent();\n        return this.line(`}${suffix}`);\n    }\n    return(expression = \"\") {\n        return this.line(`return ${expression}`);\n    }\n    compile() {\n        return new DynamicFunction(...this.argNames, this.body);\n    }\n}\nexport const compileLiteralPropAccess = (key, optional = false) => {\n    if (typeof key === \"string\" && isDotAccessible(key))\n        return `${optional ? \"?\" : \"\"}.${key}`;\n    return indexPropAccess(serializeLiteralKey(key), optional);\n};\nexport const serializeLiteralKey = (key) => typeof key === \"symbol\" ? registeredReference(key) : JSON.stringify(key);\nexport const indexPropAccess = (key, optional = false) => `${optional ? \"?.\" : \"\"}[${key}]`;\n","/** A small set of HKT utility types based on https://github.com/poteat/hkt-toolbelt */\nexport var Hkt;\n(function (Hkt) {\n    class Kind {\n    }\n    Hkt.Kind = Kind;\n    class Instantiable {\n    }\n    Hkt.Instantiable = Instantiable;\n    Hkt.reify = (def) => def.hkt;\n    class UnaryKind {\n    }\n    Hkt.UnaryKind = UnaryKind;\n    Hkt.pipe = (...kinds) => In => kinds.reduce((out, kind) => kind.hkt(out), In);\n})(Hkt || (Hkt = {}));\n","import { throwParseError } from \"./errors.js\";\n/**\n * The goal of the number literal and bigint literal regular expressions is to:\n *\n *   1. Ensure definitions form a bijection with the values they represent.\n *   2. Attempt to mirror TypeScript's own format for stringification of numeric\n *      values such that the regex should match a given definition if any only if\n *      a precise literal type will be inferred (in TS4.8+).\n */\n/**\n *  Matches a well-formatted numeric expression according to the following rules:\n *    1. Must include an integer portion (i.e. '.321' must be written as '0.321')\n *    2. The first digit of the value must not be 0, unless the entire integer portion is 0\n *    3. If the value includes a decimal, its last digit may not be 0\n *    4. The value may not be \"-0\"\n */\nexport const wellFormedNumberMatcher = /^(?!^-0$)-?(?:0|[1-9]\\d*)(?:\\.\\d*[1-9])?$/;\nexport const isWellFormedNumber = wellFormedNumberMatcher.test.bind(wellFormedNumberMatcher);\nconst numberLikeMatcher = /^-?\\d*\\.?\\d*$/;\nconst isNumberLike = (s) => s.length !== 0 && numberLikeMatcher.test(s);\n/**\n *  Matches a well-formatted integer according to the following rules:\n *    1. must begin with an integer, the first digit of which cannot be 0 unless the entire value is 0\n *    2. The value may not be \"-0\"\n */\nexport const wellFormedIntegerMatcher = /^(?:0|(?:-?[1-9]\\d*))$/;\nexport const isWellFormedInteger = wellFormedIntegerMatcher.test.bind(wellFormedIntegerMatcher);\nconst integerLikeMatcher = /^-?\\d+$/;\nconst isIntegerLike = integerLikeMatcher.test.bind(integerLikeMatcher);\nconst numericLiteralDescriptions = {\n    number: \"a number\",\n    bigint: \"a bigint\",\n    integer: \"an integer\"\n};\nexport const writeMalformedNumericLiteralMessage = (def, kind) => `'${def}' was parsed as ${numericLiteralDescriptions[kind]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`;\nconst isWellFormed = (def, kind) => kind === \"number\" ? isWellFormedNumber(def) : isWellFormedInteger(def);\nconst parseKind = (def, kind) => kind === \"number\" ? Number(def) : Number.parseInt(def);\nconst isKindLike = (def, kind) => kind === \"number\" ? isNumberLike(def) : isIntegerLike(def);\nexport const tryParseNumber = (token, options) => parseNumeric(token, \"number\", options);\nexport const tryParseInteger = (token, options) => parseNumeric(token, \"integer\", options);\nconst parseNumeric = (token, kind, options) => {\n    const value = parseKind(token, kind);\n    if (!Number.isNaN(value)) {\n        if (isKindLike(token, kind)) {\n            if (options?.strict) {\n                return isWellFormed(token, kind) ? value : (throwParseError(writeMalformedNumericLiteralMessage(token, kind)));\n            }\n            return value;\n        }\n    }\n    return (options?.errorOnFail ?\n        throwParseError(options?.errorOnFail === true ?\n            `Failed to parse ${numericLiteralDescriptions[kind]} from '${token}'`\n            : options?.errorOnFail)\n        : undefined);\n};\nexport const tryParseWellFormedBigint = (def) => {\n    if (def[def.length - 1] !== \"n\")\n        return;\n    const maybeIntegerLiteral = def.slice(0, -1);\n    let value;\n    try {\n        value = BigInt(maybeIntegerLiteral);\n    }\n    catch {\n        return;\n    }\n    if (wellFormedIntegerMatcher.test(maybeIntegerLiteral))\n        return value;\n    if (integerLikeMatcher.test(maybeIntegerLiteral)) {\n        // If the definition looks like a bigint but is\n        // not well-formed, throw.\n        return throwParseError(writeMalformedNumericLiteralMessage(def, \"bigint\"));\n    }\n};\n","import { domainOf } from \"./domain.js\";\nimport { serializePrimitive } from \"./primitive.js\";\nimport { register } from \"./registry.js\";\nexport const snapshot = (data, opts = { onUndefined: \"(undefined)\" }) => _serialize(data, opts, []);\nexport const print = (data, indent) => console.log(printable(data, indent));\nexport const printable = (data, indent) => {\n    switch (domainOf(data)) {\n        case \"object\":\n            return data instanceof Date ?\n                data.toDateString()\n                : JSON.stringify(_serialize(data, printableOpts, []), null, indent);\n        case \"symbol\":\n            return printableOpts.onSymbol(data);\n        default:\n            return serializePrimitive(data);\n    }\n};\nconst printableOpts = {\n    onCycle: () => \"(cycle)\",\n    onSymbol: v => `Symbol(${register(v)})`,\n    onFunction: v => `Function(${register(v)})`\n};\nconst _serialize = (data, opts, seen) => {\n    switch (domainOf(data)) {\n        case \"object\": {\n            if (typeof data === \"function\")\n                return printableOpts.onFunction(data);\n            if (seen.includes(data))\n                return \"(cycle)\";\n            const nextSeen = [...seen, data];\n            if (Array.isArray(data))\n                return data.map(item => _serialize(item, opts, nextSeen));\n            if (data instanceof Date)\n                return data.toDateString();\n            const result = {};\n            for (const k in data)\n                result[k] = _serialize(data[k], opts, nextSeen);\n            return result;\n        }\n        case \"symbol\":\n            return printableOpts.onSymbol(data);\n        case \"bigint\":\n            return `${data}n`;\n        case \"undefined\":\n            return opts.onUndefined ?? \"undefined\";\n        default:\n            return data;\n    }\n};\n","import { flatMorph, isArray, isDotAccessible, printable } from \"@arktype/util\";\nexport const makeRootAndArrayPropertiesMutable = (o) => \n// TODO: this cast should not be required, but it seems TS is referencing\n// the wrong parameters here?\nflatMorph(o, (k, v) => [k, isArray(v) ? [...v] : v]);\nexport const pathToPropString = (path) => {\n    const propAccessChain = path.reduce((s, k) => typeof k === \"string\" && isDotAccessible(k) ?\n        `${s}.${k}`\n        : `${s}[${printable(k)}]`, \"\");\n    return propAccessChain[0] === \".\" ? propAccessChain.slice(1) : propAccessChain;\n};\nexport const arkKind = Symbol(\"ArkTypeInternalKind\");\nexport const hasArkKind = (value, kind) => value?.[arkKind] === kind;\nexport const isNode = (value) => hasArkKind(value, \"root\") || hasArkKind(value, \"constraint\");\n// ideally this could be just declared since it is not used at runtime,\n// but it doesn't play well with typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/issues/4608\n// easiest solution seems to be just having it declared as a value so it doesn't break when we import at runtime\nexport const inferred = Symbol(\"inferred\");\n","import { compileSerializedValue, flatMorph, printable, throwParseError } from \"@arktype/util\";\nimport { isNode } from \"./utils.js\";\nexport const basisKinds = [\"unit\", \"proto\", \"domain\"];\nexport const structuralKinds = [\n    \"required\",\n    \"optional\",\n    \"index\",\n    \"sequence\"\n];\nexport const refinementKinds = [\n    \"regex\",\n    \"divisor\",\n    \"exactLength\",\n    \"max\",\n    \"min\",\n    \"maxLength\",\n    \"minLength\",\n    \"before\",\n    \"after\"\n];\nexport const constraintKinds = [\n    ...refinementKinds,\n    ...structuralKinds,\n    \"structure\",\n    \"predicate\"\n];\nexport const rootKinds = [\n    \"alias\",\n    \"union\",\n    \"morph\",\n    \"unit\",\n    \"intersection\",\n    \"proto\",\n    \"domain\"\n];\nexport const nodeKinds = [...rootKinds, ...constraintKinds];\nexport const constraintKeys = flatMorph(constraintKinds, (i, kind) => [kind, 1]);\nexport const structureKeys = flatMorph([...structuralKinds, \"undeclared\"], (i, k) => [k, 1]);\nexport const precedenceByKind = flatMorph(nodeKinds, (i, kind) => [kind, i]);\nexport const isNodeKind = (value) => typeof value === \"string\" && value in precedenceByKind;\nexport function assertNodeKind(value, kind) {\n    const valueIsNode = isNode(value);\n    if (!valueIsNode || value.kind !== kind) {\n        throwParseError(`Expected node of kind ${kind} (was ${valueIsNode ? `${value.kind} node` : printable(value)})`);\n    }\n}\nexport const precedenceOfKind = (kind) => precedenceByKind[kind];\nexport const schemaKindsRightOf = (kind) => rootKinds.slice(precedenceOfKind(kind) + 1);\nexport const defaultValueSerializer = (v) => {\n    if (typeof v === \"string\" ||\n        typeof v === \"boolean\" ||\n        typeof v === \"number\" ||\n        v === null)\n        return v;\n    return compileSerializedValue(v);\n};\nexport const compileErrorContext = (ctx) => {\n    let result = \"{ \";\n    for (const [k, v] of Object.entries(ctx))\n        result += `${k}: ${compileSerializedValue(v)}, `;\n    return result + \" }\";\n};\nexport const implementNode = (_) => {\n    const implementation = _;\n    if (implementation.hasAssociatedError) {\n        implementation.defaults.expected ??= ctx => \"description\" in ctx ?\n            ctx.description\n            : implementation.defaults.description(ctx);\n        implementation.defaults.actual ??= data => printable(data);\n        implementation.defaults.problem ??= ctx => `must be ${ctx.expected}${ctx.actual ? ` (was ${ctx.actual})` : \"\"}`;\n        implementation.defaults.message ??= ctx => {\n            if (ctx.path.length === 0)\n                return ctx.problem;\n            const problemWithLocation = `${ctx.propString} ${ctx.problem}`;\n            if (problemWithLocation[0] === \"[\") {\n                // clarify paths like [1], [0][1], and [\"key!\"] that could be confusing\n                return `value at ${problemWithLocation}`;\n            }\n            return problemWithLocation;\n        };\n    }\n    return implementation;\n};\n","import { isNodeKind } from \"./shared/implement.js\";\nexport const globalConfig = {};\nexport const mergeConfigs = (base, extensions) => {\n    const result = { ...base };\n    let k;\n    for (k in extensions) {\n        result[k] =\n            isNodeKind(k) ?\n                {\n                    ...base[k],\n                    ...extensions[k]\n                }\n                : extensions[k];\n    }\n    return result;\n};\nexport const configure = (config) => Object.assign(globalConfig, mergeConfigs(globalConfig, config));\n","import { CastableBase, ReadonlyArray, defineProperties } from \"@arktype/util\";\nimport { arkKind, pathToPropString } from \"./utils.js\";\nexport class ArkError extends CastableBase {\n    input;\n    [arkKind] = \"error\";\n    path;\n    data;\n    nodeConfig;\n    constructor(input, ctx) {\n        super();\n        this.input = input;\n        defineProperties(this, input);\n        const data = ctx.data;\n        if (input.code === \"union\") {\n            // flatten union errors to avoid repeating context like \"foo must be foo must be\"...\n            input.errors = input.errors.flatMap(e => e.hasCode(\"union\") ? e.errors : e);\n        }\n        this.nodeConfig = ctx.config[this.code];\n        this.path = input.path ?? [...ctx.path];\n        if (input.relativePath)\n            this.path.push(...input.relativePath);\n        this.data = \"data\" in input ? input.data : data;\n    }\n    hasCode(code) {\n        return this.code === code;\n    }\n    get propString() {\n        return pathToPropString(this.path);\n    }\n    get expected() {\n        return (this.input.expected ?? this.nodeConfig.expected?.(this.input));\n    }\n    get actual() {\n        // null is a valid value of actual meaning it should be omitted, so\n        // check for undefined explicitly\n        return this.input.actual !== undefined ?\n            this.input.actual\n            : this.nodeConfig.actual?.(this.data);\n    }\n    get problem() {\n        return this.input.problem ?? this.nodeConfig.problem(this);\n    }\n    get message() {\n        return this.input.message ?? this.nodeConfig.message(this);\n    }\n    toString() {\n        return this.message;\n    }\n    throw() {\n        throw this;\n    }\n}\nexport class ArkErrors extends ReadonlyArray {\n    ctx;\n    constructor(ctx) {\n        super();\n        this.ctx = ctx;\n    }\n    byPath = {};\n    count = 0;\n    mutable = this;\n    add(error) {\n        const existing = this.byPath[error.propString];\n        if (existing) {\n            const errorIntersection = new ArkError({\n                code: \"intersection\",\n                errors: existing.hasCode(\"intersection\") ?\n                    [...existing.errors, error]\n                    : [existing, error]\n            }, this.ctx);\n            const existingIndex = this.indexOf(existing);\n            // If existing is found (which it always should be unless this was externally mutated),\n            // replace it with the new problem intersection. In case it isn't for whatever reason,\n            // just append the intersection.\n            this.mutable[existingIndex === -1 ? this.length : existingIndex] =\n                errorIntersection;\n            this.byPath[error.propString] = errorIntersection;\n        }\n        else {\n            this.byPath[error.propString] = error;\n            this.mutable.push(error);\n        }\n        this.count++;\n    }\n    get summary() {\n        return this.toString();\n    }\n    get message() {\n        return this.toString();\n    }\n    toString() {\n        return this.join(\"\\n\");\n    }\n    throw() {\n        throw this;\n    }\n}\n","import { ArkError, ArkErrors } from \"./errors.js\";\nexport class TraversalContext {\n    root;\n    config;\n    path = [];\n    queuedMorphs = [];\n    errors = new ArkErrors(this);\n    branches = [];\n    seen = {};\n    constructor(root, config) {\n        this.root = root;\n        this.config = config;\n    }\n    get currentBranch() {\n        return this.branches.at(-1);\n    }\n    queueMorphs(morphs) {\n        const input = {\n            path: [...this.path],\n            morphs\n        };\n        this.currentBranch?.queuedMorphs.push(input) ??\n            this.queuedMorphs.push(input);\n    }\n    finalize() {\n        if (this.hasError())\n            return this.errors;\n        let out = this.root;\n        if (this.queuedMorphs.length) {\n            for (let i = 0; i < this.queuedMorphs.length; i++) {\n                const { path, morphs } = this.queuedMorphs[i];\n                const key = path.at(-1);\n                let parent;\n                if (key !== undefined) {\n                    // find the object on which the key to be morphed exists\n                    parent = out;\n                    for (let pathIndex = 0; pathIndex < path.length - 1; pathIndex++)\n                        parent = parent[path[pathIndex]];\n                }\n                this.path = path;\n                for (const morph of morphs) {\n                    const result = morph(parent === undefined ? out : parent[key], this);\n                    if (result instanceof ArkErrors)\n                        return result;\n                    if (this.hasError())\n                        return this.errors;\n                    if (result instanceof ArkError) {\n                        // if an ArkError was returned but wasn't added to these\n                        // errors, add it then return\n                        this.error(result);\n                        return this.errors;\n                    }\n                    // apply the morph function and assign the result to the\n                    // corresponding property, or to root if path is empty\n                    if (parent === undefined)\n                        out = result;\n                    else\n                        parent[key] = result;\n                }\n            }\n        }\n        return out;\n    }\n    get currentErrorCount() {\n        return (this.currentBranch ?\n            this.currentBranch.error ?\n                1\n                : 0\n            : this.errors.count);\n    }\n    hasError() {\n        return this.currentErrorCount !== 0;\n    }\n    get failFast() {\n        return this.branches.length !== 0;\n    }\n    error(input) {\n        const errCtx = typeof input === \"object\" ?\n            input.code ?\n                input\n                : { ...input, code: \"predicate\" }\n            : { code: \"predicate\", expected: input };\n        const error = new ArkError(errCtx, this);\n        if (this.currentBranch)\n            this.currentBranch.error = error;\n        else\n            this.errors.add(error);\n        return error;\n    }\n    get data() {\n        let result = this.root;\n        for (const segment of this.path)\n            result = result?.[segment];\n        return result;\n    }\n    invalid(input) {\n        this.error(input);\n        return false;\n    }\n    pushBranch() {\n        this.branches.push({\n            error: undefined,\n            queuedMorphs: []\n        });\n    }\n    popBranch() {\n        return this.branches.pop();\n    }\n}\n","import { Callable, flatMorph, includes, isArray, isEmptyObject, shallowClone, throwError } from \"@arktype/util\";\nimport { basisKinds, constraintKinds, precedenceOfKind, refinementKinds, rootKinds } from \"./shared/implement.js\";\nimport { TraversalContext } from \"./shared/traversal.js\";\nexport class BaseNode extends Callable {\n    attachments;\n    constructor(attachments) {\n        super(\n        // pipedFromCtx allows us internally to reuse TraversalContext\n        // through pipes and keep track of piped paths. It is not exposed\n        (data, pipedFromCtx) => {\n            if (!this.includesMorph &&\n                !this.allowsRequiresContext &&\n                this.allows(data))\n                return data;\n            if (pipedFromCtx)\n                return this.traverseApply(data, pipedFromCtx);\n            const ctx = new TraversalContext(data, this.$.resolvedConfig);\n            this.traverseApply(data, ctx);\n            return ctx.finalize();\n        }, { attach: attachments });\n        this.attachments = attachments;\n    }\n    qualifiedId = `${this.$.id}${this.id}`;\n    includesMorph = this.kind === \"morph\" ||\n        (this.hasKind(\"optional\") && this.hasDefault()) ||\n        (this.hasKind(\"structure\") && this.undeclared === \"delete\") ||\n        this.children.some(child => child.includesMorph);\n    allowsRequiresContext = \n    // if a predicate accepts exactly one arg, we can safely skip passing context\n    (this.hasKind(\"predicate\") && this.inner.predicate.length !== 1) ||\n        this.kind === \"alias\" ||\n        this.children.some(child => child.allowsRequiresContext);\n    referencesById = this.children.reduce((result, child) => Object.assign(result, child.referencesById), { [this.id]: this });\n    get references() {\n        return Object.values(this.referencesById);\n    }\n    precedence = precedenceOfKind(this.kind);\n    jit = false;\n    allows = (data) => {\n        if (this.allowsRequiresContext) {\n            return this.traverseAllows(data, new TraversalContext(data, this.$.resolvedConfig));\n        }\n        return this.traverseAllows(data);\n    };\n    traverse(data) {\n        return this(data);\n    }\n    // unfortunately we can't use the @cached\n    // decorator from @arktype/util on these for now\n    // as they cause a deopt in V8\n    _in;\n    get in() {\n        this._in ??= this.getIo(\"in\");\n        return this._in;\n    }\n    _out;\n    get out() {\n        this._out ??= this.getIo(\"out\");\n        return this._out;\n    }\n    _description;\n    get description() {\n        this._description ??=\n            this.inner.description ??\n                this.$.resolvedConfig[this.kind].description?.(this);\n        return this._description;\n    }\n    getIo(kind) {\n        if (!this.includesMorph)\n            return this;\n        const ioInner = {};\n        for (const [k, v] of this.entries) {\n            const keySchemaImplementation = this.impl.keys[k];\n            if (keySchemaImplementation.meta)\n                continue;\n            if (keySchemaImplementation.child) {\n                const childValue = v;\n                ioInner[k] =\n                    isArray(childValue) ?\n                        childValue.map(child => child[kind])\n                        : childValue[kind];\n            }\n            else\n                ioInner[k] = v;\n        }\n        return this.$.node(this.kind, ioInner);\n    }\n    toJSON() {\n        return this.json;\n    }\n    toString() {\n        return this.expression;\n    }\n    equals(other) {\n        return this.typeHash === other.typeHash;\n    }\n    hasKind(kind) {\n        return this.kind === kind;\n    }\n    isBasis() {\n        return includes(basisKinds, this.kind);\n    }\n    isConstraint() {\n        return includes(constraintKinds, this.kind);\n    }\n    isRefinement() {\n        return includes(refinementKinds, this.kind);\n    }\n    isRoot() {\n        return includes(rootKinds, this.kind);\n    }\n    hasUnit(value) {\n        return this.hasKind(\"unit\") && this.allows(value);\n    }\n    hasOpenIntersection() {\n        return this.impl.intersectionIsOpen;\n    }\n    get nestableExpression() {\n        return this.expression;\n    }\n    bindScope($) {\n        if (this.$ === $)\n            return this;\n        return new this.constructor(Object.assign(shallowClone(this.attachments), { $ }));\n    }\n    firstReference(filter) {\n        return this.references.find(n => n !== this && filter(n));\n    }\n    firstReferenceOrThrow(filter) {\n        return (this.firstReference(filter) ??\n            throwError(`${this.id} had no references matching predicate ${filter}`));\n    }\n    firstReferenceOfKind(kind) {\n        return this.firstReference((node) => node.kind === kind);\n    }\n    firstReferenceOfKindOrThrow(kind) {\n        return (this.firstReference(node => node.kind === kind) ??\n            throwError(`${this.id} had no ${kind} references`));\n    }\n    transform(mapper, opts) {\n        return this._transform(mapper, {\n            seen: {},\n            path: [],\n            shouldTransform: opts?.shouldTransform ?? (() => true)\n        });\n    }\n    _transform(mapper, ctx) {\n        if (ctx.seen[this.id])\n            // TODO: remove cast by making lazilyResolve more flexible\n            // TODO: if each transform has a unique base id, could ensure\n            // these don't create duplicates\n            return this.$.lazilyResolve(ctx.seen[this.id]);\n        if (!ctx.shouldTransform(this, ctx))\n            return this;\n        let transformedNode;\n        ctx.seen[this.id] = () => transformedNode;\n        const innerWithTransformedChildren = flatMorph(this.inner, (k, v) => {\n            if (!this.impl.keys[k].child)\n                return [k, v];\n            const children = v;\n            if (!isArray(children)) {\n                const transformed = children._transform(mapper, ctx);\n                return transformed ? [k, transformed] : [];\n            }\n            const transformed = children.flatMap(n => {\n                const transformedChild = n._transform(mapper, ctx);\n                return transformedChild ?? [];\n            });\n            return transformed.length ? [k, transformed] : [];\n        });\n        delete ctx.seen[this.id];\n        const transformedInner = mapper(this.kind, innerWithTransformedChildren, ctx);\n        if (transformedInner === null)\n            return null;\n        // TODO: more robust checks for pruned inner\n        if (isEmptyObject(transformedInner))\n            return null;\n        if ((this.kind === \"required\" ||\n            this.kind === \"optional\" ||\n            this.kind === \"index\") &&\n            !(\"value\" in transformedInner))\n            return null;\n        if (this.kind === \"morph\") {\n            ;\n            transformedInner.in ??= this.$.keywords\n                .unknown;\n        }\n        return (transformedNode = this.$.node(this.kind, transformedInner));\n    }\n    configureShallowDescendants(configOrDescription) {\n        const config = typeof configOrDescription === \"string\" ?\n            { description: configOrDescription }\n            : configOrDescription;\n        return this.transform((kind, inner) => ({ ...inner, ...config }), {\n            shouldTransform: node => node.kind !== \"structure\"\n        });\n    }\n}\n","export const shallowClone = (input) => Object.create(Object.getPrototypeOf(input), Object.getOwnPropertyDescriptors(input));\nexport const deepClone = (input) => _deepClone(input, new Map());\nconst _deepClone = (input, seen) => {\n    if (typeof input !== \"object\" || input === null)\n        return input;\n    if (seen.has(input))\n        return seen.get(input);\n    const cloned = Array.isArray(input) ?\n        // ensure arrays are copied with their original class attached so they\n        // work with Array.isArray\n        input.slice()\n        : Object.create(Object.getPrototypeOf(input));\n    seen.set(input, cloned);\n    const propertyDescriptors = Object.getOwnPropertyDescriptors(input);\n    for (const key of Object.keys(propertyDescriptors)) {\n        propertyDescriptors[key].value = _deepClone(propertyDescriptors[key].value, seen);\n    }\n    Object.defineProperties(cloned, propertyDescriptors);\n    return cloned;\n};\n","import { entriesOf, flatMorph, fromEntries, isArray, printable, register, throwInternalError, throwParseError } from \"@arktype/util\";\nimport { hasArkKind } from \"./utils.js\";\nexport class Disjoint {\n    sources;\n    constructor(sources) {\n        this.sources = sources;\n    }\n    clone() {\n        return new Disjoint(this.sources);\n    }\n    static from(kind, l, r) {\n        return new Disjoint({\n            \"[]\": {\n                [kind]: {\n                    l,\n                    r\n                }\n            }\n        });\n    }\n    static fromEntries(entries) {\n        if (!entries.length) {\n            return throwInternalError(\"Unexpected attempt to create a disjoint from no entries\");\n        }\n        return new Disjoint({ \"[]\": fromEntries(entries) });\n    }\n    get flat() {\n        return entriesOf(this.sources).flatMap(([path, disjointKinds]) => entriesOf(disjointKinds).map(([kind, disjoint]) => ({\n            path,\n            kind,\n            disjoint\n        })));\n    }\n    describeReasons() {\n        const reasons = this.flat;\n        if (reasons.length === 1) {\n            const { path, disjoint } = reasons[0];\n            const pathString = JSON.parse(path).join(\".\");\n            return `Intersection${pathString && ` at ${pathString}`} of ${describeReasons(disjoint)} results in an unsatisfiable type`;\n        }\n        return `The following intersections result in unsatisfiable types:\\n• ${reasons\n            .map(({ path, disjoint }) => `${path}: ${describeReasons(disjoint)}`)\n            .join(\"\\n• \")}`;\n    }\n    isEmpty() {\n        return this.flat.length === 0;\n    }\n    throw() {\n        return throwParseError(this.describeReasons());\n    }\n    invert() {\n        const invertedEntries = entriesOf(this.sources).map(([path, disjoints]) => [\n            path,\n            flatMorph(disjoints, (kind, disjoint) => [\n                kind,\n                { l: disjoint.r, r: disjoint.l }\n            ])\n        ]);\n        return new Disjoint(fromEntries(invertedEntries));\n    }\n    add(input) {\n        entriesOf(input.sources).forEach(([path, disjoints]) => Object.assign(this.sources[path] ?? {}, disjoints));\n    }\n    withPrefixKey(key) {\n        const entriesWithPrefix = entriesOf(this.sources).map(([path, disjoints]) => {\n            const segments = JSON.parse(path);\n            segments.unshift(typeof key === \"symbol\" ? register(key) : key);\n            const pathWithPrefix = JSON.stringify(segments);\n            return [pathWithPrefix, disjoints];\n        });\n        return new Disjoint(fromEntries(entriesWithPrefix));\n    }\n    toString() {\n        return printable(this.sources);\n    }\n}\nconst describeReasons = (source) => `${describeReason(source.l)} and ${describeReason(source.r)}`;\nconst describeReason = (value) => hasArkKind(value, \"root\") ? value.expression\n    : isArray(value) ? value.map(describeReason).join(\" | \")\n        : String(value);\n","import { Hkt } from \"@arktype/util\";\nimport { Disjoint } from \"./disjoint.js\";\nimport { isNode } from \"./utils.js\";\nconst intersectionCache = {};\nexport const intersectNodesRoot = (l, r, $) => intersectNodes(l, r, { $, invert: false, pipe: false });\nexport const pipeNodesRoot = (l, r, $) => intersectNodes(l, r, { $, invert: false, pipe: true });\nexport const intersectNodes = (l, r, ctx) => {\n    const operator = ctx.pipe ? \"|>\" : \"&\";\n    const lrCacheKey = `${l.typeHash}${operator}${r.typeHash}`;\n    if (intersectionCache[lrCacheKey] !== undefined)\n        return intersectionCache[lrCacheKey];\n    if (!ctx.pipe) {\n        // we can only use this for the commutative & operator\n        const rlCacheKey = `${r.typeHash}${operator}${l.typeHash}`;\n        if (intersectionCache[rlCacheKey] !== undefined) {\n            // if the cached result was a Disjoint and the operands originally\n            // appeared in the opposite order, we need to invert it to match\n            const rlResult = intersectionCache[rlCacheKey];\n            const lrResult = rlResult instanceof Disjoint ? rlResult.invert() : rlResult;\n            // add the lr result to the cache directly to bypass this check in the future\n            intersectionCache[lrCacheKey] = lrResult;\n            return lrResult;\n        }\n    }\n    if (l.equals(r))\n        return l;\n    let result;\n    if (ctx.pipe && l.hasKind(\"morph\")) {\n        result =\n            ctx.invert ?\n                pipeToMorph(r, l, ctx)\n                : pipeFromMorph(l, r, ctx);\n    }\n    else if (ctx.pipe && r.hasKind(\"morph\")) {\n        result =\n            ctx.invert ?\n                pipeFromMorph(r, l, ctx)\n                : pipeToMorph(l, r, ctx);\n    }\n    else {\n        const leftmostKind = l.precedence < r.precedence ? l.kind : r.kind;\n        const implementation = l.impl.intersections[r.kind] ?? r.impl.intersections[l.kind];\n        result =\n            implementation === undefined ?\n                // should be two ConstraintNodes that have no relation\n                // this could also happen if a user directly intersects a Type and a ConstraintNode,\n                // but that is not allowed by the external function signature\n                null\n                : leftmostKind === l.kind ? implementation(l, r, ctx)\n                    : implementation(r, l, { ...ctx, invert: !ctx.invert });\n    }\n    if (isNode(result)) {\n        // if the result equals one of the operands, preserve its metadata by\n        // returning the original reference\n        if (l.equals(result))\n            result = l;\n        else if (r.equals(result))\n            result = r;\n    }\n    intersectionCache[lrCacheKey] = result;\n    return result;\n};\n// TODO: double check pipes through chained morphs\nexport const pipeFromMorph = (from, to, ctx) => {\n    const morphs = [...from.morphs];\n    if (from.validatedOut) {\n        // still piped from context, so allows appending additional morphs\n        const outIntersection = intersectNodes(from.validatedOut, to, ctx);\n        if (outIntersection instanceof Disjoint)\n            return outIntersection;\n        morphs[morphs.length - 1] = outIntersection;\n    }\n    else\n        morphs.push(to);\n    return ctx.$.node(\"morph\", {\n        morphs,\n        in: from.in\n    });\n};\nexport const pipeToMorph = (from, to, ctx) => {\n    const result = intersectNodes(from, to.in, ctx);\n    if (result instanceof Disjoint)\n        return result;\n    return ctx.$.node(\"morph\", {\n        morphs: to.morphs,\n        in: result\n    });\n};\n","import { append, appendUnique, capitalize, isArray, throwInternalError, throwParseError } from \"@arktype/util\";\nimport { BaseNode } from \"./node.js\";\nimport { Disjoint } from \"./shared/disjoint.js\";\nimport { compileErrorContext, constraintKeys } from \"./shared/implement.js\";\nimport { intersectNodes, intersectNodesRoot } from \"./shared/intersections.js\";\nimport { arkKind } from \"./shared/utils.js\";\nexport class BaseConstraint extends BaseNode {\n    [arkKind] = \"constraint\";\n    impliedSiblings;\n    intersect(r) {\n        return intersectNodesRoot(this, r, this.$);\n    }\n}\nexport class RawPrimitiveConstraint extends BaseConstraint {\n    traverseApply = (data, ctx) => {\n        if (!this.traverseAllows(data, ctx))\n            ctx.error(this.errorContext);\n    };\n    compile(js) {\n        if (js.traversalKind === \"Allows\")\n            js.return(this.compiledCondition);\n        else {\n            js.if(this.compiledNegation, () => js.line(`${js.ctx}.error(${this.compiledErrorContext})`));\n        }\n    }\n    get errorContext() {\n        return { code: this.kind, description: this.description, ...this.inner };\n    }\n    get compiledErrorContext() {\n        return compileErrorContext(this.errorContext);\n    }\n}\nexport const constraintKeyParser = (kind) => (schema, ctx) => {\n    if (isArray(schema)) {\n        if (schema.length === 0) {\n            // Omit empty lists as input\n            return;\n        }\n        return schema\n            .map(schema => ctx.$.node(kind, schema))\n            .sort((l, r) => (l.innerHash < r.innerHash ? -1 : 1));\n    }\n    const child = ctx.$.node(kind, schema);\n    return child.hasOpenIntersection() ? [child] : child;\n};\nexport const intersectConstraints = (s) => {\n    const head = s.r.shift();\n    if (!head) {\n        let result = s.l.length === 0 && s.kind === \"structure\" ?\n            s.ctx.$.keywords.unknown.raw\n            : s.ctx.$.node(s.kind, Object.assign(s.baseInner, unflattenConstraints(s.l)), { prereduced: true });\n        for (const root of s.roots) {\n            if (result instanceof Disjoint)\n                return result;\n            result = intersectNodes(root, result, s.ctx);\n        }\n        return result;\n    }\n    let matched = false;\n    for (let i = 0; i < s.l.length; i++) {\n        const result = intersectNodes(s.l[i], head, s.ctx);\n        if (result === null)\n            continue;\n        if (result instanceof Disjoint)\n            return result;\n        if (!matched) {\n            if (result.isRoot()) {\n                s.roots.push(result);\n                s.l.splice(i);\n                return intersectConstraints(s);\n            }\n            s.l[i] = result;\n            matched = true;\n        }\n        else if (!s.l.includes(result)) {\n            return throwInternalError(`Unexpectedly encountered multiple distinct intersection results for refinement ${result}`);\n        }\n    }\n    if (!matched)\n        s.l.push(head);\n    if (s.kind === \"intersection\")\n        head.impliedSiblings?.forEach(node => appendUnique(s.r, node));\n    return intersectConstraints(s);\n};\nexport const flattenConstraints = (inner) => {\n    const result = Object.entries(inner)\n        .flatMap(([k, v]) => k in constraintKeys ? v : [])\n        .sort((l, r) => l.precedence < r.precedence ? -1\n        : l.precedence > r.precedence ? 1\n            : l.innerHash < r.innerHash ? -1\n                : 1);\n    return result;\n};\n// TODO: Fix type\nexport const unflattenConstraints = (constraints) => {\n    const inner = {};\n    for (const constraint of constraints) {\n        if (constraint.hasOpenIntersection()) {\n            inner[constraint.kind] = append(inner[constraint.kind], constraint);\n        }\n        else {\n            if (inner[constraint.kind]) {\n                return throwInternalError(`Unexpected intersection of closed refinements of kind ${constraint.kind}`);\n            }\n            inner[constraint.kind] = constraint;\n        }\n    }\n    return inner;\n};\nexport const throwInvalidOperandError = (...args) => throwParseError(writeInvalidOperandMessage(...args));\nexport const writeInvalidOperandMessage = (kind, expected, actual) => `${capitalize(kind)} operand must be ${expected.description} (was ${actual.exclude(expected).description})`;\n","import { registeredReference } from \"@arktype/util\";\nimport { BaseConstraint } from \"./constraint.js\";\nimport { implementNode } from \"./shared/implement.js\";\nexport const predicateImplementation = implementNode({\n    kind: \"predicate\",\n    hasAssociatedError: true,\n    collapsibleKey: \"predicate\",\n    keys: {\n        predicate: {}\n    },\n    normalize: schema => typeof schema === \"function\" ? { predicate: schema } : schema,\n    defaults: {\n        description: node => `valid according to ${node.predicate.name || \"an anonymous predicate\"}`\n    },\n    intersectionIsOpen: true,\n    intersections: {\n        // TODO: allow changed order to be the same type\n        // as long as the narrows in l and r are individually safe to check\n        // in the order they're specified, checking them in the order\n        // resulting from this intersection should also be safe.\n        predicate: () => null\n    }\n});\nexport class PredicateNode extends BaseConstraint {\n    serializedPredicate = registeredReference(this.predicate);\n    compiledCondition = `${this.serializedPredicate}(data, ctx)`;\n    compiledNegation = `!${this.compiledCondition}`;\n    impliedBasis = null;\n    expression = this.serializedPredicate;\n    traverseAllows = this.predicate;\n    errorContext = {\n        code: \"predicate\",\n        description: this.description\n    };\n    compiledErrorContext = `{ code: \"predicate\", description: \"${this.description}\" }`;\n    traverseApply = (data, ctx) => {\n        if (!this.predicate(data, ctx) && !ctx.hasError())\n            ctx.error(this.errorContext);\n    };\n    compile(js) {\n        if (js.traversalKind === \"Allows\") {\n            js.return(this.compiledCondition);\n            return;\n        }\n        js.if(`${this.compiledNegation} && !ctx.hasError()`, () => js.line(`ctx.error(${this.compiledErrorContext})`));\n    }\n}\n","import { RawPrimitiveConstraint, writeInvalidOperandMessage } from \"../constraint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nexport const divisorImplementation = implementNode({\n    kind: \"divisor\",\n    collapsibleKey: \"rule\",\n    keys: {\n        rule: {}\n    },\n    normalize: schema => typeof schema === \"number\" ? { rule: schema } : schema,\n    hasAssociatedError: true,\n    defaults: {\n        description: node => node.rule === 1 ? \"an integer\" : `a multiple of ${node.rule}`\n    },\n    intersections: {\n        divisor: (l, r, ctx) => ctx.$.node(\"divisor\", {\n            rule: Math.abs((l.rule * r.rule) / greatestCommonDivisor(l.rule, r.rule))\n        })\n    }\n});\nexport class DivisorNode extends RawPrimitiveConstraint {\n    traverseAllows = data => data % this.rule === 0;\n    compiledCondition = `data % ${this.rule} === 0`;\n    compiledNegation = `data % ${this.rule} !== 0`;\n    impliedBasis = this.$.keywords.number.raw;\n    expression = `% ${this.rule}`;\n}\nexport const writeIndivisibleMessage = (t) => writeInvalidOperandMessage(\"divisor\", t.$.raw.keywords.number, t);\n// https://en.wikipedia.org/wiki/Euclidean_algorithm\nconst greatestCommonDivisor = (l, r) => {\n    let previous;\n    let greatestCommonDivisor = l;\n    let current = r;\n    while (current !== 0) {\n        previous = current;\n        current = greatestCommonDivisor % current;\n        greatestCommonDivisor = previous;\n    }\n    return greatestCommonDivisor;\n};\n","import { isKeyOf } from \"@arktype/util\";\nimport { RawPrimitiveConstraint } from \"../constraint.js\";\nexport class BaseRange extends RawPrimitiveConstraint {\n    boundOperandKind = operandKindsByBoundKind[this.kind];\n    compiledActual = this.boundOperandKind === \"value\" ? `data`\n        : this.boundOperandKind === \"length\" ? `data.length`\n            : `data.valueOf()`;\n    comparator = compileComparator(this.kind, this.exclusive);\n    numericLimit = this.rule.valueOf();\n    expression = `${this.comparator}${this.rule}`;\n    compiledCondition = `${this.compiledActual} ${this.comparator} ${this.numericLimit}`;\n    compiledNegation = `${this.compiledActual} ${negatedComparators[this.comparator]} ${this.numericLimit}`;\n    // we need to compute stringLimit before errorContext, which references it\n    // transitively through description for date bounds\n    stringLimit = this.boundOperandKind === \"date\" ?\n        dateLimitToString(this.numericLimit)\n        : `${this.numericLimit}`;\n    limitKind = this.comparator[\"0\"] === \"<\" ? \"upper\" : \"lower\";\n    isStricterThan(r) {\n        const thisLimitIsStricter = this.limitKind === \"upper\" ?\n            this.numericLimit < r.numericLimit\n            : this.numericLimit > r.numericLimit;\n        return (thisLimitIsStricter ||\n            (this.numericLimit === r.numericLimit &&\n                this.exclusive === true &&\n                !r.exclusive));\n    }\n    overlapsRange(r) {\n        if (this.isStricterThan(r))\n            return false;\n        if (this.numericLimit === r.numericLimit && (this.exclusive || r.exclusive))\n            return false;\n        return true;\n    }\n    overlapIsUnit(r) {\n        return (this.numericLimit === r.numericLimit && !this.exclusive && !r.exclusive);\n    }\n}\nconst negatedComparators = {\n    \"<\": \">=\",\n    \"<=\": \">\",\n    \">\": \"<=\",\n    \">=\": \"<\"\n};\nexport const boundKindPairsByLower = {\n    min: \"max\",\n    minLength: \"maxLength\",\n    after: \"before\"\n};\nexport const parseExclusiveKey = {\n    // omit key with value false since it is the default\n    parse: (flag) => flag || undefined\n};\nexport const parseDateLimit = (limit) => typeof limit === \"string\" || typeof limit === \"number\" ?\n    new Date(limit)\n    : limit;\nconst operandKindsByBoundKind = {\n    min: \"value\",\n    max: \"value\",\n    minLength: \"length\",\n    maxLength: \"length\",\n    after: \"date\",\n    before: \"date\"\n};\nexport const compileComparator = (kind, exclusive) => `${isKeyOf(kind, boundKindPairsByLower) ? \">\" : \"<\"}${exclusive ? \"\" : \"=\"}`;\nexport const dateLimitToString = (limit) => typeof limit === \"string\" ? limit : new Date(limit).toLocaleString();\nexport const writeUnboundableMessage = (root) => `Bounded expression ${root} must be a number, string, Array, or Date`;\n","import { implementNode } from \"../shared/implement.js\";\nimport { BaseRange, parseDateLimit, parseExclusiveKey } from \"./range.js\";\nexport const afterImplementation = implementNode({\n    kind: \"after\",\n    collapsibleKey: \"rule\",\n    hasAssociatedError: true,\n    keys: {\n        rule: {\n            parse: parseDateLimit,\n            serialize: schema => schema.toISOString()\n        },\n        exclusive: parseExclusiveKey\n    },\n    normalize: schema => (typeof schema === \"number\" ||\n        typeof schema === \"string\" ||\n        schema instanceof Date) ?\n        { rule: schema }\n        : schema,\n    defaults: {\n        description: node => node.exclusive ?\n            `after ${node.stringLimit}`\n            : `${node.stringLimit} or later`,\n        actual: data => data.toLocaleString()\n    },\n    intersections: {\n        after: (l, r) => (l.isStricterThan(r) ? l : r)\n    }\n});\nexport class AfterNode extends BaseRange {\n    impliedBasis = this.$.keywords.Date.raw;\n    traverseAllows = this.exclusive ? data => data > this.rule : data => data >= this.rule;\n}\n","import { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { BaseRange, parseDateLimit, parseExclusiveKey } from \"./range.js\";\nexport const beforeImplementation = implementNode({\n    kind: \"before\",\n    collapsibleKey: \"rule\",\n    hasAssociatedError: true,\n    keys: {\n        rule: {\n            parse: parseDateLimit,\n            serialize: schema => schema.toISOString()\n        },\n        exclusive: parseExclusiveKey\n    },\n    normalize: schema => (typeof schema === \"number\" ||\n        typeof schema === \"string\" ||\n        schema instanceof Date) ?\n        { rule: schema }\n        : schema,\n    defaults: {\n        description: node => node.exclusive ?\n            `before ${node.stringLimit}`\n            : `${node.stringLimit} or earlier`,\n        actual: data => data.toLocaleString()\n    },\n    intersections: {\n        before: (l, r) => (l.isStricterThan(r) ? l : r),\n        after: (before, after, ctx) => before.overlapsRange(after) ?\n            before.overlapIsUnit(after) ?\n                ctx.$.node(\"unit\", { unit: before.rule })\n                : null\n            : Disjoint.from(\"range\", before, after)\n    }\n});\nexport class BeforeNode extends BaseRange {\n    traverseAllows = this.exclusive ? data => data < this.rule : data => data <= this.rule;\n    impliedBasis = this.$.keywords.Date.raw;\n}\n","import { RawPrimitiveConstraint } from \"../constraint.js\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nexport const exactLengthImplementation = implementNode({\n    kind: \"exactLength\",\n    collapsibleKey: \"rule\",\n    keys: {\n        rule: {}\n    },\n    normalize: schema => typeof schema === \"number\" ? { rule: schema } : schema,\n    hasAssociatedError: true,\n    defaults: {\n        description: node => `exactly length ${node.rule}`\n    },\n    intersections: {\n        exactLength: (l, r, ctx) => new Disjoint({\n            '[\"length\"]': {\n                unit: {\n                    l: ctx.$.node(\"unit\", { unit: l.rule }),\n                    r: ctx.$.node(\"unit\", { unit: r.rule })\n                }\n            }\n        }),\n        minLength: (exactLength, minLength) => (minLength.exclusive ?\n            exactLength.rule > minLength.rule\n            : exactLength.rule >= minLength.rule) ?\n            exactLength\n            : Disjoint.from(\"range\", exactLength, minLength),\n        maxLength: (exactLength, maxLength) => (maxLength.exclusive ?\n            exactLength.rule < maxLength.rule\n            : exactLength.rule <= maxLength.rule) ?\n            exactLength\n            : Disjoint.from(\"range\", exactLength, maxLength)\n    }\n});\nexport class ExactLengthNode extends RawPrimitiveConstraint {\n    traverseAllows = data => data.length === this.rule;\n    compiledCondition = `data.length === ${this.rule}`;\n    compiledNegation = `data.length !== ${this.rule}`;\n    impliedBasis = this.$.keywords.lengthBoundable.raw;\n    expression = `{ length: ${this.rule} }`;\n}\n","import { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { BaseRange, parseExclusiveKey } from \"./range.js\";\nexport const maxImplementation = implementNode({\n    kind: \"max\",\n    collapsibleKey: \"rule\",\n    hasAssociatedError: true,\n    keys: {\n        rule: {},\n        exclusive: parseExclusiveKey\n    },\n    normalize: schema => typeof schema === \"number\" ? { rule: schema } : schema,\n    defaults: {\n        description: node => `${node.exclusive ? \"less than\" : \"at most\"} ${node.rule}`\n    },\n    intersections: {\n        max: (l, r) => (l.isStricterThan(r) ? l : r),\n        min: (max, min, ctx) => max.overlapsRange(min) ?\n            max.overlapIsUnit(min) ?\n                ctx.$.node(\"unit\", { unit: max.rule })\n                : null\n            : Disjoint.from(\"range\", max, min)\n    }\n});\nexport class MaxNode extends BaseRange {\n    impliedBasis = this.$.keywords.number.raw;\n    traverseAllows = this.exclusive ? data => data < this.rule : data => data <= this.rule;\n}\n","import { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { BaseRange, parseExclusiveKey } from \"./range.js\";\nexport const maxLengthImplementation = implementNode({\n    kind: \"maxLength\",\n    collapsibleKey: \"rule\",\n    hasAssociatedError: true,\n    keys: {\n        rule: {},\n        exclusive: parseExclusiveKey\n    },\n    normalize: schema => typeof schema === \"number\" ? { rule: schema } : schema,\n    defaults: {\n        description: node => node.exclusive ?\n            `less than length ${node.rule}`\n            : `at most length ${node.rule}`,\n        actual: data => `${data.length}`\n    },\n    intersections: {\n        maxLength: (l, r) => (l.isStricterThan(r) ? l : r),\n        minLength: (max, min, ctx) => max.overlapsRange(min) ?\n            max.overlapIsUnit(min) ?\n                ctx.$.node(\"exactLength\", { rule: max.rule })\n                : null\n            : Disjoint.from(\"range\", max, min)\n    }\n});\nexport class MaxLengthNode extends BaseRange {\n    impliedBasis = this.$.keywords.lengthBoundable.raw;\n    traverseAllows = this.exclusive ?\n        data => data.length < this.rule\n        : data => data.length <= this.rule;\n}\n","import { AfterNode, afterImplementation } from \"./after.js\";\nimport { BeforeNode, beforeImplementation } from \"./before.js\";\nimport { ExactLengthNode, exactLengthImplementation } from \"./exactLength.js\";\nimport { MaxNode, maxImplementation } from \"./max.js\";\nimport { MaxLengthNode, maxLengthImplementation } from \"./maxLength.js\";\nimport { MinNode, minImplementation } from \"./min.js\";\nimport { MinLengthNode, minLengthImplementation } from \"./minLength.js\";\nexport const boundImplementationsByKind = {\n    min: minImplementation,\n    max: maxImplementation,\n    minLength: minLengthImplementation,\n    maxLength: maxLengthImplementation,\n    exactLength: exactLengthImplementation,\n    after: afterImplementation,\n    before: beforeImplementation\n};\nexport const boundClassesByKind = {\n    min: MinNode,\n    max: MaxNode,\n    minLength: MinLengthNode,\n    maxLength: MaxLengthNode,\n    exactLength: ExactLengthNode,\n    after: AfterNode,\n    before: BeforeNode\n};\n","import { implementNode } from \"../shared/implement.js\";\nimport { BaseRange, parseExclusiveKey } from \"./range.js\";\nexport const minImplementation = implementNode({\n    kind: \"min\",\n    collapsibleKey: \"rule\",\n    hasAssociatedError: true,\n    keys: {\n        rule: {},\n        exclusive: parseExclusiveKey\n    },\n    normalize: schema => typeof schema === \"number\" ? { rule: schema } : schema,\n    defaults: {\n        description: node => `${node.exclusive ? \"more than\" : \"at least\"} ${node.rule}`\n    },\n    intersections: {\n        min: (l, r) => (l.isStricterThan(r) ? l : r)\n    }\n});\nexport class MinNode extends BaseRange {\n    impliedBasis = this.$.keywords.number.raw;\n    traverseAllows = this.exclusive ? data => data > this.rule : data => data >= this.rule;\n}\n","import { implementNode } from \"../shared/implement.js\";\nimport { BaseRange, parseExclusiveKey } from \"./range.js\";\nexport const minLengthImplementation = implementNode({\n    kind: \"minLength\",\n    collapsibleKey: \"rule\",\n    hasAssociatedError: true,\n    keys: {\n        rule: {},\n        exclusive: parseExclusiveKey\n    },\n    normalize: schema => typeof schema === \"number\" ? { rule: schema } : schema,\n    defaults: {\n        description: node => node.exclusive ?\n            node.rule === 0 ?\n                \"non-empty\"\n                : `more than length ${node.rule}`\n            : node.rule === 1 ? \"non-empty\"\n                : `at least length ${node.rule}`,\n        actual: data => `${data.length}`\n    },\n    intersections: {\n        minLength: (l, r) => (l.isStricterThan(r) ? l : r)\n    }\n});\nexport class MinLengthNode extends BaseRange {\n    impliedBasis = this.$.keywords.lengthBoundable.raw;\n    traverseAllows = this.exclusive ?\n        data => data.length > this.rule\n        : data => data.length >= this.rule;\n}\n","import { RawPrimitiveConstraint } from \"../constraint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nexport const regexImplementation = implementNode({\n    kind: \"regex\",\n    collapsibleKey: \"rule\",\n    keys: {\n        rule: {},\n        flags: {}\n    },\n    normalize: schema => typeof schema === \"string\" ? { rule: schema }\n        : schema instanceof RegExp ?\n            schema.flags ?\n                { rule: schema.source, flags: schema.flags }\n                : { rule: schema.source }\n            : schema,\n    hasAssociatedError: true,\n    intersectionIsOpen: true,\n    defaults: {\n        description: node => `matched by ${node.rule}`\n    },\n    intersections: {\n        // for now, non-equal regex are naively intersected:\n        // https://github.com/arktypeio/arktype/issues/853\n        regex: () => null\n    }\n});\nexport class RegexNode extends RawPrimitiveConstraint {\n    instance = new RegExp(this.rule, this.flags);\n    expression = `${this.instance}`;\n    traverseAllows = this.instance.test.bind(this.instance);\n    compiledCondition = `${this.expression}.test(data)`;\n    compiledNegation = `!${this.compiledCondition}`;\n    impliedBasis = this.$.keywords.string.raw;\n}\n","import { includes, omit, throwParseError } from \"@arktype/util\";\nimport { throwInvalidOperandError } from \"../constraint.js\";\nimport { BaseNode } from \"../node.js\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { ArkErrors } from \"../shared/errors.js\";\nimport { structuralKinds } from \"../shared/implement.js\";\nimport { intersectNodesRoot, pipeNodesRoot } from \"../shared/intersections.js\";\nimport { arkKind, hasArkKind } from \"../shared/utils.js\";\nexport class BaseRoot extends BaseNode {\n    branches = this.hasKind(\"union\") ? this.inner.branches : [this];\n    [arkKind] = \"root\";\n    get raw() {\n        return this;\n    }\n    _keyof;\n    keyof() {\n        if (!this._keyof) {\n            this._keyof = this.rawKeyOf();\n            if (this._keyof.branches.length === 0) {\n                throwParseError(`keyof ${this.expression} results in an unsatisfiable type`);\n            }\n        }\n        return this._keyof;\n    }\n    intersect(r) {\n        const rNode = this.$.parseRoot(r);\n        return intersectNodesRoot(this, rNode, this.$);\n    }\n    and(r) {\n        const result = this.intersect(r);\n        return result instanceof Disjoint ? result.throw() : result;\n    }\n    or(r) {\n        const rNode = this.$.parseRoot(r);\n        const branches = [...this.branches, ...rNode.branches];\n        return this.$.schema(branches);\n    }\n    assert(data) {\n        const result = this.traverse(data);\n        return result instanceof ArkErrors ? result.throw() : result;\n    }\n    // get<key extends PropertyKey>(\n    // \t...path: readonly (key | Root<key>)[]\n    // ): this {\n    // \treturn this\n    // }\n    extract(r) {\n        const rNode = this.$.parseRoot(r);\n        return this.$.schema(this.branches.filter(branch => branch.extends(rNode)));\n    }\n    exclude(r) {\n        const rNode = this.$.parseRoot(r);\n        return this.$.schema(this.branches.filter(branch => !branch.extends(rNode)));\n    }\n    array() {\n        return this.$.schema({\n            proto: Array,\n            sequence: this\n        }, { prereduced: true });\n    }\n    extends(r) {\n        const intersection = this.intersect(r);\n        return (!(intersection instanceof Disjoint) && this.equals(intersection));\n    }\n    subsumes(r) {\n        return r.extends(this);\n    }\n    configure(configOrDescription) {\n        return this.configureShallowDescendants(configOrDescription);\n    }\n    describe(description) {\n        return this.configure(description);\n    }\n    create(input) {\n        // ideally we wouldn't validate here but for now we need to do determine\n        // which morphs to apply\n        return this.assert(input);\n    }\n    pipe(...morphs) {\n        return morphs.reduce((acc, morph) => acc.pipeOnce(morph), this);\n    }\n    pipeOnce(morph) {\n        if (hasArkKind(morph, \"root\"))\n            return pipeNodesRoot(this, morph, this.$);\n        if (this.hasKind(\"union\")) {\n            const branches = this.branches.map(node => node.pipe(morph));\n            return this.$.node(\"union\", { ...this.inner, branches });\n        }\n        if (this.hasKind(\"morph\")) {\n            return this.$.node(\"morph\", {\n                ...this.inner,\n                morphs: [...this.morphs, morph]\n            });\n        }\n        return this.$.node(\"morph\", {\n            in: this,\n            morphs: [morph]\n        });\n    }\n    narrow(predicate) {\n        return this.constrain(\"predicate\", predicate);\n    }\n    constrain(kind, schema) {\n        const constraint = this.$.node(kind, schema);\n        if (constraint.impliedBasis && !this.extends(constraint.impliedBasis)) {\n            return throwInvalidOperandError(kind, constraint.impliedBasis, this);\n        }\n        return this.and(\n        // TODO: not an intersection\n        this.$.node(\"intersection\", {\n            [kind]: constraint\n        }));\n    }\n    onUndeclaredKey(undeclared) {\n        return this.transform((kind, inner) => kind === \"structure\" ?\n            undeclared === \"ignore\" ?\n                omit(inner, { undeclared: 1 })\n                : { ...inner, undeclared }\n            : inner, { shouldTransform: node => !includes(structuralKinds, node.kind) });\n    }\n}\n","export const capitalize = (s) => (s[0].toUpperCase() + s.slice(1));\n","import { flatMorph } from \"@arktype/util\";\nimport { schemaKindsRightOf } from \"../shared/implement.js\";\nexport const defineRightwardIntersections = (kind, implementation) => flatMorph(schemaKindsRightOf(kind), (i, kind) => [\n    kind,\n    implementation\n]);\n","var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {\n    var useValue = arguments.length > 2;\n    for (var i = 0; i < initializers.length; i++) {\n        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n    }\n    return useValue ? value : void 0;\n};\nvar __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n    function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n    var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n    var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n    var _, done = false;\n    for (var i = decorators.length - 1; i >= 0; i--) {\n        var context = {};\n        for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n        for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n        context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n        var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n        if (kind === \"accessor\") {\n            if (result === void 0) continue;\n            if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n            if (_ = accept(result.get)) descriptor.get = _;\n            if (_ = accept(result.set)) descriptor.set = _;\n            if (_ = accept(result.init)) initializers.unshift(_);\n        }\n        else if (_ = accept(result)) {\n            if (kind === \"field\") initializers.unshift(_);\n            else descriptor[key] = _;\n        }\n    }\n    if (target) Object.defineProperty(target, contextIn.name, descriptor);\n    done = true;\n};\nimport { append, cached } from \"@arktype/util\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { intersectNodes } from \"../shared/intersections.js\";\nimport { BaseRoot } from \"./root.js\";\nimport { defineRightwardIntersections } from \"./utils.js\";\nlet AliasNode = (() => {\n    let _classSuper = BaseRoot;\n    let _instanceExtraInitializers = [];\n    let _get_resolution_decorators;\n    return class AliasNode extends _classSuper {\n        static {\n            const _metadata = typeof Symbol === \"function\" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;\n            _get_resolution_decorators = [cached];\n            __esDecorate(this, null, _get_resolution_decorators, { kind: \"getter\", name: \"resolution\", static: false, private: false, access: { has: obj => \"resolution\" in obj, get: obj => obj.resolution }, metadata: _metadata }, null, _instanceExtraInitializers);\n            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });\n        }\n        expression = (__runInitializers(this, _instanceExtraInitializers), this.alias);\n        get resolution() {\n            return this.resolve?.() ?? this.$.resolveRoot(this.alias);\n        }\n        rawKeyOf() {\n            return this.resolution.keyof();\n        }\n        traverseAllows = (data, ctx) => {\n            const seen = ctx.seen[this.id];\n            if (seen?.includes(data))\n                return true;\n            ctx.seen[this.id] = append(seen, data);\n            return this.resolution.traverseAllows(data, ctx);\n        };\n        traverseApply = (data, ctx) => {\n            const seen = ctx.seen[this.id];\n            if (seen?.includes(data))\n                return;\n            ctx.seen[this.id] = append(seen, data);\n            this.resolution.traverseApply(data, ctx);\n        };\n        compile(js) {\n            js.if(`ctx.seen.${this.id}?.includes(data)`, () => js.return(true));\n            js.line(`ctx.seen.${this.id} ??= []`).line(`ctx.seen.${this.id}.push(data)`);\n            js.return(js.invoke(this.resolution));\n        }\n    };\n})();\nexport { AliasNode };\nexport const normalizeAliasSchema = (schema) => typeof schema === \"string\" ? { alias: schema.slice(1) } : schema;\nexport const aliasImplementation = implementNode({\n    kind: \"alias\",\n    hasAssociatedError: false,\n    collapsibleKey: \"alias\",\n    keys: {\n        alias: {\n            serialize: schema => `$${schema}`\n        },\n        resolve: {}\n    },\n    normalize: normalizeAliasSchema,\n    defaults: {\n        description: node => node.alias\n    },\n    intersections: {\n        alias: (l, r, ctx) => ctx.$.lazilyResolve(() => neverIfDisjoint(intersectNodes(l.resolution, r.resolution, ctx), ctx.$), `${l.alias}${ctx.pipe ? \"|>\" : \"&\"}${r.alias}`),\n        ...defineRightwardIntersections(\"alias\", (l, r, ctx) => ctx.$.lazilyResolve(() => neverIfDisjoint(intersectNodes(l.resolution, r, ctx), ctx.$), `${l.alias}${ctx.pipe ? \"|>\" : \"&\"}${r.alias}`))\n    }\n});\nconst neverIfDisjoint = (result, $) => (result instanceof Disjoint ? $.keywords.never.raw : result);\n","import { compileErrorContext } from \"../shared/implement.js\";\nimport { BaseRoot } from \"./root.js\";\nexport class RawBasis extends BaseRoot {\n    rawKeyOf() {\n        return this.$.units(this.literalKeys);\n    }\n    traverseApply = (data, ctx) => {\n        if (!this.traverseAllows(data, ctx))\n            ctx.error(this.errorContext);\n    };\n    get errorContext() {\n        return { code: this.kind, description: this.description, ...this.inner };\n    }\n    get compiledErrorContext() {\n        return compileErrorContext(this.errorContext);\n    }\n    compile(js) {\n        if (js.traversalKind === \"Allows\")\n            js.return(this.compiledCondition);\n        else {\n            js.if(this.compiledNegation, () => js.line(`${js.ctx}.error(${this.compiledErrorContext})`));\n        }\n    }\n}\n","import { domainDescriptions, domainOf, getBaseDomainKeys } from \"@arktype/util\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { RawBasis } from \"./basis.js\";\nexport class DomainNode extends RawBasis {\n    traverseAllows = data => domainOf(data) === this.domain;\n    compiledCondition = this.domain === \"object\" ?\n        `((typeof data === \"object\" && data !== null) || typeof data === \"function\")`\n        : `typeof data === \"${this.domain}\"`;\n    compiledNegation = this.domain === \"object\" ?\n        `((typeof data !== \"object\" || data === null) && typeof data !== \"function\")`\n        : `typeof data !== \"${this.domain}\"`;\n    expression = this.domain;\n    literalKeys = getBaseDomainKeys(this.domain);\n}\nexport const domainImplementation = implementNode({\n    kind: \"domain\",\n    hasAssociatedError: true,\n    collapsibleKey: \"domain\",\n    keys: {\n        domain: {}\n    },\n    normalize: schema => typeof schema === \"string\" ? { domain: schema } : schema,\n    defaults: {\n        description: node => domainDescriptions[node.domain],\n        actual: data => (typeof data === \"boolean\" ? `${data}` : domainOf(data))\n    },\n    intersections: {\n        domain: (l, r) => Disjoint.from(\"domain\", l, r)\n    }\n});\n","export const metaKeys = { description: 1 };\n","import { flatMorph, hasDomain, isEmptyObject, isKeyOf, omit, pick, throwParseError } from \"@arktype/util\";\nimport { constraintKeyParser, flattenConstraints, intersectConstraints } from \"../constraint.js\";\nimport { metaKeys } from \"../shared/declare.js\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode, structureKeys } from \"../shared/implement.js\";\nimport { intersectNodes } from \"../shared/intersections.js\";\nimport { hasArkKind, isNode } from \"../shared/utils.js\";\nimport { BaseRoot } from \"./root.js\";\nimport { defineRightwardIntersections } from \"./utils.js\";\nexport class IntersectionNode extends BaseRoot {\n    basis = this.domain ?? this.proto ?? null;\n    refinements = this.children.filter((node) => node.isRefinement());\n    expression = this.structure?.expression ||\n        this.children.map(node => node.nestableExpression).join(\" & \") ||\n        \"unknown\";\n    traverseAllows = (data, ctx) => this.children.every(child => child.traverseAllows(data, ctx));\n    traverseApply = (data, ctx) => {\n        const errorCount = ctx.currentErrorCount;\n        if (this.basis) {\n            this.basis.traverseApply(data, ctx);\n            if (ctx.currentErrorCount > errorCount)\n                return;\n        }\n        if (this.refinements.length) {\n            for (let i = 0; i < this.refinements.length - 1; i++) {\n                this.refinements[i].traverseApply(data, ctx);\n                if (ctx.failFast && ctx.currentErrorCount > errorCount)\n                    return;\n            }\n            this.refinements.at(-1).traverseApply(data, ctx);\n            if (ctx.currentErrorCount > errorCount)\n                return;\n        }\n        if (this.structure) {\n            this.structure.traverseApply(data, ctx);\n            if (ctx.currentErrorCount > errorCount)\n                return;\n        }\n        if (this.predicate) {\n            for (let i = 0; i < this.predicate.length - 1; i++) {\n                this.predicate[i].traverseApply(data, ctx);\n                if (ctx.failFast && ctx.currentErrorCount > errorCount)\n                    return;\n            }\n            this.predicate.at(-1).traverseApply(data, ctx);\n        }\n    };\n    compile(js) {\n        if (js.traversalKind === \"Allows\") {\n            this.children.forEach(child => js.check(child));\n            js.return(true);\n            return;\n        }\n        js.initializeErrorCount();\n        if (this.basis) {\n            js.check(this.basis);\n            // we only have to return conditionally if this is not the last check\n            if (this.children.length > 1)\n                js.returnIfFail();\n        }\n        if (this.refinements.length) {\n            for (let i = 0; i < this.refinements.length - 1; i++) {\n                js.check(this.refinements[i]);\n                js.returnIfFailFast();\n            }\n            js.check(this.refinements.at(-1));\n            if (this.structure || this.predicate)\n                js.returnIfFail();\n        }\n        if (this.structure) {\n            js.check(this.structure);\n            if (this.predicate)\n                js.returnIfFail();\n        }\n        if (this.predicate) {\n            for (let i = 0; i < this.predicate.length - 1; i++) {\n                js.check(this.predicate[i]);\n                // since predicates can be chained, we have to fail immediately\n                // if one fails\n                js.returnIfFail();\n            }\n            js.check(this.predicate.at(-1));\n        }\n    }\n    rawKeyOf() {\n        return (this.basis ?\n            this.structure ?\n                this.basis.rawKeyOf().or(this.structure.keyof())\n                : this.basis.rawKeyOf()\n            : this.structure?.keyof() ?? this.$.keywords.never.raw);\n    }\n}\nconst intersectIntersections = (l, r, ctx) => {\n    // avoid treating adding instance keys as keys of lRoot, rRoot\n    if (hasArkKind(l, \"root\") && l.hasKind(\"intersection\"))\n        return intersectIntersections(l.inner, r, ctx);\n    if (hasArkKind(r, \"root\") && r.hasKind(\"intersection\"))\n        return intersectIntersections(l, r.inner, ctx);\n    const baseInner = isEmptyObject(l) ? pick(r, metaKeys) : {};\n    const lBasis = l.proto ?? l.domain;\n    const rBasis = r.proto ?? r.domain;\n    const basisResult = lBasis ?\n        rBasis ?\n            intersectNodes(lBasis, rBasis, ctx)\n            : lBasis\n        : rBasis;\n    if (basisResult instanceof Disjoint)\n        return basisResult;\n    if (basisResult)\n        baseInner[basisResult.kind] = basisResult;\n    return intersectConstraints({\n        kind: \"intersection\",\n        baseInner,\n        l: flattenConstraints(l),\n        r: flattenConstraints(r),\n        roots: [],\n        ctx\n    });\n};\nexport const intersectionImplementation = implementNode({\n    kind: \"intersection\",\n    hasAssociatedError: true,\n    normalize: rawSchema => {\n        if (isNode(rawSchema))\n            return rawSchema;\n        const { structure, ...schema } = rawSchema;\n        const hasRootStructureKey = !!structure;\n        const normalizedStructure = structure ?? {};\n        const normalized = flatMorph(schema, (k, v) => {\n            if (isKeyOf(k, structureKeys)) {\n                if (hasRootStructureKey) {\n                    throwParseError(`Flattened structure key ${k} cannot be specified alongside a root 'structure' key.`);\n                }\n                normalizedStructure[k] = v;\n                return [];\n            }\n            return [k, v];\n        });\n        if (!isEmptyObject(normalizedStructure))\n            normalized.structure = normalizedStructure;\n        return normalized;\n    },\n    finalizeJson: ({ structure, ...rest }) => hasDomain(structure, \"object\") ? { ...structure, ...rest } : rest,\n    keys: {\n        domain: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.node(\"domain\", schema)\n        },\n        proto: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.node(\"proto\", schema)\n        },\n        structure: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.node(\"structure\", schema),\n            serialize: node => {\n                if (!node.sequence?.minLength)\n                    return node.collapsibleJson;\n                const { sequence, ...structureJson } = node.collapsibleJson;\n                const { minVariadicLength, ...sequenceJson } = sequence;\n                const collapsibleSequenceJson = sequenceJson.variadic && Object.keys(sequenceJson).length === 1 ?\n                    sequenceJson.variadic\n                    : sequenceJson;\n                return { ...structureJson, sequence: collapsibleSequenceJson };\n            }\n        },\n        divisor: {\n            child: true,\n            parse: constraintKeyParser(\"divisor\")\n        },\n        max: {\n            child: true,\n            parse: constraintKeyParser(\"max\")\n        },\n        min: {\n            child: true,\n            parse: constraintKeyParser(\"min\")\n        },\n        maxLength: {\n            child: true,\n            parse: constraintKeyParser(\"maxLength\")\n        },\n        minLength: {\n            child: true,\n            parse: constraintKeyParser(\"minLength\")\n        },\n        exactLength: {\n            child: true,\n            parse: constraintKeyParser(\"exactLength\")\n        },\n        before: {\n            child: true,\n            parse: constraintKeyParser(\"before\")\n        },\n        after: {\n            child: true,\n            parse: constraintKeyParser(\"after\")\n        },\n        regex: {\n            child: true,\n            parse: constraintKeyParser(\"regex\")\n        },\n        predicate: {\n            child: true,\n            parse: constraintKeyParser(\"predicate\")\n        }\n    },\n    // leverage reduction logic from intersection and identity to ensure initial\n    // parse result is reduced\n    reduce: (inner, $) => \n    // we cast union out of the result here since that only occurs when intersecting two sequences\n    // that cannot occur when reducing a single intersection schema using unknown\n    intersectIntersections({}, inner, {\n        $,\n        invert: false,\n        pipe: false\n    }),\n    defaults: {\n        description: node => node.children.length === 0 ?\n            \"unknown\"\n            : node.structure?.description ??\n                node.children.map(child => child.description).join(\" and \"),\n        expected: source => `  • ${source.errors.map(e => e.expected).join(\"\\n  • \")}`,\n        problem: ctx => `must be...\\n${ctx.expected}`\n    },\n    intersections: {\n        intersection: (l, r, ctx) => intersectIntersections(l, r, ctx),\n        ...defineRightwardIntersections(\"intersection\", (l, r, ctx) => {\n            // if l is unknown, return r\n            if (l.children.length === 0)\n                return r;\n            const basis = l.basis ? intersectNodes(l.basis, r, ctx) : r;\n            return (basis instanceof Disjoint ? basis\n                : l?.basis?.equals(basis) ?\n                    // if the basis doesn't change, return the original intesection\n                    l\n                    // given we've already precluded l being unknown, the result must\n                    // be an intersection with the new basis result integrated\n                    : l.$.node(\"intersection\", Object.assign(omit(l.inner, metaKeys), {\n                        [basis.kind]: basis\n                    }), { prereduced: true }));\n        })\n    }\n});\n","import { arrayFrom, registeredReference, throwParseError } from \"@arktype/util\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { intersectNodes } from \"../shared/intersections.js\";\nimport { hasArkKind } from \"../shared/utils.js\";\nimport { BaseRoot } from \"./root.js\";\nimport { defineRightwardIntersections } from \"./utils.js\";\nconst morphInputKinds = [\n    \"intersection\",\n    \"unit\",\n    \"domain\",\n    \"proto\"\n];\nexport const morphImplementation = implementNode({\n    kind: \"morph\",\n    hasAssociatedError: false,\n    keys: {\n        in: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.node(morphInputKinds, schema)\n        },\n        morphs: {\n            parse: arrayFrom,\n            serialize: morphs => morphs.map(m => hasArkKind(m, \"root\") ? m.json : registeredReference(m))\n        }\n    },\n    normalize: schema => schema,\n    defaults: {\n        description: node => `a morph from ${node.in.description} to ${node.out?.description ?? \"unknown\"}`\n    },\n    intersections: {\n        morph: (l, r, ctx) => {\n            if (l.morphs.some((morph, i) => morph !== r.morphs[i]))\n                // TODO: check in for union reduction\n                return throwParseError(\"Invalid intersection of morphs\");\n            const inTersection = intersectNodes(l.in, r.in, ctx);\n            if (inTersection instanceof Disjoint)\n                return inTersection;\n            // in case from is a union, we need to distribute the branches\n            // to can be a union as any schema is allowed\n            return ctx.$.schema(inTersection.branches.map(inBranch => ctx.$.node(\"morph\", {\n                morphs: l.morphs,\n                in: inBranch\n            })));\n        },\n        ...defineRightwardIntersections(\"morph\", (l, r, ctx) => {\n            const inTersection = intersectNodes(l.in, r, ctx);\n            return (inTersection instanceof Disjoint ? inTersection\n                : inTersection.kind === \"union\" ?\n                    ctx.$.node(\"union\", inTersection.branches.map(branch => ({\n                        ...l.inner,\n                        in: branch\n                    })))\n                    : ctx.$.node(\"morph\", {\n                        ...l.inner,\n                        in: inTersection\n                    }));\n        })\n    }\n});\nexport class MorphNode extends BaseRoot {\n    serializedMorphs = this.morphs.map(registeredReference);\n    compiledMorphs = `[${this.serializedMorphs}]`;\n    traverseAllows = (data, ctx) => this.in.traverseAllows(data, ctx);\n    traverseApply = (data, ctx) => {\n        ctx.queueMorphs(this.morphs);\n        this.in.traverseApply(data, ctx);\n    };\n    expression = `(In: ${this.in.expression}) => Out<${this.out?.expression ?? \"unknown\"}>`;\n    compile(js) {\n        if (js.traversalKind === \"Allows\") {\n            js.return(js.invoke(this.in));\n            return;\n        }\n        js.line(`ctx.queueMorphs(${this.compiledMorphs})`);\n        js.line(js.invoke(this.in));\n    }\n    get in() {\n        return this.inner.in;\n    }\n    get validatedOut() {\n        const lastMorph = this.inner.morphs.at(-1);\n        return hasArkKind(lastMorph, \"root\") ?\n            lastMorph?.out\n            : undefined;\n    }\n    get out() {\n        return this.validatedOut ?? this.$.keywords.unknown.raw;\n    }\n    rawKeyOf() {\n        return this.in.rawKeyOf();\n    }\n}\n","import { builtinConstructors, constructorExtends, getExactBuiltinConstructorName, objectKindDescriptions, objectKindOrDomainOf, prototypeKeysOf } from \"@arktype/util\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { defaultValueSerializer, implementNode } from \"../shared/implement.js\";\nimport { RawBasis } from \"./basis.js\";\nexport const protoImplementation = implementNode({\n    kind: \"proto\",\n    hasAssociatedError: true,\n    collapsibleKey: \"proto\",\n    keys: {\n        proto: {\n            serialize: ctor => getExactBuiltinConstructorName(ctor) ?? defaultValueSerializer(ctor)\n        }\n    },\n    normalize: schema => typeof schema === \"string\" ? { proto: builtinConstructors[schema] }\n        : typeof schema === \"function\" ? { proto: schema }\n            : typeof schema.proto === \"string\" ?\n                { ...schema, proto: builtinConstructors[schema.proto] }\n                : schema,\n    defaults: {\n        description: node => node.builtinName ?\n            objectKindDescriptions[node.builtinName]\n            : `an instance of ${node.proto.name}`,\n        actual: data => objectKindOrDomainOf(data)\n    },\n    intersections: {\n        proto: (l, r) => constructorExtends(l.proto, r.proto) ? l\n            : constructorExtends(r.proto, l.proto) ? r\n                : Disjoint.from(\"proto\", l, r),\n        domain: (proto, domain, ctx) => domain.domain === \"object\" ?\n            proto\n            : Disjoint.from(\"domain\", ctx.$.keywords.object.raw, domain)\n    }\n});\nexport class ProtoNode extends RawBasis {\n    builtinName = getExactBuiltinConstructorName(this.proto);\n    serializedConstructor = this.json.proto;\n    compiledCondition = `data instanceof ${this.serializedConstructor}`;\n    compiledNegation = `!(${this.compiledCondition})`;\n    literalKeys = prototypeKeysOf(this.proto.prototype);\n    traverseAllows = data => data instanceof this.proto;\n    expression = this.proto.name;\n    domain = \"object\";\n}\n","var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {\n    var useValue = arguments.length > 2;\n    for (var i = 0; i < initializers.length; i++) {\n        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n    }\n    return useValue ? value : void 0;\n};\nvar __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n    function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n    var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n    var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n    var _, done = false;\n    for (var i = decorators.length - 1; i >= 0; i--) {\n        var context = {};\n        for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n        for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n        context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n        var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n        if (kind === \"accessor\") {\n            if (result === void 0) continue;\n            if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n            if (_ = accept(result.get)) descriptor.get = _;\n            if (_ = accept(result.set)) descriptor.set = _;\n            if (_ = accept(result.init)) initializers.unshift(_);\n        }\n        else if (_ = accept(result)) {\n            if (kind === \"field\") initializers.unshift(_);\n            else descriptor[key] = _;\n        }\n    }\n    if (target) Object.defineProperty(target, contextIn.name, descriptor);\n    done = true;\n};\nimport { appendUnique, cached, compileLiteralPropAccess, domainDescriptions, entriesOf, flatMorph, groupBy, isArray, isKeyOf, printable, throwInternalError } from \"@arktype/util\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode, schemaKindsRightOf } from \"../shared/implement.js\";\nimport { intersectNodes, intersectNodesRoot } from \"../shared/intersections.js\";\nimport { BaseRoot } from \"./root.js\";\nimport { defineRightwardIntersections } from \"./utils.js\";\nconst unionChildKinds = [\n    ...schemaKindsRightOf(\"union\"),\n    \"alias\"\n];\nexport const unionImplementation = implementNode({\n    kind: \"union\",\n    hasAssociatedError: true,\n    collapsibleKey: \"branches\",\n    keys: {\n        ordered: {},\n        branches: {\n            child: true,\n            parse: (schema, ctx) => {\n                const branches = schema.map(branch => ctx.$.node(unionChildKinds, branch));\n                if (!ctx.schema.ordered)\n                    branches.sort((l, r) => (l.innerHash < r.innerHash ? -1 : 1));\n                return branches;\n            }\n        }\n    },\n    normalize: schema => (isArray(schema) ? { branches: schema } : schema),\n    reduce: (inner, $) => {\n        const reducedBranches = reduceBranches(inner);\n        if (reducedBranches.length === 1)\n            return reducedBranches[0];\n        if (reducedBranches.length === inner.branches.length)\n            return;\n        return $.node(\"union\", {\n            ...inner,\n            branches: reducedBranches\n        }, { prereduced: true });\n    },\n    defaults: {\n        description: node => describeBranches(node.branches.map(branch => branch.description)),\n        expected: ctx => {\n            const byPath = groupBy(ctx.errors, \"propString\");\n            const pathDescriptions = Object.entries(byPath).map(([path, errors]) => {\n                const branchesAtPath = [];\n                errors.forEach(errorAtPath => \n                // avoid duplicate messages when multiple branches\n                // are invalid due to the same error\n                appendUnique(branchesAtPath, errorAtPath.expected));\n                const expected = describeBranches(branchesAtPath);\n                // if there are multiple actual descriptions that differ,\n                // just fall back to printable, which is the most specific\n                const actual = errors.every(e => e.actual === errors[0].actual) ?\n                    errors[0].actual\n                    : printable(errors[0].data);\n                return `${path && `${path} `}must be ${expected}${actual && ` (was ${actual})`}`;\n            });\n            return describeBranches(pathDescriptions);\n        },\n        problem: ctx => ctx.expected,\n        message: ctx => ctx.problem\n    },\n    intersections: {\n        union: (l, r, ctx) => {\n            if (l.isNever !== r.isNever) {\n                // if exactly one operand is never, we can use it to discriminate based on presence\n                return Disjoint.from(\"presence\", l, r);\n            }\n            let resultBranches;\n            if (l.ordered) {\n                if (r.ordered)\n                    return Disjoint.from(\"indiscriminableMorphs\", l, r);\n                resultBranches = intersectBranches(r.branches, l.branches, ctx);\n                if (resultBranches instanceof Disjoint)\n                    resultBranches.invert();\n            }\n            else\n                resultBranches = intersectBranches(l.branches, r.branches, ctx);\n            if (resultBranches instanceof Disjoint)\n                return resultBranches;\n            return ctx.$.schema(l.ordered || r.ordered ?\n                {\n                    branches: resultBranches,\n                    ordered: true\n                }\n                : { branches: resultBranches });\n        },\n        ...defineRightwardIntersections(\"union\", (l, r, ctx) => {\n            const branches = intersectBranches(l.branches, [r], ctx);\n            if (branches instanceof Disjoint)\n                return branches;\n            if (branches.length === 1)\n                return branches[0];\n            return ctx.$.schema(l.ordered ? { branches, ordered: true } : { branches });\n        })\n    }\n});\nlet UnionNode = (() => {\n    let _classSuper = BaseRoot;\n    let _instanceExtraInitializers = [];\n    let _discriminate_decorators;\n    return class UnionNode extends _classSuper {\n        static {\n            const _metadata = typeof Symbol === \"function\" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;\n            _discriminate_decorators = [cached];\n            __esDecorate(this, null, _discriminate_decorators, { kind: \"method\", name: \"discriminate\", static: false, private: false, access: { has: obj => \"discriminate\" in obj, get: obj => obj.discriminate }, metadata: _metadata }, null, _instanceExtraInitializers);\n            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });\n        }\n        isNever = (__runInitializers(this, _instanceExtraInitializers), this.branches.length === 0);\n        isBoolean = this.branches.length === 2 &&\n            this.branches[0].hasUnit(false) &&\n            this.branches[1].hasUnit(true);\n        unitBranches = this.branches.filter((n) => n.hasKind(\"unit\"));\n        discriminant = this.discriminate();\n        discriminantJson = this.discriminant ? discriminantToJson(this.discriminant) : null;\n        expression = this.isNever ? \"never\"\n            : this.isBoolean ? \"boolean\"\n                : this.branches.map(branch => branch.nestableExpression).join(\" | \");\n        traverseAllows = (data, ctx) => this.branches.some(b => b.traverseAllows(data, ctx));\n        traverseApply = (data, ctx) => {\n            const errors = [];\n            for (let i = 0; i < this.branches.length; i++) {\n                ctx.pushBranch();\n                this.branches[i].traverseApply(data, ctx);\n                if (!ctx.hasError())\n                    return ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs);\n                errors.push(ctx.popBranch().error);\n            }\n            ctx.error({ code: \"union\", errors });\n        };\n        compile(js) {\n            if (!this.discriminant ||\n                // if we have a union of two units like `boolean`, the\n                // undiscriminated compilation will be just as fast\n                (this.unitBranches.length === this.branches.length &&\n                    this.branches.length === 2))\n                return this.compileIndiscriminable(js);\n            // we need to access the path as optional so we don't throw if it isn't present\n            const condition = this.discriminant.path.reduce((acc, segment) => acc + compileLiteralPropAccess(segment, true), this.discriminant.kind === \"domain\" ? \"typeof data\" : \"data\");\n            const cases = this.discriminant.cases;\n            const caseKeys = Object.keys(cases);\n            js.block(`switch(${condition})`, () => {\n                for (const k in cases) {\n                    const v = cases[k];\n                    const caseCondition = k === \"default\" ? \"default\" : `case ${k}`;\n                    js.line(`${caseCondition}: return ${v === true ? v : js.invoke(v)}`);\n                }\n                return js;\n            });\n            if (js.traversalKind === \"Allows\") {\n                js.return(false);\n                return;\n            }\n            const expected = describeBranches(this.discriminant.kind === \"domain\" ?\n                caseKeys.map(k => domainDescriptions[k.slice(1, -1)])\n                : caseKeys);\n            js.line(`ctx.error({\n\texpected: ${JSON.stringify(expected)},\n\tactual: ${condition},\n\trelativePath: ${JSON.stringify(this.discriminant.path)}\n})`);\n        }\n        compileIndiscriminable(js) {\n            if (js.traversalKind === \"Apply\") {\n                js.const(\"errors\", \"[]\");\n                this.branches.forEach(branch => js\n                    .line(\"ctx.pushBranch()\")\n                    .line(js.invoke(branch))\n                    .if(\"!ctx.hasError()\", () => js.return(\"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)\"))\n                    .line(\"errors.push(ctx.popBranch().error)\"));\n                js.line(`ctx.error({ code: \"union\", errors })`);\n            }\n            else {\n                this.branches.forEach(branch => js.if(`${js.invoke(branch)}`, () => js.return(true)));\n                js.return(false);\n            }\n        }\n        rawKeyOf() {\n            return this.branches.reduce((result, branch) => result.and(branch.rawKeyOf()), this.$.keywords.unknown.raw);\n        }\n        get nestableExpression() {\n            // avoid adding unnecessary parentheses around boolean since it's\n            // already collapsed to a single keyword\n            return this.isBoolean ? \"boolean\" : super.nestableExpression;\n        }\n        discriminate() {\n            if (this.branches.length < 2)\n                return null;\n            if (this.unitBranches.length === this.branches.length) {\n                const cases = flatMorph(this.unitBranches, (i, unit) => [\n                    `${unit.serializedValue}`,\n                    true\n                ]);\n                return {\n                    path: [],\n                    kind: \"unit\",\n                    cases\n                };\n            }\n            const casesBySpecifier = {};\n            for (let lIndex = 0; lIndex < this.branches.length - 1; lIndex++) {\n                const l = this.branches[lIndex];\n                for (let rIndex = lIndex + 1; rIndex < this.branches.length; rIndex++) {\n                    const r = this.branches[rIndex];\n                    const result = intersectNodesRoot(l, r, l.$);\n                    if (!(result instanceof Disjoint))\n                        continue;\n                    for (const { path, kind, disjoint } of result.flat) {\n                        if (!isKeyOf(kind, discriminantKinds))\n                            continue;\n                        const qualifiedDiscriminant = `${path}${kind}`;\n                        let lSerialized;\n                        let rSerialized;\n                        if (kind === \"domain\") {\n                            lSerialized = `\"${disjoint.l.domain}\"`;\n                            rSerialized = `\"${disjoint.r.domain}\"`;\n                        }\n                        else if (kind === \"unit\") {\n                            lSerialized = disjoint.l.serializedValue;\n                            rSerialized = disjoint.r.serializedValue;\n                        }\n                        else {\n                            return throwInternalError(`Unexpected attempt to discriminate disjoint kind '${kind}'`);\n                        }\n                        if (!casesBySpecifier[qualifiedDiscriminant]) {\n                            casesBySpecifier[qualifiedDiscriminant] = {\n                                [lSerialized]: [l],\n                                [rSerialized]: [r]\n                            };\n                            continue;\n                        }\n                        const cases = casesBySpecifier[qualifiedDiscriminant];\n                        if (!isKeyOf(lSerialized, cases))\n                            cases[lSerialized] = [l];\n                        else if (!cases[lSerialized].includes(l))\n                            cases[lSerialized].push(l);\n                        if (!isKeyOf(rSerialized, cases))\n                            cases[rSerialized] = [r];\n                        else if (!cases[rSerialized].includes(r))\n                            cases[rSerialized].push(r);\n                    }\n                }\n            }\n            const bestDiscriminantEntry = entriesOf(casesBySpecifier)\n                .sort((a, b) => Object.keys(a[1]).length - Object.keys(b[1]).length)\n                .at(-1);\n            if (!bestDiscriminantEntry)\n                return null;\n            const [specifier, bestCases] = bestDiscriminantEntry;\n            const [path, kind] = parseDiscriminantKey(specifier);\n            let defaultBranches = [...this.branches];\n            const cases = flatMorph(bestCases, (k, caseBranches) => {\n                const prunedBranches = [];\n                defaultBranches = defaultBranches.filter(n => !caseBranches.includes(n));\n                for (const branch of caseBranches) {\n                    const pruned = pruneDiscriminant(kind, path, branch);\n                    // if any branch of the union has no constraints (i.e. is unknown)\n                    // return it right away\n                    if (pruned === null)\n                        return [k, true];\n                    prunedBranches.push(pruned);\n                }\n                const caseNode = prunedBranches.length === 1 ?\n                    prunedBranches[0]\n                    : this.$.node(\"union\", prunedBranches);\n                Object.assign(this.referencesById, caseNode.referencesById);\n                return [k, caseNode];\n            });\n            if (defaultBranches.length) {\n                cases.default = this.$.node(\"union\", defaultBranches, {\n                    prereduced: true\n                });\n                Object.assign(this.referencesById, cases.default.referencesById);\n            }\n            return {\n                kind,\n                path,\n                cases\n            };\n        }\n    };\n})();\nexport { UnionNode };\nconst discriminantToJson = (discriminant) => ({\n    kind: discriminant.kind,\n    path: discriminant.path,\n    cases: flatMorph(discriminant.cases, (k, node) => [\n        k,\n        node === true ? node\n            : node.hasKind(\"union\") && node.discriminantJson ? node.discriminantJson\n                : node.json\n    ])\n});\nconst describeBranches = (descriptions) => {\n    if (descriptions.length === 0)\n        return \"never\";\n    if (descriptions.length === 1)\n        return descriptions[0];\n    if ((descriptions.length === 2 &&\n        descriptions[0] === \"false\" &&\n        descriptions[1] === \"true\") ||\n        (descriptions[0] === \"true\" && descriptions[1] === \"false\"))\n        return \"boolean\";\n    let description = \"\";\n    for (let i = 0; i < descriptions.length - 1; i++) {\n        description += descriptions[i];\n        if (i < descriptions.length - 2)\n            description += \", \";\n    }\n    description += ` or ${descriptions[descriptions.length - 1]}`;\n    return description;\n};\nexport const intersectBranches = (l, r, ctx) => {\n    // If the corresponding r branch is identified as a subtype of an l branch, the\n    // value at rIndex is set to null so we can avoid including previous/future\n    // inersections in the reduced result.\n    const batchesByR = r.map(() => []);\n    for (let lIndex = 0; lIndex < l.length; lIndex++) {\n        let candidatesByR = {};\n        for (let rIndex = 0; rIndex < r.length; rIndex++) {\n            if (batchesByR[rIndex] === null) {\n                // rBranch is a subtype of an lBranch and\n                // will not yield any distinct intersection\n                continue;\n            }\n            if (l[lIndex].equals(r[rIndex])) {\n                // Combination of subtype and supertype cases\n                batchesByR[rIndex] = null;\n                candidatesByR = {};\n                break;\n            }\n            const branchIntersection = intersectNodes(l[lIndex], r[rIndex], ctx);\n            if (branchIntersection instanceof Disjoint) {\n                // Doesn't tell us anything useful about their relationships\n                // with other branches\n                continue;\n            }\n            if (branchIntersection.equals(l[lIndex])) {\n                // If the current l branch is a subtype of r, intersections\n                // with previous and remaining branches of r won't lead to\n                // distinct intersections.\n                batchesByR[rIndex].push(l[lIndex]);\n                candidatesByR = {};\n                break;\n            }\n            if (branchIntersection.equals(r[rIndex])) {\n                // If the current r branch is a subtype of l, set its batch to\n                // null, removing any previous intersections and preventing any\n                // of its remaining intersections from being computed.\n                batchesByR[rIndex] = null;\n            }\n            else {\n                // If neither l nor r is a subtype of the other, add their\n                // intersection as a candidate (could still be removed if it is\n                // determined l or r is a subtype of a remaining branch).\n                candidatesByR[rIndex] = branchIntersection;\n            }\n        }\n        for (const rIndex in candidatesByR) {\n            // batchesByR at rIndex should never be null if it is in candidatesByR\n            batchesByR[rIndex][lIndex] = candidatesByR[rIndex];\n        }\n    }\n    // Compile the reduced intersection result, including:\n    // \t\t1. Remaining candidates resulting from distinct intersections or strict subtypes of r\n    // \t\t2. Original r branches corresponding to indices with a null batch (subtypes of l)\n    const resultBranches = batchesByR.flatMap(\n    // ensure unions returned from branchable intersections like sequence are flattened\n    (batch, i) => batch?.flatMap(branch => branch.branches) ?? r[i]);\n    return resultBranches.length === 0 ?\n        Disjoint.from(\"union\", l, r)\n        : resultBranches;\n};\nexport const reduceBranches = ({ branches, ordered }) => {\n    if (branches.length < 2)\n        return branches;\n    const uniquenessByIndex = branches.map(() => true);\n    for (let i = 0; i < branches.length; i++) {\n        for (let j = i + 1; j < branches.length && uniquenessByIndex[i] && uniquenessByIndex[j]; j++) {\n            if (branches[i].equals(branches[j])) {\n                // if the two branches are equal, only \"j\" is marked as\n                // redundant so at least one copy could still be included in\n                // the final set of branches.\n                uniquenessByIndex[j] = false;\n                continue;\n            }\n            const intersection = intersectNodesRoot(branches[i], branches[j], branches[0].$);\n            if (intersection instanceof Disjoint)\n                continue;\n            if (intersection.equals(branches[i])) {\n                if (!ordered) {\n                    // preserve ordered branches that are a subtype of a subsequent branch\n                    uniquenessByIndex[i] = false;\n                }\n            }\n            else if (intersection.equals(branches[j]))\n                uniquenessByIndex[j] = false;\n        }\n    }\n    return branches.filter((_, i) => uniquenessByIndex[i]);\n};\nconst discriminantKinds = {\n    domain: 1,\n    unit: 1\n};\nconst parseDiscriminantKey = (key) => {\n    const lastPathIndex = key.lastIndexOf(\"]\");\n    const parsedPath = JSON.parse(key.slice(0, lastPathIndex + 1));\n    const parsedKind = key.slice(lastPathIndex + 1);\n    return [parsedPath, parsedKind];\n};\nexport const pruneDiscriminant = (discriminantKind, path, branch) => branch.transform((nodeKind, inner, ctx) => {\n    // if we've already checked a path at least as long as the current one,\n    // we don't need to revalidate that we're in an object\n    if (nodeKind === \"domain\" &&\n        inner.domain === \"object\" &&\n        path.length > ctx.path.length)\n        return null;\n    // if the discriminant has already checked the domain at the current path\n    // (or an exact value, implying a domain), we don't need to recheck it\n    if ((discriminantKind === nodeKind ||\n        (nodeKind === \"domain\" && ctx.path.length === path.length)) &&\n        ctx.path.length === path.length &&\n        ctx.path.every((segment, i) => segment === path[i]))\n        return null;\n    return inner;\n}, {\n    shouldTransform: node => node.children.length !== 0 ||\n        node.kind === \"domain\" ||\n        node.kind === \"unit\"\n});\n// // TODO: if deeply includes morphs?\n// const writeUndiscriminableMorphUnionMessage = <path extends string>(\n// \tpath: path\n// ) =>\n// \t`${\n// \t\tpath === \"/\" ? \"A\" : `At ${path}, a`\n// \t} union including one or more morphs must be discriminable` as const\n","import { domainOf, printable, prototypeKeysOf } from \"@arktype/util\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { defaultValueSerializer, implementNode } from \"../shared/implement.js\";\nimport { RawBasis } from \"./basis.js\";\nimport { defineRightwardIntersections } from \"./utils.js\";\nexport const unitImplementation = implementNode({\n    kind: \"unit\",\n    hasAssociatedError: true,\n    keys: {\n        unit: {\n            preserveUndefined: true,\n            serialize: schema => schema instanceof Date ?\n                schema.toISOString()\n                : defaultValueSerializer(schema)\n        }\n    },\n    normalize: schema => schema,\n    defaults: {\n        description: node => printable(node.unit),\n        problem: ({ expected, actual }) => `${expected === actual ? `must be reference equal to ${expected} (serialized to the same value)` : `must be ${expected} (was ${actual})`}`\n    },\n    intersections: {\n        unit: (l, r) => Disjoint.from(\"unit\", l, r),\n        ...defineRightwardIntersections(\"unit\", (l, r) => r.allows(l.unit) ? l : (Disjoint.from(\"assignability\", l, r.hasKind(\"intersection\") ?\n            r.children.find(rConstraint => !rConstraint.allows(l.unit))\n            : r)))\n    }\n});\nexport class UnitNode extends RawBasis {\n    compiledValue = this.json.unit;\n    serializedValue = typeof this.unit === \"string\" || this.unit instanceof Date ?\n        JSON.stringify(this.compiledValue)\n        : this.compiledValue;\n    literalKeys = prototypeKeysOf(this.unit);\n    compiledCondition = compileEqualityCheck(this.unit, this.serializedValue);\n    compiledNegation = compileEqualityCheck(this.unit, this.serializedValue, \"negated\");\n    expression = printable(this.unit);\n    domain = domainOf(this.unit);\n    traverseAllows = this.unit instanceof Date ?\n        data => data instanceof Date && data.toISOString() === this.compiledValue\n        : data => data === this.unit;\n}\nconst compileEqualityCheck = (unit, serializedValue, negated) => {\n    if (unit instanceof Date) {\n        const condition = `data instanceof Date && data.toISOString() === ${serializedValue}`;\n        return negated ? `!(${condition})` : condition;\n    }\n    return `data ${negated ? \"!\" : \"=\"}== ${serializedValue}`;\n};\n","import { printable, stringAndSymbolicEntriesOf, throwParseError } from \"@arktype/util\";\nimport { BaseConstraint } from \"../constraint.js\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { intersectNodes } from \"../shared/intersections.js\";\nexport const indexImplementation = implementNode({\n    kind: \"index\",\n    hasAssociatedError: false,\n    intersectionIsOpen: true,\n    keys: {\n        signature: {\n            child: true,\n            parse: (schema, ctx) => {\n                const key = ctx.$.schema(schema);\n                if (!key.extends(ctx.$.keywords.propertyKey)) {\n                    return throwParseError(writeInvalidPropertyKeyMessage(key.expression));\n                }\n                const enumerableBranches = key.branches.filter((b) => b.hasKind(\"unit\"));\n                if (enumerableBranches.length) {\n                    return throwParseError(writeEnumerableIndexBranches(enumerableBranches.map(b => printable(b.unit))));\n                }\n                return key;\n            }\n        },\n        value: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.schema(schema)\n        }\n    },\n    normalize: schema => schema,\n    defaults: {\n        description: node => `[${node.signature.expression}]: ${node.value.description}`\n    },\n    intersections: {\n        index: (l, r, ctx) => {\n            if (l.signature.equals(r.signature)) {\n                const valueIntersection = intersectNodes(l.value, r.value, ctx);\n                const value = valueIntersection instanceof Disjoint ?\n                    ctx.$.keywords.never.raw\n                    : valueIntersection;\n                return ctx.$.node(\"index\", { signature: l.signature, value });\n            }\n            // if r constrains all of l's keys to a subtype of l's value, r is a subtype of l\n            if (l.signature.extends(r.signature) && l.value.subsumes(r.value))\n                return r;\n            // if l constrains all of r's keys to a subtype of r's value, l is a subtype of r\n            if (r.signature.extends(l.signature) && r.value.subsumes(l.value))\n                return l;\n            // other relationships between index signatures can't be generally reduced\n            return null;\n        }\n    }\n});\nexport class IndexNode extends BaseConstraint {\n    impliedBasis = this.$.keywords.object.raw;\n    expression = `[${this.signature.expression}]: ${this.value.expression}`;\n    traverseAllows = (data, ctx) => stringAndSymbolicEntriesOf(data).every(entry => {\n        if (this.signature.traverseAllows(entry[0], ctx)) {\n            // ctx will be undefined if this node isn't context-dependent\n            ctx?.path.push(entry[0]);\n            const allowed = this.value.traverseAllows(entry[1], ctx);\n            ctx?.path.pop();\n            return allowed;\n        }\n        return true;\n    });\n    traverseApply = (data, ctx) => stringAndSymbolicEntriesOf(data).forEach(entry => {\n        if (this.signature.traverseAllows(entry[0], ctx)) {\n            ctx.path.push(entry[0]);\n            this.value.traverseApply(entry[1], ctx);\n            ctx.path.pop();\n        }\n    });\n    _transform(mapper, ctx) {\n        ctx.path.push(this.signature);\n        const result = super._transform(mapper, ctx);\n        ctx.path.pop();\n        return result;\n    }\n    compile() {\n        // this is currently handled by StructureNode\n    }\n}\nexport const writeEnumerableIndexBranches = (keys) => `Index keys ${keys.join(\", \")} should be specified as named props.`;\nexport const writeInvalidPropertyKeyMessage = (indexSchema) => `Indexed key definition '${indexSchema}' must be a string, number or symbol`;\n","import { compileSerializedValue, printable, registeredReference, throwParseError, unset } from \"@arktype/util\";\nimport { BaseConstraint } from \"../constraint.js\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { intersectNodes } from \"../shared/intersections.js\";\nexport const intersectProps = (l, r, ctx) => {\n    if (l.key !== r.key)\n        return null;\n    const key = l.key;\n    let value = intersectNodes(l.value, r.value, ctx);\n    const kind = l.required || r.required ? \"required\" : \"optional\";\n    if (value instanceof Disjoint) {\n        if (kind === \"optional\")\n            value = ctx.$.keywords.never.raw;\n        else\n            return value.withPrefixKey(l.compiledKey);\n    }\n    if (kind === \"required\") {\n        return ctx.$.node(\"required\", {\n            key,\n            value\n        });\n    }\n    const defaultIntersection = l.hasDefault() ?\n        r.hasDefault() ?\n            l.default === r.default ?\n                l.default\n                : throwParseError(`Invalid intersection of default values ${printable(l.default)} & ${printable(r.default)}`)\n            : l.default\n        : r.hasDefault() ? r.default\n            : unset;\n    return ctx.$.node(\"optional\", {\n        key,\n        value,\n        // unset is stripped during parsing\n        default: defaultIntersection\n    });\n};\nexport class BaseProp extends BaseConstraint {\n    required = this.kind === \"required\";\n    impliedBasis = this.$.keywords.object.raw;\n    serializedKey = compileSerializedValue(this.key);\n    compiledKey = typeof this.key === \"string\" ? this.key : this.serializedKey;\n    _transform(mapper, ctx) {\n        ctx.path.push(this.key);\n        const result = super._transform(mapper, ctx);\n        ctx.path.pop();\n        return result;\n    }\n    defaultValueMorphs = [\n        data => {\n            data[this.key] = this.default;\n            return data;\n        }\n    ];\n    defaultValueMorphsReference = registeredReference(this.defaultValueMorphs);\n    hasDefault() {\n        return \"default\" in this;\n    }\n    traverseAllows = (data, ctx) => {\n        if (this.key in data) {\n            // ctx will be undefined if this node isn't context-dependent\n            ctx?.path.push(this.key);\n            const allowed = this.value.traverseAllows(data[this.key], ctx);\n            ctx?.path.pop();\n            return allowed;\n        }\n        return !this.required;\n    };\n    traverseApply = (data, ctx) => {\n        if (this.key in data) {\n            ctx.path.push(this.key);\n            this.value.traverseApply(data[this.key], ctx);\n            ctx.path.pop();\n        }\n        else if (this.hasKind(\"required\"))\n            ctx.error(this.errorContext);\n        else if (this.hasKind(\"optional\") && this.hasDefault())\n            ctx.queueMorphs(this.defaultValueMorphs);\n    };\n    compile(js) {\n        js.if(`${this.serializedKey} in data`, () => js.traverseKey(this.serializedKey, `data${js.prop(this.key)}`, this.value));\n        if (this.hasKind(\"required\")) {\n            js.else(() => {\n                if (js.traversalKind === \"Apply\")\n                    return js.line(`ctx.error(${this.compiledErrorContext})`);\n                else\n                    return js.return(false);\n            });\n        }\n        else if (js.traversalKind === \"Apply\" && \"default\" in this) {\n            js.else(() => js.line(`ctx.queueMorphs(${this.defaultValueMorphsReference})`));\n        }\n        if (js.traversalKind === \"Allows\")\n            js.return(true);\n    }\n}\n","import { implementNode } from \"../shared/implement.js\";\nimport { BaseProp, intersectProps } from \"./prop.js\";\nexport const optionalImplementation = implementNode({\n    kind: \"optional\",\n    hasAssociatedError: false,\n    intersectionIsOpen: true,\n    keys: {\n        key: {},\n        value: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.schema(schema)\n        },\n        default: {\n            preserveUndefined: true\n        }\n    },\n    normalize: schema => schema,\n    defaults: {\n        description: node => `${node.compiledKey}?: ${node.value.description}`\n    },\n    intersections: {\n        optional: intersectProps\n    }\n});\nexport class OptionalNode extends BaseProp {\n    expression = `${this.compiledKey}?: ${this.value.expression}`;\n}\n","import { compileErrorContext, implementNode } from \"../shared/implement.js\";\nimport { BaseProp, intersectProps } from \"./prop.js\";\nexport class RequiredNode extends BaseProp {\n    expression = `${this.compiledKey}: ${this.value.expression}`;\n    errorContext = Object.freeze({\n        code: \"required\",\n        missingValueDescription: this.value.description,\n        relativePath: [this.key]\n    });\n    compiledErrorContext = compileErrorContext(this.errorContext);\n}\nexport const requiredImplementation = implementNode({\n    kind: \"required\",\n    hasAssociatedError: true,\n    intersectionIsOpen: true,\n    keys: {\n        key: {},\n        value: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.schema(schema)\n        }\n    },\n    normalize: schema => schema,\n    defaults: {\n        description: node => `${node.compiledKey}: ${node.value.description}`,\n        expected: ctx => ctx.missingValueDescription,\n        actual: () => \"missing\"\n    },\n    intersections: {\n        required: intersectProps,\n        optional: intersectProps\n    }\n});\n","import { append, throwInternalError, throwParseError } from \"@arktype/util\";\nimport { BaseConstraint } from \"../constraint.js\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { intersectNodes } from \"../shared/intersections.js\";\nconst fixedSequenceKeySchemaDefinition = {\n    child: true,\n    parse: (schema, ctx) => schema.length === 0 ?\n        // empty affixes are omitted. an empty array should therefore\n        // be specified as `{ proto: Array, length: 0 }`\n        undefined\n        : schema.map(element => ctx.$.schema(element))\n};\nexport const sequenceImplementation = implementNode({\n    kind: \"sequence\",\n    hasAssociatedError: false,\n    collapsibleKey: \"variadic\",\n    keys: {\n        prefix: fixedSequenceKeySchemaDefinition,\n        optionals: fixedSequenceKeySchemaDefinition,\n        variadic: {\n            child: true,\n            parse: (schema, ctx) => ctx.$.schema(schema, ctx)\n        },\n        minVariadicLength: {\n            // minVariadicLength is reflected in the id of this node,\n            // but not its IntersectionNode parent since it is superceded by the minLength\n            // node it implies\n            parse: min => (min === 0 ? undefined : min)\n        },\n        postfix: fixedSequenceKeySchemaDefinition\n    },\n    normalize: schema => {\n        if (typeof schema === \"string\")\n            return { variadic: schema };\n        if (\"variadic\" in schema ||\n            \"prefix\" in schema ||\n            \"optionals\" in schema ||\n            \"postfix\" in schema ||\n            \"minVariadicLength\" in schema) {\n            if (schema.postfix?.length) {\n                if (!schema.variadic)\n                    return throwParseError(postfixWithoutVariadicMessage);\n                if (schema.optionals?.length)\n                    return throwParseError(postfixFollowingOptionalMessage);\n            }\n            if (schema.minVariadicLength && !schema.variadic) {\n                return throwParseError(\"minVariadicLength may not be specified without a variadic element\");\n            }\n            return schema;\n        }\n        return { variadic: schema };\n    },\n    reduce: (raw, $) => {\n        let minVariadicLength = raw.minVariadicLength ?? 0;\n        const prefix = raw.prefix?.slice() ?? [];\n        const optional = raw.optionals?.slice() ?? [];\n        const postfix = raw.postfix?.slice() ?? [];\n        if (raw.variadic) {\n            // optional elements equivalent to the variadic parameter are redundant\n            while (optional.at(-1)?.equals(raw.variadic))\n                optional.pop();\n            if (optional.length === 0) {\n                // If there are no optional, normalize prefix\n                // elements adjacent and equivalent to variadic:\n                // \t\t{ variadic: number, prefix: [string, number] }\n                // reduces to:\n                // \t\t{ variadic: number, prefix: [string], minVariadicLength: 1 }\n                while (prefix.at(-1)?.equals(raw.variadic)) {\n                    prefix.pop();\n                    minVariadicLength++;\n                }\n            }\n            // Normalize postfix elements adjacent and equivalent to variadic:\n            // \t\t{ variadic: number, postfix: [number, number, 5] }\n            // reduces to:\n            // \t\t{ variadic: number, postfix: [5], minVariadicLength: 2 }\n            while (postfix[0]?.equals(raw.variadic)) {\n                postfix.shift();\n                minVariadicLength++;\n            }\n        }\n        else if (optional.length === 0) {\n            // if there's no variadic or optional parameters,\n            // postfix can just be appended to prefix\n            prefix.push(...postfix.splice(0));\n        }\n        if (\n        // if any variadic adjacent elements were moved to minVariadicLength\n        minVariadicLength !== raw.minVariadicLength ||\n            // or any postfix elements were moved to prefix\n            (raw.prefix && raw.prefix.length !== prefix.length)) {\n            // reparse the reduced def\n            return $.node(\"sequence\", {\n                ...raw,\n                // empty lists will be omitted during parsing\n                prefix,\n                postfix,\n                optionals: optional,\n                minVariadicLength\n            }, { prereduced: true });\n        }\n    },\n    defaults: {\n        description: node => {\n            if (node.isVariadicOnly)\n                return `${node.variadic.nestableExpression}[]`;\n            const innerDescription = node.tuple\n                .map(element => element.kind === \"optionals\" ? `${element.node.nestableExpression}?`\n                : element.kind === \"variadic\" ?\n                    `...${element.node.nestableExpression}[]`\n                    : element.node.expression)\n                .join(\", \");\n            return `[${innerDescription}]`;\n        }\n    },\n    intersections: {\n        sequence: (l, r, ctx) => {\n            const rootState = _intersectSequences({\n                l: l.tuple,\n                r: r.tuple,\n                disjoint: new Disjoint({}),\n                result: [],\n                fixedVariants: [],\n                ctx\n            });\n            const viableBranches = rootState.disjoint.isEmpty() ?\n                [rootState, ...rootState.fixedVariants]\n                : rootState.fixedVariants;\n            return (viableBranches.length === 0 ? rootState.disjoint\n                : viableBranches.length === 1 ?\n                    ctx.$.node(\"sequence\", sequenceTupleToInner(viableBranches[0].result))\n                    : ctx.$.node(\"union\", viableBranches.map(state => ({\n                        proto: Array,\n                        sequence: sequenceTupleToInner(state.result)\n                    }))));\n        }\n        // exactLength, minLength, and maxLength don't need to be defined\n        // here since impliedSiblings guarantees they will be added\n        // directly to the IntersectionNode parent of the SequenceNode\n        // they exist on\n    }\n});\nexport class SequenceNode extends BaseConstraint {\n    impliedBasis = this.$.keywords.Array.raw;\n    prefix = this.inner.prefix ?? [];\n    optionals = this.inner.optionals ?? [];\n    prevariadic = [...this.prefix, ...this.optionals];\n    postfix = this.inner.postfix ?? [];\n    isVariadicOnly = this.prevariadic.length + this.postfix.length === 0;\n    minVariadicLength = this.inner.minVariadicLength ?? 0;\n    minLength = this.prefix.length + this.minVariadicLength + this.postfix.length;\n    minLengthNode = this.minLength === 0 ? null : this.$.node(\"minLength\", this.minLength);\n    maxLength = this.variadic ? null : this.minLength + this.optionals.length;\n    maxLengthNode = this.maxLength === null ? null : this.$.node(\"maxLength\", this.maxLength);\n    impliedSiblings = this.minLengthNode ?\n        this.maxLengthNode ?\n            [this.minLengthNode, this.maxLengthNode]\n            : [this.minLengthNode]\n        : this.maxLengthNode ? [this.maxLengthNode]\n            : [];\n    childAtIndex(data, index) {\n        if (index < this.prevariadic.length)\n            return this.prevariadic[index];\n        const firstPostfixIndex = data.length - this.postfix.length;\n        if (index >= firstPostfixIndex)\n            return this.postfix[index - firstPostfixIndex];\n        return (this.variadic ??\n            throwInternalError(`Unexpected attempt to access index ${index} on ${this}`));\n    }\n    // minLength/maxLength should be checked by Intersection before either traversal\n    traverseAllows = (data, ctx) => {\n        for (let i = 0; i < data.length; i++)\n            if (!this.childAtIndex(data, i).traverseAllows(data[i], ctx))\n                return false;\n        return true;\n    };\n    traverseApply = (data, ctx) => {\n        for (let i = 0; i < data.length; i++) {\n            ctx.path.push(i);\n            this.childAtIndex(data, i).traverseApply(data[i], ctx);\n            ctx.path.pop();\n        }\n    };\n    // minLength/maxLength compilation should be handled by Intersection\n    compile(js) {\n        this.prefix.forEach((node, i) => js.traverseKey(`${i}`, `data[${i}]`, node));\n        this.optionals.forEach((node, i) => {\n            const dataIndex = `${i + this.prefix.length}`;\n            js.if(`${dataIndex} >= ${js.data}.length`, () => js.traversalKind === \"Allows\" ? js.return(true) : js.return());\n            js.traverseKey(dataIndex, `data[${dataIndex}]`, node);\n        });\n        if (this.variadic) {\n            if (this.postfix.length) {\n                js.const(\"firstPostfixIndex\", `${js.data}.length${this.postfix.length ? `- ${this.postfix.length}` : \"\"}`);\n            }\n            js.for(`i < ${this.postfix.length ? \"firstPostfixIndex\" : \"data.length\"}`, () => js.traverseKey(\"i\", \"data[i]\", this.variadic), this.prevariadic.length);\n            this.postfix.forEach((node, i) => {\n                const keyExpression = `firstPostfixIndex + ${i}`;\n                js.traverseKey(keyExpression, `data[${keyExpression}]`, node);\n            });\n        }\n        if (js.traversalKind === \"Allows\")\n            js.return(true);\n    }\n    _transform(mapper, ctx) {\n        ctx.path.push(this.$.keywords.nonNegativeIntegerString.raw);\n        const result = super._transform(mapper, ctx);\n        ctx.path.pop();\n        return result;\n    }\n    tuple = sequenceInnerToTuple(this.inner);\n    // this depends on tuple so needs to come after it\n    expression = this.description;\n}\nconst sequenceInnerToTuple = (inner) => {\n    const tuple = [];\n    inner.prefix?.forEach(node => tuple.push({ kind: \"prefix\", node }));\n    inner.optionals?.forEach(node => tuple.push({ kind: \"optionals\", node }));\n    if (inner.variadic)\n        tuple.push({ kind: \"variadic\", node: inner.variadic });\n    inner.postfix?.forEach(node => tuple.push({ kind: \"postfix\", node }));\n    return tuple;\n};\nconst sequenceTupleToInner = (tuple) => tuple.reduce((result, node) => {\n    if (node.kind === \"variadic\")\n        result.variadic = node.node;\n    else\n        result[node.kind] = append(result[node.kind], node.node);\n    return result;\n}, {});\nexport const postfixFollowingOptionalMessage = \"A postfix required element cannot follow an optional element\";\nexport const postfixWithoutVariadicMessage = \"A postfix element requires a variadic element\";\nconst _intersectSequences = (s) => {\n    const [lHead, ...lTail] = s.l;\n    const [rHead, ...rTail] = s.r;\n    if (!lHead || !rHead)\n        return s;\n    const lHasPostfix = lTail.at(-1)?.kind === \"postfix\";\n    const rHasPostfix = rTail.at(-1)?.kind === \"postfix\";\n    const kind = lHead.kind === \"prefix\" || rHead.kind === \"prefix\" ? \"prefix\"\n        : lHead.kind === \"optionals\" || rHead.kind === \"optionals\" ?\n            // if either operand has postfix elements, the full-length\n            // intersection can't include optional elements (though they may\n            // exist in some of the fixed length variants)\n            lHasPostfix || rHasPostfix ?\n                \"prefix\"\n                : \"optionals\"\n            : lHead.kind === \"postfix\" || rHead.kind === \"postfix\" ? \"postfix\"\n                : \"variadic\";\n    if (lHead.kind === \"prefix\" && rHead.kind === \"variadic\" && rHasPostfix) {\n        const postfixBranchResult = _intersectSequences({\n            ...s,\n            fixedVariants: [],\n            r: rTail.map(element => ({ ...element, kind: \"prefix\" }))\n        });\n        if (postfixBranchResult.disjoint.isEmpty())\n            s.fixedVariants.push(postfixBranchResult);\n    }\n    else if (rHead.kind === \"prefix\" &&\n        lHead.kind === \"variadic\" &&\n        lHasPostfix) {\n        const postfixBranchResult = _intersectSequences({\n            ...s,\n            fixedVariants: [],\n            l: lTail.map(element => ({ ...element, kind: \"prefix\" }))\n        });\n        if (postfixBranchResult.disjoint.isEmpty())\n            s.fixedVariants.push(postfixBranchResult);\n    }\n    const result = intersectNodes(lHead.node, rHead.node, s.ctx);\n    if (result instanceof Disjoint) {\n        if (kind === \"prefix\" || kind === \"postfix\") {\n            s.disjoint.add(result.withPrefixKey(\n            // TODO: more precise path handling for Disjoints\n            kind === \"prefix\" ? `${s.result.length}` : `-${lTail.length + 1}`));\n            s.result = [...s.result, { kind, node: s.ctx.$.keywords.never.raw }];\n        }\n        else if (kind === \"optionals\") {\n            // if the element result is optional and unsatisfiable, the\n            // intersection can still be satisfied as long as the tuple\n            // ends before the disjoint element would occur\n            return s;\n        }\n        else {\n            // if the element is variadic and unsatisfiable, the intersection\n            // can be satisfied with a fixed length variant including zero\n            // variadic elements\n            return _intersectSequences({\n                ...s,\n                fixedVariants: [],\n                // if there were any optional elements, there will be no postfix elements\n                // so this mapping will never occur (which would be illegal otherwise)\n                l: lTail.map(element => ({ ...element, kind: \"prefix\" })),\n                r: lTail.map(element => ({ ...element, kind: \"prefix\" }))\n            });\n        }\n    }\n    else\n        s.result = [...s.result, { kind, node: result }];\n    const lRemaining = s.l.length;\n    const rRemaining = s.r.length;\n    if (lHead.kind !== \"variadic\" ||\n        (lRemaining >= rRemaining &&\n            (rHead.kind === \"variadic\" || rRemaining === 1)))\n        s.l = lTail;\n    if (rHead.kind !== \"variadic\" ||\n        (rRemaining >= lRemaining &&\n            (lHead.kind === \"variadic\" || lRemaining === 1)))\n        s.r = rTail;\n    return _intersectSequences(s);\n};\n","import { registeredReference } from \"@arktype/util\";\nexport const arrayIndexMatcher = /(?:0|(?:[1-9]\\\\d*))$/;\nexport const arrayIndexMatcherReference = registeredReference(arrayIndexMatcher);\n","var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {\n    var useValue = arguments.length > 2;\n    for (var i = 0; i < initializers.length; i++) {\n        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n    }\n    return useValue ? value : void 0;\n};\nvar __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n    function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n    var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n    var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n    var _, done = false;\n    for (var i = decorators.length - 1; i >= 0; i--) {\n        var context = {};\n        for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n        for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n        context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n        var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n        if (kind === \"accessor\") {\n            if (result === void 0) continue;\n            if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n            if (_ = accept(result.get)) descriptor.get = _;\n            if (_ = accept(result.set)) descriptor.set = _;\n            if (_ = accept(result.init)) initializers.unshift(_);\n        }\n        else if (_ = accept(result)) {\n            if (kind === \"field\") initializers.unshift(_);\n            else descriptor[key] = _;\n        }\n    }\n    if (target) Object.defineProperty(target, contextIn.name, descriptor);\n    done = true;\n};\nimport { append, cached, flatMorph, registeredReference, spliterate } from \"@arktype/util\";\nimport { BaseConstraint, constraintKeyParser, flattenConstraints, intersectConstraints } from \"../constraint.js\";\nimport { Disjoint } from \"../shared/disjoint.js\";\nimport { implementNode } from \"../shared/implement.js\";\nimport { intersectNodesRoot } from \"../shared/intersections.js\";\nimport { makeRootAndArrayPropertiesMutable } from \"../shared/utils.js\";\nimport { arrayIndexMatcher, arrayIndexMatcherReference } from \"./shared.js\";\nlet StructureNode = (() => {\n    let _classSuper = BaseConstraint;\n    let _instanceExtraInitializers = [];\n    let _keyof_decorators;\n    return class StructureNode extends _classSuper {\n        static {\n            const _metadata = typeof Symbol === \"function\" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;\n            _keyof_decorators = [cached];\n            __esDecorate(this, null, _keyof_decorators, { kind: \"method\", name: \"keyof\", static: false, private: false, access: { has: obj => \"keyof\" in obj, get: obj => obj.keyof }, metadata: _metadata }, null, _instanceExtraInitializers);\n            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });\n        }\n        impliedBasis = (__runInitializers(this, _instanceExtraInitializers), this.$.keywords.object.raw);\n        impliedSiblings = this.children.flatMap(n => n.impliedSiblings ?? []);\n        props = this.required ?\n            this.optional ?\n                [...this.required, ...this.optional]\n                : this.required\n            : this.optional ?? [];\n        propsByKey = flatMorph(this.props, (i, node) => [node.key, node]);\n        propsByKeyReference = registeredReference(this.propsByKey);\n        expression = structuralExpression(this);\n        requiredLiteralKeys = this.required?.map(node => node.key) ?? [];\n        optionalLiteralKeys = this.optional?.map(node => node.key) ?? [];\n        literalKeys = [\n            ...this.requiredLiteralKeys,\n            ...this.optionalLiteralKeys\n        ];\n        keyof() {\n            let branches = this.$.units(this.literalKeys).branches;\n            this.index?.forEach(({ signature: index }) => {\n                branches = branches.concat(index.branches);\n            });\n            return this.$.node(\"union\", branches);\n        }\n        exhaustive = this.undeclared !== undefined || this.index !== undefined;\n        omit(...keys) {\n            return this.$.node(\"structure\", omitFromInner(this.inner, keys));\n        }\n        merge(r) {\n            const inner = makeRootAndArrayPropertiesMutable(omitFromInner(this.inner, [r.keyof()]));\n            if (r.required)\n                inner.required = append(inner.required, r.required);\n            if (r.optional)\n                inner.optional = append(inner.optional, r.optional);\n            if (r.index)\n                inner.index = append(inner.index, r.index);\n            if (r.sequence)\n                inner.sequence = r.sequence;\n            if (r.undeclared)\n                inner.undeclared = r.undeclared;\n            else\n                delete inner.undeclared;\n            return this.$.node(\"structure\", inner);\n        }\n        traverseAllows = (data, ctx) => this._traverse(\"Allows\", data, ctx);\n        traverseApply = (data, ctx) => this._traverse(\"Apply\", data, ctx);\n        _traverse = (traversalKind, data, ctx) => {\n            const errorCount = ctx?.currentErrorCount ?? 0;\n            for (let i = 0; i < this.props.length; i++) {\n                if (traversalKind === \"Allows\") {\n                    if (!this.props[i].traverseAllows(data, ctx))\n                        return false;\n                }\n                else {\n                    this.props[i].traverseApply(data, ctx);\n                    if (ctx.failFast && ctx.currentErrorCount > errorCount)\n                        return false;\n                }\n            }\n            if (this.sequence) {\n                if (traversalKind === \"Allows\") {\n                    if (!this.sequence.traverseAllows(data, ctx))\n                        return false;\n                }\n                else {\n                    this.sequence.traverseApply(data, ctx);\n                    if (ctx.failFast && ctx.currentErrorCount > errorCount)\n                        return false;\n                }\n            }\n            if (!this.exhaustive)\n                return true;\n            const keys = Object.keys(data);\n            keys.push(...Object.getOwnPropertySymbols(data));\n            for (let i = 0; i < keys.length; i++) {\n                const k = keys[i];\n                let matched = false;\n                if (this.index) {\n                    for (const node of this.index) {\n                        if (node.signature.traverseAllows(k, ctx)) {\n                            if (traversalKind === \"Allows\") {\n                                ctx?.path.push(k);\n                                const result = node.value.traverseAllows(data[k], ctx);\n                                ctx?.path.pop();\n                                if (!result)\n                                    return false;\n                            }\n                            else {\n                                ctx.path.push(k);\n                                node.value.traverseApply(data[k], ctx);\n                                ctx.path.pop();\n                                if (ctx.failFast && ctx.currentErrorCount > errorCount)\n                                    return false;\n                            }\n                            matched = true;\n                        }\n                    }\n                }\n                if (this.undeclared) {\n                    matched ||= k in this.propsByKey;\n                    matched ||=\n                        this.sequence !== undefined &&\n                            typeof k === \"string\" &&\n                            arrayIndexMatcher.test(k);\n                    if (!matched) {\n                        if (traversalKind === \"Allows\")\n                            return false;\n                        if (this.undeclared === \"reject\")\n                            ctx.error({ expected: \"removed\", actual: null, relativePath: [k] });\n                        else {\n                            ctx.queueMorphs([\n                                data => {\n                                    delete data[k];\n                                    return data;\n                                }\n                            ]);\n                        }\n                        if (ctx.failFast)\n                            return false;\n                    }\n                }\n                ctx?.path.pop();\n            }\n            return true;\n        };\n        compile(js) {\n            if (js.traversalKind === \"Apply\")\n                js.initializeErrorCount();\n            this.props.forEach(prop => {\n                js.check(prop);\n                if (js.traversalKind === \"Apply\")\n                    js.returnIfFailFast();\n            });\n            if (this.sequence) {\n                js.check(this.sequence);\n                if (js.traversalKind === \"Apply\")\n                    js.returnIfFailFast();\n            }\n            if (this.exhaustive) {\n                js.const(\"keys\", \"Object.keys(data)\");\n                js.line(\"keys.push(...Object.getOwnPropertySymbols(data))\");\n                js.for(\"i < keys.length\", () => this.compileExhaustiveEntry(js));\n            }\n            if (js.traversalKind === \"Allows\")\n                js.return(true);\n        }\n        compileExhaustiveEntry(js) {\n            js.const(\"k\", \"keys[i]\");\n            if (this.undeclared)\n                js.let(\"matched\", false);\n            this.index?.forEach(node => {\n                js.if(`${js.invoke(node.signature, { arg: \"k\", kind: \"Allows\" })}`, () => {\n                    js.traverseKey(\"k\", \"data[k]\", node.value);\n                    if (this.undeclared)\n                        js.set(\"matched\", true);\n                    return js;\n                });\n            });\n            if (this.undeclared) {\n                if (this.props?.length !== 0)\n                    js.line(`matched ||= k in ${this.propsByKeyReference}`);\n                if (this.sequence) {\n                    js.line(`matched ||= typeof k === \"string\" && ${arrayIndexMatcherReference}.test(k)`);\n                }\n                js.if(\"!matched\", () => {\n                    if (js.traversalKind === \"Allows\")\n                        return js.return(false);\n                    return this.undeclared === \"reject\" ?\n                        js\n                            .line(`ctx.error({ expected: \"removed\", actual: null, relativePath: [k] })`)\n                            .if(\"ctx.failFast\", () => js.return())\n                        : js.line(`ctx.queueMorphs([data => { delete data[k]; return data }])`);\n                });\n            }\n            return js;\n        }\n    };\n})();\nexport { StructureNode };\nconst omitFromInner = (inner, keys) => {\n    const result = { ...inner };\n    keys.forEach(k => {\n        if (result.required) {\n            result.required = result.required.filter(b => typeof k === \"function\" ? !k.allows(b.key) : k !== b.key);\n        }\n        if (result.optional) {\n            result.optional = result.optional.filter(b => typeof k === \"function\" ? !k.allows(b.key) : k !== b.key);\n        }\n        if (result.index && typeof k === \"function\") {\n            // we only have to filter index nodes if the input was a node, as\n            // literal keys should never subsume an index\n            result.index = result.index.filter(n => !n.signature.extends(k));\n        }\n    });\n    return result;\n};\nconst createStructuralWriter = (childStringProp) => (node) => {\n    if (node.props.length || node.index) {\n        const parts = node.index?.map(String) ?? [];\n        node.props.forEach(node => parts.push(node[childStringProp]));\n        if (node.undeclared)\n            parts.push(`+ (undeclared): ${node.undeclared}`);\n        const objectLiteralDescription = `{ ${parts.join(\", \")} }`;\n        return node.sequence ?\n            `${objectLiteralDescription} & ${node.sequence.description}`\n            : objectLiteralDescription;\n    }\n    return node.sequence?.description ?? \"{}\";\n};\nconst structuralDescription = createStructuralWriter(\"description\");\nconst structuralExpression = createStructuralWriter(\"expression\");\nexport const structureImplementation = implementNode({\n    kind: \"structure\",\n    hasAssociatedError: false,\n    normalize: schema => schema,\n    keys: {\n        required: {\n            child: true,\n            parse: constraintKeyParser(\"required\")\n        },\n        optional: {\n            child: true,\n            parse: constraintKeyParser(\"optional\")\n        },\n        index: {\n            child: true,\n            parse: constraintKeyParser(\"index\")\n        },\n        sequence: {\n            child: true,\n            parse: constraintKeyParser(\"sequence\")\n        },\n        undeclared: {\n            parse: behavior => (behavior === \"ignore\" ? undefined : behavior)\n        }\n    },\n    defaults: {\n        description: structuralDescription\n    },\n    intersections: {\n        structure: (l, r, ctx) => {\n            const lInner = { ...l.inner };\n            const rInner = { ...r.inner };\n            if (l.undeclared) {\n                const lKey = l.keyof();\n                const disjointRKeys = r.requiredLiteralKeys.filter(k => !lKey.allows(k));\n                if (disjointRKeys.length) {\n                    return Disjoint.from(\"presence\", ctx.$.keywords.never.raw, r.propsByKey[disjointRKeys[0]].value).withPrefixKey(disjointRKeys[0]);\n                }\n                if (rInner.optional)\n                    rInner.optional = rInner.optional.filter(n => lKey.allows(n.key));\n                if (rInner.index) {\n                    rInner.index = rInner.index.flatMap(n => {\n                        if (n.signature.extends(lKey))\n                            return n;\n                        const indexOverlap = intersectNodesRoot(lKey, n.signature, ctx.$);\n                        if (indexOverlap instanceof Disjoint)\n                            return [];\n                        const normalized = normalizeIndex(indexOverlap, n.value, ctx.$);\n                        if (normalized.required) {\n                            rInner.required =\n                                rInner.required ?\n                                    [...rInner.required, ...normalized.required]\n                                    : normalized.required;\n                        }\n                        return normalized.index ?? [];\n                    });\n                }\n            }\n            if (r.undeclared) {\n                const rKey = r.keyof();\n                const disjointLKeys = l.requiredLiteralKeys.filter(k => !rKey.allows(k));\n                if (disjointLKeys.length) {\n                    return Disjoint.from(\"presence\", l.propsByKey[disjointLKeys[0]].value, ctx.$.keywords.never.raw).withPrefixKey(disjointLKeys[0]);\n                }\n                if (lInner.optional)\n                    lInner.optional = lInner.optional.filter(n => rKey.allows(n.key));\n                if (lInner.index) {\n                    lInner.index = lInner.index.flatMap(n => {\n                        if (n.signature.extends(rKey))\n                            return n;\n                        const indexOverlap = intersectNodesRoot(rKey, n.signature, ctx.$);\n                        if (indexOverlap instanceof Disjoint)\n                            return [];\n                        const normalized = normalizeIndex(indexOverlap, n.value, ctx.$);\n                        if (normalized.required) {\n                            lInner.required =\n                                lInner.required ?\n                                    [...lInner.required, ...normalized.required]\n                                    : normalized.required;\n                        }\n                        return normalized.index ?? [];\n                    });\n                }\n            }\n            const baseInner = {};\n            if (l.undeclared || r.undeclared) {\n                baseInner.undeclared =\n                    l.undeclared === \"reject\" || r.undeclared === \"reject\" ?\n                        \"reject\"\n                        : \"delete\";\n            }\n            return intersectConstraints({\n                kind: \"structure\",\n                baseInner,\n                l: flattenConstraints(lInner),\n                r: flattenConstraints(rInner),\n                roots: [],\n                ctx\n            });\n        }\n    }\n});\n/** extract enumerable named props from an index signature */\nexport const normalizeIndex = (signature, value, $) => {\n    const [enumerableBranches, nonEnumerableBranches] = spliterate(signature.branches, (k) => k.hasKind(\"unit\"));\n    if (!enumerableBranches.length)\n        return { index: $.node(\"index\", { signature, value }) };\n    const normalized = {};\n    normalized.required = enumerableBranches.map(n => $.node(\"required\", { key: n.unit, value }));\n    if (nonEnumerableBranches.length) {\n        normalized.index = $.node(\"index\", {\n            signature: nonEnumerableBranches,\n            value\n        });\n    }\n    return normalized;\n};\n","import { PredicateNode, predicateImplementation } from \"./predicate.js\";\nimport { DivisorNode, divisorImplementation } from \"./refinements/divisor.js\";\nimport { boundClassesByKind, boundImplementationsByKind } from \"./refinements/kinds.js\";\nimport { RegexNode, regexImplementation } from \"./refinements/regex.js\";\nimport { AliasNode, aliasImplementation } from \"./roots/alias.js\";\nimport { DomainNode, domainImplementation } from \"./roots/domain.js\";\nimport { IntersectionNode, intersectionImplementation } from \"./roots/intersection.js\";\nimport { MorphNode, morphImplementation } from \"./roots/morph.js\";\nimport { ProtoNode, protoImplementation } from \"./roots/proto.js\";\nimport { UnionNode, unionImplementation } from \"./roots/union.js\";\nimport { UnitNode, unitImplementation } from \"./roots/unit.js\";\nimport { IndexNode, indexImplementation } from \"./structure/index.js\";\nimport { OptionalNode, optionalImplementation } from \"./structure/optional.js\";\nimport { RequiredNode, requiredImplementation } from \"./structure/required.js\";\nimport { SequenceNode, sequenceImplementation } from \"./structure/sequence.js\";\nimport { StructureNode, structureImplementation } from \"./structure/structure.js\";\nexport const nodeImplementationsByKind = {\n    ...boundImplementationsByKind,\n    alias: aliasImplementation,\n    domain: domainImplementation,\n    unit: unitImplementation,\n    proto: protoImplementation,\n    union: unionImplementation,\n    morph: morphImplementation,\n    intersection: intersectionImplementation,\n    divisor: divisorImplementation,\n    regex: regexImplementation,\n    predicate: predicateImplementation,\n    required: requiredImplementation,\n    optional: optionalImplementation,\n    index: indexImplementation,\n    sequence: sequenceImplementation,\n    structure: structureImplementation\n};\nexport const nodeClassesByKind = {\n    ...boundClassesByKind,\n    alias: AliasNode,\n    domain: DomainNode,\n    unit: UnitNode,\n    proto: ProtoNode,\n    union: UnionNode,\n    morph: MorphNode,\n    intersection: IntersectionNode,\n    divisor: DivisorNode,\n    regex: RegexNode,\n    predicate: PredicateNode,\n    required: RequiredNode,\n    optional: OptionalNode,\n    index: IndexNode,\n    sequence: SequenceNode,\n    structure: StructureNode\n};\n","import { DynamicBase } from \"@arktype/util\";\nimport { arkKind } from \"./shared/utils.js\";\nexport class RootModule extends DynamicBase {\n    // ensure `[arkKind]` is non-enumerable so it doesn't get spread on import/export\n    get [arkKind]() {\n        return \"module\";\n    }\n}\nexport const SchemaModule = RootModule;\n","import { entriesOf, hasDomain, isArray, printable, throwParseError, unset } from \"@arktype/util\";\nimport { nodeClassesByKind, nodeImplementationsByKind } from \"./kinds.js\";\nimport { Disjoint } from \"./shared/disjoint.js\";\nimport { constraintKeys, defaultValueSerializer, isNodeKind, precedenceOfKind } from \"./shared/implement.js\";\nimport { hasArkKind } from \"./shared/utils.js\";\nconst baseKeys = {\n    description: { meta: true }\n};\nexport const schemaKindOf = (schema, allowedKinds) => {\n    const kind = discriminateRootKind(schema);\n    if (allowedKinds && !allowedKinds.includes(kind)) {\n        return throwParseError(`Root of kind ${kind} should be one of ${allowedKinds}`);\n    }\n    return kind;\n};\nconst discriminateRootKind = (schema) => {\n    switch (typeof schema) {\n        case \"string\":\n            return schema[0] === \"$\" ? \"alias\" : \"domain\";\n        case \"function\":\n            return hasArkKind(schema, \"root\") ? schema.kind : \"proto\";\n        case \"object\": {\n            // throw at end of function\n            if (schema === null)\n                break;\n            if (\"morphs\" in schema)\n                return \"morph\";\n            if (\"branches\" in schema || isArray(schema))\n                return \"union\";\n            if (\"unit\" in schema)\n                return \"unit\";\n            if (\"alias\" in schema)\n                return \"alias\";\n            const schemaKeys = Object.keys(schema);\n            if (schemaKeys.length === 0 || schemaKeys.some(k => k in constraintKeys))\n                return \"intersection\";\n            if (\"proto\" in schema)\n                return \"proto\";\n            if (\"domain\" in schema)\n                return \"domain\";\n        }\n    }\n    return throwParseError(`${printable(schema)} is not a valid type schema`);\n};\nconst nodeCache = {};\nconst serializeListableChild = (listableNode) => isArray(listableNode) ?\n    listableNode.map(node => node.collapsibleJson)\n    : listableNode.collapsibleJson;\nexport const parseNode = (kind, ctx) => {\n    const impl = nodeImplementationsByKind[kind];\n    const inner = {};\n    // ensure node entries are parsed in order of precedence, with non-children\n    // parsed first\n    const schemaEntries = entriesOf(ctx.schema).sort(([lKey], [rKey]) => isNodeKind(lKey) ?\n        isNodeKind(rKey) ? precedenceOfKind(lKey) - precedenceOfKind(rKey)\n            : 1\n        : isNodeKind(rKey) ? -1\n            : lKey < rKey ? -1\n                : 1);\n    const children = [];\n    for (const entry of schemaEntries) {\n        const k = entry[0];\n        const keyImpl = impl.keys[k] ?? baseKeys[k];\n        if (!keyImpl)\n            return throwParseError(`Key ${k} is not valid on ${kind} schema`);\n        const v = keyImpl.parse ? keyImpl.parse(entry[1], ctx) : entry[1];\n        if (v !== unset && (v !== undefined || keyImpl.preserveUndefined))\n            inner[k] = v;\n    }\n    const entries = entriesOf(inner);\n    let json = {};\n    let typeJson = {};\n    entries.forEach(([k, v]) => {\n        const listableNode = v;\n        const keyImpl = impl.keys[k] ?? baseKeys[k];\n        const serialize = keyImpl.serialize ??\n            (keyImpl.child ? serializeListableChild : defaultValueSerializer);\n        json[k] = serialize(listableNode);\n        if (keyImpl.child) {\n            if (isArray(listableNode))\n                children.push(...listableNode);\n            else\n                children.push(listableNode);\n        }\n        if (!keyImpl.meta)\n            typeJson[k] = json[k];\n    });\n    if (impl.finalizeJson) {\n        json = impl.finalizeJson(json);\n        typeJson = impl.finalizeJson(typeJson);\n    }\n    let collapsibleJson = json;\n    const collapsibleKeys = Object.keys(collapsibleJson);\n    if (collapsibleKeys.length === 1 &&\n        collapsibleKeys[0] === impl.collapsibleKey) {\n        collapsibleJson = collapsibleJson[impl.collapsibleKey];\n        if (\n        // if the collapsibleJson is still an object\n        hasDomain(collapsibleJson, \"object\") &&\n            // and the JSON did not include any implied keys\n            Object.keys(json).length === 1) {\n            // we can replace it with its collapsed value\n            json = collapsibleJson;\n            typeJson = collapsibleJson;\n        }\n    }\n    const innerHash = JSON.stringify({ kind, ...json });\n    if (ctx.reduceTo) {\n        nodeCache[innerHash] = ctx.reduceTo;\n        return ctx.reduceTo;\n    }\n    const typeHash = JSON.stringify({ kind, ...typeJson });\n    if (impl.reduce && !ctx.prereduced) {\n        const reduced = impl.reduce(inner, ctx.$);\n        if (reduced) {\n            if (reduced instanceof Disjoint)\n                return reduced.throw();\n            // if we're defining the resolution of an alias and the result is\n            // reduced to another node, add the alias to that node if it doesn't\n            // already have one.\n            if (ctx.alias)\n                reduced.alias ??= ctx.alias;\n            // we can't cache this reduction for now in case the reduction involved\n            // impliedSiblings\n            return reduced;\n        }\n    }\n    // we have to wait until after reduction to return a cached entry,\n    // since reduction can add impliedSiblings\n    if (nodeCache[innerHash])\n        return nodeCache[innerHash];\n    const attachments = {\n        id: ctx.id,\n        kind,\n        impl,\n        inner,\n        entries,\n        json: json,\n        typeJson: typeJson,\n        collapsibleJson: collapsibleJson,\n        children,\n        innerHash,\n        typeHash,\n        $: ctx.$\n    };\n    if (ctx.alias)\n        attachments.alias = ctx.alias;\n    for (const k in inner) {\n        if (k !== \"description\" && k !== \"in\" && k !== \"out\")\n            attachments[k] = inner[k];\n    }\n    const node = new nodeClassesByKind[kind](attachments);\n    nodeCache[innerHash] = node;\n    return node;\n};\n","import { CompiledFunction } from \"@arktype/util\";\nexport class NodeCompiler extends CompiledFunction {\n    traversalKind;\n    path = [];\n    discriminants = [];\n    constructor(traversalKind) {\n        super(\"data\", \"ctx\");\n        this.traversalKind = traversalKind;\n    }\n    invoke(node, opts) {\n        const arg = opts?.arg ?? this.data;\n        if (this.requiresContextFor(node))\n            return `${this.reference(node, opts)}(${arg}, ${this.ctx})`;\n        return `${this.reference(node, opts)}(${arg})`;\n    }\n    reference(node, opts) {\n        const invokedKind = opts?.kind ?? this.traversalKind;\n        const base = `this.${node.id}${invokedKind}`;\n        return opts?.bind ? `${base}.bind(${opts?.bind})` : base;\n    }\n    requiresContextFor(node) {\n        return this.traversalKind === \"Apply\" || node.allowsRequiresContext;\n    }\n    initializeErrorCount() {\n        return this.const(\"errorCount\", \"ctx.currentErrorCount\");\n    }\n    returnIfFail() {\n        return this.if(\"ctx.currentErrorCount > errorCount\", () => this.return());\n    }\n    returnIfFailFast() {\n        return this.if(\"ctx.failFast && ctx.currentErrorCount > errorCount\", () => this.return());\n    }\n    traverseKey(keyExpression, accessExpression, node) {\n        const requiresContext = this.requiresContextFor(node);\n        if (requiresContext)\n            this.line(`${this.ctx}.path.push(${keyExpression})`);\n        this.check(node, {\n            arg: accessExpression\n        });\n        if (requiresContext)\n            this.line(`${this.ctx}.path.pop()`);\n        return this;\n    }\n    check(node, opts) {\n        return this.traversalKind === \"Allows\" ?\n            this.if(`!${this.invoke(node, opts)}`, () => this.return(false))\n            : this.line(this.invoke(node, opts));\n    }\n    writeMethod(name) {\n        return `${name}(${this.argNames.join(\", \")}){\\n${this.body}    }\\n`;\n    }\n}\n","var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {\n    var useValue = arguments.length > 2;\n    for (var i = 0; i < initializers.length; i++) {\n        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n    }\n    return useValue ? value : void 0;\n};\nvar __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n    function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n    var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n    var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n    var _, done = false;\n    for (var i = decorators.length - 1; i >= 0; i--) {\n        var context = {};\n        for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n        for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n        context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n        var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n        if (kind === \"accessor\") {\n            if (result === void 0) continue;\n            if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n            if (_ = accept(result.get)) descriptor.get = _;\n            if (_ = accept(result.set)) descriptor.set = _;\n            if (_ = accept(result.init)) initializers.unshift(_);\n        }\n        else if (_ = accept(result)) {\n            if (kind === \"field\") initializers.unshift(_);\n            else descriptor[key] = _;\n        }\n    }\n    if (target) Object.defineProperty(target, contextIn.name, descriptor);\n    done = true;\n};\nimport { CompiledFunction, DynamicBase, bound, envHasCsp, flatMorph, hasDomain, isArray, printable, throwInternalError, throwParseError } from \"@arktype/util\";\nimport { globalConfig, mergeConfigs } from \"./config.js\";\nimport { validateUninstantiatedGenericNode } from \"./generic.js\";\nimport { nodeImplementationsByKind } from \"./kinds.js\";\nimport { RootModule } from \"./module.js\";\nimport { parseNode, schemaKindOf } from \"./parse.js\";\nimport { normalizeAliasSchema } from \"./roots/alias.js\";\nimport { NodeCompiler } from \"./shared/compile.js\";\nimport { arkKind, hasArkKind, isNode } from \"./shared/utils.js\";\nexport const defaultConfig = Object.assign(flatMorph(nodeImplementationsByKind, (kind, implementation) => [\n    kind,\n    implementation.defaults\n]), {\n    jitless: envHasCsp(),\n    registerKeywords: false,\n    prereducedAliases: false\n});\nconst nonInheritedKeys = [\n    \"registerKeywords\",\n    \"prereducedAliases\"\n];\nexport const extendConfig = (base, extension) => {\n    if (!extension)\n        return base;\n    const result = mergeConfigs(base, extension);\n    nonInheritedKeys.forEach(k => {\n        if (!(k in extension))\n            delete result[k];\n    });\n    return result;\n};\nexport const resolveConfig = (config) => extendConfig(extendConfig(defaultConfig, globalConfig), config);\nconst schemaBranchesOf = (schema) => isArray(schema) ? schema\n    : \"branches\" in schema && isArray(schema.branches) ? schema.branches\n        : undefined;\nconst throwMismatchedNodeRootError = (expected, actual) => throwParseError(`Node of kind ${actual} is not valid as a ${expected} definition`);\nexport const writeDuplicateAliasError = (alias) => `#${alias} duplicates public alias ${alias}`;\nconst nodeCountsByPrefix = {};\nconst nodesById = {};\nlet scopeCount = 0;\nconst scopesById = {};\nlet RawRootScope = (() => {\n    let _instanceExtraInitializers = [];\n    let _schema_decorators;\n    let _defineRoot_decorators;\n    let _units_decorators;\n    return class RawRootScope {\n        static {\n            const _metadata = typeof Symbol === \"function\" && Symbol.metadata ? Object.create(null) : void 0;\n            _schema_decorators = [bound];\n            _defineRoot_decorators = [bound];\n            _units_decorators = [bound];\n            __esDecorate(this, null, _schema_decorators, { kind: \"method\", name: \"schema\", static: false, private: false, access: { has: obj => \"schema\" in obj, get: obj => obj.schema }, metadata: _metadata }, null, _instanceExtraInitializers);\n            __esDecorate(this, null, _defineRoot_decorators, { kind: \"method\", name: \"defineRoot\", static: false, private: false, access: { has: obj => \"defineRoot\" in obj, get: obj => obj.defineRoot }, metadata: _metadata }, null, _instanceExtraInitializers);\n            __esDecorate(this, null, _units_decorators, { kind: \"method\", name: \"units\", static: false, private: false, access: { has: obj => \"units\" in obj, get: obj => obj.units }, metadata: _metadata }, null, _instanceExtraInitializers);\n            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });\n        }\n        config = __runInitializers(this, _instanceExtraInitializers);\n        resolvedConfig;\n        id = `$${++scopeCount}`;\n        [arkKind] = \"scope\";\n        referencesById = {};\n        references = [];\n        resolutions = {};\n        json = {};\n        exportedNames;\n        aliases = {};\n        resolved = false;\n        // these allow builtin types to be accessed during parsing without cyclic imports\n        // they are populated as each scope is parsed with `registerKeywords` in its config\n        /** @internal */\n        static keywords = {};\n        /** @internal */\n        get keywords() {\n            return RawRootScope.keywords;\n        }\n        static ambient;\n        get ambient() {\n            return this.constructor.ambient;\n        }\n        constructor(\n        /** The set of names defined at the root-level of the scope mapped to their\n         * corresponding definitions.**/\n        def, config) {\n            this.config = config ?? {};\n            this.resolvedConfig = resolveConfig(config);\n            this.exportedNames = Object.keys(def).filter(k => {\n                if (k[0] === \"#\") {\n                    const name = k.slice(1);\n                    if (name in this.aliases)\n                        throwParseError(writeDuplicateAliasError(name));\n                    this.aliases[name] = def[k];\n                    return false;\n                }\n                if (k in this.aliases)\n                    throwParseError(writeDuplicateAliasError(k));\n                this.aliases[k] = def[k];\n                return true;\n            });\n            if (this.ambient) {\n                // ensure exportedResolutions is populated\n                this.ambient.export();\n                // TODO: generics and modules\n                this.resolutions = flatMorph(this.ambient.resolutions, (alias, resolution) => [\n                    alias,\n                    hasArkKind(resolution, \"root\") ?\n                        resolution.bindScope(this)\n                        : resolution\n                ]);\n            }\n            scopesById[this.id] = this;\n        }\n        get raw() {\n            return this;\n        }\n        schema(def, opts) {\n            return this.node(schemaKindOf(def), def, opts);\n        }\n        defineRoot(def) {\n            return def;\n        }\n        units(values, opts) {\n            const uniqueValues = [];\n            for (const value of values)\n                if (!uniqueValues.includes(value))\n                    uniqueValues.push(value);\n            const branches = uniqueValues.map(unit => this.node(\"unit\", { unit }, opts));\n            return this.node(\"union\", branches, {\n                ...opts,\n                prereduced: true\n            });\n        }\n        lazyResolutions = [];\n        lazilyResolve(resolve, syntheticAlias) {\n            if (!syntheticAlias) {\n                nodeCountsByPrefix.synthetic ??= 0;\n                syntheticAlias = `synthetic${++nodeCountsByPrefix.synthetic}`;\n            }\n            const node = this.node(\"alias\", {\n                alias: syntheticAlias,\n                resolve\n            }, { prereduced: true });\n            this.lazyResolutions.push(node);\n            return node;\n        }\n        node = (((kinds, nodeSchema, opts) => {\n            let kind = typeof kinds === \"string\" ? kinds : schemaKindOf(nodeSchema, kinds);\n            let schema = nodeSchema;\n            if (isNode(schema) && schema.kind === kind)\n                return schema.bindScope(this);\n            if (kind === \"alias\" && !opts?.prereduced) {\n                const resolution = this.resolveRoot(normalizeAliasSchema(schema).alias);\n                schema = resolution;\n                kind = resolution.kind;\n            }\n            else if (kind === \"union\" && hasDomain(schema, \"object\")) {\n                const branches = schemaBranchesOf(schema);\n                if (branches?.length === 1) {\n                    schema = branches[0];\n                    kind = schemaKindOf(schema);\n                }\n            }\n            const impl = nodeImplementationsByKind[kind];\n            const normalizedSchema = impl.normalize?.(schema) ?? schema;\n            // check again after normalization in case a node is a valid collapsed\n            // schema for the kind (e.g. sequence can collapse to element accepting a Node)\n            if (isNode(normalizedSchema)) {\n                return normalizedSchema.kind === kind ?\n                    normalizedSchema.bindScope(this)\n                    : throwMismatchedNodeRootError(kind, normalizedSchema.kind);\n            }\n            const prefix = opts?.alias ?? kind;\n            nodeCountsByPrefix[prefix] ??= 0;\n            const id = `${prefix}${++nodeCountsByPrefix[prefix]}`;\n            const node = parseNode(kind, {\n                ...opts,\n                id,\n                $: this,\n                schema: normalizedSchema\n            }).bindScope(this);\n            nodesById[id] = node;\n            if (this.resolved) {\n                // this node was not part of the original scope, so compile an anonymous scope\n                // including only its references\n                if (!this.resolvedConfig.jitless)\n                    bindCompiledScope(node.references);\n            }\n            else {\n                // we're still parsing the scope itself, so defer compilation but\n                // add the node as a reference\n                Object.assign(this.referencesById, node.referencesById);\n            }\n            return node;\n        })).bind(this);\n        parseRoot(def, opts) {\n            return this.schema(def, opts);\n        }\n        resolveRoot(name) {\n            return (this.maybeResolveRoot(name) ??\n                throwParseError(writeUnresolvableMessage(name)));\n        }\n        maybeResolveRoot(name) {\n            const result = this.maybeResolveGenericOrRoot(name);\n            if (hasArkKind(result, \"generic\"))\n                return;\n            return result;\n        }\n        maybeResolveGenericOrRoot(name) {\n            const resolution = this.maybeResolve(name);\n            if (hasArkKind(resolution, \"module\"))\n                return throwParseError(writeMissingSubmoduleAccessMessage(name));\n            return resolution;\n        }\n        preparseRoot(def) {\n            return def;\n        }\n        maybeResolve(name) {\n            const resolution = this.maybeShallowResolve(name);\n            return typeof resolution === \"string\" ?\n                this.node(\"alias\", { alias: resolution }, { prereduced: true })\n                : resolution;\n        }\n        maybeShallowResolve(name) {\n            const cached = this.resolutions[name];\n            if (cached)\n                return cached;\n            let def = this.aliases[name];\n            if (!def)\n                return this.maybeResolveSubalias(name);\n            def = this.preparseRoot(def);\n            if (hasArkKind(def, \"generic\"))\n                return (this.resolutions[name] = validateUninstantiatedGenericNode(def));\n            if (hasArkKind(def, \"module\"))\n                return (this.resolutions[name] = def);\n            this.resolutions[name] = name;\n            return (this.resolutions[name] = this.parseRoot(def));\n        }\n        /** If name is a valid reference to a submodule alias, return its resolution  */\n        maybeResolveSubalias(name) {\n            return resolveSubalias(this.aliases, name);\n        }\n        import(...names) {\n            return new RootModule(flatMorph(this.export(...names), (alias, value) => [\n                `#${alias}`,\n                value\n            ]));\n        }\n        _exportedResolutions;\n        _exports;\n        export(...names) {\n            if (!this._exports) {\n                this._exports = {};\n                for (const name of this.exportedNames)\n                    this._exports[name] = this.maybeResolve(name);\n                this.lazyResolutions.forEach(node => node.resolution);\n                this._exportedResolutions = resolutionsOfModule(this, this._exports);\n                // TODO: add generic json\n                Object.assign(this.json, flatMorph(this._exportedResolutions, (k, v) => hasArkKind(v, \"root\") ? [k, v.json] : []));\n                Object.assign(this.resolutions, this._exportedResolutions);\n                if (this.config.registerKeywords)\n                    Object.assign(RawRootScope.keywords, this._exportedResolutions);\n                this.references = Object.values(this.referencesById);\n                if (!this.resolvedConfig.jitless)\n                    bindCompiledScope(this.references);\n                this.resolved = true;\n            }\n            const namesToExport = names.length ? names : this.exportedNames;\n            return new RootModule(flatMorph(namesToExport, (_, name) => [\n                name,\n                this._exports[name]\n            ]));\n        }\n        resolve(name) {\n            return this.export()[name];\n        }\n    };\n})();\nexport { RawRootScope };\nconst resolveSubalias = (base, name) => {\n    const dotIndex = name.indexOf(\".\");\n    if (dotIndex === -1)\n        return;\n    const dotPrefix = name.slice(0, dotIndex);\n    const prefixSchema = base[dotPrefix];\n    // if the name includes \".\", but the prefix is not an alias, it\n    // might be something like a decimal literal, so just fall through to return\n    if (prefixSchema === undefined)\n        return;\n    if (!hasArkKind(prefixSchema, \"module\"))\n        return throwParseError(writeNonSubmoduleDotMessage(dotPrefix));\n    const subalias = name.slice(dotIndex + 1);\n    const resolution = prefixSchema[subalias];\n    // if the first part of name is a submodule but the suffix is\n    // unresolvable, we can throw immediately\n    if (resolution === undefined) {\n        if (hasArkKind(resolution, \"module\"))\n            return resolveSubalias(resolution, subalias);\n        return throwParseError(writeUnresolvableMessage(name));\n    }\n    if (hasArkKind(resolution, \"root\") || hasArkKind(resolution, \"generic\"))\n        return resolution;\n    throwInternalError(`Unexpected resolution for alias '${name}': ${printable(resolution)}`);\n};\nexport const schemaScope = (aliases, config) => new RootScope(aliases, config);\nexport const RootScope = RawRootScope;\nexport const root = new RootScope({});\nexport const schema = root.schema;\nexport const node = root.node;\nexport const defineRoot = root.defineRoot;\nexport const units = root.units;\nexport const rawRoot = root.raw.schema;\nexport const rawNode = root.raw.node;\nexport const defineRawRoot = root.raw.defineRoot;\nexport const rawUnits = root.raw.units;\nexport class RawRootModule extends DynamicBase {\n}\nconst resolutionsOfModule = ($, typeSet) => {\n    const result = {};\n    for (const k in typeSet) {\n        const v = typeSet[k];\n        if (hasArkKind(v, \"module\")) {\n            const innerResolutions = resolutionsOfModule($, v);\n            const prefixedResolutions = flatMorph(innerResolutions, (innerK, innerV) => [`${k}.${innerK}`, innerV]);\n            Object.assign(result, prefixedResolutions);\n        }\n        else if (hasArkKind(v, \"generic\"))\n            result[k] = v;\n        else if (hasArkKind(v, \"root\"))\n            result[k] = v;\n        else\n            throwInternalError(`Unexpected scope resolution ${printable(v)}`);\n    }\n    return result;\n};\nexport const writeUnresolvableMessage = (token) => `'${token}' is unresolvable`;\nexport const writeNonSubmoduleDotMessage = (name) => `'${name}' must reference a module to be accessed using dot syntax`;\nexport const writeMissingSubmoduleAccessMessage = (name) => `Reference to submodule '${name}' must specify an alias`;\nexport const bindCompiledScope = (references) => {\n    const compiledTraversals = compileScope(references);\n    for (const node of references) {\n        if (node.jit) {\n            // if node has already been bound to another scope or anonymous type, don't rebind it\n            continue;\n        }\n        node.jit = true;\n        node.traverseAllows =\n            compiledTraversals[`${node.id}Allows`].bind(compiledTraversals);\n        if (node.isRoot() && !node.allowsRequiresContext) {\n            // if the reference doesn't require context, we can assign over\n            // it directly to avoid having to initialize it\n            node.allows = node.traverseAllows;\n        }\n        node.traverseApply =\n            compiledTraversals[`${node.id}Apply`].bind(compiledTraversals);\n    }\n};\nconst compileScope = (references) => new CompiledFunction()\n    .block(\"return\", js => {\n    references.forEach(node => {\n        const allowsCompiler = new NodeCompiler(\"Allows\").indent();\n        node.compile(allowsCompiler);\n        const applyCompiler = new NodeCompiler(\"Apply\").indent();\n        node.compile(applyCompiler);\n        js.line(`${allowsCompiler.writeMethod(`${node.id}Allows`)},`).line(`${applyCompiler.writeMethod(`${node.id}Apply`)},`);\n    });\n    return js;\n})\n    .compile()();\n","import { Callable } from \"@arktype/util\";\nimport { arkKind } from \"./shared/utils.js\";\nexport const validateUninstantiatedGenericNode = (g) => {\n    g.$.schema(g.def, {\n    // // TODO: probably don't need raw once this is fixed.\n    // args: flatMorph(g.params, (_, name) => [name, g.$.raw.keywords.unknown])\n    });\n    return g;\n};\nexport class GenericRoot extends Callable {\n    params;\n    def;\n    $;\n    [arkKind] = \"generic\";\n    constructor(params, def, $) {\n        super((...args) => {\n            args;\n            // const argNodes: Record<string, RawRoot> = flatMorph(\n            // \tparams,\n            // \t(i, param) => [param, $.schema(args[i])]\n            // ) as never\n            // { args: argNodes }\n            return $.schema(def);\n        });\n        this.params = params;\n        this.def = def;\n        this.$ = $;\n    }\n}\n","import { schemaScope } from \"../scope.js\";\nexport const tsKeywords = schemaScope({\n    any: {},\n    bigint: \"bigint\",\n    // since we know this won't be reduced, it can be safely cast to a union\n    boolean: [{ unit: false }, { unit: true }],\n    false: { unit: false },\n    never: [],\n    null: { unit: null },\n    number: \"number\",\n    object: \"object\",\n    string: \"string\",\n    symbol: \"symbol\",\n    true: { unit: true },\n    unknown: {},\n    void: { unit: undefined },\n    undefined: { unit: undefined }\n}, { prereducedAliases: true, registerKeywords: true }).export();\n","import { root, schemaScope } from \"../scope.js\";\n// these are needed to create some internal types\nimport { arrayIndexMatcher } from \"../structure/shared.js\";\nimport \"./tsKeywords.js\";\nexport const internalKeywords = schemaScope({\n    lengthBoundable: [\"string\", Array],\n    propertyKey: [\"string\", \"symbol\"],\n    nonNegativeIntegerString: { domain: \"string\", regex: arrayIndexMatcher }\n}, {\n    prereducedAliases: true,\n    registerKeywords: true\n}).export();\n// reduce union of all possible values reduces to unknown\nroot.node(\"union\", {\n    branches: [\n        \"string\",\n        \"number\",\n        \"object\",\n        \"bigint\",\n        \"symbol\",\n        { unit: true },\n        { unit: false },\n        { unit: null },\n        { unit: undefined }\n    ]\n}, { reduceTo: root.node(\"intersection\", {}, { prereduced: true }) });\n","import { schemaScope } from \"../scope.js\";\nexport const jsObjects = schemaScope({\n    Array,\n    Function,\n    Date,\n    Error,\n    Map,\n    RegExp,\n    Set,\n    WeakMap,\n    WeakSet,\n    Promise\n}, { prereducedAliases: true, registerKeywords: true }).export();\n","import { root } from \"../../scope.js\";\nexport const defineRegex = (regex, description) => root.defineRoot({\n    domain: \"string\",\n    regex: {\n        rule: regex.source,\n        flags: regex.flags,\n        description\n    }\n});\n","import { isWellFormedInteger, wellFormedIntegerMatcher, wellFormedNumberMatcher } from \"@arktype/util\";\nimport { root, schemaScope } from \"../scope.js\";\nimport { tryParseDatePattern } from \"./utils/date.js\";\nimport { defineRegex } from \"./utils/regex.js\";\nconst number = root.defineRoot({\n    in: defineRegex(wellFormedNumberMatcher, \"a well-formed numeric string\"),\n    morphs: (s) => Number.parseFloat(s)\n});\nconst integer = root.defineRoot({\n    in: defineRegex(wellFormedIntegerMatcher, \"a well-formed integer string\"),\n    morphs: (s, ctx) => {\n        if (!isWellFormedInteger(s))\n            return ctx.error(\"a well-formed integer string\");\n        const parsed = Number.parseInt(s);\n        return Number.isSafeInteger(parsed) ? parsed : (ctx.error(\"an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER\"));\n    }\n});\nconst url = root.defineRoot({\n    in: \"string\",\n    morphs: (s, ctx) => {\n        try {\n            return new URL(s);\n        }\n        catch {\n            return ctx.error(\"a valid URL\");\n        }\n    }\n});\nconst json = root.defineRoot({\n    in: \"string\",\n    morphs: (s, ctx) => {\n        try {\n            return JSON.parse(s);\n        }\n        catch {\n            return ctx.error(\"a valid JSON string\");\n        }\n    }\n});\nconst date = root.defineRoot({\n    in: \"string\",\n    morphs: (s, ctx) => {\n        const result = tryParseDatePattern(s);\n        return typeof result === \"string\" ? ctx.error(result) : result;\n    }\n});\nexport const parsing = schemaScope({\n    url,\n    number,\n    integer,\n    date,\n    json\n}).export();\n","const dayDelimiterMatcher = /^[./-]$/;\n// ISO 8601 date/time modernized from https://github.com/validatorjs/validator.js/blob/master/src/lib/isISO8601.js\n// Based on https://tc39.es/ecma262/#sec-date-time-string-format, the T\n// delimiter for date/time is mandatory. Regex from validator.js strict matcher:\nconst iso8601Matcher = /^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\nconst isValidDateInstance = (date) => !Number.isNaN(+date);\nconst writeFormattedExpected = (format) => `a ${format}-formatted date`;\nexport const tryParseDatePattern = (data, opts) => {\n    if (!opts?.format) {\n        const result = new Date(data);\n        return isValidDateInstance(result) ? result : \"a valid date\";\n    }\n    if (opts.format === \"iso8601\") {\n        return iso8601Matcher.test(data) ?\n            new Date(data)\n            : writeFormattedExpected(\"iso8601\");\n    }\n    const dataParts = data.split(dayDelimiterMatcher);\n    // will be the first delimiter matched, if there is one\n    const delimiter = data[dataParts[0].length];\n    const formatParts = delimiter ? opts.format.split(delimiter) : [opts.format];\n    if (dataParts.length !== formatParts.length)\n        return writeFormattedExpected(opts.format);\n    const parsedParts = {};\n    for (let i = 0; i < formatParts.length; i++) {\n        if (dataParts[i].length !== formatParts[i].length &&\n            // if format is \"m\" or \"d\", data is allowed to be 1 or 2 characters\n            !(formatParts[i].length === 1 && dataParts[i].length === 2))\n            return writeFormattedExpected(opts.format);\n        parsedParts[formatParts[i][0]] = dataParts[i];\n    }\n    const date = new Date(`${parsedParts.m}/${parsedParts.d}/${parsedParts.y}`);\n    if (`${date.getDate()}` === parsedParts.d)\n        return date;\n    return writeFormattedExpected(opts.format);\n};\n","import { root } from \"../../scope.js\";\nimport { defineRegex } from \"./regex.js\";\n// Based on https://github.com/validatorjs/validator.js/blob/master/src/lib/isIP.js\nconst ipv4Segment = \"(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\";\nconst ipv4Address = `(${ipv4Segment}[.]){3}${ipv4Segment}`;\nconst ipv4Matcher = new RegExp(`^${ipv4Address}$`);\nexport const ipv4 = defineRegex(ipv4Matcher, \"a valid IPv4 address\");\nconst ipv6Segment = \"(?:[0-9a-fA-F]{1,4})\";\nconst ipv6Matcher = new RegExp(\"^(\" +\n    `(?:${ipv6Segment}:){7}(?:${ipv6Segment}|:)|` +\n    `(?:${ipv6Segment}:){6}(?:${ipv4Address}|:${ipv6Segment}|:)|` +\n    `(?:${ipv6Segment}:){5}(?::${ipv4Address}|(:${ipv6Segment}){1,2}|:)|` +\n    `(?:${ipv6Segment}:){4}(?:(:${ipv6Segment}){0,1}:${ipv4Address}|(:${ipv6Segment}){1,3}|:)|` +\n    `(?:${ipv6Segment}:){3}(?:(:${ipv6Segment}){0,2}:${ipv4Address}|(:${ipv6Segment}){1,4}|:)|` +\n    `(?:${ipv6Segment}:){2}(?:(:${ipv6Segment}){0,3}:${ipv4Address}|(:${ipv6Segment}){1,5}|:)|` +\n    `(?:${ipv6Segment}:){1}(?:(:${ipv6Segment}){0,4}:${ipv4Address}|(:${ipv6Segment}){1,6}|:)|` +\n    `(?::((?::${ipv6Segment}){0,5}:${ipv4Address}|(?::${ipv6Segment}){1,7}|:))` +\n    \")(%[0-9a-zA-Z-.:]{1,})?$\");\nexport const ipv6 = defineRegex(ipv6Matcher, \"a valid IPv6 address\");\nexport const ip = root.defineRoot([ipv4, ipv6]);\n","import { root, schemaScope } from \"../scope.js\";\nimport { creditCardMatcher, isLuhnValid } from \"./utils/creditCard.js\";\nimport { ip } from \"./utils/ip.js\";\nimport { defineRegex } from \"./utils/regex.js\";\n// Non-trivial expressions should have an explanation or attribution\nconst url = root.defineRoot({\n    domain: \"string\",\n    predicate: {\n        predicate: (s) => {\n            try {\n                new URL(s);\n            }\n            catch {\n                return false;\n            }\n            return true;\n        },\n        description: \"a valid URL\"\n    }\n});\n// https://www.regular-expressions.info/email.html\nconst emailMatcher = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\nconst email = defineRegex(emailMatcher, \"a valid email\");\nconst uuidMatcher = /^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/;\n// https://github.com/validatorjs/validator.js/blob/master/src/lib/isUUID.js\nconst uuid = defineRegex(uuidMatcher, \"a valid UUID\");\nconst semverMatcher = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n// https://semver.org/\nconst semver = defineRegex(semverMatcher, \"a valid semantic version (see https://semver.org/)\");\nconst creditCard = root.defineRoot({\n    domain: \"string\",\n    regex: {\n        rule: creditCardMatcher.source,\n        description: \"a valid credit card number\"\n    },\n    predicate: {\n        predicate: isLuhnValid,\n        description: \"a valid credit card number\"\n    }\n});\nexport const validation = schemaScope({\n    alpha: defineRegex(/^[A-Za-z]*$/, \"only letters\"),\n    alphanumeric: defineRegex(/^[A-Za-z\\d]*$/, \"only letters and digits\"),\n    lowercase: defineRegex(/^[a-z]*$/, \"only lowercase letters\"),\n    uppercase: defineRegex(/^[A-Z]*$/, \"only uppercase letters\"),\n    creditCard,\n    email,\n    uuid,\n    url,\n    semver,\n    ip,\n    integer: {\n        domain: \"number\",\n        divisor: 1\n    }\n}, { prereducedAliases: true }).export();\n","// https://github.com/validatorjs/validator.js/blob/master/src/lib/isLuhnNumber.js\nexport const isLuhnValid = (creditCardInput) => {\n    const sanitized = creditCardInput.replace(/[- ]+/g, \"\");\n    let sum = 0;\n    let digit;\n    let tmpNum;\n    let shouldDouble = false;\n    for (let i = sanitized.length - 1; i >= 0; i--) {\n        digit = sanitized.substring(i, i + 1);\n        tmpNum = Number.parseInt(digit, 10);\n        if (shouldDouble) {\n            tmpNum *= 2;\n            if (tmpNum >= 10)\n                sum += (tmpNum % 10) + 1;\n            else\n                sum += tmpNum;\n        }\n        else\n            sum += tmpNum;\n        shouldDouble = !shouldDouble;\n    }\n    return !!(sum % 10 === 0 ? sanitized : false);\n};\n// https://github.com/validatorjs/validator.js/blob/master/src/lib/isCreditCard.js\nexport const creditCardMatcher = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;\n","import { RawRootScope, schemaScope } from \"../scope.js\";\n// the import ordering here is important so builtin keywords can be resolved\n// and used to bootstrap nodes with constraints\nimport { tsKeywords } from \"./tsKeywords.js\";\nimport { jsObjects } from \"./jsObjects.js\";\nimport { parsing } from \"./parsing.js\";\nimport { validation } from \"./validation.js\";\nexport const ambientRootScope = schemaScope({\n    ...tsKeywords,\n    ...jsObjects,\n    ...validation,\n    parse: parsing\n    // TODO: remove cast\n});\nRawRootScope.ambient = ambientRootScope.raw;\nexport const keywordNodes = ambientRootScope.export();\n","import { arkKind } from \"@arktype/schema\";\nimport { Callable } from \"@arktype/util\";\nexport class Generic extends Callable {\n    params;\n    def;\n    $;\n    [arkKind] = \"generic\";\n    constructor(params, def, \n    // TODO: should be Scope<$>, but breaks inference\n    $) {\n        super((...args) => {\n            // const argNodes = flatMorph(params, (i, param: string) => [\n            // \tparam,\n            // \t$.parseRoot(args[i])\n            // ])\n            // { args: argNodes }\n            args;\n            return $.parseRoot(def);\n        });\n        this.params = params;\n        this.def = def;\n        this.$ = $;\n    }\n}\n","import { isKeyOf } from \"@arktype/util\";\nexport class Scanner {\n    chars;\n    i;\n    constructor(def) {\n        this.chars = [...def];\n        this.i = 0;\n    }\n    /** Get lookahead and advance scanner by one */\n    shift() {\n        return (this.chars[this.i++] ?? \"\");\n    }\n    get lookahead() {\n        return (this.chars[this.i] ?? \"\");\n    }\n    get nextLookahead() {\n        return this.chars[this.i + 1] ?? \"\";\n    }\n    get length() {\n        return this.chars.length;\n    }\n    shiftUntil(condition) {\n        let shifted = \"\";\n        while (this.lookahead) {\n            if (condition(this, shifted)) {\n                if (shifted[shifted.length - 1] === Scanner.escapeToken)\n                    shifted = shifted.slice(0, -1);\n                else\n                    break;\n            }\n            shifted += this.shift();\n        }\n        return shifted;\n    }\n    shiftUntilNextTerminator() {\n        this.shiftUntilNonWhitespace();\n        return this.shiftUntil(Scanner.lookaheadIsTerminator);\n    }\n    shiftUntilNonWhitespace() {\n        return this.shiftUntil(Scanner.lookaheadIsNotWhitespace);\n    }\n    jumpToIndex(i) {\n        this.i = i < 0 ? this.length + i : i;\n    }\n    get location() {\n        return this.i;\n    }\n    get unscanned() {\n        return this.chars.slice(this.i, this.length).join(\"\");\n    }\n    get scanned() {\n        return this.chars.slice(0, this.i).join(\"\");\n    }\n    sliceChars(start, end) {\n        return this.chars.slice(start, end).join(\"\");\n    }\n    lookaheadIs(char) {\n        return this.lookahead === char;\n    }\n    lookaheadIsIn(tokens) {\n        return this.lookahead in tokens;\n    }\n}\n(function (Scanner) {\n    Scanner.lookaheadIsTerminator = (scanner) => scanner.lookahead in Scanner.terminatingChars;\n    Scanner.lookaheadIsNotWhitespace = (scanner) => !(scanner.lookahead in Scanner.whiteSpaceTokens);\n    Scanner.terminatingChars = {\n        \"<\": true,\n        \">\": true,\n        \"=\": true,\n        \"|\": true,\n        \"&\": true,\n        \")\": true,\n        \"[\": true,\n        \"%\": true,\n        \" \": true,\n        \",\": true\n    };\n    Scanner.finalizingLookaheads = {\n        \">\": true,\n        \",\": true,\n        \"\": true\n    };\n    Scanner.escapeToken = \"\\\\\";\n    Scanner.whiteSpaceTokens = {\n        \" \": true,\n        \"\\n\": true,\n        \"\\t\": true\n    };\n    Scanner.lookaheadIsFinalizing = (lookahead, unscanned) => lookahead === \">\" ?\n        unscanned[0] === \"=\" ?\n            // >== would only occur in an expression like Array<number>==5\n            // otherwise, >= would only occur as part of a bound like number>=5\n            unscanned[1] === \"=\"\n            // if > is the end of a generic instantiation, the next token will be an operator or the end of the string\n            : unscanned.trimStart() === \"\" ||\n                isKeyOf(unscanned.trimStart()[0], Scanner.terminatingChars)\n        // if the lookahead is a finalizing token but not >, it's unambiguously a finalizer (currently just \",\")\n        : lookahead === \",\";\n})(Scanner || (Scanner = {}));\n","import { ArkErrors, normalizeIndex } from \"@arktype/schema\";\nimport { append, isArray, printable, stringAndSymbolicEntriesOf, throwParseError, unset } from \"@arktype/util\";\nimport { Scanner } from \"./string/shift/scanner.js\";\nexport const parseObjectLiteral = (def, ctx) => {\n    let spread;\n    const structure = {};\n    // We only allow a spread operator to be used as the first key in an object\n    // because to match JS behavior any keys before the spread are overwritten\n    // by the values in the target object, so there'd be no useful purpose in having it\n    // anywhere except for the beginning.\n    const parsedEntries = stringAndSymbolicEntriesOf(def).map(parseEntry);\n    if (parsedEntries[0]?.kind === \"...\") {\n        // remove the spread entry so we can iterate over the remaining entries\n        // expecting non-spread entries\n        const spreadEntry = parsedEntries.shift();\n        const spreadNode = ctx.$.parse(spreadEntry.value, ctx);\n        if (!spreadNode.hasKind(\"intersection\") || !spreadNode.structure) {\n            return throwParseError(writeInvalidSpreadTypeMessage(typeof spreadEntry.value === \"string\" ?\n                spreadEntry.value\n                : printable(spreadEntry.value)));\n        }\n        spread = spreadNode.structure;\n    }\n    for (const entry of parsedEntries) {\n        if (entry.kind === \"...\")\n            return throwParseError(nonLeadingSpreadError);\n        if (entry.kind === \"+\") {\n            if (entry.value !== \"reject\" &&\n                entry.value !== \"delete\" &&\n                entry.value !== \"ignore\")\n                throwParseError(writeInvalidUndeclaredBehaviorMessage(entry.value));\n            structure.undeclared = entry.value;\n            continue;\n        }\n        if (entry.kind === \"index\") {\n            // handle key parsing first to match type behavior\n            const key = ctx.$.parse(entry.key, ctx);\n            const value = ctx.$.parse(entry.value, ctx);\n            const normalizedSignature = normalizeIndex(key, value, ctx.$);\n            if (normalizedSignature.required) {\n                structure.required = append(structure.required, normalizedSignature.required);\n            }\n            if (normalizedSignature.index)\n                structure.index = append(structure.index, normalizedSignature.index);\n        }\n        else {\n            const value = ctx.$.parse(entry.value, ctx);\n            const inner = { key: entry.key, value };\n            if (entry.default !== unset) {\n                const out = value(entry.default);\n                if (out instanceof ArkErrors)\n                    throwParseError(`Default value at ${printable(entry.key)} ${out}`);\n                value.assert(entry.default);\n                inner.default = entry.default;\n            }\n            structure[entry.kind] = append(structure[entry.kind], inner);\n        }\n    }\n    const structureNode = ctx.$.node(\"structure\", structure);\n    return ctx.$.schema({\n        domain: \"object\",\n        structure: spread?.merge(structureNode) ?? structureNode\n    });\n};\nexport const writeInvalidUndeclaredBehaviorMessage = (actual) => `Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${printable(actual)})`;\nexport const nonLeadingSpreadError = \"Spread operator may only be used as the first key in an object\";\nexport const parseEntry = ([key, value]) => {\n    const parsedKey = parseKey(key);\n    if (isArray(value) && value[1] === \"=\") {\n        if (parsedKey.kind !== \"required\")\n            throwParseError(invalidDefaultKeyKindMessage);\n        return {\n            kind: \"optional\",\n            key: parsedKey.key,\n            value: value[0],\n            default: value[2]\n        };\n    }\n    return {\n        kind: parsedKey.kind,\n        key: parsedKey.key,\n        value,\n        default: unset\n    };\n};\n// single quote use here is better for TypeScript's inlined error to avoid escapes\nexport const invalidDefaultKeyKindMessage = `Only required keys may specify default values, e.g. { ark: ['string', '=', '⛵'] }`;\nconst parseKey = (key) => typeof key === \"symbol\" ? { kind: \"required\", key }\n    : key.at(-1) === \"?\" ?\n        key.at(-2) === Scanner.escapeToken ?\n            { kind: \"required\", key: `${key.slice(0, -2)}?` }\n            : {\n                kind: \"optional\",\n                key: key.slice(0, -1)\n            }\n        : key[0] === \"[\" && key.at(-1) === \"]\" ?\n            { kind: \"index\", key: key.slice(1, -1) }\n            : key[0] === Scanner.escapeToken && key[1] === \"[\" && key.at(-1) === \"]\" ?\n                { kind: \"required\", key: key.slice(1) }\n                : key === \"...\" || key === \"+\" ? { kind: key, key }\n                    : {\n                        kind: \"required\",\n                        key: key === \"\\\\...\" ? \"...\"\n                            : key === \"\\\\+\" ? \"+\"\n                                : key\n                    };\nexport const writeInvalidSpreadTypeMessage = (def) => `Spread operand must resolve to an object literal type (was ${def})`;\n","export const minComparators = {\n    \">\": true,\n    \">=\": true\n};\nexport const maxComparators = {\n    \"<\": true,\n    \"<=\": true\n};\nexport const comparators = {\n    \">\": true,\n    \">=\": true,\n    \"<\": true,\n    \"<=\": true,\n    \"==\": true\n};\nexport const invertedComparators = {\n    \"<\": \">\",\n    \">\": \"<\",\n    \"<=\": \">=\",\n    \">=\": \"<=\",\n    \"==\": \"==\"\n};\nexport const writeUnmatchedGroupCloseMessage = (unscanned) => `Unmatched )${(unscanned === \"\" ? \"\" : ` before ${unscanned}`)}`;\nexport const writeUnclosedGroupMessage = (missingChar) => `Missing ${missingChar}`;\nexport const writeOpenRangeMessage = (min, comparator) => `Left bounds are only valid when paired with right bounds (try ...${comparator}${min})`;\nexport const writeUnpairableComparatorMessage = (comparator) => `Left-bounded expressions must specify their limits using < or <= (was ${comparator})`;\nexport const writeMultipleLeftBoundsMessage = (openLimit, openComparator, limit, comparator) => `An expression may have at most one left bound (parsed ${openLimit}${invertedComparators[openComparator]}, ${limit}${invertedComparators[comparator]})`;\n","import { writeUnclosedGroupMessage } from \"../../reduce/shared.js\";\nexport const parseGenericArgs = (name, params, s) => _parseGenericArgs(name, params, s, [], []);\nconst _parseGenericArgs = (name, params, s, argDefs, argNodes) => {\n    const argState = s.parseUntilFinalizer();\n    // remove the finalizing token from the argDef\n    argDefs.push(argState.scanner.scanned.slice(0, -1));\n    argNodes.push(argState.root);\n    if (argState.finalizer === \">\") {\n        if (argNodes.length === params.length) {\n            return {\n                result: argNodes,\n                unscanned: argState.scanner.unscanned\n            };\n        }\n        return argState.error(writeInvalidGenericArgsMessage(name, params, argDefs));\n    }\n    if (argState.finalizer === \",\")\n        return _parseGenericArgs(name, params, s, argDefs, argNodes);\n    return argState.error(writeUnclosedGroupMessage(\">\"));\n};\nexport const writeInvalidGenericArgsMessage = (name, params, argDefs) => `${name}<${params.join(\", \")}> requires exactly ${params.length} args (got ${argDefs.length}${argDefs.length === 0 ? \"\" : `: ${argDefs.join(\", \")}`})`;\n","import { BaseRoot, hasArkKind, writeUnresolvableMessage } from \"@arktype/schema\";\nimport { printable, throwParseError, tryParseNumber, tryParseWellFormedBigint } from \"@arktype/util\";\nimport { writePrefixedPrivateReferenceMessage } from \"../../../semantic/validate.js\";\nimport { parseGenericArgs, writeInvalidGenericArgsMessage } from \"./genericArgs.js\";\nexport const parseUnenclosed = (s) => {\n    const token = s.scanner.shiftUntilNextTerminator();\n    if (token === \"keyof\")\n        s.addPrefix(\"keyof\");\n    else\n        s.root = unenclosedToNode(s, token);\n};\nexport const parseGenericInstantiation = (name, g, s) => {\n    s.scanner.shiftUntilNonWhitespace();\n    const lookahead = s.scanner.shift();\n    if (lookahead !== \"<\")\n        return s.error(writeInvalidGenericArgsMessage(name, g.params, []));\n    const parsedArgs = parseGenericArgs(name, g.params, s);\n    const remainingChars = parsedArgs.unscanned.length;\n    // set the scanner position to where the args scanner left off\n    s.scanner.jumpToIndex(remainingChars === 0 ? s.scanner.length : -remainingChars);\n    return g(...parsedArgs.result);\n};\nconst unenclosedToNode = (s, token) => maybeParseReference(s, token) ??\n    maybeParseUnenclosedLiteral(s, token) ??\n    s.error(token === \"\" ? writeMissingOperandMessage(s)\n        : token[0] === \"#\" ?\n            writePrefixedPrivateReferenceMessage(token)\n            : writeUnresolvableMessage(token));\nconst maybeParseReference = (s, token) => {\n    if (s.ctx.args?.[token])\n        return s.ctx.args[token].raw;\n    const resolution = s.ctx.$.maybeResolve(token);\n    if (resolution instanceof BaseRoot)\n        return resolution;\n    if (resolution === undefined)\n        return;\n    if (hasArkKind(resolution, \"generic\"))\n        return parseGenericInstantiation(token, resolution, s);\n    return throwParseError(`Unexpected resolution ${printable(resolution)}`);\n};\nconst maybeParseUnenclosedLiteral = (s, token) => {\n    const maybeNumber = tryParseNumber(token, { strict: true });\n    if (maybeNumber !== undefined)\n        return s.ctx.$.node(\"unit\", { unit: maybeNumber });\n    const maybeBigint = tryParseWellFormedBigint(token);\n    if (maybeBigint !== undefined)\n        return s.ctx.$.node(\"unit\", { unit: maybeBigint });\n};\nexport const writeMissingOperandMessage = (s) => {\n    const operator = s.previousOperator();\n    return operator ?\n        writeMissingRightOperandMessage(operator, s.scanner.unscanned)\n        : writeExpressionExpectedMessage(s.scanner.unscanned);\n};\nexport const writeMissingRightOperandMessage = (token, unscanned = \"\") => `Token '${token}' requires a right operand${unscanned ? ` before '${unscanned}'` : \"\"}`;\nexport const writeExpressionExpectedMessage = (unscanned) => `Expected an expression${unscanned ? ` before '${unscanned}'` : \"\"}`;\n","import { jsObjects, makeRootAndArrayPropertiesMutable, tsKeywords } from \"@arktype/schema\";\nimport { append, objectKindOrDomainOf, throwParseError } from \"@arktype/util\";\nimport { writeMissingRightOperandMessage } from \"./string/shift/operand/unenclosed.js\";\nexport const parseTuple = (def, ctx) => maybeParseTupleExpression(def, ctx) ?? parseTupleLiteral(def, ctx);\nexport const parseTupleLiteral = (def, ctx) => {\n    let sequences = [{}];\n    let i = 0;\n    while (i < def.length) {\n        let spread = false;\n        let optional = false;\n        if (def[i] === \"...\" && i < def.length - 1) {\n            spread = true;\n            i++;\n        }\n        const element = ctx.$.parse(def[i], ctx);\n        i++;\n        if (def[i] === \"?\") {\n            if (spread)\n                return throwParseError(spreadOptionalMessage);\n            optional = true;\n            i++;\n        }\n        if (spread) {\n            if (!element.extends(jsObjects.Array))\n                return throwParseError(writeNonArraySpreadMessage(element.expression));\n            // a spread must be distributed over branches e.g.:\n            // def: [string, ...(number[] | [true, false])]\n            // nodes: [string, ...number[]] | [string, true, false]\n            sequences = sequences.flatMap(base => \n            // since appendElement mutates base, we have to shallow-ish clone it for each branch\n            element.branches.map(branch => appendSpreadBranch(makeRootAndArrayPropertiesMutable(base), branch)));\n        }\n        else {\n            sequences = sequences.map(base => appendElement(base, optional ? \"optional\" : \"required\", element));\n        }\n    }\n    return ctx.$.raw.schema(sequences.map(sequence => ({\n        proto: Array,\n        sequence\n    })));\n};\nconst appendElement = (base, kind, element) => {\n    switch (kind) {\n        case \"required\":\n            if (base.optionals)\n                // e.g. [string?, number]\n                return throwParseError(requiredPostOptionalMessage);\n            if (base.variadic) {\n                // e.g. [...string[], number]\n                base.postfix = append(base.postfix, element);\n            }\n            else {\n                // e.g. [string, number]\n                base.prefix = append(base.prefix, element);\n            }\n            return base;\n        case \"optional\":\n            if (base.variadic)\n                // e.g. [...string[], number?]\n                return throwParseError(optionalPostVariadicMessage);\n            // e.g. [string, number?]\n            base.optionals = append(base.optionals, element);\n            return base;\n        case \"variadic\":\n            // e.g. [...string[], number, ...string[]]\n            if (base.postfix)\n                throwParseError(multipleVariadicMesage);\n            if (base.variadic) {\n                if (!base.variadic.equals(element)) {\n                    // e.g. [...string[], ...number[]]\n                    throwParseError(multipleVariadicMesage);\n                }\n                // e.g. [...string[], ...string[]]\n                // do nothing, second spread doesn't change the type\n            }\n            else {\n                // e.g. [string, ...number[]]\n                base.variadic = element.raw;\n            }\n            return base;\n    }\n};\nconst appendSpreadBranch = (base, branch) => {\n    const spread = branch.firstReferenceOfKind(\"sequence\");\n    if (!spread) {\n        // the only array with no sequence reference is unknown[]\n        return appendElement(base, \"variadic\", tsKeywords.unknown);\n    }\n    spread.prefix.forEach(node => appendElement(base, \"required\", node));\n    spread.optionals.forEach(node => appendElement(base, \"optional\", node));\n    spread.variadic && appendElement(base, \"variadic\", spread.variadic);\n    spread.postfix.forEach(node => appendElement(base, \"required\", node));\n    return base;\n};\nconst maybeParseTupleExpression = (def, ctx) => {\n    const tupleExpressionResult = isIndexZeroExpression(def) ? prefixParsers[def[0]](def, ctx)\n        : isIndexOneExpression(def) ? indexOneParsers[def[1]](def, ctx)\n            : undefined;\n    return tupleExpressionResult;\n};\nexport const writeNonArraySpreadMessage = (operand) => `Spread element must be an array (was ${operand})`;\nexport const multipleVariadicMesage = \"A tuple may have at most one variadic element\";\nexport const requiredPostOptionalMessage = \"A required element may not follow an optional element\";\nexport const optionalPostVariadicMessage = \"An optional element may not follow a variadic element\";\nexport const spreadOptionalMessage = \"A spread element cannot be optional\";\nexport const parseKeyOfTuple = (def, ctx) => ctx.$.parse(def[1], ctx).keyof();\nconst parseBranchTuple = (def, ctx) => {\n    if (def[2] === undefined)\n        return throwParseError(writeMissingRightOperandMessage(def[1], \"\"));\n    const l = ctx.$.parse(def[0], ctx);\n    const r = ctx.$.parse(def[2], ctx);\n    return def[1] === \"&\" ? l.and(r) : l.or(r);\n};\nconst parseArrayTuple = (def, ctx) => ctx.$.parse(def[0], ctx).array();\nconst isIndexOneExpression = (def) => indexOneParsers[def[1]] !== undefined;\nexport const parseMorphTuple = (def, ctx) => {\n    if (typeof def[2] !== \"function\") {\n        return throwParseError(writeMalformedFunctionalExpressionMessage(\"=>\", def[2]));\n    }\n    // TODO: nested morphs?\n    return ctx.$.parse(def[0], ctx).pipe(def[2]);\n};\nexport const writeMalformedFunctionalExpressionMessage = (operator, value) => `${operator === \":\" ? \"Narrow\" : \"Morph\"} expression requires a function following '${operator}' (was ${typeof value})`;\nexport const parseNarrowTuple = (def, ctx) => {\n    if (typeof def[2] !== \"function\") {\n        return throwParseError(writeMalformedFunctionalExpressionMessage(\":\", def[2]));\n    }\n    return ctx.$.parse(def[0], ctx).constrain(\"predicate\", def[2]);\n};\nconst parseAttributeTuple = (def, ctx) => ctx.$.parse(def[0], ctx).configureShallowDescendants(def[2]);\nconst indexOneParsers = {\n    \"|\": parseBranchTuple,\n    \"&\": parseBranchTuple,\n    \"[]\": parseArrayTuple,\n    \":\": parseNarrowTuple,\n    \"=>\": parseMorphTuple,\n    \"@\": parseAttributeTuple\n};\nconst prefixParsers = {\n    keyof: parseKeyOfTuple,\n    instanceof: (def, ctx) => {\n        if (typeof def[1] !== \"function\") {\n            return throwParseError(writeInvalidConstructorMessage(objectKindOrDomainOf(def[1])));\n        }\n        const branches = def\n            .slice(1)\n            .map(ctor => typeof ctor === \"function\" ?\n            ctx.$.node(\"proto\", { proto: ctor })\n            : throwParseError(writeInvalidConstructorMessage(objectKindOrDomainOf(ctor))));\n        return branches.length === 1 ?\n            branches[0]\n            : ctx.$.node(\"union\", { branches });\n    },\n    \"===\": (def, ctx) => ctx.$.units(def.slice(1))\n};\nconst isIndexZeroExpression = (def) => prefixParsers[def[0]] !== undefined;\nexport const writeInvalidConstructorMessage = (actual) => `Expected a constructor following 'instanceof' operator (was ${actual})`;\n","import { hasArkKind } from \"@arktype/schema\";\nimport { isThunk, objectKindOf, printable, throwParseError } from \"@arktype/util\";\nimport { parseObjectLiteral } from \"./objectLiteral.js\";\nimport { parseTuple } from \"./tuple.js\";\nexport const parseObject = (def, ctx) => {\n    const objectKind = objectKindOf(def);\n    switch (objectKind) {\n        case undefined:\n            if (hasArkKind(def, \"root\"))\n                return def;\n            return parseObjectLiteral(def, ctx);\n        case \"Array\":\n            return parseTuple(def, ctx);\n        case \"RegExp\":\n            return ctx.$.node(\"intersection\", {\n                domain: \"string\",\n                regex: def\n            }, { prereduced: true });\n        case \"Function\": {\n            const resolvedDef = isThunk(def) ? def() : def;\n            if (hasArkKind(resolvedDef, \"root\"))\n                return resolvedDef;\n            return throwParseError(writeBadDefinitionTypeMessage(\"Function\"));\n        }\n        default:\n            return throwParseError(writeBadDefinitionTypeMessage(objectKind ?? printable(def)));\n    }\n};\nexport const writeBadDefinitionTypeMessage = (actual) => `Type definitions must be strings or objects (was ${actual})`;\n","import { throwParseError, tryParseNumber } from \"@arktype/util\";\nexport const isDateLiteral = (value) => typeof value === \"string\" &&\n    value[0] === \"d\" &&\n    (value[1] === \"'\" || value[1] === '\"') &&\n    value.at(-1) === value[1];\nexport const isValidDate = (d) => d.toString() !== \"Invalid Date\";\nexport const extractDateLiteralSource = (literal) => literal.slice(2, -1);\nexport const writeInvalidDateMessage = (source) => `'${source}' could not be parsed by the Date constructor`;\nexport const tryParseDate = (source, errorOnFail) => maybeParseDate(source, errorOnFail);\nconst maybeParseDate = (source, errorOnFail) => {\n    const stringParsedDate = new Date(source);\n    if (isValidDate(stringParsedDate))\n        return stringParsedDate;\n    const epochMillis = tryParseNumber(source);\n    if (epochMillis !== undefined) {\n        const numberParsedDate = new Date(epochMillis);\n        if (isValidDate(numberParsedDate))\n            return numberParsedDate;\n    }\n    return errorOnFail ?\n        throwParseError(errorOnFail === true ? writeInvalidDateMessage(source) : errorOnFail)\n        : undefined;\n};\n","import { internalKeywords, jsObjects, tsKeywords, writeUnboundableMessage } from \"@arktype/schema\";\nimport { isKeyOf, throwParseError } from \"@arktype/util\";\nimport { invertedComparators, maxComparators, writeUnpairableComparatorMessage } from \"../../reduce/shared.js\";\nimport { extractDateLiteralSource, isDateLiteral } from \"../operand/date.js\";\nexport const parseBound = (s, start) => {\n    const comparator = shiftComparator(s, start);\n    if (s.root.hasKind(\"unit\")) {\n        if (typeof s.root.unit === \"number\") {\n            s.reduceLeftBound(s.root.unit, comparator);\n            s.unsetRoot();\n            return;\n        }\n        if (s.root.unit instanceof Date) {\n            const literal = `d'${s.root.description ?? s.root.unit.toISOString()}'`;\n            s.unsetRoot();\n            s.reduceLeftBound(literal, comparator);\n            return;\n        }\n    }\n    return parseRightBound(s, comparator);\n};\nconst oneCharComparators = {\n    \"<\": true,\n    \">\": true\n};\nexport const comparatorStartChars = {\n    \"<\": 1,\n    \">\": 1,\n    \"=\": 1\n};\nconst shiftComparator = (s, start) => s.scanner.lookaheadIs(\"=\") ? `${start}${s.scanner.shift()}`\n    : isKeyOf(start, oneCharComparators) ? start\n        : s.error(singleEqualsMessage);\nexport const writeIncompatibleRangeMessage = (l, r) => `Bound kinds ${l} and ${r} are incompatible`;\nexport const getBoundKinds = (comparator, limit, root, boundKind) => {\n    if (root.extends(tsKeywords.number)) {\n        if (typeof limit !== \"number\") {\n            return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));\n        }\n        return (comparator === \"==\" ? [\"min\", \"max\"]\n            : comparator[0] === \">\" ? [\"min\"]\n                : [\"max\"]);\n    }\n    if (root.extends(internalKeywords.lengthBoundable)) {\n        if (typeof limit !== \"number\") {\n            return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));\n        }\n        return (comparator === \"==\" ? [\"minLength\", \"maxLength\"]\n            : comparator[0] === \">\" ? [\"minLength\"]\n                : [\"maxLength\"]);\n    }\n    if (root.extends(jsObjects.Date)) {\n        // allow either numeric or date limits\n        return (comparator === \"==\" ? [\"after\", \"before\"]\n            : comparator[0] === \">\" ? [\"after\"]\n                : [\"before\"]);\n    }\n    return throwParseError(writeUnboundableMessage(root.expression));\n};\nexport const singleEqualsMessage = \"= is not a valid comparator. Use == to check for equality\";\nconst openLeftBoundToRoot = (leftBound) => ({\n    rule: isDateLiteral(leftBound.limit) ?\n        extractDateLiteralSource(leftBound.limit)\n        : leftBound.limit,\n    exclusive: leftBound.comparator.length === 1\n});\nexport const parseRightBound = (s, comparator) => {\n    // store the node that will be bounded\n    const previousRoot = s.unsetRoot();\n    const previousScannerIndex = s.scanner.location;\n    s.parseOperand();\n    const limitNode = s.unsetRoot();\n    // after parsing the next operand, use the locations to get the\n    // token from which it was parsed\n    const limitToken = s.scanner.sliceChars(previousScannerIndex, s.scanner.location);\n    s.root = previousRoot;\n    if (!limitNode.hasKind(\"unit\") ||\n        (typeof limitNode.unit !== \"number\" && !(limitNode.unit instanceof Date)))\n        return s.error(writeInvalidLimitMessage(comparator, limitToken, \"right\"));\n    const limit = limitNode.unit;\n    // apply the newly-parsed right bound\n    const exclusive = comparator.length === 1;\n    // if the comparator is ==, both the min and max of that pair will be applied\n    for (const kind of getBoundKinds(comparator, typeof limit === \"number\" ? limit : limitToken, previousRoot, \"right\"))\n        s.constrainRoot(kind, { rule: limit, exclusive });\n    if (!s.branches.leftBound)\n        return;\n    // if there's an open left bound, perform additional validation and apply it\n    if (!isKeyOf(comparator, maxComparators))\n        return s.error(writeUnpairableComparatorMessage(comparator));\n    const lowerBoundKind = getBoundKinds(s.branches.leftBound.comparator, s.branches.leftBound.limit, previousRoot, \"left\");\n    s.constrainRoot(lowerBoundKind[0], openLeftBoundToRoot(s.branches.leftBound));\n    s.branches.leftBound = null;\n};\nexport const writeInvalidLimitMessage = (comparator, limit, boundKind) => `Comparator ${boundKind === \"left\" ? invertedComparators[comparator] : comparator} must be ${boundKind === \"left\" ? \"preceded\" : \"followed\"} by a corresponding literal (was ${limit})`;\n","import { tryParseInteger } from \"@arktype/util\";\nexport const parseDivisor = (s) => {\n    const divisorToken = s.scanner.shiftUntilNextTerminator();\n    const divisor = tryParseInteger(divisorToken, {\n        errorOnFail: writeInvalidDivisorMessage(divisorToken)\n    });\n    if (divisor === 0)\n        s.error(writeInvalidDivisorMessage(0));\n    s.root = s.root.constrain(\"divisor\", divisor);\n};\nexport const writeInvalidDivisorMessage = (divisor) => `% operator must be followed by a non-zero integer literal (was ${divisor})`;\n","import { isKeyOf } from \"@arktype/util\";\nimport { Scanner } from \"../scanner.js\";\nimport { comparatorStartChars, parseBound } from \"./bounds.js\";\nimport { parseDivisor } from \"./divisor.js\";\nexport const parseOperator = (s) => {\n    const lookahead = s.scanner.shift();\n    return (lookahead === \"\" ? s.finalize(\"\")\n        : lookahead === \"[\" ?\n            s.scanner.shift() === \"]\" ?\n                s.setRoot(s.root.array())\n                : s.error(incompleteArrayTokenMessage)\n            : lookahead === \"|\" || lookahead === \"&\" ? s.pushRootToBranch(lookahead)\n                : lookahead === \")\" ? s.finalizeGroup()\n                    : Scanner.lookaheadIsFinalizing(lookahead, s.scanner.unscanned) ?\n                        s.finalize(lookahead)\n                        : isKeyOf(lookahead, comparatorStartChars) ? parseBound(s, lookahead)\n                            : lookahead === \"%\" ? parseDivisor(s)\n                                : lookahead === \" \" ? parseOperator(s)\n                                    : s.error(writeUnexpectedCharacterMessage(lookahead)));\n};\nexport const writeUnexpectedCharacterMessage = (char, shouldBe = \"\") => `'${char}' is not allowed here${shouldBe && ` (should be ${shouldBe})`}`;\nexport const incompleteArrayTokenMessage = `Missing expected ']'`;\n","import { throwParseError } from \"@arktype/util\";\nimport { writeUnexpectedCharacterMessage } from \"./string/shift/operator/operator.js\";\nimport { Scanner } from \"./string/shift/scanner.js\";\nexport const parseGenericParams = (def) => _parseGenericParams(new Scanner(def));\nexport const emptyGenericParameterMessage = \"An empty string is not a valid generic parameter name\";\nconst _parseGenericParams = (scanner) => {\n    const param = scanner.shiftUntilNextTerminator();\n    if (param === \"\")\n        throwParseError(emptyGenericParameterMessage);\n    scanner.shiftUntilNonWhitespace();\n    const nextNonWhitespace = scanner.shift();\n    return (nextNonWhitespace === \"\" ? [param]\n        : nextNonWhitespace === \",\" ? [param, ..._parseGenericParams(scanner)]\n            : throwParseError(writeUnexpectedCharacterMessage(nextNonWhitespace, \",\")));\n};\n","import { isKeyOf } from \"@arktype/util\";\nimport { tryParseDate, writeInvalidDateMessage } from \"./date.js\";\nexport const parseEnclosed = (s, enclosing) => {\n    const enclosed = s.scanner.shiftUntil(untilLookaheadIsClosing[enclosingTokens[enclosing]]);\n    if (s.scanner.lookahead === \"\")\n        return s.error(writeUnterminatedEnclosedMessage(enclosed, enclosing));\n    // Shift the scanner one additional time for the second enclosing token\n    s.scanner.shift();\n    if (enclosing === \"/\") {\n        // fail parsing if the regex is invalid\n        new RegExp(enclosed);\n        s.root = s.ctx.$.node(\"intersection\", {\n            domain: \"string\",\n            regex: enclosed\n        }, { prereduced: true });\n    }\n    else if (isKeyOf(enclosing, enclosingQuote))\n        s.root = s.ctx.$.node(\"unit\", { unit: enclosed });\n    else {\n        const date = tryParseDate(enclosed, writeInvalidDateMessage(enclosed));\n        s.root = s.ctx.$.node(\"unit\", { unit: date, description: enclosed });\n    }\n};\nexport const enclosingQuote = {\n    \"'\": 1,\n    '\"': 1\n};\nexport const enclosingChar = {\n    \"/\": 1,\n    \"'\": 1,\n    '\"': 1\n};\nexport const enclosingTokens = {\n    \"d'\": \"'\",\n    'd\"': '\"',\n    \"'\": \"'\",\n    '\"': '\"',\n    \"/\": \"/\"\n};\nexport const untilLookaheadIsClosing = {\n    \"'\": scanner => scanner.lookahead === `'`,\n    '\"': scanner => scanner.lookahead === `\"`,\n    \"/\": scanner => scanner.lookahead === `/`\n};\nconst enclosingCharDescriptions = {\n    '\"': \"double-quote\",\n    \"'\": \"single-quote\",\n    \"/\": \"forward slash\"\n};\nexport const writeUnterminatedEnclosedMessage = (fragment, enclosingStart) => `${enclosingStart}${fragment} requires a closing ${enclosingCharDescriptions[enclosingTokens[enclosingStart]]}`;\n","import { Scanner } from \"../scanner.js\";\nimport { enclosingChar, enclosingQuote, parseEnclosed } from \"./enclosed.js\";\nimport { parseUnenclosed, writeMissingOperandMessage } from \"./unenclosed.js\";\nexport const parseOperand = (s) => s.scanner.lookahead === \"\" ? s.error(writeMissingOperandMessage(s))\n    : s.scanner.lookahead === \"(\" ? s.shiftedByOne().reduceGroupOpen()\n        : s.scanner.lookaheadIsIn(enclosingChar) ? parseEnclosed(s, s.scanner.shift())\n            : s.scanner.lookaheadIsIn(Scanner.whiteSpaceTokens) ?\n                parseOperand(s.shiftedByOne())\n                : s.scanner.lookahead === \"d\" ?\n                    s.scanner.nextLookahead in enclosingQuote ?\n                        parseEnclosed(s, `${s.scanner.shift()}${s.scanner.shift()}`)\n                        : parseUnenclosed(s)\n                    : parseUnenclosed(s);\n","export const writeUnsatisfiableExpressionError = (expression) => `${expression} results in an unsatisfiable type`;\nexport const writePrefixedPrivateReferenceMessage = (def) => `Private type references should not include '#'. Use '${def.slice(1)}' instead.`;\n","import { throwInternalError, throwParseError } from \"@arktype/util\";\nimport { writeUnexpectedCharacterMessage } from \"./shift/operator/operator.js\";\nexport const fullStringParse = (s) => {\n    s.parseOperand();\n    const result = parseUntilFinalizer(s).root;\n    if (!result) {\n        return throwInternalError(`Root was unexpectedly unset after parsing string '${s.scanner.scanned}'`);\n    }\n    s.scanner.shiftUntilNonWhitespace();\n    if (s.scanner.lookahead) {\n        // throw a parse error if non-whitespace characters made it here without being parsed\n        throwParseError(writeUnexpectedCharacterMessage(s.scanner.lookahead));\n    }\n    return result;\n};\nexport const parseUntilFinalizer = (s) => {\n    while (s.finalizer === undefined)\n        next(s);\n    return s;\n};\nconst next = (s) => s.hasRoot() ? s.parseOperator() : s.parseOperand();\n","import { isKeyOf, throwInternalError, throwParseError } from \"@arktype/util\";\nimport { parseOperand } from \"../shift/operand/operand.js\";\nimport { parseOperator } from \"../shift/operator/operator.js\";\nimport { Scanner } from \"../shift/scanner.js\";\nimport { parseUntilFinalizer } from \"../string.js\";\nimport { invertedComparators, minComparators, writeMultipleLeftBoundsMessage, writeOpenRangeMessage, writeUnclosedGroupMessage, writeUnmatchedGroupCloseMessage, writeUnpairableComparatorMessage } from \"./shared.js\";\nexport class DynamicState {\n    ctx;\n    scanner;\n    // set root type to `any` so that all constraints can be applied\n    root;\n    branches = {\n        prefixes: [],\n        leftBound: null,\n        intersection: null,\n        union: null\n    };\n    finalizer;\n    groups = [];\n    constructor(def, ctx) {\n        this.ctx = ctx;\n        this.scanner = new Scanner(def);\n    }\n    error(message) {\n        return throwParseError(message);\n    }\n    hasRoot() {\n        return this.root !== undefined;\n    }\n    setRoot(root) {\n        this.root = root;\n    }\n    unsetRoot() {\n        const value = this.root;\n        this.root = undefined;\n        return value;\n    }\n    constrainRoot(...args) {\n        this.root = this.root.constrain(args[0], args[1]);\n    }\n    finalize(finalizer) {\n        if (this.groups.length)\n            return this.error(writeUnclosedGroupMessage(\")\"));\n        this.finalizeBranches();\n        this.finalizer = finalizer;\n    }\n    reduceLeftBound(limit, comparator) {\n        const invertedComparator = invertedComparators[comparator];\n        if (!isKeyOf(invertedComparator, minComparators))\n            return this.error(writeUnpairableComparatorMessage(comparator));\n        if (this.branches.leftBound) {\n            return this.error(writeMultipleLeftBoundsMessage(this.branches.leftBound.limit, this.branches.leftBound.comparator, limit, invertedComparator));\n        }\n        this.branches.leftBound = {\n            comparator: invertedComparator,\n            limit\n        };\n    }\n    finalizeBranches() {\n        this.assertRangeUnset();\n        if (this.branches.union) {\n            this.pushRootToBranch(\"|\");\n            this.root = this.branches.union;\n        }\n        else if (this.branches.intersection) {\n            this.pushRootToBranch(\"&\");\n            this.root = this.branches.intersection;\n        }\n        else\n            this.applyPrefixes();\n    }\n    finalizeGroup() {\n        this.finalizeBranches();\n        const topBranchState = this.groups.pop();\n        if (!topBranchState)\n            return this.error(writeUnmatchedGroupCloseMessage(this.scanner.unscanned));\n        this.branches = topBranchState;\n    }\n    addPrefix(prefix) {\n        this.branches.prefixes.push(prefix);\n    }\n    applyPrefixes() {\n        while (this.branches.prefixes.length) {\n            const lastPrefix = this.branches.prefixes.pop();\n            this.root =\n                lastPrefix === \"keyof\" ?\n                    this.root.keyof()\n                    : throwInternalError(`Unexpected prefix '${lastPrefix}'`);\n        }\n    }\n    pushRootToBranch(token) {\n        this.assertRangeUnset();\n        this.applyPrefixes();\n        const root = this.root;\n        this.branches.intersection = this.branches.intersection?.and(root) ?? root;\n        if (token === \"|\") {\n            this.branches.union =\n                this.branches.union?.or(this.branches.intersection) ??\n                    this.branches.intersection;\n            this.branches.intersection = null;\n        }\n        this.root = undefined;\n    }\n    parseUntilFinalizer() {\n        return parseUntilFinalizer(new DynamicState(this.scanner.unscanned, this.ctx));\n    }\n    parseOperator() {\n        return parseOperator(this);\n    }\n    parseOperand() {\n        return parseOperand(this);\n    }\n    assertRangeUnset() {\n        if (this.branches.leftBound) {\n            return this.error(writeOpenRangeMessage(this.branches.leftBound.limit, this.branches.leftBound.comparator));\n        }\n    }\n    reduceGroupOpen() {\n        this.groups.push(this.branches);\n        this.branches = {\n            prefixes: [],\n            leftBound: null,\n            union: null,\n            intersection: null\n        };\n    }\n    previousOperator() {\n        return (this.branches.leftBound?.comparator ??\n            this.branches.prefixes.at(-1) ??\n            (this.branches.intersection ? \"&\"\n                : this.branches.union ? \"|\"\n                    : undefined));\n    }\n    shiftedByOne() {\n        this.scanner.shift();\n        return this;\n    }\n}\n","import { ArkErrors, BaseRoot } from \"@arktype/schema\";\nimport { Callable } from \"@arktype/util\";\nimport { Generic } from \"./generic.js\";\nimport { parseGenericParams } from \"./parser/generic.js\";\nconst typeParserAttachments = Object.freeze({\n    errors: ArkErrors\n});\nexport class RawTypeParser extends Callable {\n    constructor($) {\n        super((...args) => {\n            if (args.length === 1) {\n                // treat as a simple definition\n                return $.parseRoot(args[0]);\n            }\n            if (args.length === 2 &&\n                typeof args[0] === \"string\" &&\n                args[0][0] === \"<\" &&\n                args[0].at(-1) === \">\") {\n                // if there are exactly two args, the first of which looks like <${string}>,\n                // treat as a generic\n                const params = parseGenericParams(args[0].slice(1, -1));\n                const def = args[1];\n                // TODO: validateUninstantiatedGeneric, remove this cast\n                return new Generic(params, def, $);\n            }\n            // otherwise, treat as a tuple expression. technically, this also allows\n            // non-expression tuple definitions to be parsed, but it's not a supported\n            // part of the API as specified by the associated types\n            return $.parseRoot(args);\n        }, { bind: $, attach: typeParserAttachments });\n    }\n}\nexport const Type = BaseRoot;\n","import { RawRootScope, hasArkKind } from \"@arktype/schema\";\nimport { domainOf, hasDomain, isThunk, throwParseError } from \"@arktype/util\";\nimport { Generic } from \"./generic.js\";\nimport { createMatchParser } from \"./match.js\";\nimport { parseObject, writeBadDefinitionTypeMessage } from \"./parser/definition.js\";\nimport { parseGenericParams } from \"./parser/generic.js\";\nimport { DynamicState } from \"./parser/string/reduce/dynamic.js\";\nimport { fullStringParse } from \"./parser/string/string.js\";\nimport { RawTypeParser } from \"./type.js\";\nexport const scope = ((def, config = {}) => new RawScope(def, config));\nexport class RawScope extends RawRootScope {\n    parseCache = {};\n    constructor(def, config) {\n        const aliases = {};\n        for (const k in def) {\n            const parsedKey = parseScopeKey(k);\n            aliases[parsedKey.name] =\n                parsedKey.params.length ?\n                    // TODO: this\n                    new Generic(parsedKey.params, def[k], {})\n                    : def[k];\n        }\n        super(aliases, config);\n    }\n    type = new RawTypeParser(this);\n    match = createMatchParser(this);\n    declare = (() => ({\n        type: this.type\n    })).bind(this);\n    define = ((def) => def).bind(this);\n    preparseRoot(def) {\n        if (isThunk(def) && !hasArkKind(def, \"generic\"))\n            return def();\n        return def;\n    }\n    parseRoot(def) {\n        // args: { this: {} as RawRoot },\n        return this.parse(def, {\n            $: this,\n            args: {}\n            // type parsing can bypass nodes if it hits the cache,\n            // so bind it directly (could be optimized)\n        }).bindScope(this);\n    }\n    parse(def, ctx) {\n        if (typeof def === \"string\") {\n            if (ctx.args && Object.keys(ctx.args).every(k => !def.includes(k))) {\n                // we can only rely on the cache if there are no contextual\n                // resolutions like \"this\" or generic args\n                return this.parseString(def, ctx);\n            }\n            if (!this.parseCache[def])\n                this.parseCache[def] = this.parseString(def, ctx);\n            return this.parseCache[def];\n        }\n        return hasDomain(def, \"object\") ?\n            parseObject(def, ctx)\n            : throwParseError(writeBadDefinitionTypeMessage(domainOf(def)));\n    }\n    parseString(def, ctx) {\n        return (this.maybeResolveRoot(def) ??\n            ((def.endsWith(\"[]\") &&\n                this.maybeResolveRoot(def.slice(0, -2))?.array()) ||\n                fullStringParse(new DynamicState(def, ctx))));\n    }\n}\nexport const writeShallowCycleErrorMessage = (name, seen) => `Alias '${name}' has a shallow resolution cycle: ${[...seen, name].join(\":\")}`;\nexport const parseScopeKey = (k) => {\n    const firstParamIndex = k.indexOf(\"<\");\n    if (firstParamIndex === -1) {\n        return {\n            name: k,\n            params: []\n        };\n    }\n    if (k.at(-1) !== \">\") {\n        throwParseError(`'>' must be the last character of a generic declaration in a scope`);\n    }\n    return {\n        name: k.slice(0, firstParamIndex),\n        params: parseGenericParams(k.slice(firstParamIndex + 1, -1))\n    };\n};\n","export const createMatchParser = ($) => (() => { }).bind($);\n// const matchParser = (isRestricted: boolean) => {\n// \tconst handledCases: { when: RawRoot; then: Morph }[] = []\n// \tlet defaultCase: ((x: unknown) => unknown) | null = null\n// \tconst parser = {\n// \t\twhen: (when: unknown, then: Morph) => {\n// \t\t\thandledCases.push({ when: $.parseRoot(when, {}), then })\n// \t\t\treturn parser\n// \t\t},\n// \t\tfinalize: () => {\n// \t\t\t// TODO: exhaustiveness checking\n// \t\t\tconst branches = handledCases.flatMap(({ when, then }) => {\n// \t\t\t\tif (when.kind === \"union\") {\n// \t\t\t\t\treturn when.branches.map((branch) => ({\n// \t\t\t\t\t\tin: branch,\n// \t\t\t\t\t\tmorph: then\n// \t\t\t\t\t}))\n// \t\t\t\t}\n// \t\t\t\tif (when.kind === \"morph\") {\n// \t\t\t\t\treturn [{ in: when, morph: [when.morph, then] }]\n// \t\t\t\t}\n// \t\t\t\treturn [{ in: when, morph: then }]\n// \t\t\t})\n// \t\t\tif (defaultCase) {\n// \t\t\t\tbranches.push({ in: keywordNodes.unknown, morph: defaultCase })\n// \t\t\t}\n// \t\t\tconst matchers = $.node(\"union\", {\n// \t\t\t\tbranches,\n// \t\t\t\tordered: true\n// \t\t\t})\n// \t\t\treturn matchers.assert\n// \t\t},\n// \t\torThrow: () => {\n// \t\t\t// implicitly finalize, we don't need to do anything else because we throw either way\n// \t\t\treturn parser.finalize()\n// \t\t},\n// \t\tdefault: (x: unknown) => {\n// \t\t\tif (x instanceof Function) {\n// \t\t\t\tdefaultCase = x as never\n// \t\t\t} else {\n// \t\t\t\tdefaultCase = () => x\n// \t\t\t}\n// \t\t\treturn parser.finalize()\n// \t\t}\n// \t}\n// \treturn parser\n// }\n// return Object.assign(() => matchParser(false), {\n// \tonly: () => matchParser(true)\n// }) as never\n","import { keywordNodes } from \"@arktype/schema\";\nimport { RawScope, scope } from \"./scope.js\";\nexport const tsGenerics = {};\nexport const ambient = scope(keywordNodes);\nRawScope.ambient = ambient.raw;\nexport const ark = ambient.export();\nexport const type = ambient.type;\nexport const match = ambient.match;\nexport const define = ambient.define;\nexport const declare = ambient.declare;\n","import { FieldError, FieldErrors } from 'react-hook-form';\nimport { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport type { Resolver } from './types';\nimport { ArkErrors } from 'arktype';\n\nconst parseErrorSchema = (e: ArkErrors): Record<string, FieldError> => {\n  // copy code to type to match FieldError shape\n  e.forEach((e) => Object.assign(e, { type: e.code }));\n  // need to cast here because TS doesn't understand we added the type field\n  return e.byPath as never;\n};\n\nexport const arktypeResolver: Resolver =\n  (schema, _schemaOptions, resolverOptions = {}) =>\n  (values, _, options) => {\n    const out = schema(values);\n\n    if (out instanceof ArkErrors) {\n      return {\n        values: {},\n        errors: toNestErrors(parseErrorSchema(out), options),\n      };\n    }\n\n    options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n    return {\n      errors: {} as FieldErrors,\n      values: resolverOptions.raw ? values : out,\n    };\n  };\n"],"names":["ReadonlyArray","Array","includes","array","element","append","to","value","opts","undefined","isArray","prepend","unshift","push","appendUnique","InternalArktypeError","Error","throwInternalError","message","throwError","ctor","ParseError","name","throwParseError","flatMorph","o","flatMapEntry","inputIsArray","entries","Object","flatMap","entry","i","result","length","objectResult","fromEntries","values","entriesOf","isKeyOf","k","InnerDynamicBase","constructor","properties","assign","this","DynamicBase","NoopBase","CastableBase","splitByKeys","leftKeys","l","r","omit","keys","isEmptyObject","stringAndSymbolicEntriesOf","getOwnPropertySymbols","map","unset","Symbol","bound","target","ctx","addInitializer","bind","cached","context","call","defineProperty","kind","enumerable","isThunk","DynamicFunction","Function","args","params","slice","body","at","super","e","Callable","f","setPrototypeOf","prototype","attach","envHasCsp","thunk","cachedThunk","hasDomain","data","domainOf","builtinType","domainDescriptions","bigint","number","object","string","symbol","boolean","null","builtinConstructors","Date","Map","RegExp","Set","String","Number","Boolean","WeakMap","WeakSet","Promise","objectKindOf","getPrototypeOf","objectKindOrDomainOf","objectKindDescriptions","getExactBuiltinConstructorName","constructorName","prototypeKeysOf","curr","getOwnPropertyNames","baseKeysByDomain","constructorExtends","base","current","serializePrimitive","JSON","stringify","registry","globalThis","$ark","namesByResolution","nameCounts","register","existingName","get","baseNameFor","set","registeredReference","isDotAccessible","keyName","test","compileSerializedValue","prefix","toLowerCase","description","CompiledFunction","argNames","arg","indentation","indent","dedent","prop","key","optional","compileLiteralPropAccess","index","indexPropAccess","line","statement","repeat","identifier","expression","condition","then","block","elseIf","until","initialValue","forIn","contents","suffix","compile","serializeLiteralKey","Hkt","Kind","Instantiable","reify","def","hkt","UnaryKind","pipe","kinds","In","reduce","out","wellFormedNumberMatcher","isWellFormedNumber","numberLikeMatcher","wellFormedIntegerMatcher","isWellFormedInteger","integerLikeMatcher","isIntegerLike","numericLiteralDescriptions","integer","writeMalformedNumericLiteralMessage","tryParseNumber","token","options","parseNumeric","parseInt","parseKind","isNaN","s","isKindLike","strict","isWellFormed","errorOnFail","printable","toDateString","_serialize","printableOpts","onSymbol","onCycle","v","onFunction","seen","nextSeen","item","onUndefined","makeRootAndArrayPropertiesMutable","arkKind","hasArkKind","isNode","basisKinds","structuralKinds","refinementKinds","constraintKinds","rootKinds","nodeKinds","constraintKeys","structureKeys","precedenceByKind","isNodeKind","precedenceOfKind","schemaKindsRightOf","defaultValueSerializer","compileErrorContext","implementNode","_","implementation","hasAssociatedError","defaults","expected","actual","problem","path","problemWithLocation","propString","globalConfig","ArkError","input","nodeConfig","defineProperties","getOwnPropertyDescriptors","code","errors","hasCode","config","relativePath","propAccessChain","pathToPropString","toString","ArkErrors","byPath","count","mutable","add","error","existing","errorIntersection","existingIndex","indexOf","summary","join","TraversalContext","root","queuedMorphs","branches","currentBranch","queueMorphs","morphs","finalize","hasError","parent","pathIndex","morph","currentErrorCount","failFast","errCtx","segment","invalid","pushBranch","popBranch","pop","BaseNode","attachments","pipedFromCtx","includesMorph","allowsRequiresContext","allows","traverseApply","$","resolvedConfig","qualifiedId","id","hasKind","hasDefault","undeclared","children","some","child","inner","predicate","referencesById","references","precedence","jit","traverseAllows","traverse","_in","getIo","_out","_description","ioInner","keySchemaImplementation","impl","meta","childValue","node","toJSON","json","equals","other","typeHash","isBasis","isConstraint","isRefinement","isRoot","hasUnit","hasOpenIntersection","intersectionIsOpen","nestableExpression","bindScope","create","firstReference","filter","find","n","firstReferenceOrThrow","firstReferenceOfKind","firstReferenceOfKindOrThrow","transform","mapper","_transform","shouldTransform","lazilyResolve","transformedNode","innerWithTransformedChildren","transformed","transformedInner","in","keywords","unknown","configureShallowDescendants","configOrDescription","Disjoint","sources","clone","from","flat","disjointKinds","disjoint","describeReasons","reasons","pathString","parse","isEmpty","invert","invertedEntries","disjoints","forEach","withPrefixKey","entriesWithPrefix","segments","source","describeReason","intersectionCache","intersectNodesRoot","intersectNodes","operator","lrCacheKey","rlCacheKey","rlResult","lrResult","pipeToMorph","pipeFromMorph","intersections","validatedOut","outIntersection","BaseConstraint","impliedSiblings","intersect","RawPrimitiveConstraint","errorContext","js","traversalKind","return","compiledCondition","if","compiledNegation","compiledErrorContext","constraintKeyParser","schema","sort","innerHash","intersectConstraints","head","shift","raw","baseInner","unflattenConstraints","prereduced","roots","matched","splice","flattenConstraints","constraints","constraint","predicateImplementation","collapsibleKey","normalize","divisorImplementation","rule","divisor","Math","abs","greatestCommonDivisor","previous","BaseRange","boundOperandKind","operandKindsByBoundKind","compiledActual","comparator","compileComparator","exclusive","numericLimit","valueOf","negatedComparators","stringLimit","dateLimitToString","limitKind","isStricterThan","overlapsRange","overlapIsUnit","boundKindPairsByLower","min","minLength","after","parseExclusiveKey","flag","parseDateLimit","limit","max","maxLength","before","toLocaleString","afterImplementation","serialize","toISOString","beforeImplementation","unit","exactLengthImplementation","exactLength","maxImplementation","maxLengthImplementation","boundImplementationsByKind","boundClassesByKind","impliedBasis","lengthBoundable","regexImplementation","flags","regex","BaseRoot","_keyof","keyof","rawKeyOf","rNode","parseRoot","and","throw","or","assert","extract","branch","extends","exclude","proto","sequence","intersection","subsumes","configure","describe","acc","pipeOnce","narrow","constrain","toUpperCase","writeInvalidOperandMessage","throwInvalidOperandError","onUndeclaredKey","defineRightwardIntersections","AliasNode","_get_resolution_decorators","_classSuper","_instanceExtraInitializers","_metadata","metadata","descriptorIn","decorators","contextIn","initializers","extraInitializers","accept","TypeError","descriptor","getOwnPropertyDescriptor","done","p","access","init","__esDecorate","static","private","has","obj","resolution","configurable","writable","thisArg","useValue","arguments","__runInitializers","alias","resolve","resolveRoot","invoke","normalizeAliasSchema","aliasImplementation","neverIfDisjoint","never","RawBasis","units","literalKeys","domainImplementation","domain","metaKeys","intersectIntersections","lBasis","rBasis","basisResult","intersectionImplementation","rawSchema","structure","hasRootStructureKey","normalizedStructure","normalized","finalizeJson","rest","collapsibleJson","structureJson","minVariadicLength","sequenceJson","variadic","basis","morphInputKinds","morphImplementation","m","inTersection","inBranch","protoImplementation","builtinName","unionChildKinds","unionImplementation","ordered","reducedBranches","reduceBranches","describeBranches","pathDescriptions","branchesAtPath","errorAtPath","every","union","isNever","resultBranches","intersectBranches","UnionNode","_discriminate_decorators","discriminate","isBoolean","unitBranches","discriminant","discriminantJson","discriminantToJson","b","compileIndiscriminable","cases","caseKeys","const","serializedValue","casesBySpecifier","lIndex","rIndex","discriminantKinds","qualifiedDiscriminant","lSerialized","rSerialized","bestDiscriminantEntry","a","specifier","bestCases","parseDiscriminantKey","defaultBranches","caseBranches","prunedBranches","pruned","pruneDiscriminant","caseNode","default","descriptions","batchesByR","candidatesByR","branchIntersection","batch","uniquenessByIndex","j","lastPathIndex","lastIndexOf","discriminantKind","nodeKind","unitImplementation","preserveUndefined","rConstraint","compileEqualityCheck","negated","indexImplementation","signature","propertyKey","writeInvalidPropertyKeyMessage","enumerableBranches","writeEnumerableIndexBranches","valueIntersection","indexSchema","intersectProps","required","compiledKey","defaultIntersection","BaseProp","serializedKey","defaultValueMorphs","defaultValueMorphsReference","allowed","traverseKey","else","optionalImplementation","requiredImplementation","missingValueDescription","fixedSequenceKeySchemaDefinition","sequenceImplementation","optionals","postfix","postfixWithoutVariadicMessage","postfixFollowingOptionalMessage","isVariadicOnly","tuple","rootState","_intersectSequences","fixedVariants","viableBranches","sequenceTupleToInner","state","lHead","lTail","rHead","rTail","lHasPostfix","rHasPostfix","postfixBranchResult","lRemaining","rRemaining","arrayIndexMatcher","arrayIndexMatcherReference","StructureNode","_keyof_decorators","props","propsByKey","propsByKeyReference","structuralExpression","requiredLiteralKeys","optionalLiteralKeys","concat","exhaustive","omitFromInner","merge","_traverse","errorCount","initializeErrorCount","check","returnIfFailFast","for","compileExhaustiveEntry","let","createStructuralWriter","childStringProp","parts","objectLiteralDescription","structuralDescription","structureImplementation","behavior","lInner","rInner","lKey","disjointRKeys","indexOverlap","normalizeIndex","rKey","disjointLKeys","nonEnumerableBranches","list","by","spliterate","nodeImplementationsByKind","nodeClassesByKind","getBaseDomainKeys","compiledValue","serializedConstructor","serializedMorphs","compiledMorphs","lastMorph","refinements","returnIfFail","instance","serializedPredicate","freeze","prevariadic","minLengthNode","maxLengthNode","childAtIndex","firstPostfixIndex","dataIndex","keyExpression","nonNegativeIntegerString","sequenceInnerToTuple","RootModule","baseKeys","schemaKindOf","allowedKinds","discriminateRootKind","schemaKeys","nodeCache","serializeListableChild","listableNode","NodeCompiler","discriminants","requiresContextFor","reference","accessExpression","requiresContext","writeMethod","defaultConfig","jitless","registerKeywords","prereducedAliases","nonInheritedKeys","extendConfig","extension","extensions","mergeConfigs","writeDuplicateAliasError","nodeCountsByPrefix","scopeCount","RawRootScope","_schema_decorators","_defineRoot_decorators","_units_decorators","defineRoot","resolutions","exportedNames","aliases","resolved","ambient","resolveConfig","export","uniqueValues","lazyResolutions","syntheticAlias","synthetic","nodeSchema","schemaBranchesOf","normalizedSchema","schemaEntries","keyImpl","typeJson","collapsibleKeys","reduceTo","reduced","parseNode","bindCompiledScope","maybeResolveRoot","writeUnresolvableMessage","maybeResolveGenericOrRoot","maybeResolve","writeMissingSubmoduleAccessMessage","preparseRoot","maybeShallowResolve","g","maybeResolveSubalias","resolveSubalias","import","names","_exportedResolutions","_exports","resolutionsOfModule","dotIndex","dotPrefix","prefixSchema","writeNonSubmoduleDotMessage","subalias","schemaScope","RootScope","typeSet","prefixedResolutions","innerK","innerV","compiledTraversals","compileScope","allowsCompiler","applyCompiler","tsKeywords","any","false","true","void","internalKeywords","jsObjects","defineRegex","parseFloat","parsed","isSafeInteger","url","URL","parsing","date","tryParseDatePattern","ipv4Segment","ipv4Address","ipv4","ipv6Segment","ipv6","ip","email","uuid","semver","creditCard","creditCardInput","sanitized","replace","digit","tmpNum","sum","shouldDouble","substring","validation","alpha","alphanumeric","lowercase","uppercase","ambientRootScope","keywordNodes","Generic","Scanner","chars","lookahead","nextLookahead","shiftUntil","shifted","escapeToken","shiftUntilNextTerminator","shiftUntilNonWhitespace","lookaheadIsTerminator","lookaheadIsNotWhitespace","jumpToIndex","location","unscanned","scanned","sliceChars","start","end","lookaheadIs","char","lookaheadIsIn","tokens","scanner","terminatingChars","whiteSpaceTokens","finalizingLookaheads","lookaheadIsFinalizing","trimStart","parseEntry","parsedKey","parseKey","invalidDefaultKeyKindMessage","minComparators","maxComparators","invertedComparators","writeUnclosedGroupMessage","missingChar","writeUnpairableComparatorMessage","_parseGenericArgs","argDefs","argNodes","argState","parseUntilFinalizer","finalizer","writeInvalidGenericArgsMessage","writeMissingOperandMessage","previousOperator","writeMissingRightOperandMessage","writeExpressionExpectedMessage","appendElement","requiredPostOptionalMessage","optionalPostVariadicMessage","multipleVariadicMesage","appendSpreadBranch","spread","parseBranchTuple","writeMalformedFunctionalExpressionMessage","indexOneParsers","prefixParsers","instanceof","writeInvalidConstructorMessage","writeBadDefinitionTypeMessage","isValidDate","d","writeInvalidDateMessage","oneCharComparators","comparatorStartChars","getBoundKinds","boundKind","writeInvalidLimitMessage","writeUnboundableMessage","writeInvalidDivisorMessage","parseOperator","setRoot","incompleteArrayTokenMessage","pushRootToBranch","finalizeGroup","shiftComparator","reduceLeftBound","unsetRoot","literal","previousRoot","previousScannerIndex","parseOperand","limitNode","limitToken","constrainRoot","leftBound","lowerBoundKind","parseRightBound","parseBound","divisorToken","parseDivisor","writeUnexpectedCharacterMessage","shouldBe","parseGenericParams","_parseGenericParams","param","nextNonWhitespace","parseEnclosed","enclosing","enclosed","untilLookaheadIsClosing","enclosingTokens","writeUnterminatedEnclosedMessage","enclosingQuote","stringParsedDate","epochMillis","numberParsedDate","maybeParseDate","enclosingChar","enclosingCharDescriptions","fragment","enclosingStart","shiftedByOne","reduceGroupOpen","addPrefix","parsedArgs","parseGenericArgs","remainingChars","parseGenericInstantiation","maybeParseReference","maybeNumber","maybeBigint","maybeIntegerLiteral","BigInt","tryParseWellFormedBigint","maybeParseUnenclosedLiteral","unenclosedToNode","parseUnenclosed","next","hasRoot","DynamicState","prefixes","groups","finalizeBranches","invertedComparator","openLimit","openComparator","writeMultipleLeftBoundsMessage","assertRangeUnset","applyPrefixes","topBranchState","lastPrefix","typeParserAttachments","RawTypeParser","RawScope","parseCache","parseScopeKey","type","match","createMatchParser","declare","define","parseString","objectKind","parsedEntries","spreadEntry","spreadNode","writeInvalidSpreadTypeMessage","normalizedSignature","structureNode","parseObjectLiteral","isIndexZeroExpression","isIndexOneExpression","maybeParseTupleExpression","sequences","parseTupleLiteral","parseTuple","resolvedDef","parseObject","endsWith","fullStringParse","firstParamIndex","scope","arktypeResolver","_schemaOptions","resolverOptions","toNestErrors","shouldUseNativeValidation","validateFieldsNatively"],"mappings":"+EAgBO,MAWMA,EAAgBC,MAChBC,EAAW,CAACC,EAAOC,IAAYD,EAAMD,SAASE,GAW9CC,EAAS,CAACC,EAAIC,EAAOC,SAChBC,IAAVF,EACOD,GAAM,QACNG,IAAPH,OACkBG,IAAVF,EAAsB,GACxBN,MAAMS,QAAQH,GAASA,EACnB,CAACA,IAEXC,GAAMG,QACNV,MAAMS,QAAQH,GAASD,EAAGM,WAAWL,GAASD,EAAGM,QAAQL,GAEzDN,MAAMS,QAAQH,GAASD,EAAGO,QAAQN,GAASD,EAAGO,KAAKN,GAChDD,GA6BEQ,EAAe,CAACR,EAAIC,SAClBE,IAAPH,EACO,CAACC,IACPD,EAAGJ,SAASK,IACbD,EAAGO,KAAKN,GACLD,GCrFJ,MAAMS,UAA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