/** Compiler-owned host ABI for checked public, private, and static class-field reads. */ export declare const VELAR_CLASS_FIELD_RUNTIME = "const __velarClassNativeObject = globalThis.Object;\nconst __velarClassNativeReflect = globalThis.Reflect;\nconst __velarClassNativeTypeError = globalThis.TypeError;\nconst __velarClassGetOwnPropertyDescriptor = __velarClassNativeObject.getOwnPropertyDescriptor;\nconst __velarClassReflectApply = __velarClassGetOwnPropertyDescriptor(__velarClassNativeReflect, \"apply\")?.value;\nconst __velarClassReflectGet = __velarClassGetOwnPropertyDescriptor(__velarClassNativeReflect, \"get\")?.value;\nconst __velarClassGetPrototypeOf = __velarClassGetOwnPropertyDescriptor(__velarClassNativeObject, \"getPrototypeOf\")?.value;\nfunction __velarClassHostCall(operation, receiver, arguments_) {\n if (typeof operation !== \"function\" || typeof __velarClassReflectApply !== \"function\") throw new __velarClassNativeTypeError(\"The JavaScript class field runtime is unavailable\");\n return __velarClassReflectApply(operation, receiver, arguments_);\n}\nfunction __velarReadInstanceField(receiver, name) {\n const value = __velarClassHostCall(__velarClassReflectGet, __velarClassNativeReflect, [receiver, name]);\n if (value === undefined) throw new __velarClassNativeTypeError(\"Field '\" + name + \"' was read before initialization or contains undefined\");\n return value;\n}\nfunction __velarReadPrivateField(value, name) {\n if (value === undefined) throw new __velarClassNativeTypeError(\"Private field '\" + name + \"' was read before initialization or contains undefined\");\n return value;\n}\nfunction __velarReadStaticField(receiver, name, ownerDepth) {\n let owner = receiver;\n for (let depth = 0; depth < ownerDepth; depth += 1) owner = __velarClassHostCall(__velarClassGetPrototypeOf, __velarClassNativeObject, [owner]);\n const descriptor = owner == null ? null : __velarClassHostCall(__velarClassGetOwnPropertyDescriptor, __velarClassNativeObject, [owner, name]);\n if (!descriptor || !(\"value\" in descriptor) || descriptor.value === undefined) {\n throw new __velarClassNativeTypeError(\"Static field '\" + name + \"' was read before initialization\");\n }\n const value = __velarClassHostCall(__velarClassReflectGet, __velarClassNativeReflect, [receiver, name]);\n if (value === undefined) throw new __velarClassNativeTypeError(\"Static field '\" + name + \"' contains undefined\");\n return value;\n}\n"; /** Project-shared implementation of compiler-lowered checked class-field reads. */ export declare const VELAR_CLASS_FIELD_MODULE_SOURCE: string; /** Canonical generated runtime for collection identity and runtime-Type traversal. */ export declare const VELAR_COLLECTION_IDENTITY_RUNTIME = "const __velarCollectionNativeArray = globalThis.Array;\nconst __velarCollectionNativeMap = globalThis.Map;\nconst __velarCollectionNativeSet = globalThis.Set;\nconst __velarCollectionNativeObject = globalThis.Object;\nconst __velarCollectionNativeReflect = globalThis.Reflect;\nconst __velarCollectionNativeWeakMap = globalThis.WeakMap;\nconst __velarCollectionNativeTypeError = globalThis.TypeError;\nconst __velarCollectionGetOwnPropertyDescriptor = __velarCollectionNativeObject.getOwnPropertyDescriptor;\nconst __velarCollectionReflectApply = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeReflect, \"apply\")?.value;\nconst __velarCollectionArrayIsArray = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeArray, \"isArray\")?.value;\nconst __velarCollectionGetPrototypeOf = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"getPrototypeOf\")?.value;\nconst __velarCollectionObjectPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"prototype\")?.value;\nconst __velarCollectionMapPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeMap, \"prototype\")?.value;\nconst __velarCollectionSetPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeSet, \"prototype\")?.value;\nconst __velarCollectionMapSize = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"size\")?.get;\nconst __velarCollectionSetSize = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, \"size\")?.get;\nfunction __velarCollectionHostCall(operation, receiver, arguments_) {\n if (typeof operation !== \"function\" || typeof __velarCollectionReflectApply !== \"function\") throw new __velarCollectionNativeTypeError(\"The JavaScript collection runtime is unavailable\");\n return __velarCollectionReflectApply(operation, receiver, arguments_);\n}\nconst __velarCollectionWeakMapPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeWeakMap, \"prototype\")?.value;\nconst __velarCollectionWeakMapGetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionWeakMapPrototype, \"get\")?.value;\nconst __velarCollectionWeakMapSetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionWeakMapPrototype, \"set\")?.value;\nconst __velarCollectionBrands = new __velarCollectionNativeWeakMap();\n// The only unforgeable, cross-realm Map/Set test JavaScript offers is invoking\n// the prototype 'size' getter and observing whether it throws, and a thrown and\n// caught exception costs roughly 1.8us -- paid by every Set membership test,\n// which probes Map first. Internal slots are fixed at construction, so the\n// verdict can never change for a given object: probe once, then answer from a\n// WeakMap. 0 = neither, 1 = Map, 2 = Set.\nfunction __velarCollectionBrand(value) {\n if (value === null || (typeof value !== \"object\" && typeof value !== \"function\")) return 0;\n const known = __velarCollectionHostCall(__velarCollectionWeakMapGetOperation, __velarCollectionBrands, [value]);\n if (known !== undefined) return known;\n let brand = 0;\n try { __velarCollectionHostCall(__velarCollectionMapSize, value, []); brand = 1; }\n catch {\n try { __velarCollectionHostCall(__velarCollectionSetSize, value, []); brand = 2; }\n catch { brand = 0; }\n }\n __velarCollectionHostCall(__velarCollectionWeakMapSetOperation, __velarCollectionBrands, [value, brand]);\n return brand;\n}\nfunction __velarIsMap(value) {\n return __velarCollectionBrand(value) === 1;\n}\nfunction __velarIsSet(value) {\n return __velarCollectionBrand(value) === 2;\n}\nfunction __velarIsRecord(value) {\n if (value === null || typeof value !== \"object\" || __velarCollectionHostCall(__velarCollectionArrayIsArray, __velarCollectionNativeArray, [value])) return false;\n const prototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [value]);\n return prototype === __velarCollectionObjectPrototype || prototype === null;\n}\n"; /** Additional host traversal used only when a module emits runtime collection Types. */ export declare const VELAR_COLLECTION_TYPE_RUNTIME = "const __velarCollectionOwnNames = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"getOwnPropertyNames\")?.value;\nconst __velarCollectionOwnSymbols = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"getOwnPropertySymbols\")?.value;\nconst __velarCollectionOwnKeys = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeReflect, \"ownKeys\")?.value;\nconst __velarCollectionMapEntries = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"entries\")?.value;\nconst __velarCollectionSetValues = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, \"values\")?.value;\nconst __velarCollectionMapIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionMapEntries, new __velarCollectionNativeMap(), [])]);\nconst __velarCollectionSetIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionSetValues, new __velarCollectionNativeSet(), [])]);\nconst __velarCollectionMapIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapIteratorPrototype, \"next\")?.value;\nconst __velarCollectionSetIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetIteratorPrototype, \"next\")?.value;\nfunction __velarCollectionMapTypeIterator(value) { return __velarCollectionHostCall(__velarCollectionMapEntries, value, []); }\nfunction __velarCollectionSetTypeIterator(value) { return __velarCollectionHostCall(__velarCollectionSetValues, value, []); }\nfunction __velarCollectionMapTypeNext(iterator) { return __velarCollectionHostCall(__velarCollectionMapIteratorNext, iterator, []); }\nfunction __velarCollectionSetTypeNext(iterator) { return __velarCollectionHostCall(__velarCollectionSetIteratorNext, iterator, []); }\n"; /** Host operations required by ordinary List validation and receiver methods. */ export declare const VELAR_COLLECTION_LIST_RUNTIME = "const __velarCollectionListNativeNumber = globalThis.Number;\nconst __velarCollectionListNativeMath = globalThis.Math;\nconst __velarCollectionListNativeRangeError = globalThis.RangeError;\nconst __velarCollectionListArrayPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeArray, \"prototype\")?.value;\nconst __velarCollectionListOwnNamesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"getOwnPropertyNames\")?.value;\nconst __velarCollectionListOwnSymbolsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"getOwnPropertySymbols\")?.value;\nconst __velarCollectionListDefinePropertyOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"defineProperty\")?.value;\nconst __velarCollectionListObjectIsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"is\")?.value;\nconst __velarCollectionListIntegerOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeNumber, \"isInteger\")?.value;\nconst __velarCollectionListSafeIntegerOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeNumber, \"isSafeInteger\")?.value;\nconst __velarCollectionListNaNOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeNumber, \"isNaN\")?.value;\nconst __velarCollectionListFiniteOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeNumber, \"isFinite\")?.value;\nconst __velarCollectionListMaximumOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeMath, \"max\")?.value;\nconst __velarCollectionListMinimumOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeMath, \"min\")?.value;\nconst __velarCollectionListJoinOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListArrayPrototype, \"join\")?.value;\nconst __velarCollectionListSortOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListArrayPrototype, \"sort\")?.value;\nconst __velarCollectionListReverseOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListArrayPrototype, \"reverse\")?.value;\nfunction __velarCollectionListIsArray(value) { return __velarCollectionHostCall(__velarCollectionArrayIsArray, __velarCollectionNativeArray, [value]); }\nfunction __velarCollectionListGetOwnPropertyDescriptor(value, key) { return __velarCollectionHostCall(__velarCollectionGetOwnPropertyDescriptor, __velarCollectionNativeObject, [value, key]); }\nfunction __velarCollectionListOwnNames(value) { return __velarCollectionHostCall(__velarCollectionListOwnNamesOperation, __velarCollectionNativeObject, [value]); }\nfunction __velarCollectionListOwnSymbols(value) { return __velarCollectionHostCall(__velarCollectionListOwnSymbolsOperation, __velarCollectionNativeObject, [value]); }\nfunction __velarCollectionListDefineProperty(value, key, descriptor) { return __velarCollectionHostCall(__velarCollectionListDefinePropertyOperation, __velarCollectionNativeObject, [value, key, descriptor]); }\nfunction __velarCollectionListObjectIs(left, right) { return __velarCollectionHostCall(__velarCollectionListObjectIsOperation, __velarCollectionNativeObject, [left, right]); }\nfunction __velarCollectionListIsInteger(value) { return __velarCollectionHostCall(__velarCollectionListIntegerOperation, __velarCollectionListNativeNumber, [value]); }\nfunction __velarCollectionListIsSafeInteger(value) { return __velarCollectionHostCall(__velarCollectionListSafeIntegerOperation, __velarCollectionListNativeNumber, [value]); }\nfunction __velarCollectionListIsNaN(value) { return __velarCollectionHostCall(__velarCollectionListNaNOperation, __velarCollectionListNativeNumber, [value]); }\nfunction __velarCollectionListIsFinite(value) { return __velarCollectionHostCall(__velarCollectionListFiniteOperation, __velarCollectionListNativeNumber, [value]); }\nfunction __velarCollectionListMaximum(...values) { return __velarCollectionHostCall(__velarCollectionListMaximumOperation, __velarCollectionListNativeMath, values); }\nfunction __velarCollectionListMinimum(...values) { return __velarCollectionHostCall(__velarCollectionListMinimumOperation, __velarCollectionListNativeMath, values); }\nfunction __velarCollectionListHostJoin(value, separator) { return __velarCollectionHostCall(__velarCollectionListJoinOperation, value, [separator]); }\nfunction __velarCollectionListHostSort(value, compare) { return __velarCollectionHostCall(__velarCollectionListSortOperation, value, [compare]); }\nfunction __velarCollectionListHostReverse(value) { return __velarCollectionHostCall(__velarCollectionListReverseOperation, value, []); }\n"; /** Host operations required by ordinary Set and Map construction and receiver methods. */ export declare const VELAR_COLLECTION_SET_MAP_RUNTIME = "const __velarCollectionSetMapNativeRangeError = globalThis.RangeError;\nconst __velarCollectionSetMapFreezeOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"freeze\")?.value;\nconst __velarCollectionSetAddOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, \"add\")?.value;\nconst __velarCollectionSetHasOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, \"has\")?.value;\nconst __velarCollectionSetDeleteOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, \"delete\")?.value;\nconst __velarCollectionSetClearOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, \"clear\")?.value;\nconst __velarCollectionSetValuesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, \"values\")?.value;\nconst __velarCollectionMapGetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"get\")?.value;\nconst __velarCollectionMapSetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"set\")?.value;\nconst __velarCollectionMapHasOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"has\")?.value;\nconst __velarCollectionMapDeleteOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"delete\")?.value;\nconst __velarCollectionMapClearOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"clear\")?.value;\nconst __velarCollectionMapKeysOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"keys\")?.value;\nconst __velarCollectionMapValuesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"values\")?.value;\nconst __velarCollectionMapEntriesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, \"entries\")?.value;\nconst __velarCollectionSetMapMapIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionMapEntriesOperation, new __velarCollectionNativeMap(), [])]);\nconst __velarCollectionSetMapSetIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionSetValuesOperation, new __velarCollectionNativeSet(), [])]);\nconst __velarCollectionSetMapMapIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetMapMapIteratorPrototype, \"next\")?.value;\nconst __velarCollectionSetMapSetIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetMapSetIteratorPrototype, \"next\")?.value;\nfunction __velarCollectionSetMapFreeze(value) { return __velarCollectionHostCall(__velarCollectionSetMapFreezeOperation, __velarCollectionNativeObject, [value]); }\nfunction __velarCollectionSetMapSetSize(value) { return __velarCollectionHostCall(__velarCollectionSetSize, value, []); }\nfunction __velarCollectionSetMapMapSize(value) { return __velarCollectionHostCall(__velarCollectionMapSize, value, []); }\nfunction __velarCollectionSetMapSetAdd(value, item) { return __velarCollectionHostCall(__velarCollectionSetAddOperation, value, [item]); }\nfunction __velarCollectionSetMapSetHas(value, item) { return __velarCollectionHostCall(__velarCollectionSetHasOperation, value, [item]); }\nfunction __velarCollectionSetMapSetDelete(value, item) { return __velarCollectionHostCall(__velarCollectionSetDeleteOperation, value, [item]); }\nfunction __velarCollectionSetMapSetClear(value) { return __velarCollectionHostCall(__velarCollectionSetClearOperation, value, []); }\nfunction __velarCollectionSetMapSetValues(value) { return __velarCollectionHostCall(__velarCollectionSetValuesOperation, value, []); }\nfunction __velarCollectionSetMapSetNext(iterator) { return __velarCollectionHostCall(__velarCollectionSetMapSetIteratorNext, iterator, []); }\nfunction __velarCollectionSetMapMapGet(value, key) { return __velarCollectionHostCall(__velarCollectionMapGetOperation, value, [key]); }\nfunction __velarCollectionSetMapMapSet(value, key, item) { return __velarCollectionHostCall(__velarCollectionMapSetOperation, value, [key, item]); }\nfunction __velarCollectionSetMapMapHas(value, key) { return __velarCollectionHostCall(__velarCollectionMapHasOperation, value, [key]); }\nfunction __velarCollectionSetMapMapDelete(value, key) { return __velarCollectionHostCall(__velarCollectionMapDeleteOperation, value, [key]); }\nfunction __velarCollectionSetMapMapClear(value) { return __velarCollectionHostCall(__velarCollectionMapClearOperation, value, []); }\nfunction __velarCollectionSetMapMapKeys(value) { return __velarCollectionHostCall(__velarCollectionMapKeysOperation, value, []); }\nfunction __velarCollectionSetMapMapValues(value) { return __velarCollectionHostCall(__velarCollectionMapValuesOperation, value, []); }\nfunction __velarCollectionSetMapMapEntries(value) { return __velarCollectionHostCall(__velarCollectionMapEntriesOperation, value, []); }\nfunction __velarCollectionSetMapMapNext(iterator) { return __velarCollectionHostCall(__velarCollectionSetMapMapIteratorNext, iterator, []); }\n"; /** Host operations required by ordinary Record validation and receiver methods. */ export declare const VELAR_COLLECTION_RECORD_RUNTIME = "const __velarCollectionRecordNativeRangeError = globalThis.RangeError;\nconst __velarCollectionRecordOwnNamesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"getOwnPropertyNames\")?.value;\nconst __velarCollectionRecordOwnSymbolsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"getOwnPropertySymbols\")?.value;\nconst __velarCollectionRecordDefinePropertyOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"defineProperty\")?.value;\nconst __velarCollectionRecordObjectIsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"is\")?.value;\nconst __velarCollectionRecordDeletePropertyOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeReflect, \"deleteProperty\")?.value;\nconst __velarCollectionRecordFreezeOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, \"freeze\")?.value;\nfunction __velarCollectionRecordGetOwnPropertyDescriptor(value, key) { return __velarCollectionHostCall(__velarCollectionGetOwnPropertyDescriptor, __velarCollectionNativeObject, [value, key]); }\nfunction __velarCollectionRecordOwnNames(value) { return __velarCollectionHostCall(__velarCollectionRecordOwnNamesOperation, __velarCollectionNativeObject, [value]); }\nfunction __velarCollectionRecordOwnSymbols(value) { return __velarCollectionHostCall(__velarCollectionRecordOwnSymbolsOperation, __velarCollectionNativeObject, [value]); }\nfunction __velarCollectionRecordDefineProperty(value, key, descriptor) { return __velarCollectionHostCall(__velarCollectionRecordDefinePropertyOperation, __velarCollectionNativeObject, [value, key, descriptor]); }\nfunction __velarCollectionRecordObjectIs(left, right) { return __velarCollectionHostCall(__velarCollectionRecordObjectIsOperation, __velarCollectionNativeObject, [left, right]); }\nfunction __velarCollectionRecordDeleteProperty(value, key) { return __velarCollectionHostCall(__velarCollectionRecordDeletePropertyOperation, __velarCollectionNativeReflect, [value, key]); }\nfunction __velarCollectionRecordFreeze(value) { return __velarCollectionHostCall(__velarCollectionRecordFreezeOperation, __velarCollectionNativeObject, [value]); }\n"; /** Project-shared immutable host operations for module-local collection algorithms. */ export declare const VELAR_COLLECTION_HOST_MODULE_SOURCE: string; /** * CO-U4b: the one class every out-of-range position raises, standing on its own * host captures so that a module which inlines only the String receiver methods * carries it too. `is IndexError` is an `instanceof` against this class. */ export declare const VELAR_INDEX_ERROR_RUNTIME = "const __velarIndexErrorNativeRangeError = globalThis.RangeError;\nconst __velarIndexErrorDefineProperty = globalThis.Object.defineProperty;\nclass __VelarIndexError extends __velarIndexErrorNativeRangeError {\n constructor(message) {\n super(message);\n this.name = \"IndexError\";\n }\n}\n// D51 rule 107: 'code' answers with the class a value was constructed from, so\n// the compiler-owned class carries the source-level name it reports.\n__velarIndexErrorDefineProperty(__VelarIndexError, \"name\", { value: \"IndexError\", writable: false, enumerable: false, configurable: true });\n"; export declare const VELAR_COLLECTION_LOWERING_RUNTIME: string; export declare const VELAR_COLLECTION_LOWERING_MODULE_SOURCE: string; export declare const VELAR_ERROR_NORMALIZATION_RUNTIME = "const __velarErrorNativeError = globalThis.Error;\nconst __velarErrorNativeString = globalThis.String;\nconst __velarErrorNativeObject = globalThis.Object;\nconst __velarErrorNativeReflect = globalThis.Reflect;\nconst __velarErrorNativeTypeError = globalThis.TypeError;\nconst __velarErrorGetOwnPropertyDescriptor = __velarErrorNativeObject.getOwnPropertyDescriptor;\nconst __velarErrorGetPrototypeOf = __velarErrorNativeObject.getPrototypeOf;\nconst __velarErrorReflectApply = __velarErrorGetOwnPropertyDescriptor(__velarErrorNativeReflect, \"apply\")?.value;\nconst __velarErrorIsErrorOperation = __velarErrorGetOwnPropertyDescriptor(__velarErrorNativeError, \"isError\")?.value;\nconst __velarErrorArrayIsArray = globalThis.Array.isArray;\nconst __velarErrorStackGetter = __velarErrorGetOwnPropertyDescriptor(new __velarErrorNativeError(), \"stack\")?.get;\nfunction __velarErrorApply(operation, receiver, arguments_, label) {\n if (typeof operation !== \"function\" || typeof __velarErrorReflectApply !== \"function\") {\n throw new __velarErrorNativeTypeError(\"The JavaScript \" + label + \" API is unavailable\");\n }\n return __velarErrorReflectApply(operation, receiver, arguments_);\n}\nfunction __velarIsError(value) {\n return __velarErrorApply(__velarErrorIsErrorOperation, __velarErrorNativeError, [value], \"Error.isError\");\n}\n// D50 rule 89: 'code' is the string projection of an error's declared class,\n// never a second taxonomy. The class lowering writes the declared name into\n// the instance's own 'name' property (rule 74), and this reads exactly that\n// property back \u2014 one source of truth, so the two can never diverge. A value\n// no Velar class declared (a host TypeError, a foreign Error) reports the base\n// contract it actually satisfies: \"Error\".\n//\n// D51 rule 107: 'is' is the only discrimination authority, so the own 'name'\n// counts only when the class the value was constructed from declares that same\n// name. A JavaScript caller writing e.name = \"FileNotFoundError\" on a host\n// TypeError produced an error whose 'code' said FileNotFoundError while 'is'\n// said false; the class behind the value is what answers now.\nfunction __velarErrorCode(value) {\n if (value === null || typeof value !== \"object\" && typeof value !== \"function\") return \"Error\";\n const descriptor = __velarErrorGetOwnPropertyDescriptor(value, \"name\");\n if (!descriptor || !(\"value\" in descriptor) || typeof descriptor.value !== \"string\" || descriptor.value.length === 0) return \"Error\";\n const prototype = __velarErrorGetPrototypeOf(value);\n const constructor = prototype === null ? null : __velarErrorGetOwnPropertyDescriptor(prototype, \"constructor\");\n if (!constructor || !(\"value\" in constructor) || typeof constructor.value !== \"function\") return \"Error\";\n const declared = __velarErrorGetOwnPropertyDescriptor(constructor.value, \"name\");\n return declared && \"value\" in declared && declared.value === descriptor.value ? descriptor.value : \"Error\";\n}\nfunction __velarNormalizeError(value) {\n if (__velarIsError(value)) return value;\n const kind = typeof value;\n let message;\n if (kind === \"string\") message = value;\n else if (value === null) message = \"null\";\n else if (kind === \"undefined\") message = \"undefined\";\n else if (kind === \"number\" || kind === \"boolean\" || kind === \"bigint\" || kind === \"symbol\") {\n message = __velarErrorApply(__velarErrorNativeString, globalThis, [value], \"String\");\n }\n else message = \"A non-Error value was thrown by JavaScript\";\n return new __velarErrorNativeError(message, { cause: value });\n}\n// One frame policy for run, test, and the emitted host-error channels. Helpers\n// inlined into a source-mapped module are still runtime code: their reserved\n// names, not their paths, identify them. Only the compiler's exact test entry\n// name denotes authored source despite that prefix.\nconst __velarHostErrorInternalFrame = /(?:^|\\s|\\()node:[a-z_]+(?:\\/|:)/u;\nconst __velarHostErrorRuntimeFrame = /\\bat\\s(?:async\\s)?(?:new\\s)?(?:[^\\s(]*\\.)?__[Vv]elar/u;\nconst __velarHostErrorPosition = /\\(?([^()]+):(\\d+):(\\d+)\\)?$/u;\nfunction __velarHostErrorFrame(line) {\n return /^\\s+at\\s/u.test(line) || /^[^@\\n]*@.+:\\d+:\\d+$/u.test(line);\n}\nfunction __velarHostErrorFramePosition(line) {\n const text = line.trimEnd();\n const position = __velarHostErrorPosition.exec(text);\n if (!position) return null;\n // V8 paths may themselves contain '@' (scoped npm packages or authored\n // filenames). Only Firefox/WebKit's function@location syntax strips it.\n const path = /^\\s*at\\s/u.test(text)\n ? position[1].replace(/^\\s*at\\s+(?:async\\s+)?/u, \"\")\n : position[1].replace(/^[^@]*@/u, \"\");\n const row = Number(position[2]);\n const column = Number(position[3]);\n if (!Number.isSafeInteger(row) || row < 1 || !Number.isSafeInteger(column) || column < 1) return null;\n return { path, line: row, column };\n}\nfunction __velarHostErrorOwnedFrame(line, runtimeRoots = []) {\n const portable = line.replaceAll(\"\\\\\", \"/\");\n const path = __velarHostErrorFramePosition(portable)?.path;\n if (path !== undefined && runtimeRoots.some((root) => path.startsWith(root))) return false;\n if (__velarHostErrorInternalFrame.test(portable) || portable.includes(\"/node_modules/velar/\")) return false;\n const runtime = __velarHostErrorRuntimeFrame.test(portable) || /^(?:[^@.]+\\.)?__[Vv]elar[^@]*@/u.test(portable);\n if (!runtime) return true;\n return /^(?:\\s+at\\s+(?:async\\s+)?__velarTest\\d+\\s+\\(|__velarTest\\d+@)/u.test(portable)\n && __velarHostErrorFramePosition(portable)?.path.endsWith(\".vel\") === true;\n}\nfunction __velarHostErrorPortableFrame(line) {\n return line.replaceAll(\"\\\\\", \"/\")\n .replace(/(\\bat\\s+(?:async\\s+)?)__velarTest\\d+(?=\\s)/u, \"$1\")\n .replace(/^__velarTest\\d+@/u, \"@\");\n}\nfunction __velarHostErrorPresentation(trace, fullStack = false, excluded = [], runtimeRoots = []) {\n const lines = trace.slice(0, 64 * 1024).split(\"\\n\");\n const frames = lines.filter((line) => __velarHostErrorFrame(line) && !excluded.some((path) => line.includes(path)))\n .filter((line, index, all) => line !== all[index - 1]);\n const owned = frames.filter((line) => __velarHostErrorOwnedFrame(line, runtimeRoots));\n return {\n header: lines.filter((line) => !__velarHostErrorFrame(line)),\n frames: (fullStack ? frames : owned).map(__velarHostErrorPortableFrame),\n snippet: owned[0],\n hidden: fullStack ? 0 : frames.length - owned.length,\n };\n}\nfunction __velarHostErrorCommand(command) {\n return command === \"velar run\" || command === \"velar test\" || command === \"velar test --browser\";\n}\nfunction __velarHostErrorSummary(hidden, command) {\n const hint = __velarHostErrorCommand(command)\n ? \"; rerun with '\" + command + \" --stack' for the full trace\" : \"\";\n return \" (\" + hidden + \" frame\" + (hidden === 1 ? \"\" : \"s\") + \" outside your program hidden\" + hint + \")\";\n}\n// The launcher supplies a checked command as well as the flag: a test must not\n// suggest rerunning a different command. No launcher context means a built app\n// keeps its raw trace. Read data descriptors rather than invoking host getters.\nfunction __velarHostErrorContext() {\n try {\n const property = __velarErrorGetOwnPropertyDescriptor(globalThis, Symbol.for(\"velar.run.stack\"));\n const value = property && \"value\" in property ? property.value : null;\n if (value === false || value === true) return { fullStack: value, command: \"velar run\", runtimeRoots: [] };\n if (value === null || typeof value !== \"object\") return null;\n const stack = __velarErrorGetOwnPropertyDescriptor(value, \"fullStack\");\n const command = __velarErrorGetOwnPropertyDescriptor(value, \"command\");\n if (!stack || !(\"value\" in stack) || typeof stack.value !== \"boolean\"\n || !command || !(\"value\" in command) || !__velarHostErrorCommand(command.value)) return null;\n const runtimeRoots = __velarHostErrorRuntimeRoots(value);\n return runtimeRoots === null ? null : { fullStack: stack.value, command: command.value, runtimeRoots };\n } catch { return null; }\n}\n// Only Node test owners supply their own installation directory. Built pages\n// receive no host paths. The optional list is bounded and never reads getters.\nfunction __velarHostErrorRuntimeRoots(context) {\n const property = __velarErrorGetOwnPropertyDescriptor(context, \"runtimeRoots\");\n if (!property) return [];\n if (!(\"value\" in property) || !__velarErrorArrayIsArray(property.value)) return null;\n const entries = property.value;\n const length = __velarErrorGetOwnPropertyDescriptor(entries, \"length\")?.value;\n if (!Number.isSafeInteger(length) || length < 0 || length > 8) return null;\n const roots = [];\n for (let index = 0; index < length; index += 1) {\n const entry = __velarErrorGetOwnPropertyDescriptor(entries, __velarErrorNativeString(index));\n if (!entry || !(\"value\" in entry) || typeof entry.value !== \"string\"\n || entry.value.length > 4096 || !entry.value.endsWith(\"/\")) return null;\n roots.push(entry.value);\n }\n return roots;\n}\nfunction __velarHostErrorOwnCause(error) {\n try {\n const cause = __velarErrorGetOwnPropertyDescriptor(error, \"cause\");\n return cause && \"value\" in cause ? cause.value : undefined;\n } catch { return undefined; }\n}\nfunction __velarHostErrorText(error, name, inherited = false) {\n try {\n for (let current = error, depth = 0; current !== null && depth < 8; depth += 1) {\n const property = __velarErrorGetOwnPropertyDescriptor(current, name);\n if (property) return \"value\" in property && typeof property.value === \"string\" ? property.value.slice(0, 64 * 1024) : null;\n if (!inherited) break;\n current = __velarErrorGetPrototypeOf(current);\n }\n } catch {}\n return null;\n}\nfunction __velarHostErrorDescription(error) {\n let native = false;\n try { native = __velarIsError(error); } catch {}\n if (!native) {\n if (typeof error === \"string\") return \"The program threw a non-Error string value: \" + error.slice(0, 64 * 1024);\n return \"The program threw a non-Error \" + (error === null ? \"null\" : typeof error) + \" value\";\n }\n const name = __velarHostErrorText(error, \"name\", true);\n const message = __velarHostErrorText(error, \"message\", true);\n let stack = __velarHostErrorText(error, \"stack\");\n if (stack === null && name !== null && message !== null && typeof __velarErrorStackGetter === \"function\") {\n // V8's stack is an own accessor. Invoke the captured native getter, never\n // an accessor supplied by the thrown value, and guard custom preparation.\n try {\n const value = __velarErrorApply(__velarErrorStackGetter, error, [], \"Error.stack\");\n if (typeof value === \"string\") stack = value.slice(0, 64 * 1024);\n } catch {}\n }\n if (stack !== null && stack !== \"\") return stack;\n return (name || \"Error\") + \": \" + (message || \"An Error was thrown without a message\");\n}\nfunction __velarHostErrorTrace(error, fallback) {\n const trace = __velarHostErrorDescription(error) || fallback;\n const context = __velarHostErrorContext();\n if (context === null) return trace;\n const presentation = __velarHostErrorPresentation(trace, context.fullStack, [], context.runtimeRoots);\n return presentation.header.concat(presentation.frames,\n presentation.hidden > 0 ? [__velarHostErrorSummary(presentation.hidden, context.command)] : []).join(\"\\n\");\n}\n"; /** * D50 rule 89 / D51 rule 107: the failure `assert` and `value!` raise is a * compiler-owned class, not a relabelled `Error`. `code` answers with the name * the class the value was constructed from declares, so an assertion failure * that only wrote `name` onto the instance reported "Error" — the language's * own most common failure was indistinguishable from a foreign one. The class * carries its name the same way `NarrowingError` and `IndexError` do. */ export declare const VELAR_ASSERTION_ERROR_RUNTIME = "const __velarAssertionNativeError = globalThis.Error;\nconst __velarAssertionDefineProperty = globalThis.Object.defineProperty;\nclass __VelarAssertionError extends __velarAssertionNativeError {\n constructor(message) {\n super(message);\n this.name = \"AssertionError\";\n }\n}\n__velarAssertionDefineProperty(__VelarAssertionError, \"name\", { value: \"AssertionError\", writable: false, enumerable: false, configurable: true });\n"; export declare const VELAR_HOST_ERROR_RUNTIME = "const __velarHostErrorNativeError = globalThis.Error;\nconst __velarHostErrorDefineProperty = globalThis.Object.defineProperty;\nclass __VelarFileNotFoundError extends __velarHostErrorNativeError {\n constructor(message, path = null) {\n super(message);\n this.name = \"FileNotFoundError\";\n this.path = path;\n }\n}\n// D51 rule 107: the class the value was constructed from is what 'code' reads,\n// so a compiler-owned class carries the source-level name it reports.\n__velarHostErrorDefineProperty(__VelarFileNotFoundError, \"name\", { value: \"FileNotFoundError\", writable: false, enumerable: false, configurable: true });\nclass __VelarPermissionError extends __velarHostErrorNativeError {\n constructor(message, path = null) {\n super(message);\n this.name = \"PermissionError\";\n this.path = path;\n }\n}\n// D51 rule 107: the class the value was constructed from is what 'code' reads,\n// so a compiler-owned class carries the source-level name it reports.\n__velarHostErrorDefineProperty(__VelarPermissionError, \"name\", { value: \"PermissionError\", writable: false, enumerable: false, configurable: true });\nclass __VelarNotADirectoryError extends __velarHostErrorNativeError {\n constructor(message, path = null) {\n super(message);\n this.name = \"NotADirectoryError\";\n this.path = path;\n }\n}\n// D51 rule 107: the class the value was constructed from is what 'code' reads,\n// so a compiler-owned class carries the source-level name it reports.\n__velarHostErrorDefineProperty(__VelarNotADirectoryError, \"name\", { value: \"NotADirectoryError\", writable: false, enumerable: false, configurable: true });\nclass __VelarFileExistsError extends __velarHostErrorNativeError {\n constructor(message, path = null) {\n super(message);\n this.name = \"FileExistsError\";\n this.path = path;\n }\n}\n// D51 rule 107: the class the value was constructed from is what 'code' reads,\n// so a compiler-owned class carries the source-level name it reports.\n__velarHostErrorDefineProperty(__VelarFileExistsError, \"name\", { value: \"FileExistsError\", writable: false, enumerable: false, configurable: true });\nclass __VelarAddressInUseError extends __velarHostErrorNativeError {\n constructor(message) {\n super(message);\n this.name = \"AddressInUseError\";\n }\n}\n__velarHostErrorDefineProperty(__VelarAddressInUseError, \"name\", { value: \"AddressInUseError\", writable: false, enumerable: false, configurable: true });\nclass __VelarTimeoutError extends __velarHostErrorNativeError {\n constructor(message) {\n super(message);\n this.name = \"TimeoutError\";\n }\n}\n__velarHostErrorDefineProperty(__VelarTimeoutError, \"name\", { value: \"TimeoutError\", writable: false, enumerable: false, configurable: true });\n"; /** Project-shared implementation of compiler-owned foreign Error normalization. */ export declare const VELAR_ERROR_NORMALIZATION_MODULE_SOURCE: string; export declare const VELAR_STRICT_JSON_RUNTIME = "const __velarMaxJsonCodeUnits = 16 * 1024 * 1024;\nconst __velarMaxJsonNodes = 1000000;\nconst __velarMaxJsonDepth = 128;\nconst __velarJsonNativeArray = globalThis.Array;\nconst __velarJsonNativeSet = globalThis.Set;\nconst __velarJsonNativeObject = globalThis.Object;\nconst __velarJsonNativeNumber = globalThis.Number;\nconst __velarJsonNativeString = globalThis.String;\nconst __velarJsonNativeMath = globalThis.Math;\nconst __velarJsonNativeTypeError = globalThis.TypeError;\nconst __velarJsonNativeRangeError = globalThis.RangeError;\nconst __velarJsonGetOwnPropertyDescriptor = __velarJsonNativeObject.getOwnPropertyDescriptor;\nconst __velarJsonGetOwnPropertyNames = __velarJsonNativeObject.getOwnPropertyNames;\nconst __velarJsonGetOwnPropertySymbols = __velarJsonNativeObject.getOwnPropertySymbols;\nconst __velarJsonGetPrototypeOf = __velarJsonNativeObject.getPrototypeOf;\nconst __velarJsonObjectPrototype = __velarJsonGetOwnPropertyDescriptor(__velarJsonNativeObject, \"prototype\")?.value;\nconst __velarJsonCreate = __velarJsonNativeObject.create;\nconst __velarJsonDefineProperty = __velarJsonNativeObject.defineProperty;\nconst __velarJsonArrayIsArray = __velarJsonNativeArray.isArray;\nconst __velarJsonArrayPrototype = __velarJsonGetOwnPropertyDescriptor(__velarJsonNativeArray, \"prototype\")?.value;\nconst __velarJsonArraySort = __velarJsonGetOwnPropertyDescriptor(__velarJsonArrayPrototype, \"sort\")?.value;\nconst __velarJsonNumberIsFinite = __velarJsonNativeNumber.isFinite;\nconst __velarJsonNumberIsInteger = __velarJsonNativeNumber.isInteger;\nconst __velarJsonMathMax = __velarJsonNativeMath.max;\nconst __velarJsonSymbolFor = globalThis.Symbol.for;\nconst __velarJsonReflectOwnKeys = globalThis.Reflect.ownKeys;\nconst __velarNativeReflectApply = __velarJsonGetOwnPropertyDescriptor(globalThis.Reflect, \"apply\")?.value;\nconst __velarJsonSetPrototype = __velarJsonGetOwnPropertyDescriptor(__velarJsonNativeSet, \"prototype\")?.value;\nconst __velarJsonSetHas = __velarJsonGetOwnPropertyDescriptor(__velarJsonSetPrototype, \"has\")?.value;\nconst __velarJsonSetAdd = __velarJsonGetOwnPropertyDescriptor(__velarJsonSetPrototype, \"add\")?.value;\nconst __velarJsonSetDelete = __velarJsonGetOwnPropertyDescriptor(__velarJsonSetPrototype, \"delete\")?.value;\nconst __velarJsonStringPrototype = __velarJsonGetOwnPropertyDescriptor(__velarJsonNativeString, \"prototype\")?.value;\nconst __velarJsonCharCodeAt = __velarJsonGetOwnPropertyDescriptor(__velarJsonStringPrototype, \"charCodeAt\")?.value;\nconst __velarJsonPathPattern = /^[A-Za-z_][A-Za-z0-9_]*$/u;\nconst __velarJsonRegExpPrototype = __velarJsonGetPrototypeOf(__velarJsonPathPattern);\nconst __velarJsonRegExpTest = __velarJsonGetOwnPropertyDescriptor(__velarJsonRegExpPrototype, \"test\")?.value;\nfunction __velarJsonApply(operation, receiver, arguments_, label) {\n if (typeof operation !== \"function\" || typeof __velarNativeReflectApply !== \"function\") throw new __velarJsonNativeTypeError(\"The JavaScript \" + label + \" JSON API is unavailable\");\n return __velarNativeReflectApply(operation, receiver, arguments_);\n}\nconst __velarJsonHostDescriptor = __velarJsonGetOwnPropertyDescriptor(globalThis, \"JSON\");\nconst __velarJsonHost = __velarJsonHostDescriptor && \"value\" in __velarJsonHostDescriptor ? __velarJsonHostDescriptor.value : null;\nconst __velarNativeJsonParse = __velarJsonHost && __velarJsonGetOwnPropertyDescriptor(__velarJsonHost, \"parse\")?.value;\nconst __velarNativeJsonStringify = __velarJsonHost && __velarJsonGetOwnPropertyDescriptor(__velarJsonHost, \"stringify\")?.value;\nfunction __velarJsonRaw(value) {\n const descriptor = __velarJsonGetOwnPropertyDescriptor(globalThis, __velarJsonApply(__velarJsonSymbolFor, undefined, [\"velar.runtime.v1\"], \"Symbol.for\"));\n const runtime = descriptor && \"value\" in descriptor ? descriptor.value : null;\n // Absent is the blessed case: a realm with no reactive runtime keeps ordinary\n // Core behavior. A registry that is present but from another generation is\n // not that case \u2014 reading past it would drop reactivity with no trace \u2014 so it\n // fails closed, and it is tested before the callable duck-check so a schema\n // bump that also renamed 'toRaw' still reports the version.\n if (!runtime || (typeof runtime !== \"object\" && typeof runtime !== \"function\")) return value;\n if (runtime.version !== \"0.12\") {\n throw new __velarJsonNativeTypeError(\"VelarScript reactive runtime schema \" + (typeof runtime.version === \"string\" ? runtime.version : \"(unknown)\") + \" does not match this module's schema 0.12; one build mixed two generations of @velarscript/* \u2014 run 'npm ls @velarscript/compiler' and pin one version\");\n }\n if (typeof runtime.toRaw !== \"function\") return value;\n if (typeof runtime.trackDeep === \"function\") runtime.trackDeep(value);\n return runtime.toRaw(value);\n}\nfunction __velarJsonFailure(path, message) {\n throw new __velarJsonNativeTypeError(\"Invalid JSON value at \" + path + \": \" + message);\n}\nfunction __velarJsonPath(parent, key) {\n return __velarJsonApply(__velarJsonRegExpTest, __velarJsonPathPattern, [key], \"RegExp.test\") ? parent + \".\" + key : parent + \"[field]\";\n}\nfunction __velarJsonStringUnits(value) {\n let units = 2;\n for (let index = 0; index < value.length; index += 1) {\n const code = __velarJsonApply(__velarJsonCharCodeAt, value, [index], \"String.charCodeAt\");\n if (code === 34 || code === 92 || code === 8 || code === 9 || code === 10 || code === 12 || code === 13) units += 2;\n else if (code <= 31 || (code >= 0xD800 && code <= 0xDFFF && !(code <= 0xDBFF && index + 1 < value.length && __velarJsonApply(__velarJsonCharCodeAt, value, [index + 1], \"String.charCodeAt\") >= 0xDC00 && __velarJsonApply(__velarJsonCharCodeAt, value, [index + 1], \"String.charCodeAt\") <= 0xDFFF))) units += 6;\n else { units += 1; if (code >= 0xD800 && code <= 0xDBFF) { units += 1; index += 1; } }\n if (units > __velarMaxJsonCodeUnits) return units;\n }\n return units;\n}\nfunction __velarJsonBudget(state, path) {\n if (state.nodes > __velarMaxJsonNodes) __velarJsonFailure(path, \"data cannot exceed \" + __velarMaxJsonNodes + \" values\");\n if (state.compactUnits > __velarMaxJsonCodeUnits) __velarJsonFailure(path, \"encoded JSON cannot exceed 16 MiB\");\n}\nfunction __velarJsonState() { return { active: new __velarJsonNativeSet(), nodes: 0, depth: 0, compactUnits: 0, prettyLines: 0, prettyIndentWeight: 0, prettyColonSpaces: 0 }; }\nfunction __velarInspectJson(value, path, state, copy) {\n value = __velarJsonRaw(value);\n state.nodes += 1;\n if (value === null) { state.compactUnits += 4; __velarJsonBudget(state, path); return value; }\n if (typeof value === \"string\") { state.compactUnits += __velarJsonStringUnits(value); __velarJsonBudget(state, path); return value; }\n if (typeof value === \"boolean\") { state.compactUnits += value ? 4 : 5; __velarJsonBudget(state, path); return value; }\n if (typeof value === \"number\") {\n if (!__velarJsonApply(__velarJsonNumberIsFinite, __velarJsonNativeNumber, [value], \"Number.isFinite\")) __velarJsonFailure(path, \"numbers must be finite\");\n state.compactUnits += __velarJsonApply(__velarJsonNativeString, undefined, [value], \"String\").length;\n __velarJsonBudget(state, path);\n return value;\n }\n if (typeof value !== \"object\") __velarJsonFailure(path, typeof value + \" is not supported\");\n if (state.depth >= __velarMaxJsonDepth) __velarJsonFailure(path, \"data cannot exceed \" + __velarMaxJsonDepth + \" nested collections\");\n if (__velarJsonApply(__velarJsonSetHas, state.active, [value], \"Set.has\")) __velarJsonFailure(path, \"cyclic data is not supported\");\n __velarJsonApply(__velarJsonSetAdd, state.active, [value], \"Set.add\");\n try {\n if (__velarJsonApply(__velarJsonArrayIsArray, __velarJsonNativeArray, [value], \"Array.isArray\")) {\n if (value.length > 1000000) __velarJsonFailure(path, \"Lists cannot exceed 1000000 items\");\n if (__velarJsonGetOwnPropertySymbols(value).length > 0) __velarJsonFailure(path, \"List symbol fields are not supported\");\n const names = __velarJsonGetOwnPropertyNames(value);\n if (names.length !== value.length + 1 || names[names.length - 1] !== \"length\") {\n __velarJsonFailure(path, \"Lists must be dense and cannot have extra fields\");\n }\n state.compactUnits += 2 + __velarJsonApply(__velarJsonMathMax, __velarJsonNativeMath, [0, value.length - 1], \"Math.max\");\n if (value.length > 0) {\n state.prettyLines += value.length + 1;\n state.prettyIndentWeight += value.length * (state.depth + 1) + state.depth;\n }\n __velarJsonBudget(state, path);\n const output = copy ? new __velarJsonNativeArray(value.length) : value;\n state.depth += 1;\n for (let index = 0; index < value.length; index += 1) {\n const descriptor = __velarJsonGetOwnPropertyDescriptor(value, index);\n if (!descriptor?.enumerable || !(\"value\" in descriptor)) __velarJsonFailure(path + \"[\" + index + \"]\", \"List entries must be enumerable data values\");\n const child = __velarInspectJson(descriptor.value, path + \"[\" + index + \"]\", state, copy);\n if (copy) output[index] = child;\n }\n state.depth -= 1;\n return output;\n }\n const prototype = __velarJsonGetPrototypeOf(value);\n if (prototype !== __velarJsonObjectPrototype && prototype !== null) {\n __velarJsonFailure(path, \"only records and Lists are supported\");\n }\n const keys = __velarJsonApply(__velarJsonReflectOwnKeys, globalThis.Reflect, [value], \"Reflect.ownKeys\");\n if (keys.length > 1000000) __velarJsonFailure(path, \"records cannot exceed 1000000 fields\");\n state.compactUnits += 2 + __velarJsonApply(__velarJsonMathMax, __velarJsonNativeMath, [0, keys.length - 1], \"Math.max\");\n if (keys.length > 0) {\n state.prettyLines += keys.length + 1;\n state.prettyIndentWeight += keys.length * (state.depth + 1) + state.depth;\n state.prettyColonSpaces += keys.length;\n }\n __velarJsonBudget(state, path);\n const output = copy ? __velarJsonApply(__velarJsonCreate, __velarJsonNativeObject, [null], \"Object.create\") : value;\n state.depth += 1;\n for (let index = 0; index < keys.length; index += 1) {\n const key = keys[index];\n if (typeof key !== \"string\") __velarJsonFailure(path, \"record symbol fields are not supported\");\n state.compactUnits += __velarJsonStringUnits(key) + 1;\n __velarJsonBudget(state, path);\n const childPath = __velarJsonPath(path, key);\n const descriptor = __velarJsonGetOwnPropertyDescriptor(value, key);\n if (!descriptor?.enumerable || !(\"value\" in descriptor)) {\n __velarJsonFailure(childPath, \"record fields must be enumerable data values\");\n }\n const child = __velarInspectJson(descriptor.value, childPath, state, copy);\n if (copy) __velarJsonApply(__velarJsonDefineProperty, __velarJsonNativeObject, [output, key, { value: child, enumerable: true, configurable: true, writable: true }], \"Object.defineProperty\");\n }\n state.depth -= 1;\n return output;\n } finally {\n __velarJsonApply(__velarJsonSetDelete, state.active, [value], \"Set.delete\");\n }\n}\nfunction __velarAssertJson(value, path = \"$\", state = null) {\n state ??= __velarJsonState();\n __velarInspectJson(value, path, state, false);\n return state;\n}\nfunction __velarJsonSnapshot(value) {\n const state = __velarJsonState();\n return { value: __velarInspectJson(value, \"$\", state, true), state };\n}\nfunction __velarJsonIndent(pretty) {\n if (pretty === false) return 0;\n if (pretty === true) return 2;\n if (!__velarJsonApply(__velarJsonNumberIsInteger, __velarJsonNativeNumber, [pretty], \"Number.isInteger\") || pretty < 0 || pretty > 10) {\n throw new __velarJsonNativeRangeError(\"JSON indentation must be false, true, or an integer from 0 to 10\");\n }\n return pretty;\n}\nfunction __velarJsonDecode(text, name, copy) {\n if (typeof text !== \"string\") throw new __velarJsonNativeTypeError(name + \" must be a string\");\n if (text.length > __velarMaxJsonCodeUnits) throw new __velarJsonNativeRangeError(name + \" cannot exceed 16 MiB\");\n if (typeof __velarNativeJsonParse !== \"function\" || typeof __velarNativeReflectApply !== \"function\") {\n throw new __velarJsonNativeTypeError(\"The host JSON parser is unavailable\");\n }\n const value = __velarNativeReflectApply(__velarNativeJsonParse, __velarJsonHost, [text]);\n return __velarInspectJson(value, \"$\", __velarJsonState(), copy);\n}\nfunction __velarJsonParse(text, name = \"JSON text\") {\n return __velarJsonDecode(text, name, true);\n}\n// Decoding text straight into a runtime Type rebuilds the value twice and keeps\n// only the second rebuild: D90 rule R5's copy builds its result from the Type's\n// declared fields, which discards everything the owned-data rebuild made. This\n// entry runs the same validating walk \u2014 the walk is what enforces the depth,\n// node, and encoded size budgets \u2014 and skips only the rebuild the Type is about\n// to discard. The host parser's tree is brand new with no second holder, so\n// nothing the Type reads is aliased, and taking the Type here rather than\n// returning the tree is what keeps a value that skipped the rebuild from\n// reaching anyone else.\nfunction __velarJsonParseTyped(Type, text, name = \"JSON text\") {\n return Type.parse(__velarJsonDecode(text, name, false));\n}\nfunction __velarJsonStringify(value, pretty = false) {\n const snapshot = __velarJsonSnapshot(value);\n const state = snapshot.state;\n const indentation = __velarJsonIndent(pretty);\n const estimated = state.compactUnits + (indentation ? state.prettyLines + state.prettyColonSpaces + state.prettyIndentWeight * indentation : 0);\n if (estimated > __velarMaxJsonCodeUnits) throw new __velarJsonNativeRangeError(\"Encoded JSON cannot exceed 16 MiB\");\n if (typeof __velarNativeJsonStringify !== \"function\" || typeof __velarNativeReflectApply !== \"function\") {\n throw new __velarJsonNativeTypeError(\"The host JSON serializer is unavailable\");\n }\n const output = __velarNativeReflectApply(__velarNativeJsonStringify, __velarJsonHost, [snapshot.value, null, indentation]);\n if (typeof output !== \"string\") throw new __velarJsonNativeTypeError(\"The host JSON serializer must return a string\");\n if (output.length > __velarMaxJsonCodeUnits) throw new __velarJsonNativeRangeError(\"Encoded JSON cannot exceed 16 MiB\");\n return output;\n}\nfunction __velarJsonClone(value) { return __velarJsonParse(__velarJsonStringify(value)); }\n"; /** Runtime guard for optimistic flow facts that cross opaque effects. */ export declare const VELAR_NARROWING_RUNTIME = "const __velarNarrowingNativeTypeError = globalThis.TypeError;\nconst __velarNarrowingDefineProperty = globalThis.Object.defineProperty;\nclass __VelarNarrowingError extends __velarNarrowingNativeTypeError {\n constructor(message) {\n super(message);\n this.name = \"NarrowingError\";\n }\n}\n// D51 rule 107: 'code' answers with the class a value was constructed from, so\n// the compiler-owned class carries the source-level name it reports.\n__velarNarrowingDefineProperty(__VelarNarrowingError, \"name\", { value: \"NarrowingError\", writable: false, enumerable: false, configurable: true });\n// AS-U2: the report says where, in the file:line:column every other report in\n// this program uses. A byte offset is not a position an author can act on, and\n// the stack frame printed directly under it already spells the same place the\n// other way.\nfunction __velarNarrow(value, valid, expected, description, location) {\n if (!valid) throw new __VelarNarrowingError(\"Flow narrowing for '\" + description + \"' no longer holds: expected \" + expected + \" at \" + location);\n return value;\n}\n"; export declare const VELAR_NARROWING_MODULE_SOURCE: string; /** Canonical generated runtime for checked Number receiver methods. */ export declare const VELAR_NUMBER_METHOD_RUNTIME = "const __velarNumberNativeMath = globalThis.Math;\nconst __velarNumberNativeNumber = globalThis.Number;\nconst __velarNumberNativeObject = globalThis.Object;\nconst __velarNumberNativeTypeError = globalThis.TypeError;\nconst __velarNumberNativeRangeError = globalThis.RangeError;\nconst __velarNumberGetOwnPropertyDescriptor = __velarNumberNativeObject.getOwnPropertyDescriptor;\nconst __velarNumberReflectApply = __velarNumberGetOwnPropertyDescriptor(globalThis.Reflect, \"apply\")?.value;\nconst __velarNumberPrototype = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeNumber, \"prototype\")?.value;\nconst __velarNumberMathAbs = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeMath, \"abs\")?.value;\nconst __velarNumberMathRound = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeMath, \"round\")?.value;\nconst __velarNumberMathFloor = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeMath, \"floor\")?.value;\nconst __velarNumberMathCeil = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeMath, \"ceil\")?.value;\nconst __velarNumberMathSign = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeMath, \"sign\")?.value;\nconst __velarNumberMathTrunc = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeMath, \"trunc\")?.value;\nconst __velarNumberNativeIsSafeInteger = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeNumber, \"isSafeInteger\")?.value;\nconst __velarNumberNativeIsInteger = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeNumber, \"isInteger\")?.value;\nconst __velarNumberNativeIsNaN = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeNumber, \"isNaN\")?.value;\nconst __velarNumberNativeIsFinite = __velarNumberGetOwnPropertyDescriptor(__velarNumberNativeNumber, \"isFinite\")?.value;\nconst __velarNativeNumberToFixed = __velarNumberGetOwnPropertyDescriptor(__velarNumberPrototype, \"toFixed\")?.value;\nfunction __velarNumberCall(operation, receiver, arguments_) {\n if (typeof operation !== \"function\" || typeof __velarNumberReflectApply !== \"function\") throw new __velarNumberNativeTypeError(\"The JavaScript Number runtime is unavailable\");\n return __velarNumberReflectApply(operation, receiver, arguments_);\n}\nfunction __velarNumberValue(value) { if (typeof value !== \"number\") throw new __velarNumberNativeTypeError(\"Number methods require a number receiver\"); return value; }\nfunction __velarNumberAbs(value) { return __velarNumberCall(__velarNumberMathAbs, __velarNumberNativeMath, [__velarNumberValue(value)]); }\nfunction __velarNumberRound(value) { return __velarNumberCall(__velarNumberMathRound, __velarNumberNativeMath, [__velarNumberValue(value)]); }\nfunction __velarNumberFloor(value) { return __velarNumberCall(__velarNumberMathFloor, __velarNumberNativeMath, [__velarNumberValue(value)]); }\nfunction __velarNumberCeil(value) { return __velarNumberCall(__velarNumberMathCeil, __velarNumberNativeMath, [__velarNumberValue(value)]); }\nfunction __velarNumberSign(value) { return __velarNumberCall(__velarNumberMathSign, __velarNumberNativeMath, [__velarNumberValue(value)]); }\nfunction __velarNumberTrunc(value) { return __velarNumberCall(__velarNumberMathTrunc, __velarNumberNativeMath, [__velarNumberValue(value)]); }\nfunction __velarNumberToFixed(value, digits) {\n if (!__velarNumberCall(__velarNumberNativeIsSafeInteger, __velarNumberNativeNumber, [digits]) || digits < 0 || digits > 100) throw new __velarNumberNativeRangeError(\"Number.toFixed digits must be an integer from 0 through 100\");\n return __velarNumberCall(__velarNativeNumberToFixed, __velarNumberValue(value), [digits]);\n}\nfunction __velarNumberIsInteger(value) { return __velarNumberCall(__velarNumberNativeIsInteger, __velarNumberNativeNumber, [__velarNumberValue(value)]); }\nfunction __velarNumberIsSafeInteger(value) { return __velarNumberCall(__velarNumberNativeIsSafeInteger, __velarNumberNativeNumber, [__velarNumberValue(value)]); }\nfunction __velarNumberIsNaN(value) { return __velarNumberCall(__velarNumberNativeIsNaN, __velarNumberNativeNumber, [__velarNumberValue(value)]); }\nfunction __velarNumberIsFinite(value) { return __velarNumberCall(__velarNumberNativeIsFinite, __velarNumberNativeNumber, [__velarNumberValue(value)]); }\n"; export declare const VELAR_TEXT_METHOD_RUNTIME = "const __velarMaxTextCodeUnits = 16 * 1024 * 1024;\nconst __velarMaxTextItems = 1000000;\nconst __velarTextNativeArray = globalThis.Array;\nconst __velarTextNativeString = globalThis.String;\nconst __velarTextNativeNumber = globalThis.Number;\nconst __velarTextNativeMath = globalThis.Math;\nconst __velarTextNativeObject = globalThis.Object;\nconst __velarTextNativeMap = globalThis.Map;\nconst __velarTextNativeTypeError = globalThis.TypeError;\nconst __velarTextNativeRangeError = globalThis.RangeError;\nconst __velarTextGetOwnPropertyDescriptor = __velarTextNativeObject.getOwnPropertyDescriptor;\nconst __velarTextRuntimeGetPrototypeOf = __velarTextGetOwnPropertyDescriptor(__velarTextNativeObject, \"getPrototypeOf\")?.value;\nconst __velarTextReflectApply = __velarTextGetOwnPropertyDescriptor(globalThis.Reflect, \"apply\")?.value;\nconst __velarTextStringPrototype = __velarTextGetOwnPropertyDescriptor(__velarTextNativeString, \"prototype\")?.value;\nconst __velarTextArrayIsArray = __velarTextGetOwnPropertyDescriptor(__velarTextNativeArray, \"isArray\")?.value;\nconst __velarTextNumberIsSafeInteger = __velarTextGetOwnPropertyDescriptor(__velarTextNativeNumber, \"isSafeInteger\")?.value;\nconst __velarTextNumberIsInteger = __velarTextGetOwnPropertyDescriptor(__velarTextNativeNumber, \"isInteger\")?.value;\nconst __velarTextMathFloor = __velarTextGetOwnPropertyDescriptor(__velarTextNativeMath, \"floor\")?.value;\nconst __velarTextMathMax = __velarTextGetOwnPropertyDescriptor(__velarTextNativeMath, \"max\")?.value;\nconst __velarTextMathMin = __velarTextGetOwnPropertyDescriptor(__velarTextNativeMath, \"min\")?.value;\nconst __velarNativeStringIndexOf = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"indexOf\")?.value;\nconst __velarNativeStringSlice = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"slice\")?.value;\nconst __velarNativeStringCharCodeAt = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"charCodeAt\")?.value;\nconst __velarNativeStringTrim = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"trim\")?.value;\nconst __velarNativeStringUpper = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"toUpperCase\")?.value;\nconst __velarNativeStringLower = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"toLowerCase\")?.value;\nconst __velarNativeStringSplit = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"split\")?.value;\nconst __velarNativeStringReplaceAll = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"replaceAll\")?.value;\nconst __velarNativeStringRepeat = __velarTextGetOwnPropertyDescriptor(__velarTextStringPrototype, \"repeat\")?.value;\nconst __velarTextMapPrototype = typeof __velarTextNativeMap === \"function\" ? __velarTextGetOwnPropertyDescriptor(__velarTextNativeMap, \"prototype\")?.value : null;\nconst __velarTextMapGet = __velarTextMapPrototype ? __velarTextGetOwnPropertyDescriptor(__velarTextMapPrototype, \"get\")?.value : null;\nconst __velarTextMapSet = __velarTextMapPrototype ? __velarTextGetOwnPropertyDescriptor(__velarTextMapPrototype, \"set\")?.value : null;\nconst __velarTextMapClear = __velarTextMapPrototype ? __velarTextGetOwnPropertyDescriptor(__velarTextMapPrototype, \"clear\")?.value : null;\nconst __velarTextSurrogatePattern = /[\\u{10000}-\\u{10FFFF}\\uD800-\\uDFFF]/u;\nconst __velarTextRegExpPrototype = typeof __velarTextRuntimeGetPrototypeOf === \"function\" ? __velarTextRuntimeGetPrototypeOf(__velarTextSurrogatePattern) : null;\nconst __velarTextSurrogateExec = __velarTextRegExpPrototype ? __velarTextGetOwnPropertyDescriptor(__velarTextRegExpPrototype, \"exec\")?.value : null;\nfunction __velarTextCall(operation, receiver, arguments_) {\n if (typeof operation !== \"function\" || typeof __velarTextReflectApply !== \"function\") throw new __velarTextNativeTypeError(\"The JavaScript text runtime is unavailable\");\n return __velarTextReflectApply(operation, receiver, arguments_);\n}\n\nfunction __velarTextValue(value) {\n if (typeof value !== \"string\") throw new __velarTextNativeTypeError(\"String methods require a string receiver\");\n if (value.length > __velarMaxTextCodeUnits) throw new __velarTextNativeRangeError(\"Strings cannot exceed 16 MiB\");\n return value;\n}\nfunction __velarTextArgument(value, name) {\n if (typeof value !== \"string\") throw new __velarTextNativeTypeError(name + \" must be a string\");\n if (value.length > __velarMaxTextCodeUnits) throw new __velarTextNativeRangeError(name + \" cannot exceed 16 MiB\");\n return value;\n}\nfunction __velarTextOutput(value, name) {\n if (value.length > __velarMaxTextCodeUnits) throw new __velarTextNativeRangeError(name + \" output cannot exceed 16 MiB\");\n return value;\n}\nfunction __velarTextCount(value, name) {\n if (!__velarTextCall(__velarTextNumberIsSafeInteger, __velarTextNativeNumber, [value]) || value < 0 || value > __velarMaxTextCodeUnits) {\n throw new __velarTextNativeRangeError(name + \" must be an integer from 0 through \" + __velarMaxTextCodeUnits);\n }\n return value;\n}\nfunction __velarTextList(values, name) {\n if (values.length > __velarMaxTextItems) throw new __velarTextNativeRangeError(name + \" cannot produce more than \" + __velarMaxTextItems + \" items\");\n return values;\n}\nfunction __velarTextNextCodePointOffset(value, offset) {\n const first = __velarTextCall(__velarNativeStringCharCodeAt, value, [offset]);\n if (first < 0xD800 || first > 0xDBFF || offset + 1 >= value.length) return offset + 1;\n const second = __velarTextCall(__velarNativeStringCharCodeAt, value, [offset + 1]);\n return second >= 0xDC00 && second <= 0xDFFF ? offset + 2 : offset + 1;\n}\n// D90 R7, performance half. Measuring a string used to be a whole-string job\n// every single time: the surrogate probe ran per call, and one astral character\n// anywhere forced every offset conversion to walk code points from zero, which\n// made a loop of char/slice calls quadratic: 20,000 char/slice calls over a\n// 200 KiB string with one leading astral character took 17.1 s, and 34 ms\n// once measurement was memoised. A measurement is a pure function of an\n// immutable value, so it is memoised: a dense string answers offset conversions in\n// O(1) when no surrogate pair splits it, and otherwise the checkpoint list\n// records the code-unit offset of every stride-th code point so a conversion\n// starts from the nearest checkpoint instead of from the start of the string.\n// The cache may only change the cost of an answer, never the answer.\nconst __velarTextCheckpointStride = 64;\nconst __velarTextMeasureMinimumUnits = 64;\n// The cache holds its keys strongly, so its budget is memory the program has\n// stopped using but cannot reclaim. Eight MiB buys the loops that matter and\n// bounds what a document-processing program leaves behind; a single string\n// larger than the budget still measures once and stays, because evicting the\n// string a loop is walking would put the cliff back. The entry count only\n// bounds the cache's own bookkeeping, so it is set well above the number of\n// strings a loop cycles through: a tighter count made a walk over 65 short\n// strings 15x slower than the same walk over 64.\nconst __velarTextMeasureCacheEntries = 512;\nconst __velarTextMeasureCacheUnits = 8 * 1024 * 1024;\nconst __velarTextMeasureCache = typeof __velarTextNativeMap === \"function\"\n && typeof __velarTextMapGet === \"function\" && typeof __velarTextMapSet === \"function\" && typeof __velarTextMapClear === \"function\"\n ? new __velarTextNativeMap() : null;\nlet __velarTextMeasureCacheCount = 0;\nlet __velarTextMeasureCacheHeld = 0;\nfunction __velarTextMeasureText(value) {\n if (__velarTextCall(__velarTextSurrogateExec, __velarTextSurrogatePattern, [value]) === null) {\n return { length: value.length, dense: true, checkpoints: null };\n }\n const checkpoints = new __velarTextNativeArray();\n let length = 0, offset = 0;\n while (offset < value.length) {\n if (length % __velarTextCheckpointStride === 0) checkpoints[length / __velarTextCheckpointStride] = offset;\n offset = __velarTextNextCodePointOffset(value, offset);\n length += 1;\n }\n // A string that carries only unpaired surrogates still has one unit per code\n // point, so it keeps the O(1) path even though the probe matched.\n return { length: length, dense: length === value.length, checkpoints: checkpoints };\n}\nfunction __velarTextMeasure(value) {\n if (__velarTextMeasureCache === null || value.length < __velarTextMeasureMinimumUnits) return __velarTextMeasureText(value);\n const cached = __velarTextCall(__velarTextMapGet, __velarTextMeasureCache, [value]);\n if (cached !== undefined) return cached;\n const measured = __velarTextMeasureText(value);\n if (__velarTextMeasureCacheCount >= __velarTextMeasureCacheEntries\n || (__velarTextMeasureCacheCount > 0 && __velarTextMeasureCacheHeld + value.length > __velarTextMeasureCacheUnits)) {\n __velarTextCall(__velarTextMapClear, __velarTextMeasureCache, []);\n __velarTextMeasureCacheCount = 0;\n __velarTextMeasureCacheHeld = 0;\n }\n __velarTextCall(__velarTextMapSet, __velarTextMeasureCache, [value, measured]);\n __velarTextMeasureCacheCount += 1;\n __velarTextMeasureCacheHeld += value.length;\n return measured;\n}\nfunction __velarTextCodePointLength(value) {\n return __velarTextMeasure(value).length;\n}\nfunction __velarTextCodePointPrefix(value, count) { return __velarTextCall(__velarNativeStringSlice, value, [0, __velarTextCodeUnitOffset(value, count)]); }\nfunction __velarTextCodeUnitOffset(value, position) {\n const measured = __velarTextMeasure(value);\n if (measured.dense) return position < value.length ? position : value.length;\n if (position <= 0) return 0;\n const checkpoints = measured.checkpoints;\n let block = __velarTextCall(__velarTextMathFloor, __velarTextNativeMath, [position / __velarTextCheckpointStride]);\n if (block >= checkpoints.length) block = checkpoints.length - 1;\n let offset = checkpoints[block], current = block * __velarTextCheckpointStride;\n while (offset < value.length && current < position) { offset = __velarTextNextCodePointOffset(value, offset); current += 1; }\n return offset;\n}\nfunction __velarTextCodePointIndex(value, unitOffset) {\n const measured = __velarTextMeasure(value);\n if (measured.dense) return unitOffset <= value.length ? unitOffset : null;\n if (unitOffset < 0 || unitOffset > value.length) return null;\n const checkpoints = measured.checkpoints;\n let low = 0, high = checkpoints.length - 1;\n while (low < high) {\n const middle = low + __velarTextCall(__velarTextMathFloor, __velarTextNativeMath, [(high - low + 1) / 2]);\n if (checkpoints[middle] <= unitOffset) low = middle; else high = middle - 1;\n }\n let offset = checkpoints[low], position = low * __velarTextCheckpointStride;\n while (offset < unitOffset && offset < value.length) { offset = __velarTextNextCodePointOffset(value, offset); position += 1; }\n return offset === unitOffset ? position : null;\n}\nfunction __velarTextCodePointDistance(value, start, end) {\n if (__velarTextMeasure(value).dense) return end >= start ? end - start : null;\n let offset = start, distance = 0;\n while (offset < end) { offset = __velarTextNextCodePointOffset(value, offset); distance += 1; }\n return offset === end ? distance : null;\n}\n// D90 R7: a code-unit offset sits between two code points unless it splits a\n// surrogate pair, and only an adjacent lead/trail pair can be split. The test\n// is O(1), so every search below can reject a mid-pair hit without measuring\n// the string.\nfunction __velarTextIsBoundary(value, offset) {\n if (offset <= 0 || offset >= value.length) return true;\n const lead = __velarTextCall(__velarNativeStringCharCodeAt, value, [offset - 1]);\n if (lead < 0xD800 || lead > 0xDBFF) return true;\n const trail = __velarTextCall(__velarNativeStringCharCodeAt, value, [offset]);\n return trail < 0xDC00 || trail > 0xDFFF;\n}\n// D90 R7, performance half. A match can only start inside a pair when the\n// needle starts with a trail surrogate, and can only end inside one when the\n// needle ends with a lead surrogate: the unit the gate reads at each end of a\n// match is the needle's own edge unit. Both are properties of the needle\n// alone, so one O(1) look says whether the native scan already answers what\n// the bounded scan answers, and an ordinary needle keeps native speed on any\n// haystack. The needle must not be empty; each caller handles that case.\nfunction __velarTextNeedsBoundaryCheck(search) {\n const first = __velarTextCall(__velarNativeStringCharCodeAt, search, [0]);\n if (first >= 0xDC00 && first <= 0xDFFF) return true;\n const last = __velarTextCall(__velarNativeStringCharCodeAt, search, [search.length - 1]);\n return last >= 0xD800 && last <= 0xDBFF;\n}\n// Every search operation goes through here so that a match is accepted only\n// when it starts and ends on a code-point boundary. A needle that begins or\n// ends with an unpaired surrogate therefore never matches inside a pair, which\n// is what keeps split/replace/replaceAll from manufacturing lone surrogates.\n// The needle must not be empty; each caller handles that case in its own voice.\nfunction __velarTextBoundedIndexOf(value, search, cursor) {\n if (!__velarTextNeedsBoundaryCheck(search)) return __velarTextCall(__velarNativeStringIndexOf, value, [search, cursor]);\n while (cursor <= value.length) {\n const found = __velarTextCall(__velarNativeStringIndexOf, value, [search, cursor]);\n if (found < 0) return -1;\n if (__velarTextIsBoundary(value, found) && __velarTextIsBoundary(value, found + search.length)) return found;\n cursor = found + 1;\n }\n return -1;\n}\nfunction __velarTextReplacementOutputUnits(value, search, replacement, all) {\n let matches = 0;\n if (search === \"\") matches = all ? __velarTextCodePointLength(value) + 1 : 1;\n else {\n let cursor = 0;\n while (true) {\n const index = __velarTextBoundedIndexOf(value, search, cursor);\n if (index < 0) break;\n matches += 1;\n if (!all) break;\n cursor = index + search.length;\n }\n }\n if (replacement.length <= search.length || matches === 0) return value.length;\n const growth = replacement.length - search.length;\n if (matches > __velarTextCall(__velarTextMathFloor, __velarTextNativeMath, [(__velarMaxTextCodeUnits - value.length) / growth])) return __velarMaxTextCodeUnits + 1;\n return value.length + matches * growth;\n}\n\n// TXT-D1: ordered string comparison uses code-point order (= UTF-8 binary\n// order). UTF-16 code-unit order already agrees when neither operand\n// contains a surrogate, so the native probe keeps the decoded walk on\n// surrogate-bearing strings only.\nfunction __velarStringCompare(left, right) {\n left = __velarTextValue(left);\n right = __velarTextValue(right);\n if (left === right) return 0;\n if (__velarTextCall(__velarTextSurrogateExec, __velarTextSurrogatePattern, [left]) === null\n && __velarTextCall(__velarTextSurrogateExec, __velarTextSurrogatePattern, [right]) === null) {\n return left < right ? -1 : 1;\n }\n let leftOffset = 0;\n let rightOffset = 0;\n while (leftOffset < left.length && rightOffset < right.length) {\n let first = __velarTextCall(__velarNativeStringCharCodeAt, left, [leftOffset]);\n let firstUnits = 1;\n if (first >= 0xD800 && first <= 0xDBFF && leftOffset + 1 < left.length) {\n const trail = __velarTextCall(__velarNativeStringCharCodeAt, left, [leftOffset + 1]);\n if (trail >= 0xDC00 && trail <= 0xDFFF) { first = (first - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; firstUnits = 2; }\n }\n let second = __velarTextCall(__velarNativeStringCharCodeAt, right, [rightOffset]);\n let secondUnits = 1;\n if (second >= 0xD800 && second <= 0xDBFF && rightOffset + 1 < right.length) {\n const trail = __velarTextCall(__velarNativeStringCharCodeAt, right, [rightOffset + 1]);\n if (trail >= 0xDC00 && trail <= 0xDFFF) { second = (second - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; secondUnits = 2; }\n }\n if (first !== second) return first < second ? -1 : 1;\n leftOffset += firstUnits;\n rightOffset += secondUnits;\n }\n return leftOffset < left.length ? 1 : rightOffset < right.length ? -1 : 0;\n}\n// D41 item 61: two 'Comparable'-bounded values hold numbers or strings, and\n// which one is known only at runtime. A string pair keeps code-point order\n// (TXT-D1); everything else uses the plain relational order, exactly as a\n// monomorphic comparison of that category would.\n// D90 R6: one NaN policy. A NaN may be held and tested with .isNaN(), but an\n// operation that orders it raises instead of answering. Without this the\n// \"neither less nor greater\" arm returned 0, which made NaN compare both <=\n// and >= as true at a generic site while the same source on a plain number\n// answered false, and produced genuinely mis-sorted output.\nfunction __velarOrderCompare(left, right) {\n if (typeof left === \"string\" && typeof right === \"string\") return __velarStringCompare(left, right);\n if (left !== left || right !== right) throw new __velarTextNativeTypeError(\"ordered comparison found NaN, which has no ordering; drop it with filter(x => not x.isNaN()) or fix the upstream computation\");\n return left < right ? -1 : left > right ? 1 : 0;\n}\nfunction __velarStringSize(value) { return __velarTextCodePointLength(__velarTextValue(value)); }\nfunction __velarStringTrim(value) { return __velarTextCall(__velarNativeStringTrim, __velarTextValue(value), []); }\nfunction __velarStringIsBlank(value) { return __velarTextCall(__velarNativeStringTrim, __velarTextValue(value), []) === \"\"; }\nfunction __velarStringUpper(value) { return __velarTextOutput(__velarTextCall(__velarNativeStringUpper, __velarTextValue(value), []), \"String.upper\"); }\nfunction __velarStringLower(value) { return __velarTextOutput(__velarTextCall(__velarNativeStringLower, __velarTextValue(value), []), \"String.lower\"); }\n// CO-U4c: a String position is a position, so it raises what a List position\n// raises. `slice` clamps an out-of-range position rather than failing, so the\n// non-integer one is its whole position contract; the sentence is the one\n// `List.slice` already says, one receiver name apart.\nfunction __velarStringSlice(value, start = 0, end = null) {\n value = __velarTextValue(value);\n const total = __velarTextCodePointLength(value);\n if (end === null) end = total;\n if (!__velarTextCall(__velarTextNumberIsInteger, __velarTextNativeNumber, [start]) || !__velarTextCall(__velarTextNumberIsInteger, __velarTextNativeNumber, [end])) throw new __VelarIndexError(\"String.slice positions must be integers\");\n const first = start < 0 ? __velarTextCall(__velarTextMathMax, __velarTextNativeMath, [total + start, 0]) : __velarTextCall(__velarTextMathMin, __velarTextNativeMath, [start, total]);\n const last = end < 0 ? __velarTextCall(__velarTextMathMax, __velarTextNativeMath, [total + end, 0]) : __velarTextCall(__velarTextMathMin, __velarTextNativeMath, [end, total]);\n return __velarTextCall(__velarNativeStringSlice, value, [__velarTextCodeUnitOffset(value, first), __velarTextCodeUnitOffset(value, last)]);\n}\n// CO-U4: `char` reads forwards. Its index domain is 0 <= index < size, so a\n// negative index is an out-of-range position rather than a read from the end:\n// `\"abc\".char(-1)` used to answer \"c\", which is a whole different member than\n// the one the author wrote and the one every message about `char` describes.\n// Past the end stays `null`, because that is the absence the `string?` result\n// exists to report; before the beginning is a position that cannot exist.\n// The report names the index and the size, as List's own position guard does.\n// CO-U4b: and it raises the class List's guard raises. A plain RangeError\n// carries no name, so `catch error: if error is IndexError` did not match it\n// and `try` turned it into the `null` that reads like \"not found\" \u2014 the costume\n// charter \u00A711 keeps the three integrity failures out of. The class is\n// `__VelarIndexError`, imported from the collection-lowering module when this\n// runtime is a project module and emitted beside it when it is inlined, so one\n// out-of-range position has one class however the program was built.\n// CO-U4c: the non-integer index is the other half of that same \u00A711 sentence \u2014\n// \"an out-of-range or non-integer position\" \u2014 and it was still raising a host\n// `TypeError`, which is not one of the three names `try` refuses to swallow. So\n// a fractional index that reached this guard at run time read as an absence,\n// the very costume CO-U4b took off the negative one. The sentence is the one\n// `List.get` says for the identical failure, one member name apart.\nfunction __velarStringChar(value, index) {\n value = __velarTextValue(value);\n if (!__velarTextCall(__velarTextNumberIsInteger, __velarTextNativeNumber, [index])) throw new __VelarIndexError(\"String.char index must be an integer\");\n const total = __velarTextCodePointLength(value);\n if (index < 0) throw new __VelarIndexError(\"String.char index \" + index + \" is out of range for \" + total + (total === 1 ? \" character\" : \" characters\") + \"; the index domain is 0 through size - 1\");\n if (index >= total) return null;\n const start = __velarTextCodeUnitOffset(value, index);\n return __velarTextCall(__velarNativeStringSlice, value, [start, __velarTextNextCodePointOffset(value, start)]);\n}\nfunction __velarStringHas(value, text) {\n value = __velarTextValue(value); text = __velarTextArgument(text, \"String.has text\");\n return text === \"\" || __velarTextBoundedIndexOf(value, text, 0) >= 0;\n}\n// CO-U4c: `start` is a position as well, clamped when out of range and refused\n// when it is not an integer, so it raises the class the other two raise.\nfunction __velarStringIndex(value, text, start = 0) {\n value = __velarTextValue(value); text = __velarTextArgument(text, \"String.index text\");\n if (!__velarTextCall(__velarTextNumberIsInteger, __velarTextNativeNumber, [start])) throw new __VelarIndexError(\"String.index start must be an integer\");\n const total = __velarTextCodePointLength(value);\n const first = start < 0 ? __velarTextCall(__velarTextMathMax, __velarTextNativeMath, [total + start, 0]) : __velarTextCall(__velarTextMathMin, __velarTextNativeMath, [start, total]);\n const cursor = __velarTextCodeUnitOffset(value, first);\n if (text === \"\") return first;\n const found = __velarTextBoundedIndexOf(value, text, cursor);\n if (found < 0) return null;\n return __velarTextCodePointIndex(value, found);\n}\nfunction __velarStringCount(value, text) {\n value = __velarTextValue(value); text = __velarTextArgument(text, \"String.count text\");\n if (text === \"\") return __velarTextCodePointLength(value) + 1;\n let count = 0;\n let cursor = 0;\n while (true) {\n const index = __velarTextBoundedIndexOf(value, text, cursor);\n if (index < 0) return count;\n count += 1;\n cursor = index + text.length;\n }\n}\nfunction __velarStringStartsWith(value, text) {\n value = __velarTextValue(value); text = __velarTextArgument(text, \"String.startsWith text\");\n return __velarTextCall(__velarNativeStringIndexOf, value, [text, 0]) === 0 && __velarTextIsBoundary(value, text.length);\n}\nfunction __velarStringEndsWith(value, text) {\n value = __velarTextValue(value); text = __velarTextArgument(text, \"String.endsWith text\");\n const start = value.length - text.length;\n return start >= 0 && __velarTextIsBoundary(value, start) && __velarTextCall(__velarNativeStringIndexOf, value, [text, start]) === start;\n}\nfunction __velarStringSplit(value, separator) {\n value = __velarTextValue(value); separator = __velarTextArgument(separator, \"String.split separator\");\n if (separator === \"\") {\n const count = __velarTextCodePointLength(value);\n if (count > __velarMaxTextItems) throw new __velarTextNativeRangeError(\"String.split cannot produce more than \" + __velarMaxTextItems + \" items\");\n const output = new __velarTextNativeArray(count);\n let offset = 0;\n for (let index = 0; index < count; index += 1) {\n const next = __velarTextNextCodePointOffset(value, offset);\n output[index] = __velarTextCall(__velarNativeStringSlice, value, [offset, next]);\n offset = next;\n }\n return output;\n }\n // The native split matches UTF-16 code units, so it would cut a surrogate\n // pair in half on a separator that begins or ends with an unpaired\n // surrogate. Every other separator makes the two scans agree match for\n // match, and the native one is the faster: its limit argument also stops it\n // before it can build an oversize array.\n if (!__velarTextNeedsBoundaryCheck(separator)) {\n return __velarTextList(__velarTextCall(__velarNativeStringSplit, value, [separator, __velarMaxTextItems + 1]), \"String.split\");\n }\n // Searching on code-point boundaries keeps every piece well formed; the\n // pieces themselves are still plain slices of the input.\n const parts = new __velarTextNativeArray();\n let cursor = 0;\n while (true) {\n const found = __velarTextBoundedIndexOf(value, separator, cursor);\n if (found < 0) break;\n parts[parts.length] = __velarTextCall(__velarNativeStringSlice, value, [cursor, found]);\n if (parts.length > __velarMaxTextItems) return __velarTextList(parts, \"String.split\");\n cursor = found + separator.length;\n }\n parts[parts.length] = __velarTextCall(__velarNativeStringSlice, value, [cursor]);\n return __velarTextList(parts, \"String.split\");\n}\nfunction __velarStringReplace(value, from, to) {\n value = __velarTextValue(value); from = __velarTextArgument(from, \"String.replace from\"); to = __velarTextArgument(to, \"String.replace to\");\n if (__velarTextReplacementOutputUnits(value, from, to, false) > __velarMaxTextCodeUnits) throw new __velarTextNativeRangeError(\"String.replace output cannot exceed 16 MiB\");\n if (from === \"\") return to + value;\n const found = __velarTextBoundedIndexOf(value, from, 0);\n if (found < 0) return value;\n return __velarTextCall(__velarNativeStringSlice, value, [0, found]) + to + __velarTextCall(__velarNativeStringSlice, value, [found + from.length]);\n}\nfunction __velarStringReplaceAll(value, from, to) {\n value = __velarTextValue(value); from = __velarTextArgument(from, \"String.replaceAll from\"); to = __velarTextArgument(to, \"String.replaceAll to\");\n if (__velarTextReplacementOutputUnits(value, from, to, true) > __velarMaxTextCodeUnits) throw new __velarTextNativeRangeError(\"String.replaceAll output cannot exceed 16 MiB\");\n if (from === \"\") {\n let output = to;\n let offset = 0;\n while (offset < value.length) { const next = __velarTextNextCodePointOffset(value, offset); output += __velarTextCall(__velarNativeStringSlice, value, [offset, next]) + to; offset = next; }\n return output;\n }\n // A separator that cannot split a pair leaves nothing for the bounded walk\n // to reject, so the native rewrite answers the same string faster. The\n // replacement is passed as a function so that a '$' in it stays literal.\n if (!__velarTextNeedsBoundaryCheck(from)) return __velarTextCall(__velarNativeStringReplaceAll, value, [from, () => to]);\n let output = \"\";\n let cursor = 0;\n while (true) {\n const found = __velarTextBoundedIndexOf(value, from, cursor);\n if (found < 0) break;\n output += __velarTextCall(__velarNativeStringSlice, value, [cursor, found]) + to;\n cursor = found + from.length;\n }\n return output + __velarTextCall(__velarNativeStringSlice, value, [cursor]);\n}\nfunction __velarStringPad(value, size, fill, start) {\n const name = start ? \"String.padStart\" : \"String.padEnd\";\n value = __velarTextValue(value); size = __velarTextCount(size, name + \" size\"); fill = __velarTextArgument(fill, name + \" fill\");\n const needed = size - __velarTextCodePointLength(value);\n if (needed <= 0 || fill.length === 0) return value;\n let outputUnits = value.length;\n let padding = \"\";\n let counted = 0, fillOffset = 0;\n while (counted < needed) {\n const next = __velarTextNextCodePointOffset(fill, fillOffset);\n const character = __velarTextCall(__velarNativeStringSlice, fill, [fillOffset, next]);\n outputUnits += character.length;\n if (outputUnits > __velarMaxTextCodeUnits) throw new __velarTextNativeRangeError(name + \" output cannot exceed 16 MiB\");\n padding += character;\n counted += 1;\n fillOffset = next === fill.length ? 0 : next;\n }\n return start ? padding + value : value + padding;\n}\nfunction __velarStringPadStart(value, size, fill = \" \") { return __velarStringPad(value, size, fill, true); }\nfunction __velarStringPadEnd(value, size, fill = \" \") { return __velarStringPad(value, size, fill, false); }\nfunction __velarStringRepeat(value, count) {\n value = __velarTextValue(value); count = __velarTextCount(count, \"String.repeat count\");\n if (value.length > 0 && count > __velarTextCall(__velarTextMathFloor, __velarTextNativeMath, [__velarMaxTextCodeUnits / value.length])) throw new __velarTextNativeRangeError(\"String.repeat output cannot exceed 16 MiB\");\n return __velarTextCall(__velarNativeStringRepeat, value, [count]);\n}\n"; /** Project-shared implementation of compiler-lowered String and Number receiver methods. */ export declare const VELAR_PRIMITIVE_METHOD_MODULE_SOURCE: string; /** * Compiler-owned Promise normalization and async-result host ABI. * * Normalization proves its input by invoking the captured `then` intrinsic on * it and then builds the normalized value with the captured `%Promise%` * constructor rather than returning what `then` handed back: `then` derives * its result through `SpeciesConstructor`, so one assignment to a Promise's * `constructor` would otherwise make the normalized identity an arbitrary * foreign thenable. The hostile species is still constructed by `then` and its * capability discarded; only the `%Promise%`-owned value is cached. * * The cache is one immutable per-realm WeakMap found under * `VELAR_PROMISE_NORMALIZATION_REGISTRY_KEY`, whose trailing `v` component is * the generation in `VELAR_PROMISE_NORMALIZATION_REGISTRY_VERSION`. Whichever * module of a generation loads first installs that generation's WeakMap; a * generation with a different normalized identity bumps the version and gets * its own slot rather than reading entries a foreign generation cached. Nothing * evicts, and nothing should: the map is keyed by the source Promise, so an * entry lives exactly as long as the Promise it normalizes. */ export declare const VELAR_PROMISE_NORMALIZATION_RUNTIME = "const __velarNormalizeGlobal = globalThis;\nconst __velarNormalizeNativeObject = globalThis.Object;\nconst __velarNormalizeNativeReflect = globalThis.Reflect;\nconst __velarNormalizeNativeWeakMap = globalThis.WeakMap;\nconst __velarNormalizeNativePromise = globalThis.Promise;\nconst __velarNormalizeNativeSymbol = globalThis.Symbol;\nconst __velarNormalizeTypeError = globalThis.TypeError;\nconst __velarNormalizeGetOwnPropertyDescriptor = __velarNormalizeNativeObject.getOwnPropertyDescriptor;\nconst __velarNormalizeGetPrototypeOf = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeNativeObject, \"getPrototypeOf\")?.value;\nconst __velarNormalizeDefineProperty = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeNativeObject, \"defineProperty\")?.value;\nconst __velarNormalizeApply = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeNativeReflect, \"apply\")?.value;\nconst __velarNormalizeWeakMapPrototype = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeNativeWeakMap, \"prototype\")?.value;\nconst __velarNormalizeWeakMapHas = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeWeakMapPrototype, \"has\")?.value;\nconst __velarNormalizeWeakMapGet = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeWeakMapPrototype, \"get\")?.value;\nconst __velarNormalizeWeakMapSet = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeWeakMapPrototype, \"set\")?.value;\nconst __velarNormalizePromisePrototype = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeNativePromise, \"prototype\")?.value;\nconst __velarNormalizePromiseThen = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizePromisePrototype, \"then\")?.value;\nconst __velarNormalizeSymbolFor = __velarNormalizeGetOwnPropertyDescriptor(__velarNormalizeNativeSymbol, \"for\")?.value;\nfunction __velarNormalizeCall(operation, receiver, arguments_) {\n if (typeof operation !== \"function\" || typeof __velarNormalizeApply !== \"function\") throw new __velarNormalizeTypeError(\"The JavaScript Promise normalization runtime is unavailable\");\n return __velarNormalizeApply(operation, receiver, arguments_);\n}\nconst __velarNormalizedPromiseRegistryKey = __velarNormalizeCall(__velarNormalizeSymbolFor, __velarNormalizeNativeSymbol, [\"velar.promise.normalization.v1\"]);\nconst __velarNormalizedPromiseValues = (() => {\n const descriptor = __velarNormalizeCall(__velarNormalizeGetOwnPropertyDescriptor, __velarNormalizeNativeObject, [__velarNormalizeGlobal, __velarNormalizedPromiseRegistryKey]);\n if (descriptor) {\n if (!(\"value\" in descriptor) || descriptor.enumerable || descriptor.configurable || descriptor.writable) {\n throw new __velarNormalizeTypeError(\"VelarScript Promise normalization registry ownership is invalid\");\n }\n try { __velarNormalizeCall(__velarNormalizeWeakMapHas, descriptor.value, [descriptor.value]); }\n catch { throw new __velarNormalizeTypeError(\"VelarScript Promise normalization registry is invalid\"); }\n return descriptor.value;\n }\n const registry = new __velarNormalizeNativeWeakMap();\n __velarNormalizeCall(__velarNormalizeDefineProperty, __velarNormalizeNativeObject, [__velarNormalizeGlobal, __velarNormalizedPromiseRegistryKey, {\n value: registry,\n enumerable: false,\n configurable: false,\n writable: false,\n }]);\n return registry;\n})();\nfunction __velarNormalizeOwnsPromise(candidate) {\n if ((typeof candidate !== \"object\" && typeof candidate !== \"function\") || candidate === null) return false;\n let prototype;\n try { prototype = __velarNormalizeCall(__velarNormalizeGetPrototypeOf, __velarNormalizeNativeObject, [candidate]); }\n catch { return false; }\n return prototype === __velarNormalizePromisePrototype;\n}\nfunction __velarNormalizePromiseValue(value) {\n if ((typeof value !== \"object\" && typeof value !== \"function\") || value === null) throw new __velarNormalizeTypeError(\"Expected an actual Promise\");\n const known = __velarNormalizeCall(__velarNormalizeWeakMapGet, __velarNormalizedPromiseValues, [value]);\n if (known) return known;\n let settle;\n let fail;\n try {\n __velarNormalizeCall(__velarNormalizePromiseThen, value, [\n (resolved) => { if (typeof settle === \"function\") settle(resolved ?? null); },\n (reason) => { if (typeof fail === \"function\") fail(reason); },\n ]);\n }\n catch { throw new __velarNormalizeTypeError(\"Expected an actual Promise\"); }\n if (typeof __velarNormalizeNativePromise !== \"function\") throw new __velarNormalizeTypeError(\"The JavaScript Promise normalization runtime is unavailable\");\n const normalized = new __velarNormalizeNativePromise((resolve, reject) => { settle = resolve; fail = reject; });\n if (typeof settle !== \"function\" || typeof fail !== \"function\" || !__velarNormalizeOwnsPromise(normalized)) throw new __velarNormalizeTypeError(\"The JavaScript Promise normalization runtime is unavailable\");\n __velarNormalizeCall(__velarNormalizeWeakMapSet, __velarNormalizedPromiseValues, [value, normalized]);\n __velarNormalizeCall(__velarNormalizeWeakMapSet, __velarNormalizedPromiseValues, [normalized, normalized]);\n return normalized;\n}\nfunction __velarAsyncResolvedValue(value) {\n if (value === undefined) return null;\n if ((typeof value !== \"object\" && typeof value !== \"function\") || value === null) return value;\n try { return __velarNormalizePromiseValue(value); } catch {}\n let owner = value;\n for (let depth = 0; owner !== null && depth < 128; depth += 1) {\n let descriptor;\n try { descriptor = __velarNormalizeCall(__velarNormalizeGetOwnPropertyDescriptor, __velarNormalizeNativeObject, [owner, \"then\"]); }\n catch { throw new __velarNormalizeTypeError(\"An async result must not expose a callable 'then' or a 'then' getter\"); }\n if (descriptor) {\n if (!(\"value\" in descriptor) || typeof descriptor.value === \"function\") throw new __velarNormalizeTypeError(\"An async result must not expose a callable 'then' or a 'then' getter\");\n return value;\n }\n try { owner = __velarNormalizeCall(__velarNormalizeGetPrototypeOf, __velarNormalizeNativeObject, [owner]); }\n catch { throw new __velarNormalizeTypeError(\"An async result must have an inspectable prototype chain\"); }\n }\n if (owner !== null) throw new __velarNormalizeTypeError(\"An async result prototype chain is too deep\");\n return value;\n}\n"; /** Project-shared implementation of compiler-lowered Promise boundaries. */ export declare const VELAR_PROMISE_NORMALIZATION_MODULE_SOURCE: string; /** * D114 S3: the prelude `range` and its counted-loop owner. Both used to live in * `velar/collections`; that module retired when its twelve List duplicates * became members, and `range` is the one name it published that was never a * List operation, so it moves to a compiler-owned runtime module rather than * keeping a public module alive for one function. * * D97: the counted form validates the whole range before the emitted loop body * runs, in constant time for finite safe-integer bounds, and hands back three * scalars that generated code unpacks immediately — never a List. */ export declare const VELAR_RANGE_RUNTIME = "const __velarRangeMaxItems = 1000000;\nconst __velarRangeNativeArray = globalThis.Array;\nconst __velarRangeNativeNumber = globalThis.Number;\nconst __velarRangeNativeMath = globalThis.Math;\nconst __velarRangeNativeObject = globalThis.Object;\nconst __velarRangeNativeTypeError = globalThis.TypeError;\nconst __velarRangeNativeRangeError = globalThis.RangeError;\nconst __velarRangeGetOwnPropertyDescriptor = __velarRangeNativeObject.getOwnPropertyDescriptor;\nconst __velarRangeReflectApply = __velarRangeGetOwnPropertyDescriptor(globalThis.Reflect, \"apply\")?.value;\nfunction __velarRangeHostOperation(owner, key) {\n const descriptor = __velarRangeGetOwnPropertyDescriptor(owner, key);\n if (!descriptor || !(\"value\" in descriptor) || typeof descriptor.value !== \"function\") throw new __velarRangeNativeTypeError(\"The JavaScript \" + key + \" numeric API is unavailable\");\n return descriptor.value;\n}\nconst __velarRangeNumberIsFinite = __velarRangeHostOperation(__velarRangeNativeNumber, \"isFinite\");\nconst __velarRangeNumberIsSafeInteger = __velarRangeHostOperation(__velarRangeNativeNumber, \"isSafeInteger\");\nconst __velarRangeMathFloor = __velarRangeHostOperation(__velarRangeNativeMath, \"floor\");\nconst __velarRangeObjectDefineProperty = __velarRangeHostOperation(__velarRangeNativeObject, \"defineProperty\");\nif (typeof __velarRangeReflectApply !== \"function\") throw new __velarRangeNativeTypeError(\"The JavaScript Reflect.apply numeric API is unavailable\");\nfunction __velarRangeCall(operation, receiver, arguments_) { return __velarRangeReflectApply(operation, receiver, arguments_); }\nfunction __velarRangeBounds(start, stop, step) {\n if (!__velarRangeCall(__velarRangeNumberIsFinite, __velarRangeNativeNumber, [start]) || !__velarRangeCall(__velarRangeNumberIsFinite, __velarRangeNativeNumber, [stop]) || !__velarRangeCall(__velarRangeNumberIsFinite, __velarRangeNativeNumber, [step]) || step === 0) throw new __velarRangeNativeRangeError(\"range requires finite numbers and a non-zero step\");\n}\nfunction __velarRange(start, stop = null, step = 1) {\n if (stop === null) { stop = start; start = 0; }\n __velarRangeBounds(start, stop, step);\n const output = new __velarRangeNativeArray();\n if (step > 0) for (let value = start; value < stop;) {\n if (output.length >= __velarRangeMaxItems) throw new __velarRangeNativeRangeError(\"range cannot produce more than \" + __velarRangeMaxItems + \" items\");\n output[output.length] = value; const next = value + step;\n if (next === value) throw new __velarRangeNativeRangeError(\"range step is too small to advance at this magnitude\");\n value = next;\n } else for (let value = start; value > stop;) {\n if (output.length >= __velarRangeMaxItems) throw new __velarRangeNativeRangeError(\"range cannot produce more than \" + __velarRangeMaxItems + \" items\");\n output[output.length] = value; const next = value + step;\n if (next === value) throw new __velarRangeNativeRangeError(\"range step is too small to advance at this magnitude\");\n value = next;\n }\n return output;\n}\n// Compiler-only entry point for a direct counted range loop. Validation\n// deliberately completes before the loop body starts, matching range()'s\n// eager errors without allocating the produced List.\nfunction __velarCountedRange(start, stop = null, step = 1) {\n if (stop === null) { stop = start; start = 0; }\n __velarRangeBounds(start, stop, step);\n // World and binary workloads use many small integer ranges. Their iteration\n // count is exact arithmetic, so validate the million-item bound in constant\n // time instead of replaying the complete counter before the emitted loop.\n // Floating-point and very large ranges retain the step-by-step path below,\n // including its exact non-advancing-number behaviour.\n if (__velarRangeCall(__velarRangeNumberIsSafeInteger, __velarRangeNativeNumber, [start])\n && __velarRangeCall(__velarRangeNumberIsSafeInteger, __velarRangeNativeNumber, [stop])\n && __velarRangeCall(__velarRangeNumberIsSafeInteger, __velarRangeNativeNumber, [step])) {\n const distance = step > 0 ? stop - start : start - stop;\n if (distance <= 0) return [start, stop, step];\n if (__velarRangeCall(__velarRangeNumberIsSafeInteger, __velarRangeNativeNumber, [distance])) {\n const magnitude = step > 0 ? step : -step;\n const count = __velarRangeCall(__velarRangeMathFloor, __velarRangeNativeMath, [(distance - 1) / magnitude]) + 1;\n if (count > __velarRangeMaxItems) throw new __velarRangeNativeRangeError(\"range cannot produce more than \" + __velarRangeMaxItems + \" items\");\n return [start, stop, step];\n }\n }\n let count = 0;\n if (step > 0) for (let value = start; value < stop;) {\n if (count >= __velarRangeMaxItems) throw new __velarRangeNativeRangeError(\"range cannot produce more than \" + __velarRangeMaxItems + \" items\");\n count += 1; const next = value + step;\n if (next === value) throw new __velarRangeNativeRangeError(\"range step is too small to advance at this magnitude\");\n value = next;\n } else for (let value = start; value > stop;) {\n if (count >= __velarRangeMaxItems) throw new __velarRangeNativeRangeError(\"range cannot produce more than \" + __velarRangeMaxItems + \" items\");\n count += 1; const next = value + step;\n if (next === value) throw new __velarRangeNativeRangeError(\"range step is too small to advance at this magnitude\");\n value = next;\n }\n // The tuple is a compiler-private handoff consumed immediately by generated\n // scalar locals. It never reaches VelarScript code, so freezing it only adds\n // allocation work to every nested counter loop without strengthening a\n // source-visible boundary.\n return [start, stop, step];\n}\n__velarRangeCall(__velarRangeObjectDefineProperty, __velarRangeNativeObject, [__velarRange, \"__velarCounted\", {\n value: __velarCountedRange,\n enumerable: false,\n configurable: false,\n writable: false,\n}]);\n"; export declare const VELAR_RANGE_MODULE_SOURCE: string; /** * Core has no reactive provider. Keep the same private module ABI so shared * collection lowering remains target-agnostic, but make absence a compile-time * fact instead of probing the Web registry on every collection operation. */ export declare const VELAR_NON_REACTIVE_BRIDGE_RUNTIME = "const __velarReactiveIterateKey = null;\nconst __velarReactiveStructureKey = null;\nfunction __velarReactiveRaw(value) { return value; }\nfunction __velarHostRaw(value) { return value; }\n"; export declare const VELAR_NON_REACTIVE_COLLECTION_BRIDGE_RUNTIME = "function __velarReactiveCollectionRead(value, key, child) { return child === undefined ? null : child; }\nfunction __velarReactiveCollectionTrack() {}\nfunction __velarReactiveCollectionLink() {}\nfunction __velarReactiveCollectionTrigger() {}\nfunction __velarReactiveCollectionUnlink() {}\n"; export declare const VELAR_NON_REACTIVE_BRIDGE_MODULE_SOURCE: string; /** * Canonical generated runtime for compiler-known Type identities. Core and * extensions embed this source into separate modules, then converge through * one immutable global WeakSet descriptor. */ export declare const VELAR_TYPE_REGISTRY_RUNTIME = "const __velarTypeNativeWeakSet = globalThis.WeakSet;\nconst __velarTypeNativeObject = globalThis.Object;\nconst __velarTypeNativeTypeError = globalThis.TypeError;\nconst __velarTypeGetOwnPropertyDescriptor = __velarTypeNativeObject.getOwnPropertyDescriptor;\nconst __velarTypeDefineProperty = __velarTypeNativeObject.defineProperty;\nconst __velarTypeReflectApply = __velarTypeGetOwnPropertyDescriptor(globalThis.Reflect, \"apply\")?.value;\nconst __velarTypeSymbolFor = globalThis.Symbol.for;\nconst __velarTypeWeakSetPrototype = __velarTypeGetOwnPropertyDescriptor(__velarTypeNativeWeakSet, \"prototype\")?.value;\nconst __velarTypeWeakSetHas = __velarTypeGetOwnPropertyDescriptor(__velarTypeWeakSetPrototype, \"has\")?.value;\nconst __velarTypeWeakSetAdd = __velarTypeGetOwnPropertyDescriptor(__velarTypeWeakSetPrototype, \"add\")?.value;\nfunction __velarTypeCall(operation, receiver, arguments_) { if (typeof operation !== \"function\" || typeof __velarTypeReflectApply !== \"function\") throw new __velarTypeNativeTypeError(\"The JavaScript runtime Type registry API is unavailable\"); return __velarTypeReflectApply(operation, receiver, arguments_); }\nconst __velarRuntimeTypeRegistryKey = __velarTypeCall(__velarTypeSymbolFor, globalThis.Symbol, [\"velar.type.registry.v1\"]);\nconst __velarRuntimeTypeRegistry = (() => {\n const descriptor = __velarTypeGetOwnPropertyDescriptor(globalThis, __velarRuntimeTypeRegistryKey);\n if (descriptor) {\n if (!(\"value\" in descriptor) || descriptor.enumerable || descriptor.configurable || descriptor.writable) {\n throw new __velarTypeNativeTypeError(\"VelarScript runtime type registry descriptor is invalid\");\n }\n try { __velarTypeCall(__velarTypeWeakSetHas, descriptor.value, [descriptor.value]); }\n catch { throw new __velarTypeNativeTypeError(\"VelarScript runtime type registry is invalid\"); }\n return descriptor.value;\n }\n const registry = new __velarTypeNativeWeakSet();\n __velarTypeCall(__velarTypeDefineProperty, __velarTypeNativeObject, [globalThis, __velarRuntimeTypeRegistryKey, {\n value: registry,\n enumerable: false,\n configurable: false,\n writable: false,\n }]);\n return registry;\n})();\nfunction __velarRegisterRuntimeType(value) {\n __velarTypeCall(__velarTypeWeakSetAdd, __velarRuntimeTypeRegistry, [value]);\n return value;\n}\nfunction __velarRequireRuntimeType(value, name, optional = false) {\n if (optional && value == null) return null;\n // Registry membership proves the value was registered somewhere in this\n // realm; it does not prove it still presents the Type surface. A module built\n // by another generation registers into the same WeakSet whenever both\n // generations share the registry key, so the surface itself is asserted here:\n // 'is' and 'parse' are the two operations every caller of this helper goes on\n // to invoke.\n if (!value || typeof value !== \"object\" || !__velarTypeCall(__velarTypeWeakSetHas, __velarRuntimeTypeRegistry, [value])\n || typeof value.is !== \"function\" || typeof value.parse !== \"function\") {\n throw new __velarTypeNativeTypeError(name + \" requires a compiler-known VelarScript runtime type\");\n }\n return value;\n}\n"; /** Cached public module views and ordered dynamic-import capture. */ export declare const VELAR_MODULE_NAMESPACE_RUNTIME = "const __velarModuleNativeObject = globalThis.Object;\nconst __velarModuleNativeWeakMap = globalThis.WeakMap;\nconst __velarModuleNativeProxy = globalThis.Proxy;\nconst __velarModuleNativeTypeError = globalThis.TypeError;\nconst __velarModuleOwnDescriptor = __velarModuleNativeObject.getOwnPropertyDescriptor;\nconst __velarModuleCreate = __velarModuleOwnDescriptor(__velarModuleNativeObject, \"create\")?.value;\nconst __velarModuleDefine = __velarModuleOwnDescriptor(__velarModuleNativeObject, \"defineProperty\")?.value;\nconst __velarModulePreventExtensions = __velarModuleOwnDescriptor(__velarModuleNativeObject, \"preventExtensions\")?.value;\nconst __velarModuleApply = __velarModuleOwnDescriptor(globalThis.Reflect, \"apply\")?.value;\nconst __velarModuleSort = __velarModuleOwnDescriptor(globalThis.Array.prototype, \"sort\")?.value;\nconst __velarModuleWeakMapPrototype = __velarModuleOwnDescriptor(__velarModuleNativeWeakMap, \"prototype\")?.value;\nconst __velarModuleWeakMapGet = __velarModuleOwnDescriptor(__velarModuleWeakMapPrototype, \"get\")?.value;\nconst __velarModuleWeakMapHas = __velarModuleOwnDescriptor(__velarModuleWeakMapPrototype, \"has\")?.value;\nconst __velarModuleWeakMapSet = __velarModuleOwnDescriptor(__velarModuleWeakMapPrototype, \"set\")?.value;\nconst __velarModulePromiseThen = __velarModuleOwnDescriptor(globalThis.Promise.prototype, \"then\")?.value;\nconst __velarModuleSymbolFor = __velarModuleOwnDescriptor(globalThis.Symbol, \"for\")?.value;\nfunction __velarModuleCall(operation, receiver, arguments_) {\n if (typeof operation !== \"function\" || typeof __velarModuleApply !== \"function\") throw new __velarModuleNativeTypeError(\"The JavaScript module namespace runtime is unavailable\");\n return __velarModuleApply(operation, receiver, arguments_);\n}\nconst __velarModuleRegistryKey = __velarModuleCall(__velarModuleSymbolFor, globalThis.Symbol, [\"velar.module.namespace.v1\"]);\nconst __velarModuleViews = (() => {\n const descriptor = __velarModuleOwnDescriptor(globalThis, __velarModuleRegistryKey);\n if (descriptor) {\n if (!(\"value\" in descriptor) || descriptor.enumerable || descriptor.configurable || descriptor.writable) throw new __velarModuleNativeTypeError(\"VelarScript module namespace registry ownership is invalid\");\n try { __velarModuleCall(__velarModuleWeakMapHas, descriptor.value, [descriptor.value]); }\n catch { throw new __velarModuleNativeTypeError(\"VelarScript module namespace registry is invalid\"); }\n return descriptor.value;\n }\n const registry = new __velarModuleNativeWeakMap();\n __velarModuleCall(__velarModuleDefine, __velarModuleNativeObject, [globalThis, __velarModuleRegistryKey, {value: registry, enumerable: false, configurable: false, writable: false}]);\n return registry;\n})();\nfunction __velarModuleNamespace(raw, publicNames) {\n const known = __velarModuleCall(__velarModuleWeakMapGet, __velarModuleViews, [raw]);\n if (known) return known;\n const target = __velarModuleCall(__velarModuleCreate, __velarModuleNativeObject, [null]);\n const names = [];\n for (let index = 0; index < publicNames.length; index += 1) names[index] = publicNames[index];\n __velarModuleCall(__velarModuleSort, names, []);\n for (let index = 0; index < names.length; index += 1) {\n __velarModuleCall(__velarModuleDefine, __velarModuleNativeObject, [target, names[index], {value: undefined, enumerable: true, configurable: false, writable: true}]);\n }\n __velarModuleCall(__velarModulePreventExtensions, __velarModuleNativeObject, [target]);\n // Creating the view must not read a binding: a cycle may expose a namespace\n // before its lexical exports initialize. Data descriptors read only the\n // requested binding, so checked record spread stays live and retains TDZ.\n const view = new __velarModuleNativeProxy(target, {\n get(object, key) {\n return __velarModuleOwnDescriptor(object, key) ? raw[key] : undefined;\n },\n getOwnPropertyDescriptor(object, key) {\n if (!__velarModuleOwnDescriptor(object, key)) return undefined;\n return {value: raw[key], enumerable: true, configurable: false, writable: true};\n },\n set() { return false; },\n defineProperty() { return false; },\n });\n __velarModuleCall(__velarModuleWeakMapSet, __velarModuleViews, [raw, view]);\n return view;\n}\nfunction __velarImportModule(promise, receive, publicNames) {\n // This is the only observer of the native import. The returned chain owns\n // both import and callback failures, and records raw bindings before any\n // caller observes the public namespace.\n return __velarModuleCall(__velarModulePromiseThen, promise, [(raw) => {\n receive(raw);\n return __velarModuleNamespace(raw, publicNames);\n }]);\n}\n"; /** Canonical runtime for data Type traversal and private/public module routing. */ export declare const VELAR_TYPE_VALIDATION_RUNTIME: string; /** Stateless traversal for collection-shaped runtime Types. */ export declare const VELAR_RUNTIME_TYPE_COLLECTION_RUNTIME = "function __velarListTypeIs(value, check) {\n if (!__velarCollectionHostCall(__velarCollectionArrayIsArray, __velarCollectionNativeArray, [value]) || value.length > 1000000 || __velarCollectionHostCall(__velarCollectionOwnSymbols, __velarCollectionNativeObject, [value]).length > 0 || __velarCollectionHostCall(__velarCollectionOwnNames, __velarCollectionNativeObject, [value]).length !== value.length + 1) return false;\n const lengthDescriptor = __velarCollectionHostCall(__velarCollectionGetOwnPropertyDescriptor, __velarCollectionNativeObject, [value, \"length\"]);\n if (!lengthDescriptor || !lengthDescriptor.writable || lengthDescriptor.enumerable || lengthDescriptor.configurable || !(\"value\" in lengthDescriptor)) return false;\n for (let index = 0; index < value.length; index += 1) {\n const descriptor = __velarCollectionHostCall(__velarCollectionGetOwnPropertyDescriptor, __velarCollectionNativeObject, [value, index]);\n if (!descriptor?.enumerable || !descriptor.configurable || !descriptor.writable || !(\"value\" in descriptor) || !check(descriptor.value)) return false;\n }\n return true;\n}\n\nfunction __velarSetTypeIs(value, check) {\n if (!__velarIsSet(value) || __velarCollectionHostCall(__velarCollectionSetSize, value, []) > 1000000) return false;\n const iterator = __velarCollectionSetTypeIterator(value);\n while (true) { const step = __velarCollectionSetTypeNext(iterator); if (step.done) break; if (!check(step.value)) return false; }\n return true;\n}\n\nfunction __velarMapTypeIs(value, check) {\n if (!__velarIsMap(value) || __velarCollectionHostCall(__velarCollectionMapSize, value, []) > 1000000) return false;\n const iterator = __velarCollectionMapTypeIterator(value);\n while (true) { const step = __velarCollectionMapTypeNext(iterator); if (step.done) break; const entry = step.value; if (!check(entry[0], entry[1])) return false; }\n return true;\n}\n\nfunction __velarRecordTypeIs(value, check) {\n if (!__velarIsRecord(value)) return false;\n const keys = __velarCollectionHostCall(__velarCollectionOwnKeys, __velarCollectionNativeReflect, [value]);\n if (keys.length > 1000000) return false;\n for (let index = 0; index < keys.length; index += 1) {\n const key = keys[index];\n if (typeof key !== \"string\") return false;\n const descriptor = __velarCollectionHostCall(__velarCollectionGetOwnPropertyDescriptor, __velarCollectionNativeObject, [value, key]);\n if (!descriptor?.enumerable || !descriptor.configurable || !descriptor.writable || !(\"value\" in descriptor) || !check(descriptor.value)) return false;\n }\n return true;\n}\n"; export declare const VELAR_VALIDATION_ERROR_RUNTIME = "// One path implementation serves generated structural checks and velar/validation.\nconst __velarValidationErrorDefineProperty = globalThis.Object.defineProperty;\nconst __velarValidationPathIsSafeInteger = globalThis.Number.isSafeInteger;\nconst __velarValidationMessageSlice = globalThis.String.prototype.slice;\nconst __velarValidationPathKind = __velarRegisterRuntimeType(__velarValidationFreeze({\n field: \"field\", listIndex: \"listIndex\", mapKey: \"mapKey\", mapValue: \"mapValue\",\n setElement: \"setElement\", recordEntry: \"recordEntry\", truncated: \"truncated\",\n is(value) { return value === \"field\" || value === \"listIndex\" || value === \"mapKey\" || value === \"mapValue\" || value === \"setElement\" || value === \"recordEntry\" || value === \"truncated\"; },\n parse(value) { if (!__velarValidationPathKind.is(value)) throw new __VelarValidationError(\"Value does not match ValidationPathKind\"); return value; },\n copy(value) { return value; },\n values() { return [\"field\", \"listIndex\", \"mapKey\", \"mapValue\", \"setElement\", \"recordEntry\", \"truncated\"]; },\n}));\nfunction __velarValidationPath(value = []) {\n if (!__velarValidationIsArray(value)) throw new __velarCollectionNativeTypeError(\"validation path must be a List\");\n const length = __velarValidationOwnDescriptor(value, \"length\").value;\n if (length > 64) throw new __velarCollectionNativeTypeError(\"validation path cannot exceed 64 segments\");\n const result = [];\n for (let index = 0; index < length; index += 1) {\n const segment = __velarValidationOwnDescriptor(value, index)?.value;\n if (segment === null || typeof segment !== \"object\") throw new __velarCollectionNativeTypeError(\"validation path segment must be a record\");\n const kind = __velarValidationOwnDescriptor(segment, \"kind\")?.value;\n let copy;\n if (kind === \"field\") {\n const name = __velarValidationOwnDescriptor(segment, \"name\")?.value;\n if (typeof name !== \"string\") throw new __velarCollectionNativeTypeError(\"validation field path requires a name\");\n copy = {kind, name};\n } else if (kind === \"truncated\" && index === length - 1) {\n copy = {kind};\n } else if (kind === \"listIndex\" || kind === \"mapKey\" || kind === \"mapValue\" || kind === \"setElement\" || kind === \"recordEntry\") {\n const position = __velarValidationOwnDescriptor(segment, \"index\")?.value;\n if (!__velarCollectionHostCall(__velarValidationPathIsSafeInteger, undefined, [position]) || position < 0) throw new __velarCollectionNativeTypeError(\"validation path index must be a non-negative safe integer\");\n copy = {kind, index: position};\n } else throw new __velarCollectionNativeTypeError(\"invalid validation path kind or truncated position\");\n result[result.length] = copy;\n }\n // readonly is a static view; List uses ordinary mutable array descriptors.\n return result;\n}\nfunction __velarValidationPathAppend(path, segment) {\n const result = [];\n const length = path.length < 64 ? path.length : 63;\n for (let index = 0; index < length; index += 1) result[index] = path[index];\n if (path.length > 0 && path[path.length - 1].kind === \"truncated\") return path;\n result[result.length] = path.length >= 64 ? {kind: \"truncated\"} : segment;\n return result;\n}\nfunction __velarValidationBoundMessage(message) {\n return message.length <= 4096 ? message : __velarCollectionHostCall(__velarValidationMessageSlice, message, [0, 4068]) + \" [diagnostic truncated]\";\n}\nfunction __velarValidationFormatPath(path) {\n let text = \"value\";\n for (let index = 0; index < path.length; index += 1) {\n const segment = path[index];\n text += segment.kind === \"field\" ? \".\" + segment.name\n : segment.kind === \"truncated\" ? \" [diagnostic truncated]\"\n : \"[\" + segment.kind + \":\" + segment.index + \"]\";\n if (text.length > 4096) return __velarValidationBoundMessage(text);\n }\n return text;\n}\nclass __VelarValidationError extends __velarCollectionNativeTypeError {\n constructor(message = \"\", detail) {\n let path = __velarValidationPath(detail?.path ?? []);\n if (detail && __velarValidationFormatPath(path).length + message.length + 2 > 4096) path = __velarValidationPath(__velarValidationPathAppend(path, {kind: \"truncated\"}));\n const rawReason = detail?.reason ?? null;\n const reason = rawReason !== null && path[path.length - 1]?.kind === \"truncated\" ? rawReason + \" [diagnostic truncated]\" : rawReason;\n super(__velarValidationBoundMessage(detail ? __velarValidationFormatPath(path) + \": \" + message : message));\n this.name = \"ValidationError\";\n __velarValidationErrorDefineProperty(this, \"path\", {value: path, enumerable: true});\n this.reason = reason === null ? null : __velarValidationBoundMessage(reason);\n }\n get field() {\n const tail = this.path[this.path.length - 1];\n return tail?.kind === \"field\" ? tail.name : null;\n }\n}\n__velarValidationErrorDefineProperty(__VelarValidationError, \"name\", { value: \"ValidationError\", writable: false, enumerable: false, configurable: true });\n\nfunction __velarValidationExplain(type, value) {\n const state = {nodes: 0, active: new __velarValidationNativeWeakMap()};\n return __velarValidationLocate({kind: \"reference\", target: () => type}, value, [], state)\n ?? {path: [], reason: \"the value does not match the expected type\"};\n}\nfunction __velarValidationDiagnosticFailure(path, reason) {\n return {path, reason: path[path.length - 1]?.kind === \"truncated\" ? reason + \" [diagnostic truncated]\" : reason};\n}\nfunction __velarValidationDiagnosticTruncated(path) {\n return {path: __velarValidationPathAppend(path, {kind: \"truncated\"}), reason: \"diagnostic truncated\"};\n}\nfunction __velarValidationLocate(plan, value, path, state) {\n if (++state.nodes > 4096 || path.length > 64 || path[path.length - 1]?.kind === \"truncated\") return __velarValidationDiagnosticTruncated(path);\n const fail = () => __velarValidationDiagnosticFailure(path, \"the value does not match \" + (plan.name ?? \"the expected type\"));\n const child = (nested, item, segment) => __velarValidationLocate(nested, item, __velarValidationPathAppend(path, segment), state);\n if (plan.kind === \"reference\" || plan.kind === \"lazy\") {\n const type = plan.kind === \"lazy\" ? plan.target : plan.target();\n if (plan.kind === \"reference\" && typeof type.diagnosticPlan !== \"function\") return type.is(value) ? null : fail();\n let active;\n if (value !== null && typeof value === \"object\") {\n active = __velarValidationWeakMapGet(state.active, value);\n if (active && __velarValidationSetHas(active, type)) return __velarValidationDiagnosticFailure(path, \"cyclic value does not match the expected type\");\n if (!active) { active = __velarValidationSet(); __velarValidationWeakMapSet(state.active, value, active); }\n __velarValidationSetAdd(active, type);\n }\n try { return __velarValidationLocate(plan.kind === \"lazy\" ? type() : type.diagnosticPlan(), value, path, state); }\n finally { if (active) __velarValidationSetDelete(active, type); }\n }\n if (plan.kind === \"optional\") return value == null ? null : __velarValidationLocate(plan.inner, value, path, state);\n if (plan.kind === \"leaf\") return plan.check(value) ? null : fail();\n if (plan.kind === \"union\") {\n // Validate all alternatives within the same budget; only a uniquely proven\n // enum discriminant permits reporting inside a failed branch.\n const failures = [];\n const tags = [];\n for (let index = 0; index < plan.members.length; index += 1) {\n const member = plan.members[index];\n const failure = __velarValidationLocate(member, value, path, state);\n if (failure === null) return null;\n if (state.nodes > 4096) return __velarValidationDiagnosticTruncated(path);\n failures[index] = failure;\n tags[index] = __velarValidationDiscriminants(member, value, state);\n if (state.nodes > 4096) return __velarValidationDiagnosticTruncated(path);\n }\n let selected = -1;\n for (let tagIndex = 0; tagIndex < (tags[0]?.length ?? 0); tagIndex += 1) {\n const name = tags[0][tagIndex].name;\n let candidate = -1;\n let common = true;\n let matches = 0;\n for (let index = 0; index < tags.length; index += 1) {\n let found = false;\n for (let position = 0; position < tags[index].length; position += 1) {\n if (++state.nodes > 4096) return __velarValidationDiagnosticTruncated(path);\n const tag = tags[index][position];\n if (tag.name !== name) continue;\n found = true;\n if (tag.matches) { candidate = index; matches += 1; }\n break;\n }\n if (!found) common = false;\n }\n if (common && matches === 1) {\n if (selected >= 0 && selected !== candidate) return fail();\n selected = candidate;\n }\n }\n return selected >= 0 ? failures[selected] : fail();\n }\n\n if (plan.kind === \"object\") {\n if (value === null || typeof value !== \"object\" || __velarValidationIsArray(value) || !__velarValidationIsPlainObject(value)) return __velarValidationDiagnosticFailure(path, \"the value is not a record\");\n if (plan.base) { const error = __velarValidationLocate(plan.base, value, path, state); if (error) return error; }\n for (let index = 0; index < plan.fields.length; index += 1) {\n if (++state.nodes > 4096) return __velarValidationDiagnosticTruncated(path);\n const field = plan.fields[index];\n const descriptor = __velarValidationOwnDescriptor(value, field.name);\n const segment = {kind: \"field\", name: field.name};\n if (descriptor === undefined && field.optional) continue;\n if (descriptor === undefined || !descriptor.enumerable || !(\"value\" in descriptor)) return __velarValidationDiagnosticFailure(__velarValidationPathAppend(path, segment), \"field '\" + field.name + \"' \" + (descriptor === undefined ? \"is missing\" : \"must be an enumerable data property\"));\n const error = child(field.plan, descriptor.value, segment);\n if (error) return error;\n }\n return null;\n }\n if (plan.kind === \"list\") {\n if (!__velarValidationIsArray(value)) return fail();\n const lengthDescriptor = __velarValidationOwnDescriptor(value, \"length\");\n const length = lengthDescriptor.value;\n if (length > 1000000 || !lengthDescriptor.writable || __velarCollectionHostCall(__velarCollectionOwnSymbols, __velarCollectionNativeObject, [value]).length > 0 || __velarCollectionHostCall(__velarCollectionOwnNames, __velarCollectionNativeObject, [value]).length !== length + 1) return fail();\n for (let index = 0; index < length; index += 1) {\n const descriptor = __velarValidationOwnDescriptor(value, index);\n if (!descriptor?.enumerable || !descriptor.writable || !descriptor.configurable || !(\"value\" in descriptor)) return __velarValidationDiagnosticFailure(__velarValidationPathAppend(path, {kind: \"listIndex\", index}), \"element must be a data property\");\n const error = child(plan.element, descriptor.value, {kind: \"listIndex\", index});\n if (error) return error;\n }\n return null;\n }\n if (plan.kind === \"map\" || plan.kind === \"set\") {\n const map = plan.kind === \"map\";\n if (map ? !__velarIsMap(value) : !__velarIsSet(value)) return fail();\n if (__velarCollectionHostCall(map ? __velarCollectionMapSize : __velarCollectionSetSize, value, []) > 1000000) return fail();\n const iterator = map ? __velarCollectionMapTypeIterator(value) : __velarCollectionSetTypeIterator(value);\n for (let index = 0; ; index += 1) {\n const step = map ? __velarCollectionMapTypeNext(iterator) : __velarCollectionSetTypeNext(iterator);\n if (step.done) return null;\n if (map) {\n const error = child(plan.key, step.value[0], {kind: \"mapKey\", index});\n if (error) return error;\n }\n const error = child(plan.element, map ? step.value[1] : step.value, {kind: map ? \"mapValue\" : \"setElement\", index});\n if (error) return error;\n }\n }\n if (plan.kind === \"record\") {\n if (!__velarIsRecord(value)) return fail();\n const keys = __velarCollectionHostCall(__velarCollectionOwnKeys, __velarCollectionNativeReflect, [value]);\n if (keys.length > 1000000) return fail();\n let position = 0;\n for (let index = 0; index < keys.length; index += 1) {\n if (++state.nodes > 4096) return __velarValidationDiagnosticTruncated(path);\n const descriptor = __velarValidationOwnDescriptor(value, keys[index]);\n const segment = {kind: \"recordEntry\", index: position++};\n if (typeof keys[index] !== \"string\" || !descriptor?.enumerable || !descriptor.writable || !descriptor.configurable || !(\"value\" in descriptor)) return __velarValidationDiagnosticFailure(__velarValidationPathAppend(path, segment), \"entry must be a text-keyed data property\");\n const error = child(plan.element, descriptor.value, segment);\n if (error) return error;\n }\n return null;\n }\n return fail();\n}\nfunction __velarValidationDiscriminants(plan, value, state) {\n if (++state.nodes > 4096 || value === null || typeof value !== \"object\") return [];\n if (plan.kind === \"lazy\") return __velarValidationDiscriminants(plan.target(), value, state);\n if (plan.kind === \"reference\") {\n const type = plan.target();\n return typeof type.diagnosticPlan === \"function\" ? __velarValidationDiscriminants(type.diagnosticPlan(), value, state) : [];\n }\n if (plan.kind !== \"object\") return [];\n const result = plan.base ? __velarValidationDiscriminants(plan.base, value, state) : [];\n for (let index = 0; index < plan.fields.length; index += 1) {\n if (++state.nodes > 4096) return result;\n const field = plan.fields[index];\n let fieldPlan = field.plan;\n while (fieldPlan.kind === \"lazy\") {\n if (++state.nodes > 4096) return result;\n fieldPlan = fieldPlan.target();\n }\n if (!fieldPlan.discriminant) continue;\n const descriptor = __velarValidationOwnDescriptor(value, field.name);\n result[result.length] = {name: field.name, matches: !!descriptor?.enumerable && \"value\" in descriptor && fieldPlan.check(descriptor.value)};\n }\n return result;\n}\n"; /** * Project-shared runtime-Type host ABI. Generated predicates and Type values * remain in their source modules; only immutable host operations and fresh * per-call traversal state cross the project boundary. */ export declare const VELAR_TYPE_VALIDATION_MODULE_SOURCE: string; /** * Platform-neutral UTF-8 sizing for transport contracts. This intentionally * does not depend on TextEncoder or Buffer so every official target applies * the same treatment to surrogate pairs and unpaired surrogates. */ export declare const VELAR_UTF8_RUNTIME = "const __velarUtf8CharCodeAt = Object.getOwnPropertyDescriptor(String.prototype, \"charCodeAt\")?.value;\nconst __velarUtf8ReflectApply = Object.getOwnPropertyDescriptor(Reflect, \"apply\")?.value;\nfunction __velarUtf8ByteLength(value) {\n if (typeof value !== \"string\") throw new TypeError(\"UTF-8 byte length requires text\");\n if (typeof __velarUtf8CharCodeAt !== \"function\" || typeof __velarUtf8ReflectApply !== \"function\") {\n throw new TypeError(\"The host UTF-8 sizing intrinsics are unavailable\");\n }\n let bytes = 0;\n for (let index = 0; index < value.length; index += 1) {\n const unit = __velarUtf8ReflectApply(__velarUtf8CharCodeAt, value, [index]);\n if (unit <= 0x7F) bytes += 1;\n else if (unit <= 0x7FF) bytes += 2;\n else if (unit >= 0xD800 && unit <= 0xDBFF && index + 1 < value.length) {\n const next = __velarUtf8ReflectApply(__velarUtf8CharCodeAt, value, [index + 1]);\n if (next >= 0xDC00 && next <= 0xDFFF) { bytes += 4; index += 1; }\n else bytes += 3;\n } else bytes += 3;\n }\n return bytes;\n}\nfunction __velarDeclaredLength(value) {\n if (typeof value !== \"string\" || value.length === 0) return null;\n if (typeof __velarUtf8CharCodeAt !== \"function\" || typeof __velarUtf8ReflectApply !== \"function\") {\n throw new TypeError(\"The host transport sizing intrinsics are unavailable\");\n }\n let length = 0;\n for (let index = 0; index < value.length; index += 1) {\n const unit = __velarUtf8ReflectApply(__velarUtf8CharCodeAt, value, [index]);\n if (unit < 48 || unit > 57) return null;\n if (length > 900719925474099) return 1 / 0;\n length = length * 10 + unit - 48;\n if (length > 9007199254740991) return 1 / 0;\n }\n return length;\n}\n"; //# sourceMappingURL=runtime-sources.generated.d.ts.map