@dcmjs-org/parser 0.0.0-stage → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/eventStream/EventStreamListener.js","../src/eventStream/CollectorListener.js","../src/eventStream/NaturalizedListener.js","../src/eventStream/fromDicomWebJson.js","../src/eventStream/fromDataSet.js","../src/eventStream/asyncIterator.js","../src/eventStream/emit.js","../src/core/decodeCore.js","../src/eventStream/fromPart10Stream.js","../src/eventStream/fromPart10.js"],"sourcesContent":["/**\n * EventStreamListener — the push-core of the dcmjs event-stream contract.\n *\n * This is the canonical, low-allocation listener interface that every reader,\n * writer, filter, validator, and anonymizer speaks (see CLAUDE_REFACTOR_PLAN.md,\n * slice A). It formalizes the implicit `next`-middleware model that previously\n * lived in DicomMetadataListener, with the richer, explicit vocabulary the\n * Naturalized DICOM Metadata Behavior Specification calls for (§15.1).\n *\n * The vocabulary:\n *\n * Lifecycle: startDataSet / endDataSet\n * startFileMetaInformation / endFileMetaInformation\n * Structural: startElement / endElement\n * startSequence / endSequence\n * startItem / endItem\n * value(v, { index, rawValue? })\n * Binary: bulkDataReference\n * startBinary / binaryFragment / endBinary\n *\n * The `value` event's options bag is optional and extensible; `rawValue` carries\n * the source string (when available) for precision-preserving retention\n * (§16/§27). Consumers that don't need it ignore it.\n *\n * Structural and value callbacks are synchronous (allocation-free hot path,\n * §15.4 / §24.1). Backpressure is applied out of band via setDrain/awaitDrain,\n * which generators await only at defined checkpoints (top-level element\n * boundaries and binary-fragment emission).\n *\n * Filters are first-class: each filter is an object that may implement any\n * vocabulary method as `method(next, ...args)`; calling `next(...)` invokes the\n * rest of the chain, ending in the listener's `_base<Method>` implementation.\n */\n\nexport const EVENT_STREAM_VOCABULARY = [\n \"startDataSet\",\n \"endDataSet\",\n \"startFileMetaInformation\",\n \"endFileMetaInformation\",\n \"startElement\",\n \"endElement\",\n \"startSequence\",\n \"endSequence\",\n \"startItem\",\n \"endItem\",\n \"value\",\n \"bulkDataReference\",\n \"startBinary\",\n \"binaryFragment\",\n \"endBinary\"\n];\n\n/** Contract version — generators and listeners can declare conformance. */\nexport const CONTRACT_VERSION = \"1.0.0-A\";\n\n/**\n * Merge raw encapsulated-pixel-data fragments into one buffer per Basic\n * Offset Table window (issue #204 — eager-reader shape parity for\n * BOT-aware listeners). The event stream itself stays raw (one\n * binaryFragment per on-wire fragment); listeners that rebuild a dataset\n * call this at endBinary time when startBinary carried a non-empty\n * `basicOffsetTable`.\n *\n * Fragment offsets are reconstructed from the fragment lengths: fragment\n * i's item header starts at Σ_{j<i} (8 + length_j), matching the BOT's\n * item-header-relative offset convention. Grouping and merge semantics\n * mirror BinaryRepresentation.readBytes: a single-fragment window stays\n * that fragment's buffer; a multi-fragment window merges into one\n * ArrayBuffer.\n *\n * @param {Array<ArrayBuffer|TypedArray>} fragments raw fragment buffers\n * @param {number[]} basicOffsetTable BOT offsets (item-header relative)\n * @returns {Array<ArrayBuffer|TypedArray>} one entry per BOT window\n */\nexport function mergeFragmentsPerBotWindow(fragments, basicOffsetTable) {\n if (!basicOffsetTable || basicOffsetTable.length === 0) {\n return fragments;\n }\n const toBytes = f =>\n f instanceof ArrayBuffer\n ? new Uint8Array(f)\n : new Uint8Array(f.buffer, f.byteOffset, f.byteLength);\n let offset = 0;\n const placed = fragments.map(fragment => {\n const length = fragment.byteLength;\n const entry = { fragment, offset, length };\n offset += 8 + length;\n return entry;\n });\n const frames = [];\n for (let i = 0; i < basicOffsetTable.length; i++) {\n const start = basicOffsetTable[i];\n const stop =\n i + 1 < basicOffsetTable.length\n ? basicOffsetTable[i + 1]\n : Number.POSITIVE_INFINITY;\n const windowFragments = placed.filter(\n f => f.offset >= start && f.offset < stop\n );\n if (windowFragments.length === 1) {\n frames.push(windowFragments[0].fragment);\n continue;\n }\n const frameSize = windowFragments.reduce((n, f) => n + f.length, 0);\n const merged = new Uint8Array(frameSize);\n let position = 0;\n for (const f of windowFragments) {\n merged.set(toBytes(f.fragment), position);\n position += f.length;\n }\n frames.push(merged.buffer);\n }\n return frames;\n}\n\nexport class EventStreamListener {\n /**\n * @param {...Object} filters - Filter objects. Each may implement any\n * vocabulary method as `method(next, ...args)`.\n */\n constructor(...filters) {\n this.filters = filters.filter(Boolean);\n this._drain = null;\n this._createMethodChains();\n }\n\n /**\n * Builds, for every vocabulary method, a chain that threads each filter's\n * implementation in front of the base implementation via `next`.\n * @private\n */\n _createMethodChains() {\n for (const methodName of EVENT_STREAM_VOCABULARY) {\n const baseName = `_base${methodName[0].toUpperCase()}${methodName.slice(\n 1\n )}`;\n let chain = this[baseName].bind(this);\n\n for (let i = this.filters.length - 1; i >= 0; i--) {\n const filter = this.filters[i];\n const filterFn = filter && filter[methodName];\n if (typeof filterFn === \"function\") {\n const next = chain;\n chain = (...args) => filterFn.call(this, next, ...args);\n }\n }\n\n this[methodName] = chain;\n }\n }\n\n // --- Backpressure -------------------------------------------------------\n\n /**\n * Install a backpressure gate. The function should return a Promise that\n * resolves when it is safe to emit more data. Pass null to clear.\n * @param {(() => Promise<void>) | null} fn\n */\n setDrain(fn) {\n this._drain = typeof fn === \"function\" ? fn : null;\n }\n\n /**\n * Await the backpressure gate (resolves immediately when none is set).\n * Generators call this only at defined checkpoints.\n * @returns {Promise<void>}\n */\n awaitDrain() {\n return this._drain ? this._drain() : Promise.resolve();\n }\n\n // --- Base (no-op) vocabulary implementations ----------------------------\n // Consumers override these (or subclass) to do real work. They are no-ops\n // here so the base listener is a valid, inert sink.\n\n _baseStartDataSet() {}\n _baseEndDataSet() {}\n _baseStartFileMetaInformation() {}\n _baseEndFileMetaInformation() {}\n _baseStartElement() {}\n _baseEndElement() {}\n _baseStartSequence() {}\n _baseEndSequence() {}\n _baseStartItem() {}\n _baseEndItem() {}\n _baseValue() {}\n _baseBulkDataReference() {}\n _baseStartBinary() {}\n _baseBinaryFragment() {}\n _baseEndBinary() {}\n}\n","import {\n EventStreamListener,\n mergeFragmentsPerBotWindow\n} from \"./EventStreamListener.js\";\n\n/**\n * CollectorListener — a reference event-stream consumer that rebuilds a\n * tag-keyed `{ meta, dict }` tree from the contract events.\n *\n * Its purpose is to validate the contract: a generator's event stream, fed\n * through this listener, should reconstruct a tree equivalent to the existing\n * dcmjs parse. It is intentionally NOT the naturalized listener (slice D) — it\n * preserves the raw tag-keyed `{ vr, Value }` shape so it can be deep-compared\n * against `DicomMessage.readFile` output.\n *\n * Value shapes match the existing parse:\n * - scalar/multi-value element → { vr, Value: [...] }\n * - sequence → { vr, Value: [ {itemDict}, ... ] }\n * - binary → { vr, Value: [ArrayBuffer, ...] } (one entry\n * per fragment; boundaries preserved, §33 —\n * except encapsulated pixel data whose\n * startBinary carries a non-empty\n * basicOffsetTable: those fragments are\n * merged per BOT window at endBinary, so the\n * final Value shape matches the eager\n * reader's one-entry-per-frame contract,\n * issue #204)\n * - bulk data reference → { vr, Value: [ { BulkDataURI } ] }\n */\nexport class CollectorListener extends EventStreamListener {\n constructor(...filters) {\n super(...filters);\n this.result = { meta: {}, dict: {} };\n this._stack = [];\n this._current = null;\n }\n\n /** Top container: an object (dataset/item) or array (sequence Value). */\n _top() {\n return this._stack[this._stack.length - 1];\n }\n\n _baseStartDataSet() {\n this.result = { meta: {}, dict: {} };\n this._stack = [this.result.dict];\n this._current = null;\n }\n\n _baseEndDataSet() {\n this._current = null;\n }\n\n _baseStartFileMetaInformation() {\n this._stack.push(this.result.meta);\n }\n\n _baseEndFileMetaInformation() {\n this._stack.pop();\n }\n\n _baseStartElement(tag, info = {}) {\n const el = { vr: info.vr, Value: [] };\n this._top()[tag] = el;\n this._current = el;\n }\n\n _baseEndElement() {\n this._current = null;\n }\n\n _baseValue(v) {\n this._current.Value.push(v);\n }\n\n _baseStartSequence(tag, info = {}) {\n const seq = { vr: info.vr, Value: [] };\n this._top()[tag] = seq;\n this._stack.push(seq.Value);\n this._current = null;\n }\n\n _baseEndSequence() {\n this._stack.pop();\n }\n\n _baseStartItem() {\n const item = {};\n this._top().push(item);\n this._stack.push(item);\n this._current = null;\n }\n\n _baseEndItem() {\n this._stack.pop();\n }\n\n _baseBulkDataReference(ref = {}) {\n this._current.Value.push({ BulkDataURI: ref.uri });\n }\n\n _baseStartBinary(info = {}) {\n // The current element accumulates fragments as Value entries. A\n // non-empty basicOffsetTable is kept so endBinary can merge the\n // fragments per BOT window (eager-reader shape parity, issue #204).\n this._binaryInfo = info;\n }\n\n _baseBinaryFragment(chunk) {\n this._current.Value.push(chunk);\n }\n\n _baseEndBinary() {\n const bot = this._binaryInfo && this._binaryInfo.basicOffsetTable;\n this._binaryInfo = null;\n if (bot && bot.length && this._current) {\n this._current.Value = mergeFragmentsPerBotWindow(\n this._current.Value,\n bot\n );\n }\n }\n}\n","import {\n EventStreamListener,\n mergeFragmentsPerBotWindow\n} from \"./EventStreamListener.js\";\nimport {\n lookupTagHex,\n lookupPrivateTag,\n addAccessors,\n isMultiVM,\n dicomJson,\n log\n} from \"@dcmjs-org/core\";\n\n/**\n * NaturalizedListener — slice D1: the core naturalized value model.\n *\n * An event-stream consumer that builds the application-facing naturalized\n * object per the Naturalized DICOM Metadata Behavior Specification: canonical\n * keyword keys (§5) and VM-driven cardinality (§7-§14). Because it consumes the\n * source-agnostic contract, the SAME naturalized object is produced from Part 10\n * bytes, a dcmjs dict, or DICOMweb JSON.\n *\n * Scope (D1): keyword naming, VM cardinality, single-item sequences with hidden\n * length (§12, via core addAccessors, no Proxy), empty→null/[], binary\n * assembly (InlineBinary/BulkDataURI), and the cardinality-violation policy\n * (§15.2, default warnAndPreserve). Deferred to D2: the PN proxy/toString sugar\n * (§17), private-tag grouping (§18), and precision/raw retention (§16/§27, which\n * needs the contract to carry raw values).\n *\n * Sequence note: a DICOM sequence's declared VM (\"1\") constrains how many times\n * the attribute appears, NOT its item count — multi-item sequences (e.g.\n * PerFrameFunctionalGroupsSequence) are normal, not violations. Violations apply\n * to non-sequence scalar VRs whose value count exceeds the declared VM.\n */\nexport class NaturalizedListener extends EventStreamListener {\n /**\n * @param {Object} [options]\n * @param {string} [options.cardinalityViolationPolicy=\"warnAndPreserve\"]\n * One of preserve | discardExtra | warnAndPreserve | warnAndDiscardExtra |\n * recordAndPreserve | recordAndDiscardExtra | throw.\n */\n constructor(options = {}, ...filters) {\n super(...filters);\n this.policy = options.cardinalityViolationPolicy || \"warnAndPreserve\";\n this.result = {};\n this.meta = {};\n this.violations = [];\n // Frame stack. Each frame is one of:\n // { kind: \"object\", obj } dataset or sequence item\n // { kind: \"element\", tag, vr, values, binary }\n // { kind: \"sequence\", tag, vr, items }\n this._stack = [];\n }\n\n _objectFrame() {\n for (let i = this._stack.length - 1; i >= 0; i--) {\n if (this._stack[i].kind === \"object\") {\n return this._stack[i];\n }\n }\n return null;\n }\n\n _baseStartDataSet() {\n this.result = {};\n this.meta = {};\n this.violations = [];\n this._stack = [{ kind: \"object\", obj: this.result }];\n }\n\n _baseEndDataSet() {}\n\n _baseStartFileMetaInformation() {\n this._stack.push({ kind: \"object\", obj: this.meta });\n }\n\n _baseEndFileMetaInformation() {\n this._stack.pop();\n }\n\n _baseStartElement(tag, info = {}) {\n this._stack.push({\n kind: \"element\",\n tag,\n vr: info.vr,\n values: [],\n rawValues: [],\n binary: undefined\n });\n }\n\n _baseValue(v, opts = {}) {\n const frame = this._stack[this._stack.length - 1];\n frame.values.push(v);\n frame.rawValues.push(opts.rawValue);\n }\n\n _baseBulkDataReference(ref = {}) {\n this._stack[this._stack.length - 1].binary = { BulkDataURI: ref.uri };\n }\n\n _baseStartBinary(info = {}) {\n const frame = this._stack[this._stack.length - 1];\n frame._fragments = [];\n // A non-empty basicOffsetTable is kept so endBinary can merge the\n // raw fragments per BOT window (eager-reader frame shape parity,\n // issue #204).\n frame._binaryInfo = info;\n }\n\n _baseBinaryFragment(chunk) {\n this._stack[this._stack.length - 1]._fragments.push(chunk);\n }\n\n _baseEndBinary() {\n const frame = this._stack[this._stack.length - 1];\n let fragments = frame._fragments || [];\n const bot = frame._binaryInfo && frame._binaryInfo.basicOffsetTable;\n if (bot && bot.length) {\n fragments = mergeFragmentsPerBotWindow(fragments, bot);\n }\n frame.binary = {\n InlineBinary: fragments.length === 1 ? fragments[0] : fragments\n };\n frame._fragments = undefined;\n frame._binaryInfo = undefined;\n }\n\n _baseEndElement() {\n const frame = this._stack.pop();\n const targetFrame = this._objectFrame();\n\n // §16 precision: where a canonical JS number would lose precision and a\n // raw source string is available, retain the raw string.\n if (frame.binary === undefined && frame.rawValues) {\n for (let i = 0; i < frame.values.length; i++) {\n frame.values[i] = retainPrecision(\n frame.vr,\n frame.values[i],\n frame.rawValues[i]\n );\n }\n }\n\n if (isPrivateTag(frame.tag)) {\n this._placePrivate(targetFrame, frame);\n return;\n }\n\n const entry = lookupTagHex(frame.tag);\n const key = (entry && entry.name) || frame.tag;\n if (frame.binary !== undefined) {\n targetFrame.obj[key] = frame.binary;\n return;\n }\n let shaped = this._shapeValues(frame, entry, key);\n if (frame.vr === \"PN\" && shaped !== null) {\n shaped = addPersonNameAccessors(shaped);\n }\n targetFrame.obj[key] = shaped;\n }\n\n _baseStartSequence(tag, info = {}) {\n this._stack.push({ kind: \"sequence\", tag, vr: info.vr, items: [] });\n }\n\n _baseStartItem() {\n this._stack.push({ kind: \"object\", obj: {} });\n }\n\n _baseEndItem() {\n const itemFrame = this._stack.pop();\n // The enclosing frame is the sequence.\n this._stack[this._stack.length - 1].items.push(itemFrame.obj);\n }\n\n _baseEndSequence() {\n const frame = this._stack.pop();\n const targetFrame = this._objectFrame();\n const shaped = this._shapeSequence(frame, lookupTagHex(frame.tag));\n\n if (isPrivateTag(frame.tag)) {\n this._placePrivateValue(targetFrame, frame.tag, frame.vr, shaped);\n return;\n }\n const entry = lookupTagHex(frame.tag);\n const key = (entry && entry.name) || frame.tag;\n targetFrame.obj[key] = shaped;\n }\n\n // --- private-tag grouping (§18) -----------------------------------------\n\n _placePrivate(targetFrame, frame) {\n const elem = parseInt(frame.tag.slice(4, 8), 16);\n // Private creator (gggg,00xx): record it for the block; do NOT emit it\n // as an ordinary attribute (§18.5).\n if (elem <= 0x00ff) {\n const v =\n frame.values && frame.values.length ? frame.values[0] : null;\n if (v != null) {\n targetFrame.creators = targetFrame.creators || {};\n targetFrame.creators[elem] = String(v);\n }\n return;\n }\n const value =\n frame.binary !== undefined\n ? frame.binary\n : privateShape(frame.values);\n this._placePrivateValue(targetFrame, frame.tag, frame.vr, value);\n }\n\n _placePrivateValue(targetFrame, tag, vr, value) {\n const elem = parseInt(tag.slice(4, 8), 16);\n const slot = elem >> 8; // creator slot (high byte of the element)\n const offset = elem & 0xff; // block-relative element (low byte)\n const creator = targetFrame.creators && targetFrame.creators[slot];\n\n if (creator) {\n const groupKey = `${hex2(slot)}:${creator}`;\n let group = targetFrame.obj[groupKey];\n if (!group) {\n group = { originalTagOffset: slot };\n targetFrame.obj[groupKey] = group;\n }\n group[privateKeyFor(tag, creator, offset, group)] = value;\n return;\n }\n // §18.4: no identifiable creator -> full tag key, unknown attribute shape.\n targetFrame.obj[tag] = {\n vr,\n Value: Array.isArray(value) ? value : value == null ? [] : [value]\n };\n }\n\n // --- cardinality shaping ------------------------------------------------\n\n _shapeValues(frame, entry, key) {\n const values = frame.values;\n const multi = isMultiVM(entry && entry.vm);\n\n if (multi) {\n // §10/§11: always list-like; present-empty -> [].\n return values;\n }\n // Scalar VM (1 or 0-1).\n if (values.length === 0) {\n return null; // §7/§9 present-empty\n }\n if (values.length === 1) {\n return values[0];\n }\n // §8: scalar VM with 2+ actual values -> cardinality violation.\n return this._applyViolation(key, values, 1);\n }\n\n _shapeSequence(frame, entry) {\n const items = frame.items;\n const declaredMulti = isMultiVM(entry && entry.vm);\n\n if (items.length === 0) {\n return []; // §12 present-empty\n }\n if (items.length === 1 && !declaredMulti) {\n // §12: the item object itself, with a hidden [0] and length 1\n return addAccessors(items);\n }\n // §13: multiple items -> list-like. Not a violation (declared SQ VM\n // constrains attribute occurrence, not item count).\n return items;\n }\n\n _applyViolation(keyword, values, declaredMax) {\n const violation = {\n keyword,\n declaredMax,\n actual: values.length\n };\n const discard = /DiscardExtra$/.test(this.policy);\n const kept = discard ? values.slice(0, declaredMax) : values.slice();\n\n if (this.policy === \"throw\") {\n throw new Error(\n `Cardinality violation: ${keyword} has ${values.length} values, declared VM ${declaredMax}`\n );\n }\n if (/^warn/.test(this.policy)) {\n log.warn(\n `Cardinality violation: ${keyword} has ${values.length} values (declared VM ${declaredMax})`\n );\n }\n this.violations.push(violation);\n\n // discardExtra of a now-scalar VM collapses to the single kept value.\n if (discard && declaredMax === 1) {\n return kept[0];\n }\n return kept;\n }\n}\n\n/**\n * A private tag has an odd group number and an element at or above 0x0010 (the\n * first usable private creator slot). Group-length (0x0000) and reserved low\n * elements fall through to standard handling.\n */\nfunction isPrivateTag(tag) {\n const group = parseInt(tag.slice(0, 4), 16);\n const elem = parseInt(tag.slice(4, 8), 16);\n return (group & 1) === 1 && elem >= 0x0010;\n}\n\n/** Two-hex-digit uppercase, e.g. 0x10 -> \"10\". */\nfunction hex2(n) {\n return n.toString(16).toUpperCase().padStart(2, \"0\");\n}\n\n/**\n * Block-relative key for a private data element (§18.2): the registered private\n * name when the (creator, offset) is known in the private dictionary and the\n * name is meaningful and non-colliding; otherwise the numeric block-relative\n * offset. Registered names stay scoped to the creator group.\n */\nfunction privateKeyFor(tag, creator, offset, group) {\n const numeric = hex2(offset);\n const reg = lookupPrivateTag(\n `(${tag.slice(0, 4)},\"${creator}\",${numeric})`\n );\n if (reg && reg.name && reg.name !== \"Unknown\" && !(reg.name in group)) {\n return reg.name;\n }\n return numeric;\n}\n\n/**\n * §16 precision retention (raw-retention default \"inexact only\", §27). A numeric\n * VR value (IS/DS) decoded to a JS number has lost precision when the number's\n * shortest decimal cannot reproduce the source string (an over-length decimal,\n * or an integer beyond the safe range). In that case retain the original string.\n * This is VR-agnostic: it fires only when a number and its source string\n * disagree, so normal values keep their number.\n */\nfunction retainPrecision(vr, value, raw) {\n if (typeof value !== \"number\" || typeof raw !== \"string\") {\n return value;\n }\n const source = raw.trim();\n if (source === \"\" || !Number.isFinite(value)) {\n return value;\n }\n if (canonicalDecimal(source) === canonicalDecimal(value.toString())) {\n return value; // recoverable from the number -> no loss\n }\n return source;\n}\n\n/**\n * Canonical decimal form for comparing whether two decimal strings denote the\n * same number, ignoring formatting (sign, leading/trailing zeros). Exponent\n * notation is left intact, so a number serialized in exponent form that differs\n * from a fixed-notation source compares unequal (conservatively retained).\n */\nfunction canonicalDecimal(s) {\n let str = s.trim().replace(/^\\+/, \"\");\n if (/[eE]/.test(str)) {\n return str;\n }\n let neg = false;\n if (str.startsWith(\"-\")) {\n neg = true;\n str = str.slice(1);\n }\n let [int = \"\", frac = \"\"] = str.split(\".\");\n int = int.replace(/^0+(?=\\d)/, \"\");\n frac = frac.replace(/0+$/, \"\");\n if (int === \"\") {\n int = \"0\";\n }\n const body = frac ? `${int}.${frac}` : int;\n return neg && body !== \"0\" ? `-${body}` : body;\n}\n\n/** Shape a private data value with no VM info: scalar if one value, else array. */\nfunction privateShape(values) {\n if (values.length === 0) {\n return null;\n }\n return values.length === 1 ? values[0] : values.slice();\n}\n\n/**\n * Add Person Name accessors (§17): a non-enumerable toString() returning the raw\n * PN string and toJSON() keeping the DICOM JSON model. Component access\n * (`.Alphabetic`) works directly because the value IS the {Alphabetic,...}\n * object (VM 1) or an array of them (VM n). Reuses dcmjs's shared helper.\n */\nfunction addPersonNameAccessors(shaped) {\n if (typeof shaped === \"string\") {\n shaped = new String(shaped);\n }\n if (shaped && typeof shaped === \"object\") {\n return dicomJson.pnAddValueAccessors(shaped);\n }\n return shaped;\n}\n","/**\n * fromDicomWebJson — slice C: a DICOMweb JSON (DICOM JSON model) ->\n * event-stream generator.\n *\n * Walks a parsed DICOMweb JSON object and emits the event-stream contract,\n * proving the source-agnostic claim (§4.4): the same contract a Part 10 reader\n * produces is produced here from a third source. Implemented as a low-allocation\n * visitor that calls listener callbacks directly, without building intermediate\n * event objects (§24.1).\n *\n * Values are emitted AS-IS — Person Names stay as DICOMweb `{ Alphabetic }`\n * objects, numbers stay numbers. Cross-source value canonicalization (PN proxy,\n * IS/DS normalization, §17/§28) belongs to the naturalized listener (slice D).\n * The two binary forms are handled per spec:\n * - `BulkDataURI` -> bulkDataReference (nothing fetched, §21)\n * - `InlineBinary` -> base64 decoded to a buffer fragment (§22)\n *\n * @param {Object} json - DICOM JSON model: { \"ggggeeee\": { vr, Value | BulkDataURI | InlineBinary }, ... }\n * @param {import(\"./EventStreamListener\").EventStreamListener} listener\n */\nexport async function fromDicomWebJson(json, listener) {\n const tags = Object.keys(json);\n const metaTags = tags.filter(isMetaTag);\n const bodyTags = tags.filter(t => !isMetaTag(t));\n\n listener.startDataSet({ transferSyntaxUID: transferSyntaxOf(json) });\n\n if (metaTags.length) {\n listener.startFileMetaInformation();\n for (const tag of metaTags) {\n emitAttribute(listener, tag, json[tag]);\n }\n listener.endFileMetaInformation();\n }\n\n for (const tag of bodyTags) {\n emitAttribute(listener, tag, json[tag]);\n // Top-level element boundary: a defined backpressure checkpoint.\n await listener.awaitDrain();\n }\n\n listener.endDataSet();\n}\n\nfunction emitAttribute(listener, tag, attr) {\n if (!attr) {\n return;\n }\n const vr = attr.vr;\n\n if (vr === \"SQ\") {\n listener.startSequence(tag, { vr });\n for (const item of attr.Value || []) {\n listener.startItem({});\n for (const childTag of Object.keys(item)) {\n emitAttribute(listener, childTag, item[childTag]);\n }\n listener.endItem();\n }\n listener.endSequence();\n return;\n }\n\n if (attr.BulkDataURI !== undefined) {\n listener.startElement(tag, { vr });\n listener.bulkDataReference({ uri: attr.BulkDataURI });\n listener.endElement();\n return;\n }\n\n if (attr.InlineBinary !== undefined) {\n listener.startElement(tag, { vr });\n listener.startBinary({ encapsulated: false });\n listener.binaryFragment(base64ToArrayBuffer(attr.InlineBinary));\n listener.endBinary();\n listener.endElement();\n return;\n }\n\n listener.startElement(tag, { vr });\n let index = 0;\n for (const v of attr.Value || []) {\n listener.value(v, { index: index++ });\n }\n listener.endElement();\n}\n\nfunction transferSyntaxOf(json) {\n const ts = json[\"00020010\"];\n return ts && ts.Value ? ts.Value[0] : undefined;\n}\n\nfunction isMetaTag(tag) {\n return tag.slice(0, 4) === \"0002\";\n}\n\n/** Decode a base64 string into an ArrayBuffer (Node and browser). */\nexport function base64ToArrayBuffer(b64) {\n if (typeof Buffer !== \"undefined\") {\n const buf = Buffer.from(b64, \"base64\");\n return buf.buffer.slice(\n buf.byteOffset,\n buf.byteOffset + buf.byteLength\n );\n }\n const binary = atob(b64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes.buffer;\n}\n","/**\n * fromDataSet — the reference event-stream generator for slice A.\n *\n * Walks a parsed dcmjs dataset (a `{ meta, dict }` shape — e.g. the DicomDict\n * returned by `DicomMessage.readFile`, produced by the lazy core over\n * `@dcmjs-org/parser`) and pushes the event-stream contract to a listener. It\n * reuses the lazy core's already-decoded values rather than re-decoding raw\n * offsets, which keeps slice A decoupled from the Part 10 byte parser (that\n * production \"bytes -> events\" generator is slice B). This generator exercises\n * the spec §32 \"tag / naturalized source -> event stream\" path and proves the\n * vocabulary can carry a real dataset losslessly.\n *\n * Async by design: structural/value callbacks are synchronous, but the\n * generator awaits `listener.awaitDrain()` at the defined backpressure\n * checkpoints — top-level element boundaries and between binary fragments.\n *\n * @param {{ meta?: Object, dict?: Object }} dataset\n * @param {import(\"./EventStreamListener\").EventStreamListener} listener\n */\nimport { base64ToArrayBuffer } from \"./fromDicomWebJson.js\";\n\nexport async function fromDataSet(dataset, listener) {\n const meta = dataset.meta || null;\n const dict = dataset.dict || dataset;\n\n listener.startDataSet({\n transferSyntaxUID: transferSyntaxOf(meta)\n });\n\n if (meta && Object.keys(meta).length) {\n listener.startFileMetaInformation();\n for (const tag of Object.keys(meta)) {\n emitEntry(listener, tag, meta[tag]);\n }\n listener.endFileMetaInformation();\n }\n\n for (const tag of Object.keys(dict)) {\n emitEntry(listener, tag, dict[tag]);\n // Top-level element boundary: a defined backpressure checkpoint.\n await listener.awaitDrain();\n }\n\n listener.endDataSet();\n}\n\nfunction transferSyntaxOf(meta) {\n const ts = meta && meta[\"00020010\"];\n return ts && ts.Value ? ts.Value[0] : undefined;\n}\n\n/** Emit one tag entry (element, sequence, or binary) and its children.\n * Exported for fromPart10's §6.2.2 UN-sequence emission (issue #363). */\nexport function emitEntry(listener, tag, entry) {\n if (!entry) {\n return;\n }\n const values = entry.Value || [];\n\n if (entry.vr === \"SQ\") {\n listener.startSequence(tag, { vr: entry.vr, length: entry.length });\n for (const item of values) {\n listener.startItem({ length: item && item._length });\n for (const childTag of Object.keys(item)) {\n emitEntry(listener, childTag, item[childTag]);\n }\n listener.endItem();\n }\n listener.endSequence();\n return;\n }\n\n if (entry.InlineBinary !== undefined || values.some(isInlineBinary)) {\n emitInlineBinary(listener, tag, entry, values);\n return;\n }\n\n if (isBinary(values)) {\n listener.startElement(tag, { vr: entry.vr, length: entry.length });\n listener.startBinary({ encapsulated: !!entry.encapsulatedPixelData });\n for (const fragment of values) {\n listener.binaryFragment(fragment);\n }\n listener.endBinary();\n listener.endElement();\n return;\n }\n\n listener.startElement(tag, { vr: entry.vr, length: entry.length });\n // _rawValue (when present on lazy/eager dict entries) carries the source\n // string for precision-preserving retention (§16/§27).\n const rawValues = entry._rawValue;\n let index = 0;\n for (const v of values) {\n if (isBulkDataReference(v)) {\n listener.bulkDataReference({ uri: v.BulkDataURI });\n } else {\n listener.value(v, {\n index,\n rawValue: Array.isArray(rawValues)\n ? rawValues[index]\n : undefined\n });\n }\n index++;\n }\n listener.endElement();\n}\n\n/**\n * Emit an entry that holds {InlineBinary} wrappers as binary events.\n *\n * {InlineBinary} wrappers are the naturalized binary form produced by both\n * NaturalizedListener and DicomMetaDictionary.naturalizeDataset (§22). They\n * are unwrapped to binary events exactly as fromDicomWebJson does; without\n * this the wrapper object reaches BinaryRepresentation.writeBytes and throws\n * (the UN naturalize→write round-trip crash). The wrapper may sit on the\n * entry itself (no Value array) or inside Value; its content may be an\n * ArrayBuffer, a typed-array view, a base64 string, or an array of fragments\n * in any of those forms.\n */\nfunction emitInlineBinary(listener, tag, entry, values) {\n const wrappers = entry.InlineBinary !== undefined ? [entry] : values;\n listener.startElement(tag, { vr: entry.vr, length: entry.length });\n listener.startBinary({ encapsulated: !!entry.encapsulatedPixelData });\n for (const w of wrappers) {\n const inline = isInlineBinary(w) ? w.InlineBinary : w;\n for (const fragment of Array.isArray(inline) ? inline : [inline]) {\n listener.binaryFragment(toBinaryFragment(fragment));\n }\n }\n listener.endBinary();\n listener.endElement();\n}\n\nfunction isBinary(values) {\n return values.some(v => v instanceof ArrayBuffer || ArrayBuffer.isView(v));\n}\n\n/** True for a naturalized binary wrapper: { InlineBinary: <content> }. */\nfunction isInlineBinary(v) {\n return (\n v &&\n typeof v === \"object\" &&\n v.InlineBinary !== undefined &&\n !(v instanceof ArrayBuffer) &&\n !ArrayBuffer.isView(v)\n );\n}\n\n/** Coerce one InlineBinary fragment (buffer, view, or base64) to bytes. */\nfunction toBinaryFragment(fragment) {\n if (typeof fragment === \"string\") {\n return base64ToArrayBuffer(fragment);\n }\n return fragment;\n}\n\nfunction isBulkDataReference(v) {\n return (\n v &&\n typeof v === \"object\" &&\n typeof v.BulkDataURI === \"string\" &&\n !(v instanceof ArrayBuffer) &&\n !ArrayBuffer.isView(v)\n );\n}\n","import {\n EventStreamListener,\n EVENT_STREAM_VOCABULARY\n} from \"./EventStreamListener.js\";\n\n/**\n * createEventAsyncIterable — the pull adapter of the hybrid contract.\n *\n * The push/callback listener is canonical; this wraps a generator run as an\n * async-iterable so ergonomic consumers can `for await (const ev of ...)`.\n * Each yielded event is `{ type, args }` where `type` is a vocabulary method\n * name and `args` is the argument array.\n *\n * Backpressure is real: the bridge installs a drain gate on the listener, so a\n * slow consumer suspends the generator at its checkpoints once the internal\n * queue exceeds `highWaterMark`. Events are freshly allocated (not pooled) so\n * consumers may retain them safely.\n *\n * @param {(listener: EventStreamListener) => Promise<void>} run - drives the listener\n * @param {{ highWaterMark?: number }} [options]\n * @returns {AsyncIterable<{type: string, args: any[]}>}\n */\nexport function createEventAsyncIterable(run, { highWaterMark = 64 } = {}) {\n return {\n [Symbol.asyncIterator]() {\n const queue = [];\n let finished = false;\n let cancelled = false;\n let failure = null;\n let onItem = null; // resolve a waiting consumer\n let onSpace = null; // {resolve, reject} of a suspended producer\n\n const cancellation = () => {\n const err = new Error(\"event iteration cancelled\");\n err.name = \"EventIterationCancelled\";\n return err;\n };\n const wakeConsumer = () => {\n if (onItem) {\n const r = onItem;\n onItem = null;\n r();\n }\n };\n const wakeProducer = () => {\n if (onSpace && queue.length < highWaterMark) {\n const r = onSpace;\n onSpace = null;\n r.resolve();\n }\n };\n\n // A capture filter enqueues one event per vocabulary call.\n const captureFilter = {};\n for (const name of EVENT_STREAM_VOCABULARY) {\n captureFilter[name] = function (next, ...args) {\n queue.push({ type: name, args });\n wakeConsumer();\n return next(...args);\n };\n }\n\n const listener = new EventStreamListener(captureFilter);\n listener.setDrain(() => {\n if (cancelled) {\n return Promise.reject(cancellation());\n }\n return queue.length < highWaterMark\n ? Promise.resolve()\n : new Promise((resolve, reject) => {\n onSpace = { resolve, reject };\n });\n });\n\n Promise.resolve()\n .then(() => run(listener))\n .then(\n () => {\n finished = true;\n wakeConsumer();\n },\n err => {\n // A rejection we caused by cancelling is a clean end,\n // not a stream failure.\n if (\n !cancelled ||\n err?.name !== \"EventIterationCancelled\"\n ) {\n failure = err || new Error(\"event stream failed\");\n }\n finished = true;\n wakeConsumer();\n }\n );\n\n return {\n async next() {\n while (queue.length === 0 && !finished) {\n await new Promise(resolve => {\n onItem = resolve;\n });\n }\n if (queue.length > 0) {\n const value = queue.shift();\n wakeProducer();\n return { value, done: false };\n }\n if (failure) {\n throw failure;\n }\n return { value: undefined, done: true };\n },\n // Called by `break`/`return` out of a for-await loop. Without\n // it a producer suspended in awaitDrain waits forever on a\n // consumer that is gone.\n async return(value) {\n cancelled = true;\n queue.length = 0;\n if (onSpace) {\n const r = onSpace;\n onSpace = null;\n r.reject(cancellation());\n }\n return { value, done: true };\n }\n };\n }\n };\n}\n","import { emitEntry } from \"./fromDataSet.js\";\n\n/**\n * Shared emit helpers for byte-level event sources.\n *\n * These route a decoded element ({ values, rawValues }) to the correct\n * listener events. They lived in the tokenizer-backed fromPart10 module;\n * with the vendored tokenizer removed they are a standalone module the\n * streaming reader (and the thin fromPart10 wrapper) share.\n */\n\n/**\n * Emits a decoded leaf element. Sequence-shaped decodes yield item dicts —\n * those are emitted as sequence events (matching the eager dict shape);\n * everything else routes through emitValues.\n *\n * Two decodes are sequence-shaped: (a) UN with undefined length parsed as an\n * implicit-VR sequence (PS3.5 §6.2.2, issue #363), and (b) defined-length UN\n * whose dictionary VR is SQ (ParsedUnknownValue re-parses the value as a\n * sequence — corpus shape \"EVRLE SQ as UN\"). Both decode to item dicts in\n * `values` and must be emitted as sequence events; emitting them through the\n * scalar value() path crashed on rawValues[index] (the corpus bare-TypeError\n * cluster).\n */\nexport function emitDecodedLeaf(\n listener,\n tag,\n vrInstance,\n el,\n values,\n rawValues\n) {\n // Sequence-shaped decodes (see JSDoc).\n if (\n (vrInstance.type === \"SQ\" ||\n (vrInstance.type === \"UN\" && el.hadUndefinedLength)) &&\n Array.isArray(values) &&\n values.every(isItemDictLike)\n ) {\n listener.startSequence(tag, { vr: \"SQ\", length: el.length });\n for (const itemDict of values) {\n listener.startItem({});\n for (const childTag of Object.keys(itemDict)) {\n emitEntry(listener, childTag, itemDict[childTag]);\n }\n listener.endItem();\n }\n listener.endSequence();\n return;\n }\n emitValues(listener, tag, vrInstance, el, values, rawValues);\n}\n\n/**\n * Route decoded {values, rawValues} to binary or scalar listener events.\n *\n * The decoded shapes are normalized first: some VR reads legitimately yield\n * a bare value or no rawValues array (classic stores these shapes untouched\n * in the dict; the event stream must not crash on them — corpus\n * bare-TypeError cluster).\n */\nexport function emitValues(listener, tag, vrInstance, el, values, rawValues) {\n // Normalize bare / missing values to a list (see JSDoc).\n const list = Array.isArray(values)\n ? values\n : values === undefined || values === null\n ? []\n : [values];\n if (list.some(isBufferLike)) {\n listener.startElement(tag, { vr: vrInstance.type, length: el.length });\n listener.startBinary({ encapsulated: false });\n for (const buf of list) {\n listener.binaryFragment(buf);\n }\n listener.endBinary();\n listener.endElement();\n return;\n }\n\n listener.startElement(tag, { vr: vrInstance.type, length: el.length });\n let index = 0;\n for (const v of list) {\n listener.value(v, {\n index,\n rawValue: Array.isArray(rawValues) ? rawValues[index] : undefined\n });\n index++;\n }\n listener.endElement();\n}\n\nfunction isItemDictLike(v) {\n return (\n v &&\n typeof v === \"object\" &&\n !(v instanceof ArrayBuffer) &&\n !ArrayBuffer.isView(v) &&\n Object.keys(v).every(k => /^[0-9A-Fx]{8,9}$/i.test(k))\n );\n}\n\nfunction isBufferLike(v) {\n return v instanceof ArrayBuffer || ArrayBuffer.isView(v);\n}\n","import {\n ReadBufferStream,\n UNDEFINED_LENGTH,\n VM_DELIMITER,\n resolveCharsetDecoder,\n log,\n singleVRs,\n DicomMetaDictionary,\n Tag,\n ValueRepresentation\n} from \"@dcmjs-org/core\";\n\n/**\n * Shared element-decode core extracted from src/lazy/LazyDicomReader.js.\n *\n * All functions operate on two read-only input shapes instead of the mutable\n * `ctx` used by the lazy reader:\n *\n * window = { arrayBuffer, baseOffset, syntax, littleEndian, implicit, decoder }\n * A fully-resolved byte region. Callers construct a *meta window*\n * (original buffer, EXPLICIT_LITTLE_ENDIAN, littleEndian=true,\n * implicit=false, decoder=null) or a *body window* (post-inflate\n * buffer, negotiated syntax/endianness/implicitness, active decoder).\n * There is no `isMeta` parameter anywhere in this module: callers\n * select the correct window.\n *\n * policy = { forceStoreRaw, noCopy, ignoreErrors }\n *\n * Every function body that reaches DicomMessage / Tag accesses them at call\n * time, never at module-evaluation time, to honour the circular-import\n * discipline of the wider codebase.\n */\n\n// ──────────────────────────────────────────────────────────────────────────────\n// Internal helpers (not exported)\n// ──────────────────────────────────────────────────────────────────────────────\n\n// ──────────────────────────────────────────────────────────────────────────────\n// Exported functions\n// ──────────────────────────────────────────────────────────────────────────────\n\n/**\n * Resolves the ValueRepresentation instance for a parser element,\n * replicating DicomMessage._readTag's VR resolution rules\n * (src/DicomMessage.js, explicit + implicit branches).\n *\n * THIS IS THE SINGLE CANONICAL IMPLICIT-VR CONTRACT (AD-1). Every read\n * path — eager, lazy, fromPart10, fromPart10Stream — resolves implicit\n * VRs here, with eager parity: a DEFINED-length dictionary-miss element\n * resolves to UN (or OW/LO by tag rules) and is NEVER data-peek-promoted\n * to SQ, regardless of its value bytes; an UNDEFINED-length dictionary\n * miss resolves to SQ by the length rule. The parser's el.items (its\n * framing peek) is metadata only and must not influence VR resolution.\n *\n * `window.implicit` is already resolved by the caller: a meta window\n * always carries implicit=false; a body window carries the negotiated value.\n * The lazy source computed `ctx.implicit && !isMeta`; here the caller\n * selects the window instead.\n *\n * Uses DicomMetaDictionary.lookupTag, ValueRepresentation.parseUnknownVr /\n * createByTypeString, Tag — all accessed inside the function body.\n */\nexport function resolveVrInstance(el, window) {\n const implicit = window.implicit;\n\n if (!implicit) {\n const vrType = el.vr;\n if (vrType === \"UN\") {\n const tag = new Tag(el.tagValue);\n const elementData = DicomMetaDictionary.lookupTag(tag);\n if (elementData && elementData.vr) {\n // UN with a known dictionary VR: eager re-parses the value\n // as the dictionary VR via ParsedUnknownValue.\n let dictVr = elementData.vr;\n if (dictVr === \"xs\") {\n dictVr = resolveXsVr(window);\n }\n return ValueRepresentation.parseUnknownVr(dictVr);\n }\n }\n return ValueRepresentation.createByTypeString(vrType);\n }\n\n // Implicit VR: dictionary lookup with _readTag's fallback rules.\n const tag = new Tag(el.tagValue);\n const elementData = DicomMetaDictionary.lookupTag(tag);\n let vrType;\n if (elementData) {\n vrType = elementData.vr;\n if (vrType === \"xs\") {\n vrType = resolveXsVr(window);\n }\n } else if (el.hadUndefinedLength) {\n // eager: length == UNDEFINED_LENGTH (the parser corrects element\n // .length for undefined-length elements, so use the flag)\n vrType = \"SQ\";\n } else if (tag.isPixelDataTag()) {\n vrType = \"OW\";\n } else if (tag.isPrivateCreator()) {\n vrType = \"LO\";\n } else {\n vrType = \"UN\";\n }\n return ValueRepresentation.createByTypeString(vrType);\n}\n\n/**\n * Resolves the dictionary meta-VR \"xs\" (\"US or SS\") by PixelRepresentation\n * (PS3.5): SS when (0028,0103) is 1, US otherwise — including when the\n * window carries no pixelRepresentation (parity with DicomMessage._readTag,\n * fixed in this arc for issue #368). Sources thread the parsed\n * (0028,0103) value onto their read window as `pixelRepresentation`;\n * (0028,0103) precedes every xs tag in tag order.\n */\nfunction resolveXsVr(window) {\n return window.pixelRepresentation === 1 ? \"SS\" : \"US\";\n}\n\n/**\n * True when resolveVrInstance produced a ParsedUnknownValue (UN element with\n * a known dictionary VR): those are per-call instances, while every plain VR\n * resolves to the shared VRinstances singleton.\n */\nexport function isParsedUnknownVr(vrInstance) {\n return (\n vrInstance !== ValueRepresentation.createByTypeString(vrInstance.type)\n );\n}\n\n/**\n * Verbatim replication of DicomMessage._readTag's value-shaping block\n * (src/DicomMessage.js:380-402): string VM splitting, the SQ and OW/OB\n * passthroughs and the array-or-push fallback (which yields\n * `_rawValue: [undefined]` for non-raw-storing VRs like UN/OF/OD - a quirk\n * the lazy core must reproduce).\n *\n * Uses the canonical singleVRs exported from @dcmjs-org/core (includes LT).\n * Arg order is (vr, rawValue, value) — same as the source.\n */\nexport function shapeReadValues(vr, rawValue, value) {\n let values = [];\n let rawValues = [];\n if (!vr.isBinary() && singleVRs.indexOf(vr.type) == -1) {\n rawValues = rawValue;\n values = value;\n if (typeof value === \"string\") {\n const delimiterChar = String.fromCharCode(VM_DELIMITER);\n rawValues = vr.dropPadByte(rawValue.split(delimiterChar));\n values = vr.dropPadByte(value.split(delimiterChar));\n }\n } else if (vr.type == \"SQ\") {\n rawValues = rawValue;\n values = value;\n } else if (vr.type == \"OW\" || vr.type == \"OB\") {\n rawValues = rawValue;\n values = value;\n } else {\n Array.isArray(value) ? (values = value) : values.push(value);\n Array.isArray(rawValue)\n ? (rawValues = rawValue)\n : rawValues.push(rawValue);\n }\n return { values, rawValues };\n}\n\n/**\n * Replicates ValueRepresentation.read's raw-value retention rule\n * (src/ValueRepresentation.js:213-215) for values produced outside vr.read.\n *\n * First arg is policy (not ctx), so callers pass { forceStoreRaw }.\n */\nexport function retainRaw(policy, vr, producedValue) {\n return vr.storeRaw() || policy.forceStoreRaw ? producedValue : undefined;\n}\n\n/**\n * Constructs a ReadBufferStream over the element's data bytes within the\n * given window, mirroring the stream construction in materializeElement\n * (src/lazy/LazyDicomReader.js:565-575).\n *\n * start = window.baseOffset + el.dataOffset\n * stop = start + el.length\n *\n * policy.noCopy controls whether getBuffer() returns a Uint8Array (true) or\n * an ArrayBuffer (false), exactly as the source does. When window.decoder is\n * non-null the stream's decoder is set before returning.\n * NOTE: callers using a meta window must pass policy.noCopy = false (the lazy\n * source always forced noCopy off for meta reads).\n */\nexport function buildElementStream(window, el, policy) {\n const start = window.baseOffset + el.dataOffset;\n const stream = new ReadBufferStream(\n window.arrayBuffer,\n window.littleEndian,\n {\n start,\n stop: start + effectiveElementLength(window, el, true),\n // eager's body stream carries noCopy (getBuffer then returns\n // Uint8Array instead of ArrayBuffer); its meta stream comes from\n // stream.more(), which drops it\n noCopy: policy.noCopy\n }\n );\n if (window.decoder) {\n stream.setDecoder(window.decoder);\n }\n return stream;\n}\n\n/**\n * Corrective guard: a defined length that overruns the underlying buffer is\n * a corrupt length (or a derailed walk). Historic (and test-pinned) leniency\n * reads truncated trailing elements, so the length is CLAMPED to the bytes\n * actually available — but no longer silently (the corruption is logged, and\n * phantom multi-GB allocations from garbage lengths are avoided). Parity\n * with the classic reader's overrun clamp in DicomMessage._readTag.\n */\nfunction effectiveElementLength(window, el, warn) {\n const available =\n window.arrayBuffer.byteLength - (window.baseOffset + el.dataOffset);\n if (\n el.length === undefined ||\n el.length === UNDEFINED_LENGTH ||\n el.length <= available\n ) {\n return el.length;\n }\n if (warn) {\n log.warn(\n `decodeCore: element ${el.tag || \"\"} declares ${el.length} ` +\n `bytes but only ${Math.max(available, 0)} remain in the ` +\n `buffer; clamping to the remaining bytes`\n );\n }\n return Math.max(available, 0);\n}\n\n/**\n * Decodes the value phase of a defined-length element, mirroring the tail of\n * materializeElement (src/lazy/LazyDicomReader.js:557-598): the binary\n * multi-read loop (oversized binary values), or a single vr.read() followed\n * by shapeReadValues for everything else.\n *\n * Callers must already have built the stream via buildElementStream or have\n * established that the element is defined-length (not undefined-length, not\n * a sequence, not encapsulated pixel data). Use classifyElement to determine\n * the routing before calling.\n */\nexport function decodeElementValues(window, el, vrInstance, policy) {\n const vr = vrInstance;\n // Clamped for buffer-overrunning corrupt lengths (see\n // effectiveElementLength); buildElementStream applies (and logs) the\n // same clamp for the stream's stop offset.\n const length = effectiveElementLength(window, el, false);\n const stream = buildElementStream(window, el, policy);\n return readValues(window, vr, stream, length, policy);\n}\n\n/**\n * Decodes the value of an undefined-length element that is not a streamed\n * sequence and not encapsulated pixel data (classifyElement \"eagerWindow\").\n * The value bytes are [dataOffset, endOffset) of the window; endOffset is the\n * end of the closing delimiter. The VR reads with UNDEFINED_LENGTH, so the\n * result is the same as DicomMessage._readTag gives for the element.\n *\n * Returns { values, rawValues } in the same shape as decodeElementValues.\n */\nexport function decodeUndefinedLengthValues(window, el, vrInstance, policy) {\n const stream = new ReadBufferStream(\n window.arrayBuffer,\n window.littleEndian,\n {\n start: window.baseOffset + el.dataOffset,\n stop: window.baseOffset + el.endOffset,\n noCopy: policy.noCopy\n }\n );\n if (window.decoder) {\n stream.setDecoder(window.decoder);\n }\n return readValues(window, vrInstance, stream, UNDEFINED_LENGTH, policy);\n}\n\n/**\n * The value read of DicomMessage._readTag: the binary multi-read loop for\n * oversized binary values, or one vr.read() followed by shapeReadValues.\n */\nfunction readValues(window, vr, stream, length, policy) {\n const readOptions = { forceStoreRaw: policy.forceStoreRaw };\n\n if (vr.isBinary() && length > vr.maxLength && !vr.noMultiple) {\n const values = [];\n const rawValues = [];\n const times = length / vr.maxLength;\n let i = 0;\n while (i++ < times) {\n const { rawValue, value } = vr.read(\n stream,\n vr.maxLength,\n window.syntax,\n readOptions\n );\n rawValues.push(rawValue);\n values.push(value);\n }\n return { values, rawValues };\n }\n const { rawValue, value } =\n vr.read(stream, length, window.syntax, readOptions) || {};\n return shapeReadValues(vr, rawValue, value);\n}\n\n/**\n * Routing predicate: maps an element and its resolved VR instance to one of\n * four decode strategies, mirroring the routing logic in materializeElement\n * (src/lazy/LazyDicomReader.js:533-556).\n *\n * Returns one of:\n * \"sequence\" — real SQ singleton (VR identity check, excluding\n * ParsedUnknownValue); delegate to sequence materializer\n * \"encapsulated\"— el.hadUndefinedLength + el.encapsulatedPixelData + not\n * ParsedUnknownValue; delegate to encapsulated pixel data\n * \"eagerWindow\" — any other hadUndefinedLength; use\n * decodeUndefinedLengthValues\n * \"value\" — defined-length element; use decodeElementValues\n */\nexport function classifyElement(el, vrInstance) {\n // identity check: a ParsedUnknownValue with dictionary VR \"SQ\" is a\n // per-call instance, not the shared SQ singleton, and must keep eager's\n // ParsedUnknownValue.read path.\n if (vrInstance === ValueRepresentation.createByTypeString(\"SQ\")) {\n return \"sequence\";\n }\n if (el.hadUndefinedLength) {\n if (el.encapsulatedPixelData && !isParsedUnknownVr(vrInstance)) {\n return \"encapsulated\";\n }\n // UN parsed as implicit SQ by the tokenizer, ParsedUnknownValue with\n // undefined length, delimiter-scanned values.\n return \"eagerWindow\";\n }\n return \"value\";\n}\n\n/**\n * Resolves the dataset decoder from SpecificCharacterSet (00080005) with\n * the exact eager semantics of DicomMessage._read (src/DicomMessage.js:77-105):\n * encodingMapping lookup, warn-or-throw per policy.ignoreErrors for unsupported\n * or multiple charsets, and the entry Value rewritten to [\"ISO_IR 192\"] while\n * _rawValue keeps the original.\n *\n * Side-effect-free version of resolveCharacterSet in LazyDicomReader: instead\n * of assigning ctx.decoder the resolved TextDecoder is RETURNED in the result\n * object. The caller is responsible for setting it on the body window.\n *\n * Returns { decoder, vrInstance, originalValues, seedState } or null if csEl\n * is absent.\n *\n * decoder — the resolved TextDecoder, or null when the charset is\n * unsupported under ignoreErrors=true.\n * vrInstance — the resolved VR for the charset element.\n * originalValues — the values as stored in the file, BEFORE the ISO_IR 192\n * rewrite (consumed by the charsetPassthroughSafe check).\n * seedState — { values: [\"ISO_IR 192\"], rawValues } — the seed for the\n * 00080005 lazy entry (eager quirk: rewrites Value to UTF-8).\n */\nexport function resolveCharacterSet(window, csEl, policy) {\n if (!csEl) {\n return null;\n }\n const vrInstance = resolveVrInstance(csEl, window);\n // Read with the default (latin1) decoder, exactly like the eager loop\n // does before it reaches the setDecoder call.\n const { values, rawValues } = decodeElementValues(\n window,\n csEl,\n vrInstance,\n policy\n );\n\n // Shared charset resolution (single charsets, ISO 2022 code extensions,\n // error policy) — src/charset/iso2022.js. Same eager error semantics:\n // throws when ignoreErrors=false, warns and degrades to a null decoder\n // when ignoreErrors=true.\n const decoder = resolveCharsetDecoder(values, {\n ignoreErrors: policy.ignoreErrors\n });\n\n return {\n decoder,\n vrInstance,\n // the values as stored in the file, BEFORE the ISO_IR 192 rewrite\n // (consumed by the charsetPassthroughSafe computation)\n originalValues: values,\n seedState: {\n // change SpecificCharacterSet to UTF-8 (eager quirk, kept)\n values: [\"ISO_IR 192\"],\n rawValues\n }\n };\n}\n","/**\n * src/eventStream/fromPart10Stream.js\n *\n * fromPart10Stream — chunked bytes → events source (slice K, stage 2).\n *\n * This is the public entry point for the bounded-memory streaming path.\n * Input is normalized into an AsyncIterable and fed into a ReadBufferStream\n * concurrently with parsing.\n *\n * The **preamble + File Meta Information phase** is genuinely incremental (K2+):\n * FMI elements are decoded on-the-fly as bytes arrive, so `startFileMetaInformation` /\n * per-element events / `endFileMetaInformation` are emitted before body bytes finish.\n *\n * The **body phase** streams natively for all transfer syntaxes (K3+ native paths):\n * defined-length, undefined-length, and encapsulated fragments stream directly\n * from the source. Deflate-compressed bodies (K5) inflate incrementally via\n * chunked pako.Inflate into a zero-based bodyStream, avoiding full-buffer copies.\n *\n * Both streams use clearBuffers=true with per-top-level-element consume() so that\n * chunk memory is released as the parse advances (bounded-memory streaming). A\n * bare (meta-less) dataset streams through the same body loop, behind the\n * allowMissingHeader opt-in.\n *\n * Decision D-E: noCopy is intentionally unsupported (see JSDoc above).\n */\n\nimport pako from \"pako\";\nimport {\n ReadBufferStream,\n EXPLICIT_LITTLE_ENDIAN,\n EXPLICIT_BIG_ENDIAN,\n IMPLICIT_LITTLE_ENDIAN,\n DEFLATED_EXPLICIT_LITTLE_ENDIAN,\n VALID_VRS,\n normalizeSyntax,\n ValueRepresentation\n} from \"@dcmjs-org/core\";\nimport { emitValues, emitDecodedLeaf } from \"./emit.js\";\nimport {\n resolveVrInstance,\n decodeElementValues,\n decodeUndefinedLengthValues,\n isParsedUnknownVr,\n resolveCharacterSet\n} from \"../core/decodeCore.js\";\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * K5b: how far (in retained, unconsumed bytes) the raw feed loop may run\n * ahead of the parse before throttling itself. Pending demand always wins —\n * a consumer blocked in ensureAvailable wakes the feed regardless of the\n * watermark — so an element or fragment larger than this still accumulates\n * fully and the gate cannot deadlock. Overridable per call via\n * `options.feedHighWater`.\n *\n * Without this throttle, a listener stalled on its drain gate (e.g. a write\n * sink flushing a fragment to disk) lets the feed buffer the entire remaining\n * input. Parse settlement (parseState) wakes the gate on early exit or error.\n */\nconst FEED_HIGH_WATER = 4 * 1024 * 1024;\n\n/**\n * pako.Inflate chunkSize for the K5 deflate relay: controls when pako calls\n * onData. The default is 64 KiB (pako 2.x source: 1024*64) — large enough\n * that typical DICOM deflate bodies never fill a single chunk before the\n * stream is finalised, so onData would never fire mid-stream. 16 KiB keeps\n * the buffer small enough to ensure onData fires for every 16 KiB of\n * inflated output, giving the body loop bytes to parse before the raw stream\n * ends.\n */\nconst INFLATE_CHUNK_SIZE = 16384;\n\n/**\n * K5 relay throttle (ED-1): pause the relay while the body loop holds more\n * than RELAY_HIGH_WATER inflated bytes and has no pending demand — otherwise\n * a fast feed + slow listener grows bodyStream without bound (the\n * relay-balloon risk).\n */\nconst RELAY_HIGH_WATER = 16384;\n\n/**\n * K5 relay sub-slice size (ED-1). Because DEFLATE can expand >100× (a whole\n * file's output can hide in a few hundred compressed bytes), pausing between\n * network chunks is not enough: raw bytes are fed to the inflater in\n * RELAY_RAW_SLICE sub-slices with a retention check between each, bounding\n * the overshoot to one sub-slice's expansion.\n */\nconst RELAY_RAW_SLICE = 128;\n\n/**\n * fromPart10Stream — parse a chunked DICOM Part 10 byte source into events.\n *\n * Accepted `input` forms (all normalized to AsyncIterable internally):\n *\n * 1. `ArrayBuffer | Uint8Array`\n * Degenerate single-chunk input. Re-runnable: each call starts fresh.\n *\n * 2. `AsyncIterable<Uint8Array | ArrayBuffer | Buffer>`\n * Streamed chunks (async generators, Node.js Readable streams in\n * object mode, etc.). Single-use: the iterator is exhausted on the\n * first call and cannot be rewound.\n *\n * 3. WHATWG `ReadableStream`\n * Adapted to AsyncIterable via `Symbol.asyncIterator` (Node ≥ 16.14).\n * A reader-loop fallback is provided for environments where ReadableStream\n * does not implement AsyncIterable (older browsers / Node builds). No\n * additional dependencies are required.\n *\n * NOTE — `noCopy` is intentionally NOT accepted. The streaming source forces\n * noCopy semantics OFF because zero-copy views alias chunk memory that\n * `consume()` releases when the incremental loop (K3-K5) is in place\n * (decision D-E).\n *\n * @param {ArrayBuffer|Uint8Array|AsyncIterable|ReadableStream} input\n * @param {import(\"./EventStreamListener\").EventStreamListener} listener\n * @param {Object} [options]\n * @param {boolean} [options.forceStoreRaw] Thread to the decode core.\n * @param {boolean} [options.ignoreErrors] Thread to the decode core.\n * @param {number} [options.feedHighWater] K5b feed throttle watermark in\n * bytes (default {@link FEED_HIGH_WATER}); see the constant's JSDoc.\n * @returns {Promise<void>}\n */\nexport function fromPart10Stream(input, listener, options = {}) {\n // Settlement handshake for the K5b feed gate: when the parse settles\n // (success OR error, from any of the many exit points), a throttled feed\n // must wake and wind down instead of waiting forever for consumer\n // activity that will never come.\n const parseState = { done: false, resolveDone: null };\n parseState.donePromise = new Promise(\n resolve => (parseState.resolveDone = resolve)\n );\n return fromPart10StreamImpl(input, listener, options, parseState).finally(\n () => {\n parseState.done = true;\n parseState.resolveDone();\n }\n );\n}\n\n/**\n * The parse behind {@link fromPart10Stream}. It runs in four phases:\n *\n * 1. Preamble detection ({@link detectPreamble}); a bare dataset gets its\n * body syntax from {@link detectBareSyntax} and skips phase 2.\n * 2. Incremental FMI parse ({@link readFileMetaInformation}).\n * 3. Emission of the collected FMI events, after startDataSet.\n * 4. The body phase (K4 — fully incremental element loop).\n *\n * K4: the raw `stream` uses clearBuffers:true — the incremental body loop\n * consume()s each completed top-level element, so chunk memory is released\n * as the parse advances (bounded-memory streaming). The deflate relay\n * consumes the raw stream itself as it advances.\n *\n * Body phase: every structure now streams natively, in source order, bounded\n * only by the element currently being decoded:\n *\n * - Defined-length leaves and SQ: emitted directly (K3 behavior).\n * - Undefined-length SQ / items: parsed delimiter-driven; the subtree is\n * buffered ONLY long enough to backfill the buffered-parity content-span\n * length payload on startSequence/startItem (unknown until the closing\n * FFFE,E0DD / FFFE,E00D is reached), then flushed.\n * - Encapsulated pixel data: fragments streamed one at a time (the Basic\n * Offset Table item is skipped, matching buffered fromPart10).\n * - Undefined-length non-SQ leaves (\"eagerWindow\"): the value is bounded\n * by a delimiter scan ({@link skipUndefinedSequence}) and decoded via\n * decodeUndefinedLengthValues.\n *\n * The K3 tail-fallback (walkBodyTail / TailFallbackSignal / EventBuffer-for-\n * atomicity) is deleted: nothing can fall back mid-subtree anymore because\n * deflate is decided BEFORE the body loop. The only remaining buffered path\n * is deflate (K5). Chunk release is LIVE (clearBuffers:true + consume()).\n *\n * K5 deflate: a relay coroutine (runInflateRelay) reads compressed bytes from\n * `stream` (raw space, fixed at metaEndOffset after FMI parsing) and pushes\n * them through pako.Inflate into `bodyStream` (inflated/zero-based space).\n * The body element loop reads from `bsrc`, which is `bodyStream` for deflate\n * and `stream` for everything else. This is the ONLY branch that decides\n * which offset space the body loop operates in.\n *\n * Offset-space invariant: `stream` coordinates are always raw/compressed;\n * `bodyStream` coordinates are always inflated/zero-based. The two spaces are\n * NEVER mixed: body element offsets, `ensureAbs` calls, `slice` calls, and\n * `consume` calls all operate exclusively on whichever `bsrc` resolves to.\n * The relay is the sole owner of `stream` during the body phase.\n *\n * K5 top-level body element loop: every element (defined or undefined\n * length, leaf or SQ or encapsulated) is read and emitted incrementally by\n * parseOneElement. After each top-level element completes, consume()\n * releases the chunks it no longer needs. For deflate, `bsrc` is bodyStream\n * (inflated space, zero-based); the relay concurrently pushes inflated\n * chunks. For all other paths, `bsrc` is stream (raw space).\n */\nasync function fromPart10StreamImpl(input, listener, options, parseState) {\n const iterable = normalizeInput(input);\n\n // K4: clearBuffers releases chunks as the parse advances (see JSDoc).\n const stream = new ReadBufferStream(null, true, { clearBuffers: true });\n\n // Feed runs unawaited so the FMI parse can proceed concurrently.\n const feedHighWater = options.feedHighWater ?? FEED_HIGH_WATER;\n let feedError = null;\n const feedPromise = runFeed();\n\n /**\n * Feed loop: copies each source chunk into `stream`, then completes it.\n * K5b: the loop throttles against the parse loop at `feedHighWater`\n * retained bytes (see {@link FEED_HIGH_WATER}). Pending demand always\n * wins so a starved consumer can never deadlock; parse settlement\n * (parseState) wakes the gate on early exit or error. A source error is\n * stored in `feedError` for the parse to rethrow.\n */\n async function runFeed() {\n try {\n for await (const chunk of iterable) {\n stream.addBuffer(toArrayBuffer(chunk));\n // K5b: throttle against the parse loop (see JSDoc).\n while (\n !parseState.done &&\n stream.getBufferMemoryInfo().totalSize > feedHighWater &&\n !stream.hasPendingDemand()\n ) {\n await Promise.race([\n stream.awaitConsumerActivity(),\n parseState.donePromise\n ]);\n }\n }\n stream.setComplete();\n } catch (e) {\n feedError = e;\n // Unblock any stream.ensureAvailable() waiters so the parse\n // can observe the error and propagate it.\n stream.setComplete();\n }\n }\n\n const policy = {\n forceStoreRaw: !!options.forceStoreRaw,\n noCopy: false,\n ignoreErrors: !!options.ignoreErrors\n };\n\n // ---- Phase 1: Preamble detection (incremental) ----\n let fmiElements = [];\n let transferSyntaxUID;\n let rawTransferSyntaxUID;\n if (await detectPreamble(stream)) {\n // A bare dataset has no FMI; its body starts at byte 0.\n transferSyntaxUID = await detectBareSyntax(stream, options);\n rawTransferSyntaxUID = transferSyntaxUID;\n } else {\n // ---- Phase 2: Incremental FMI parse ----\n ({ fmiElements, transferSyntaxUID, rawTransferSyntaxUID } =\n await readFileMetaInformation(stream, policy));\n }\n\n // ---- Phase 3: Emit collected FMI events ----\n //\n // Now that we know the TransferSyntaxUID we can emit startDataSet with\n // the correct TS before the FMI bracket and element events.\n\n listener.startDataSet({ transferSyntaxUID });\n\n if (fmiElements.length > 0) {\n listener.startFileMetaInformation();\n for (const el of fmiElements) {\n emitFmiElement(listener, el);\n }\n listener.endFileMetaInformation();\n }\n\n // ---- Phase 4: Body phase (K4 — fully incremental; see JSDoc) ----\n\n let bodyStream = null;\n let inflateError = null;\n let relayPromise = Promise.resolve();\n\n // F6: the body-loop catch below awaits relayPromise, so the relay must\n // never park on consumer activity that a failed body loop will never\n // produce. The catch resolves this deferred BEFORE awaiting the relay,\n // and the relay races it inside its throttle gate and winds down.\n let bodyFailed = false;\n let signalBodyFailed = null;\n const bodyFailedPromise = new Promise(\n resolve => (signalBodyFailed = resolve)\n );\n\n if (rawTransferSyntaxUID === DEFLATED_EXPLICIT_LITTLE_ENDIAN) {\n bodyStream = new ReadBufferStream(null, true, { clearBuffers: true });\n\n // `stream.offset` is fixed at metaEndOffset throughout the body phase\n // for the deflate path — the body parser reads from bodyStream, never\n // from stream. This keeps raw-space and inflated-space counters separate.\n const relayStartPos = stream.offset; // == metaEndOffset\n\n relayPromise = runInflateRelay(relayStartPos);\n }\n\n /**\n * K5 deflate relay: reads compressed bytes from `stream` starting at\n * `relayStartPos`, inflates them (raw DEFLATE, chunk size\n * {@link INFLATE_CHUNK_SIZE}) and appends the output to `bodyStream`.\n * Sets `inflateError` on a decompress failure, or copies `feedError`\n * there when the raw stream failed, then completes `bodyStream`.\n *\n * Throttle (ED-1, see {@link RELAY_HIGH_WATER} and\n * {@link RELAY_RAW_SLICE}): after each raw sub-slice, the relay waits for\n * the body loop to consume below the watermark before it inflates more.\n * A consumer blocked on ensureAvailable (pending demand) always wins — the\n * relay resumes immediately. A body loop that FAILED (listener threw)\n * produces no consumer activity ever again, so the gate also races the\n * bodyFailed deferred and winds down (F6).\n */\n async function runInflateRelay(relayStartPos) {\n const inflater = new pako.Inflate({\n raw: true,\n chunkSize: INFLATE_CHUNK_SIZE\n });\n inflater.onData = chunk => {\n // chunk is a Uint8Array (pako 2.x). Slice to an owned\n // ArrayBuffer so bodyStream's view doesn't alias pako's buffer.\n bodyStream.addBuffer(\n chunk.buffer.slice(\n chunk.byteOffset,\n chunk.byteOffset + chunk.byteLength\n )\n );\n };\n\n let relayPos = relayStartPos;\n for (;;) {\n // Wait for at least one new byte at relayPos, or raw stream done.\n // stream.offset stays fixed (== metaEndOffset), so:\n // need = relayPos + 1 - stream.offset = bytes to advance past offset.\n const need = relayPos + 1 - stream.offset;\n await stream.ensureAvailable(need);\n\n // Synchronous snapshot after the await (JS single-threaded:\n // no feed-loop interleaving between these two reads).\n const nowEnd = stream.endOffset;\n const done = stream.isComplete;\n\n if (nowEnd > relayPos) {\n const rawSlice = new Uint8Array(stream.slice(relayPos, nowEnd));\n relayPos = nowEnd;\n // Release raw chunks that the relay has fully passed.\n stream.consume(relayPos);\n // isLast: feed loop called setComplete() — no more chunks.\n const isLast = done;\n for (let s = 0; s < rawSlice.length; s += RELAY_RAW_SLICE) {\n const subEnd = Math.min(\n s + RELAY_RAW_SLICE,\n rawSlice.length\n );\n const subLast = isLast && subEnd === rawSlice.length;\n inflater.push(rawSlice.subarray(s, subEnd), subLast);\n if (inflater.err) {\n // pako 2.x stores the error message in inflater.msg.\n inflateError = new Error(\n `fromPart10Stream: deflate decompress failed: ${inflater.msg}`\n );\n bodyStream.setComplete(); // unblock waiting body parser\n return;\n }\n if (subLast) break;\n // Throttle below the watermark; races bodyFailed (F6).\n while (\n !bodyFailed &&\n bodyStream.getBufferMemoryInfo().totalSize >\n RELAY_HIGH_WATER &&\n !bodyStream.hasPendingDemand()\n ) {\n await Promise.race([\n bodyStream.awaitConsumerActivity(),\n bodyFailedPromise\n ]);\n }\n if (bodyFailed) {\n bodyStream.setComplete();\n return;\n }\n }\n if (isLast) break;\n } else {\n // No new bytes — stream must be isComplete (OR-complete).\n // Finalize: push empty batch with isLast=true.\n inflater.push(new Uint8Array(0), true);\n if (inflater.err) {\n inflateError = new Error(\n `fromPart10Stream: deflate decompress failed: ${inflater.msg}`\n );\n }\n break;\n }\n }\n\n // Propagate a feed error if the raw stream failed (e.g. network\n // error mid-stream). Prefer inflate error if both occurred.\n if (!inflateError && feedError) {\n inflateError = feedError;\n }\n\n bodyStream.setComplete();\n }\n\n // Body source: inflated bodyStream for deflate, raw stream for everything else.\n // ALL body helper functions and the body loop use `bsrc` exclusively.\n const bsrc = bodyStream ?? stream;\n\n // Body transfer syntax characteristics — drive all element reads.\n const bodyLittleEndian = transferSyntaxUID !== EXPLICIT_BIG_ENDIAN;\n const bodyImplicit = transferSyntaxUID === IMPLICIT_LITTLE_ENDIAN;\n\n // Chunk release is LIVE for all paths: clearBuffers=true on both `stream`\n // (non-deflate) and `bodyStream` (deflate). The relay releases raw chunks\n // as it advances; the body loop releases inflated (or native) chunks below.\n const releaseEnabled = true;\n\n const UNDEFINED_LEN = 0xffffffff;\n const EMPTY_WIN = {\n arrayBuffer: new ArrayBuffer(0),\n baseOffset: 0,\n syntax: transferSyntaxUID,\n littleEndian: bodyLittleEndian,\n implicit: bodyImplicit,\n decoder: null\n };\n\n /**\n * Byte-order helpers for body elements (tag, VR, length). They use `bsrc`\n * (bodyStream for deflate, stream for everything else) so that they\n * operate in the correct offset space.\n *\n * FFFE-family item/delimiter tags (FFFE,E000 / FFFE,E00D / FFFE,E0DD) and\n * their length fields are read in the body transfer-syntax byte order,\n * exactly as the buffered fromPart10 reads them via Tag.readTag →\n * readUint16, which honors stream.isLittleEndian. They are NOT\n * unconditionally little-endian: in an Explicit Big Endian dataset the\n * item bytes on wire are big-endian (FF FE for the group, E0 00 for the\n * element, etc.) and must be read as BE.\n */\n const getU16 = abs => bsrc.view.getUint16(abs, bodyLittleEndian);\n /** 32-bit form of {@link getU16}, in the body byte order. */\n const getU32 = abs => bsrc.view.getUint32(abs, bodyLittleEndian);\n\n /** Convert (group, element) numbers to clean DICOM tag string \"GGGGEEEE\". */\n function bodyTagStr(g, e) {\n return (\n g.toString(16).padStart(4, \"0\").toUpperCase() +\n e.toString(16).padStart(4, \"0\").toUpperCase()\n );\n }\n\n /**\n * EventBuffer — records listener events as lambdas so an undefined-length\n * SQ / item subtree can be replayed AFTER its closing delimiter is reached,\n * once the content-span length payload is known (buffered fromPart10 emits\n * that computed span, not the on-wire 0xFFFFFFFF). Values are baked into the\n * lambdas at decode time, so charset scoping and fresh-copy semantics are\n * unaffected by the deferred flush. awaitDrain is a local no-op during\n * buffering (backpressure is applied by the real listener after the flush).\n */\n class EventBuffer {\n constructor() {\n this._q = [];\n }\n startElement(tag, info) {\n this._q.push(l => l.startElement(tag, info));\n }\n endElement() {\n this._q.push(l => l.endElement());\n }\n value(v, opts) {\n this._q.push(l => l.value(v, opts));\n }\n startBinary(opts) {\n this._q.push(l => l.startBinary(opts));\n }\n binaryFragment(buf) {\n this._q.push(l => l.binaryFragment(buf));\n }\n endBinary() {\n this._q.push(l => l.endBinary());\n }\n startSequence(tag, info) {\n this._q.push(l => l.startSequence(tag, info));\n }\n endSequence() {\n this._q.push(l => l.endSequence());\n }\n startItem(info) {\n this._q.push(l => l.startItem(info));\n }\n endItem() {\n this._q.push(l => l.endItem());\n }\n awaitDrain() {} // no-op during buffering\n /** Replay all buffered events to `realListener`. */\n flushTo(realListener) {\n for (const fn of this._q) fn(realListener);\n }\n }\n\n /**\n * Ensure the bytes up to absolute offset `absEnd` are present, then re-check\n * strict availability (ensureAvailable resolves at EOF too — OR-complete\n * semantics). Returns true only when the bytes are genuinely available.\n */\n async function ensureAbs(absEnd) {\n // Operate on `bsrc`: bodyStream (inflated, zero-based) for deflate,\n // stream (raw) for everything else. Never mix offset spaces.\n const need = absEnd - bsrc.offset;\n if (need > 0) {\n await bsrc.ensureAvailable(need);\n }\n return absEnd <= bsrc.endOffset;\n }\n\n // ---- Undefined-length structural end-finders (element-aware skip, no emission) ----\n\n /**\n * Skip an undefined-length sequence's items, returning\n * `{ contentEnd, end }`: `contentEnd` is the offset of the closing\n * FFFE,E0DD (the parser's content-span end == element.length base), `end`\n * is the offset just past it. Mirrors readSQElementUndefinedLength*.\n *\n * DICOM PS3.5 permits undefined length (0xFFFFFFFF) ONLY for SQ elements,\n * items, and encapsulated pixel data. The only non-SQ undefined-length\n * element dcmjs decodes cleanly (classifyElement \"eagerWindow\", via\n * decodeUndefinedLengthValues) is explicit-VR UN of undefined length (and private\n * implicit undefined-length elements), which the offsets parser routes\n * through readSequenceItemsImplicit. These end at the SEQUENCE delimiter\n * FFFE,E0DD, NOT at an item delimiter.\n *\n * For non-conformant text VRs (UT/UC/UR) with undefined length, the two\n * paths DELIBERATELY diverge (empirically verified; pinned in the K4 test\n * suite):\n * - buffered fromPart10 — readEncodedString clamps the 0xFFFFFFFF read\n * to the actual buffer size, bleeds past any FFFE,E00D delimiter and\n * returns a garbage string containing all remaining bytes (no throw);\n * any element following the delimiter is silently consumed into the\n * string value.\n * - fromPart10Stream — emitUndefinedLeaf's skipUndefinedSequence sees\n * the non-FFFE value bytes as malformed (not FFFE,E0DD / FFFE,E000),\n * stops the window at the value start; the body loop then re-parses\n * the value bytes as a DICOM element, producing a truncation throw.\n *\n * This loud-failure divergence is DELIBERATE: stream fails loudly on\n * non-conformant data that buffered silently mishandles.\n *\n * For binary VRs (OB/OW/etc.) with undefined length, both paths throw\n * (buffered: \"Item tag not found after undefined binary length\"; stream:\n * similar truncation), so no path-divergence arises there.\n *\n * These scanners mirror the parser's sequence walk (FFFE,E0DD) with\n * nested item-delimiter (FFFE,E00D) handling. skipUndefinedItem is\n * ELEMENT-AWARE — it steps whole element headers/values via\n * skipOneElementEnd — not a 2-byte byte-scan like findItemDelimitationItem.\n */\n async function skipUndefinedSequence(fromAbs) {\n let pos = fromAbs;\n for (;;) {\n if (!(await ensureAbs(pos + 8))) {\n return { contentEnd: bsrc.endOffset, end: bsrc.endOffset };\n }\n const g = getU16(pos);\n const e = getU16(pos + 2);\n if (g === 0xfffe && e === 0xe0dd) {\n return { contentEnd: pos, end: pos + 8 };\n }\n if (g !== 0xfffe || e !== 0xe000) {\n return { contentEnd: pos, end: pos }; // malformed — stop\n }\n const itemLength = getU32(pos + 4);\n pos += 8;\n pos =\n itemLength === UNDEFINED_LEN\n ? await skipUndefinedItem(pos)\n : pos + itemLength;\n }\n }\n\n /**\n * Skip an undefined-length item's elements, returning the offset just past\n * its FFFE,E00D delimiter (findItemDelimitationItem semantics, but element-\n * aware so nested defined-length values are stepped over correctly).\n */\n async function skipUndefinedItem(fromAbs) {\n let pos = fromAbs;\n for (;;) {\n if (!(await ensureAbs(pos + 8))) return bsrc.endOffset;\n const g = getU16(pos);\n const e = getU16(pos + 2);\n if (g === 0xfffe && e === 0xe00d) return pos + 8;\n pos = await skipOneElementEnd(pos);\n }\n }\n\n /** Skip a single element header + value, recursing into nested structures. */\n async function skipOneElementEnd(fromAbs) {\n let pos = fromAbs;\n if (!(await ensureAbs(pos + 8))) return bsrc.endOffset;\n pos += 4; // tag\n let valueLength;\n if (bodyImplicit) {\n valueLength = bsrc.view.getUint32(pos, true);\n pos += 4;\n } else {\n const vr =\n String.fromCharCode(bsrc.view.getUint8(pos)) +\n String.fromCharCode(bsrc.view.getUint8(pos + 1));\n pos += 2;\n if (ValueRepresentation.createByTypeString(vr).isLength32()) {\n if (!(await ensureAbs(pos + 6))) return bsrc.endOffset;\n pos += 2; // reserved\n valueLength = getU32(pos);\n pos += 4;\n } else {\n valueLength = getU16(pos);\n pos += 2;\n }\n }\n if (valueLength === UNDEFINED_LEN) {\n return (await skipUndefinedSequence(pos)).end;\n }\n if (!(await ensureAbs(pos + valueLength))) return bsrc.endOffset;\n return pos + valueLength;\n }\n\n /**\n * Read ONE element header at `elemStartAbs` (the caller has verified it is\n * not a delimiter tag) and route it by classification, emitting into\n * `target`. Returns the (possibly charset-updated) decoder for the caller\n * to thread into the next element. Mirrors decodeCore.classifyElement.\n *\n * Defined length: resolveVrInstance is the single canonical implicit-VR\n * contract (AD-1) — dictionary-miss elements resolve to UN and are never\n * data-peek-promoted to SQ (eager parity). Only dictionary-known SQs take\n * the sequence path.\n *\n * Undefined length: the element is classified as SQ\n * ({@link isUndefinedLengthSequence}), encapsulated pixel data, or an\n * eagerWindow leaf, matching decodeCore.classifyElement + the parser's SQ\n * resolution.\n */\n async function parseOneElement(target, elemStartAbs, currentDecoder) {\n bsrc.offset = elemStartAbs;\n const elGroup = getU16(elemStartAbs);\n const elElement = getU16(elemStartAbs + 2);\n bsrc.offset = elemStartAbs + 4;\n const tagStr = bodyTagStr(elGroup, elElement);\n\n let vrStr = null;\n let valueLength;\n if (bodyImplicit) {\n if (!(await ensureAbs(bsrc.offset + 4))) {\n throw new Error(\n `fromPart10Stream: truncated at ${elemStartAbs}: missing implicit length`\n );\n }\n // Implicit is always LITTLE_ENDIAN regardless of body TS.\n valueLength = bsrc.view.getUint32(bsrc.offset, true);\n bsrc.offset += 4;\n } else {\n if (!(await ensureAbs(bsrc.offset + 2))) {\n throw new Error(\n `fromPart10Stream: truncated at ${elemStartAbs}: missing VR bytes`\n );\n }\n vrStr =\n String.fromCharCode(bsrc.view.getUint8(bsrc.offset)) +\n String.fromCharCode(bsrc.view.getUint8(bsrc.offset + 1));\n bsrc.offset += 2;\n const vrForLen = ValueRepresentation.createByTypeString(vrStr);\n if (vrForLen.isLength32()) {\n if (!(await ensureAbs(bsrc.offset + 6))) {\n throw new Error(\n `fromPart10Stream: truncated at ${elemStartAbs}: missing extended length`\n );\n }\n bsrc.offset += 2; // reserved\n valueLength = getU32(bsrc.offset);\n bsrc.offset += 4;\n } else {\n if (!(await ensureAbs(bsrc.offset + 2))) {\n throw new Error(\n `fromPart10Stream: truncated at ${elemStartAbs}: missing 2-byte length`\n );\n }\n valueLength = getU16(bsrc.offset);\n bsrc.offset += 2;\n }\n }\n\n const valueStartAbs = bsrc.offset;\n const undef = valueLength === UNDEFINED_LEN;\n const elLike = {\n vr: vrStr,\n tagValue: ((elGroup << 16) | elElement) >>> 0,\n dataOffset: 0,\n length: valueLength,\n hadUndefinedLength: undef\n };\n let vrInstance = resolveVrInstance(elLike, EMPTY_WIN);\n\n if (!undef) {\n // Only dictionary-known SQs take the sequence path (AD-1).\n if (vrInstance.type === \"SQ\") {\n await emitSequence(\n target,\n tagStr,\n valueStartAbs,\n valueLength,\n currentDecoder\n );\n return currentDecoder;\n }\n return await emitDefinedLeaf(\n target,\n tagStr,\n elLike,\n vrInstance,\n valueLength,\n valueStartAbs,\n currentDecoder\n );\n }\n\n // Undefined length: classify SQ / encapsulated / eagerWindow leaf.\n const treatAsSq = await isUndefinedLengthSequence(\n elLike,\n vrInstance,\n valueStartAbs\n );\n if (treatAsSq) {\n await emitSequence(\n target,\n tagStr,\n valueStartAbs,\n UNDEFINED_LEN,\n currentDecoder\n );\n return currentDecoder;\n }\n if (tagStr === \"7FE00010\" && !isParsedUnknownVr(vrInstance)) {\n await emitEncapsulated(target, tagStr, vrInstance, valueStartAbs);\n return currentDecoder;\n }\n await emitUndefinedLeaf(\n target,\n tagStr,\n valueStartAbs,\n elLike,\n vrInstance,\n currentDecoder\n );\n return currentDecoder;\n }\n\n /**\n * Decide whether an undefined-length element streams as a sequence.\n * Explicit VR: true when the resolved VR is SQ. Implicit VR: true for a\n * dictionary-known SQ (no peek); a dictionary-unknown element that\n * resolved to SQ (hadUndefinedLength fallback) is peeked for an\n * FFFE,E000 / FFFE,E0DD first tag.\n *\n * The peek is ROUTING-ONLY (AD-1): it chooses between streamed\n * emitSequence and the delimiter-scanned eager-window leaf, both of which\n * yield eager-SQ semantics for undefined-length dictionary-miss elements\n * (resolveVrInstance's length rule). The semantic contract itself never\n * data-peek-promotes defined-length elements.\n */\n async function isUndefinedLengthSequence(\n elLike,\n vrInstance,\n valueStartAbs\n ) {\n let treatAsSq = false;\n if (vrInstance.type === \"SQ\") {\n if (!bodyImplicit) {\n treatAsSq = true; // explicit VR SQ\n } else {\n const dictVr = resolveVrInstance(\n { ...elLike, hadUndefinedLength: false },\n EMPTY_WIN\n );\n if (dictVr.type === \"SQ\") {\n treatAsSq = true;\n } else if (await ensureAbs(valueStartAbs + 4)) {\n const pg = bsrc.view.getUint16(valueStartAbs, true);\n const pe = bsrc.view.getUint16(valueStartAbs + 2, true);\n treatAsSq =\n pg === 0xfffe && (pe === 0xe000 || pe === 0xe0dd);\n }\n }\n }\n return treatAsSq;\n }\n\n /**\n * Defined-length leaf element: decode the value and emit directly. Returns\n * the decoder to thread onward (updated when this is (0008,0005)).\n *\n * (0028,0103) PixelRepresentation drives the \"xs\" (US-or-SS) meta-VR\n * resolution of subsequent elements (issue #368). EMPTY_WIN is the window\n * handed to resolveVrInstance and is created per parse, so the in-place\n * update is private to this stream.\n */\n async function emitDefinedLeaf(\n target,\n tagStr,\n elLike,\n vrInstance,\n valueLength,\n valueStartAbs,\n decoder\n ) {\n const valueEndAbs = valueStartAbs + valueLength;\n if (valueLength > 0 && !(await ensureAbs(valueEndAbs))) {\n throw new Error(\n `fromPart10Stream: truncated: element at ${valueStartAbs} ` +\n `declares ${valueLength} bytes but stream ended`\n );\n }\n const valueAB = bsrc.slice(valueStartAbs, valueEndAbs);\n const win = {\n arrayBuffer: valueAB,\n baseOffset: 0,\n syntax: transferSyntaxUID,\n littleEndian: bodyLittleEndian,\n implicit: bodyImplicit,\n decoder\n };\n const { values, rawValues } = decodeElementValues(\n win,\n elLike,\n vrInstance,\n policy\n );\n let newDecoder = decoder;\n // (0008,0005) SpecificCharacterSet sets the decoder for subsequent\n // elements in this scope (top-level body or the current SQ item).\n if (tagStr === \"00080005\") {\n const csResult = resolveCharacterSet(win, elLike, policy);\n newDecoder = csResult?.decoder ?? null;\n }\n // (0028,0103) drives \"xs\" VR resolution (issue #368; see JSDoc).\n if (tagStr === \"00280103\" && values && values.length) {\n EMPTY_WIN.pixelRepresentation = values[0];\n }\n emitValues(target, tagStr, vrInstance, elLike, values, rawValues);\n bsrc.offset = valueEndAbs;\n return newDecoder;\n }\n\n /**\n * Emit a sequence (defined or undefined length) into `target`.\n * `dataOffsetAbs` is the absolute offset of the sequence's first content\n * byte. Defined-length sequences emit directly with the declared length;\n * undefined-length sequences buffer their items so the content-span length\n * payload (parity with buffered fromPart10) can be backfilled at the\n * closing FFFE,E0DD.\n */\n async function emitSequence(\n target,\n tagStr,\n dataOffsetAbs,\n declaredLength,\n outerDecoder\n ) {\n if (declaredLength !== UNDEFINED_LEN) {\n const sqEndAbs = dataOffsetAbs + declaredLength;\n target.startSequence(tagStr, { vr: \"SQ\", length: declaredLength });\n await parseSqItems(target, sqEndAbs, false, outerDecoder);\n target.endSequence();\n bsrc.offset = sqEndAbs;\n } else {\n const buf = new EventBuffer();\n const delimStart = await parseSqItems(buf, -1, true, outerDecoder);\n const contentSpan = delimStart - dataOffsetAbs;\n target.startSequence(tagStr, { vr: \"SQ\", length: contentSpan });\n buf.flushTo(target);\n target.endSequence();\n // bsrc.offset already advanced past FFFE,E0DD by parseSqItems.\n }\n }\n\n /**\n * Encapsulated pixel data: stream fragments one at a time. The first item is\n * the Basic Offset Table — its header is read and its bytes skipped (buffered\n * fromPart10 keeps it in element.basicOffsetTable and does NOT emit it as a\n * fragment). The startElement length payload is the on-wire 0xFFFFFFFF\n * (the computed span is unknown until the closing delimiter, which would\n * defeat fragment streaming) — a documented delta from buffered fromPart10.\n *\n * The Basic Offset Table item (FFFE,E000) offsets are surfaced on\n * startBinary so BOT-aware listeners can merge fragments per frame window\n * (issue #204).\n *\n * K6: per-fragment release (see {@link releaseConsumedChunks}) bounds\n * peak memory to (largest fragment + chunk size + fixed slack) rather than\n * the full pixel-data element. The fragment bytes were already copied\n * into an owned ArrayBuffer by bsrc.slice(), so aliasing is safe to\n * discard. Without this, the whole encapsulated element accumulates in\n * the stream buffer until the post-element consume() in the body loop\n * fires.\n */\n async function emitEncapsulated(target, tagStr, vrInstance, dataOffsetAbs) {\n target.startElement(tagStr, {\n vr: vrInstance.type,\n length: UNDEFINED_LEN\n });\n bsrc.offset = dataOffsetAbs;\n\n // Basic Offset Table: surface offsets (issue #204), then skip bytes.\n if (!(await ensureAbs(bsrc.offset + 8))) {\n throw new Error(\n `fromPart10Stream: truncated: encapsulated BOT header at ${bsrc.offset}`\n );\n }\n const botLen = getU32(bsrc.offset + 4);\n bsrc.offset += 8;\n const startBinaryInfo = { encapsulated: true };\n if (botLen > 0) {\n if (!(await ensureAbs(bsrc.offset + botLen))) {\n throw new Error(\n `fromPart10Stream: truncated: encapsulated BOT (${botLen} bytes)`\n );\n }\n const botCount = Math.floor(botLen / 4);\n if (botCount > 0) {\n const basicOffsetTable = new Array(botCount);\n for (let i = 0; i < botCount; i++) {\n basicOffsetTable[i] = getU32(bsrc.offset + i * 4);\n }\n startBinaryInfo.basicOffsetTable = basicOffsetTable;\n }\n bsrc.offset += botLen;\n }\n target.startBinary(startBinaryInfo);\n\n for (;;) {\n if (!(await ensureAbs(bsrc.offset + 8))) {\n throw new Error(\n `fromPart10Stream: truncated: encapsulated item header at ${bsrc.offset}`\n );\n }\n const g = getU16(bsrc.offset);\n const e = getU16(bsrc.offset + 2);\n if (g === 0xfffe && e === 0xe0dd) {\n bsrc.offset += 8; // sequence-delimiter tag + 4-byte length\n break;\n }\n if (g !== 0xfffe || e !== 0xe000) {\n break; // unexpected tag — stop gracefully\n }\n const fragLen = getU32(bsrc.offset + 4);\n bsrc.offset += 8;\n const fragStart = bsrc.offset;\n const fragEnd = fragStart + fragLen;\n if (!(await ensureAbs(fragEnd))) {\n throw new Error(\n `fromPart10Stream: truncated: pixel-data fragment (${fragLen} bytes) at ${fragStart}`\n );\n }\n // Fresh copy — the emitted buffer must not alias released chunks.\n target.binaryFragment(bsrc.slice(fragStart, fragEnd));\n bsrc.offset = fragEnd;\n await target.awaitDrain(); // backpressure between fragments\n // K6: per-fragment release (see JSDoc).\n if (releaseEnabled) {\n releaseConsumedChunks();\n }\n }\n target.endBinary();\n target.endElement();\n }\n\n /**\n * Release every `bsrc` chunk fully behind the current position, then\n * report the buffer memory state to `options.onConsume`. For the deflate\n * path (bodyStream active), the report also includes the raw stream\n * memory state, so tests can verify both streams release chunks\n * concurrently.\n */\n function releaseConsumedChunks() {\n bsrc.consume(bsrc.offset);\n const info = bsrc.getBufferMemoryInfo();\n if (bodyStream) {\n info.rawStreamInfo = stream.getBufferMemoryInfo();\n }\n options.onConsume?.(info);\n }\n\n /**\n * Undefined-length non-SQ leaf (\"eagerWindow\"): bound the value by\n * walking the structure to its closing sequence delimiter, copy the value\n * bytes, and decode via decodeUndefinedLengthValues. The emitted length\n * payload is the content span (delimiter offset minus the data offset),\n * for parity with buffered. See {@link skipUndefinedSequence} for the\n * deliberate divergence on non-conformant undefined-length UT/UC/UR.\n */\n async function emitUndefinedLeaf(\n target,\n tagStr,\n valueStartAbs,\n elLike,\n vrInstance,\n decoder\n ) {\n const { contentEnd, end } = await skipUndefinedSequence(valueStartAbs);\n const win = {\n arrayBuffer: bsrc.slice(valueStartAbs, end),\n baseOffset: 0,\n syntax: transferSyntaxUID,\n littleEndian: bodyLittleEndian,\n implicit: bodyImplicit,\n decoder\n };\n const valueEl = {\n ...elLike,\n dataOffset: 0,\n endOffset: end - valueStartAbs,\n length: contentEnd - valueStartAbs\n };\n const { values, rawValues } = decodeUndefinedLengthValues(\n win,\n valueEl,\n vrInstance,\n policy\n );\n emitDecodedLeaf(target, tagStr, vrInstance, valueEl, values, rawValues);\n bsrc.offset = end;\n }\n\n /**\n * Parse the items of a sequence into `target`.\n * - Defined-length SQ (`undefinedSeq=false`): items until `sqEndAbs`.\n * - Undefined-length SQ (`undefinedSeq=true`, `sqEndAbs` ignored): items\n * until the sequence delimiter (FFFE,E0DD); returns the absolute offset\n * of that delimiter (the parser's content-span end).\n * `outerDecoder` is the parent-scope charset decoder inherited by items.\n */\n async function parseSqItems(target, sqEndAbs, undefinedSeq, outerDecoder) {\n while (undefinedSeq || bsrc.offset < sqEndAbs) {\n if (!(await ensureAbs(bsrc.offset + 8))) {\n if (undefinedSeq) return bsrc.offset; // EOF before delimiter\n throw new Error(\n `fromPart10Stream: truncated: SQ item header at ${bsrc.offset}`\n );\n }\n const itemStart = bsrc.offset;\n const itemGroup = getU16(itemStart);\n const itemElement = getU16(itemStart + 2);\n\n if (itemGroup === 0xfffe && itemElement === 0xe0dd) {\n bsrc.offset = itemStart + 8; // consume seq-delimiter + length\n return itemStart;\n }\n if (itemGroup !== 0xfffe || itemElement !== 0xe000) {\n return itemStart; // unexpected tag — stop gracefully\n }\n const itemLength = getU32(itemStart + 4);\n bsrc.offset = itemStart + 8; // past item header\n const itemDataOffset = bsrc.offset;\n\n if (itemLength !== UNDEFINED_LEN) {\n const itemEndAbs = itemDataOffset + itemLength;\n target.startItem({ length: itemLength });\n await parseItemElements(\n target,\n itemEndAbs,\n false,\n outerDecoder\n );\n target.endItem();\n bsrc.offset = itemEndAbs;\n } else {\n // Undefined-length item: buffer to backfill the parser's item\n // span (data offset → past the closing item delimiter).\n const ibuf = new EventBuffer();\n const delimStart = await parseItemElements(\n ibuf,\n -1,\n true,\n outerDecoder\n );\n const itemSpan = delimStart + 8 - itemDataOffset;\n target.startItem({ length: itemSpan });\n ibuf.flushTo(target);\n target.endItem();\n }\n }\n return bsrc.offset;\n }\n\n /**\n * Parse the elements of a single sequence item into `target`.\n * - Defined-length item (`undefinedItem=false`): elements until\n * `itemEndAbs`.\n * - Undefined-length item (`undefinedItem=true`, `itemEndAbs` ignored):\n * elements until the item delimiter (FFFE,E00D); returns the absolute\n * offset of that delimiter.\n * Per-item charset scoping: this item's own (0008,0005) overrides\n * `parentDecoder` for subsequent elements in its subtree.\n */\n async function parseItemElements(\n target,\n itemEndAbs,\n undefinedItem,\n parentDecoder\n ) {\n let itemDecoder = parentDecoder;\n while (undefinedItem || bsrc.offset < itemEndAbs) {\n if (!(await ensureAbs(bsrc.offset + 4))) {\n if (undefinedItem) return bsrc.offset;\n throw new Error(\n `fromPart10Stream: truncated: item element header at ${bsrc.offset}`\n );\n }\n const elemStart = bsrc.offset;\n const g = getU16(elemStart);\n const e = getU16(elemStart + 2);\n if (g === 0xfffe && e === 0xe00d) {\n // Item delimiter: consume tag + 4-byte length.\n if (!(await ensureAbs(elemStart + 8)) && undefinedItem) {\n return elemStart;\n }\n bsrc.offset = elemStart + 8;\n return elemStart;\n }\n itemDecoder = await parseOneElement(target, elemStart, itemDecoder);\n }\n return bsrc.offset;\n }\n\n // ---- K5 top-level body element loop (see fromPart10StreamImpl JSDoc) ----\n let bodyDecoder = null; // resolved when (0008,0005) is first seen in body\n\n try {\n bodyLoop: for (;;) {\n // --- Read next element tag (4 bytes) ---\n if (!(await ensureAbs(bsrc.offset + 4))) break bodyLoop; // clean EOF\n\n const elemStartAbs = bsrc.offset;\n const elGroup = getU16(elemStartAbs);\n\n // Defensive: stray top-level FFFE delimiter tags are malformed for a\n // well-formed Part 10 body; skip them so the next real element frames\n // correctly (native SQ/encapsulated handlers already consume their own\n // delimiters, so this is only reached on malformed input).\n if (elGroup === 0xfffe) {\n if (!(await ensureAbs(elemStartAbs + 8))) break bodyLoop;\n bsrc.offset = elemStartAbs + 8;\n continue bodyLoop;\n }\n\n bodyDecoder = await parseOneElement(\n listener,\n elemStartAbs,\n bodyDecoder\n );\n await listener.awaitDrain();\n if (releaseEnabled) {\n releaseConsumedChunks();\n }\n }\n } catch (bodyErr) {\n // F6: wake a relay parked on consumer activity BEFORE awaiting it,\n // or the two awaits deadlock each other and the promise never settles.\n bodyFailed = true;\n signalBodyFailed();\n // Wait for the relay to settle so inflateError is populated (if any).\n await relayPromise;\n // Prioritize the root cause over the symptom: an inflate or source\n // (feed) error explains the truncated read the body loop tripped on.\n throw inflateError ?? feedError ?? bodyErr;\n }\n\n // Relay must finish before we inspect inflateError.\n await relayPromise;\n if (inflateError) throw inflateError;\n\n // F7: the body loop treats stream-complete as a clean EOF, but the feed\n // catch also calls setComplete() when the SOURCE throws mid-transfer. A\n // clean end is only clean if the feed finished without error — otherwise\n // a truncated transfer would resolve as a well-formed shorter dataset.\n await feedPromise;\n if (feedError) throw feedError;\n\n // Observable hook: fires for ALL paths (deflate and non-deflate) now that\n // the early deflate return is gone.\n options.onPhase?.(\"native\");\n\n listener.endDataSet();\n}\n\n// ---------------------------------------------------------------------------\n// Preamble, bare dataset and FMI parse\n// ---------------------------------------------------------------------------\n\n/**\n * Phase 1: preamble detection (incremental). Sets `stream.offset` to the\n * start of the FMI and returns false, or returns true when the input is a\n * bare dataset.\n *\n * - \"DICM\" at bytes 128-131 → normal Part 10, advance to offset 132\n * - First 2 bytes are group 0x0002 → PART10_NO_PREAMBLE, stay at 0\n * - Neither → bare dataset or non-DICOM input\n * (see {@link detectBareSyntax}).\n *\n * @param {ReadBufferStream} stream the raw input stream\n * @returns {Promise<boolean>} true for a bare dataset\n */\nasync function detectPreamble(stream) {\n let rawDatasetFallback = false;\n\n // Wait for enough bytes to check the DICM marker (requires 132 bytes:\n // 128-byte preamble + 4-byte \"DICM\"). ensureAvailable resolves even\n // at EOF if bytes are insufficient (OR-complete semantics), so we\n // always re-check with isAvailable(N, false) after the await.\n await stream.ensureAvailable(132);\n\n if (stream.isAvailable(132, false)) {\n // We have at least 132 bytes — check for \"DICM\" at bytes 128-131.\n const hasDicm =\n stream.view.getUint8(128) === 0x44 && // D\n stream.view.getUint8(129) === 0x49 && // I\n stream.view.getUint8(130) === 0x43 && // C\n stream.view.getUint8(131) === 0x4d; // M\n if (hasDicm) {\n // Normal Part 10: skip preamble + DICM marker.\n stream.offset = 132;\n } else {\n // No DICM — check whether the file starts with group 0x0002.\n const firstGroup = stream.view.getUint16(0, true); // LE\n if (firstGroup === 0x0002) {\n // PART10_NO_PREAMBLE: FMI starts at byte 0.\n stream.offset = 0;\n } else {\n rawDatasetFallback = true;\n }\n }\n } else {\n // Fewer than 132 bytes available (short stream or early EOF).\n // Try to at least check the 0x0002 group in the first 2 bytes.\n await stream.ensureAvailable(4);\n if (stream.isAvailable(2, false)) {\n const firstGroup = stream.view.getUint16(0, true); // LE\n if (firstGroup === 0x0002) {\n stream.offset = 0; // PART10_NO_PREAMBLE\n } else {\n rawDatasetFallback = true;\n }\n } else {\n rawDatasetFallback = true;\n }\n }\n return rawDatasetFallback;\n}\n\n/**\n * Bare (meta-less, DIMSE-style) dataset: returns the transfer syntax of the\n * body, or refuses the input (issue #93).\n *\n * The input needs an explicit opt-in: allowMissingHeader, or the tolerant\n * ignoreErrors mode. The body is Explicit Little Endian when bytes 4-5 of the\n * first element header are a valid VR code, and Implicit Little Endian\n * otherwise (the same rule as DicomMessage._detectBareSyntax). The body then\n * streams through the standard body loop from byte 0.\n *\n * Without the opt-in, the reader refuses input that is neither Part 10 nor\n * an FMI group, with the streaming reader's own error text.\n *\n * @param {ReadBufferStream} stream the raw input stream, at offset 0\n * @param {Object} options the fromPart10Stream options\n * @returns {Promise<string>} the body transfer syntax UID\n */\nasync function detectBareSyntax(stream, options) {\n if (!options.allowMissingHeader && !options.ignoreErrors) {\n throw new Error(\n \"fromPart10Stream: input has no DICM marker and does not start \" +\n \"with a File Meta Information group; pass \" +\n \"allowMissingHeader: true (or ignoreErrors: true) to \" +\n \"force-read a bare dataset\"\n );\n }\n stream.offset = 0;\n await stream.ensureAvailable(8);\n if (!stream.isAvailable(8, false)) {\n return EXPLICIT_LITTLE_ENDIAN;\n }\n const vrStr =\n String.fromCharCode(stream.view.getUint8(4)) +\n String.fromCharCode(stream.view.getUint8(5));\n return VALID_VRS.has(vrStr)\n ? EXPLICIT_LITTLE_ENDIAN\n : IMPLICIT_LITTLE_ENDIAN;\n}\n\n/**\n * Phase 2: incremental FMI parse, from `stream.offset` to the end of the\n * File Meta Information. Leaves `stream.offset` at the first body byte.\n *\n * FMI is always EXPLICIT_LITTLE_ENDIAN regardless of the body TS. The decoded\n * FMI elements (tag, VR, values, rawValues) are accumulated into an array so\n * that the caller can emit startDataSet *after* it knows the\n * TransferSyntaxUID from (0002,0010) — the listener must receive\n * startDataSet with the correct TS before any FMI events.\n *\n * Two forms of the TS are returned. `rawTransferSyntaxUID` is the raw\n * (un-normalised) TS read from (0002,0010): it is used for the K5 deflate\n * detection because _normalizeSyntax maps deflate → ELE, which would prevent\n * bodyStream from being created (K5 root bug). `transferSyntaxUID`\n * (normalised) is kept for listener.startDataSet and body-parsing parity with\n * the eager reader, which normalises the same way. Both default to\n * EXPLICIT_LITTLE_ENDIAN when (0002,0010) is absent.\n *\n * @param {ReadBufferStream} stream the raw input stream\n * @param {Object} policy the decode policy\n * @returns {Promise<{fmiElements: Array<{tag:string, vrStr:string, length:number, values:any[], rawValues:any[]}>, transferSyntaxUID: string, rawTransferSyntaxUID: string}>}\n */\nasync function readFileMetaInformation(stream, policy) {\n const fmiElements = [];\n let transferSyntaxUID = EXPLICIT_LITTLE_ENDIAN; // default if 0002,0010 absent\n let rawTransferSyntaxUID = EXPLICIT_LITTLE_ENDIAN;\n\n // We need at least 8 bytes for the smallest possible FMI header.\n await stream.ensureAvailable(8);\n\n // Determine whether (0002,0000) FileMetaInformationGroupLength is present.\n // If present, we know the exact end-of-FMI offset; otherwise we stop\n // when the first non-0002 group tag appears (AsyncDicomReader.readMeta\n // §233–240 fallback).\n let metaEndOffset = null; // null → no fixed bound\n\n if (\n stream.isAvailable(8, false) &&\n stream.view.getUint16(stream.offset, true) === 0x0002 &&\n stream.view.getUint16(stream.offset + 2, true) === 0x0000\n ) {\n // (0002,0000) is present. We'll parse it in the main loop below\n // and set metaEndOffset once we have the UL value.\n // (No special pre-read needed — the loop handles it uniformly.)\n }\n\n // ---- FMI element loop ----\n while (true) {\n // Fixed-bound termination: used when (0002,0000) was found.\n if (metaEndOffset !== null && stream.offset >= metaEndOffset) break;\n\n // Wait for enough bytes to read a minimal element header (8 bytes:\n // 4-byte tag + 2-byte VR + 2-byte length). If the stream ends\n // before we get 8 bytes (unlikely for valid FMI), we stop.\n await stream.ensureAvailable(8);\n\n // EOF or insufficient data: stop FMI loop gracefully.\n if (!stream.isAvailable(4, false)) break;\n\n // Peek at the next element's group tag (LE uint16).\n // For the no-group-length fallback: stop as soon as group != 0x0002.\n const peekGroup = stream.view.getUint16(stream.offset, true);\n if (peekGroup !== 0x0002) break; // body starts here\n\n // Confirm we have at least a full 8-byte header before committing.\n if (!stream.isAvailable(8, false)) break;\n\n // ---- Read element header (Explicit Little Endian) ----\n const elGroup = stream.readUint16(); // always 0x0002\n const elElement = stream.readUint16();\n // Build DICOM clean tag string: \"GGGGEEEE\" (uppercase hex, 8 chars)\n const tagStr =\n elGroup.toString(16).padStart(4, \"0\").toUpperCase() +\n elElement.toString(16).padStart(4, \"0\").toUpperCase();\n\n // VR: 2 ASCII bytes\n const vrStr =\n String.fromCharCode(stream.view.getUint8(stream.offset)) +\n String.fromCharCode(stream.view.getUint8(stream.offset + 1));\n stream.offset += 2;\n\n // Length: 2 bytes (standard VR) or 2 reserved + 4 bytes (extended VR)\n let valueLength;\n // Resolve VR instance to determine header framing via isLength32()\n // createByTypeString handles invalid VR strings by falling back to UN.\n const vrForHeader = ValueRepresentation.createByTypeString(vrStr);\n if (vrForHeader.isLength32()) {\n // Extended form: need 2 more bytes (reserved) + 4 bytes (length32)\n await stream.ensureAvailable(6);\n if (!stream.isAvailable(6, false)) break; // truncated\n stream.offset += 2; // skip reserved (0x0000)\n valueLength = stream.readUint32();\n } else {\n // Standard form: length is already in the next 2 bytes\n await stream.ensureAvailable(2);\n if (!stream.isAvailable(2, false)) break; // truncated\n valueLength = stream.readUint16();\n }\n\n // Set metaEndOffset after reading the FileMetaInformationGroupLength\n // value (0002,0000) UL. The bound is relative to the END of this\n // element (i.e., the first byte AFTER the UL value bytes).\n const isGroupLengthTag = elGroup === 0x0002 && elElement === 0x0000;\n\n // Wait for value bytes\n await stream.ensureAvailable(valueLength);\n\n if (!stream.isAvailable(valueLength, false)) {\n // Stream ended mid-value: best-effort stop (truncated FMI)\n break;\n }\n\n // Extract value bytes into a fresh ArrayBuffer (copy is acceptable\n // for FMI — FMI is at most a few hundred bytes).\n const valueStart = stream.offset;\n const valueAB = stream.slice(valueStart, valueStart + valueLength);\n\n const { values, rawValues } = decodeFmiValue(\n valueAB,\n elGroup,\n elElement,\n vrStr,\n valueLength,\n policy\n );\n\n // Capture TransferSyntaxUID for startDataSet and body-phase delegation.\n // Matches seedReadContext's normalization (core normalizeSyntax).\n if (tagStr === \"00020010\" && values[0]) {\n rawTransferSyntaxUID = values[0];\n transferSyntaxUID = normalizeSyntax(values[0]);\n }\n\n // Set meta end offset from (0002,0000) FileMetaInformationGroupLength\n if (isGroupLengthTag && values[0] !== undefined) {\n // values[0] is the UL integer: bytes after THIS element\n metaEndOffset = valueStart + valueLength + values[0];\n }\n\n fmiElements.push({\n tag: tagStr,\n vrStr,\n length: valueLength,\n values,\n rawValues\n });\n\n // Advance stream past the value bytes\n stream.offset = valueStart + valueLength;\n }\n\n return { fmiElements, transferSyntaxUID, rawTransferSyntaxUID };\n}\n\n/**\n * Decode one FMI element value through decodeCore, over a minimal\n * Explicit Little Endian read window that holds only the value bytes.\n *\n * The `elLike` object is the minimal shape decodeCore.resolveVrInstance and\n * decodeCore.decodeElementValues require:\n * - vr — VR string (e.g. \"UI\", \"UL\", \"OB\")\n * - tagValue — numeric tag (group << 16) | element, for UN dictionary lookup\n * - dataOffset — byte offset of value within the window.arrayBuffer\n * - length — value byte count\n * - hadUndefinedLength — always false for FMI elements (PS3.5 §7.1)\n *\n * @param {ArrayBuffer} valueAB a fresh copy of the value bytes\n * @param {number} elGroup the tag group\n * @param {number} elElement the tag element\n * @param {string} vrStr the on-wire VR string\n * @param {number} valueLength the value byte count\n * @param {Object} policy the decode policy\n * @returns {{values: any[], rawValues: any[]}}\n */\nfunction decodeFmiValue(\n valueAB,\n elGroup,\n elElement,\n vrStr,\n valueLength,\n policy\n) {\n const fakeWindow = {\n arrayBuffer: valueAB,\n baseOffset: 0,\n syntax: EXPLICIT_LITTLE_ENDIAN,\n littleEndian: true,\n implicit: false,\n decoder: null\n };\n const elLike = {\n vr: vrStr,\n tagValue: (elGroup << 16) | elElement,\n dataOffset: 0,\n length: valueLength,\n hadUndefinedLength: false\n };\n\n const vrInstance = resolveVrInstance(elLike, fakeWindow);\n return decodeElementValues(fakeWindow, elLike, vrInstance, policy);\n}\n\n// ---------------------------------------------------------------------------\n// FMI element emission\n// ---------------------------------------------------------------------------\n\n/**\n * Emit a single FMI element's events into `listener`.\n *\n * Mirrors fromPart10's `emitValues` logic:\n * - Buffer-valued VRs (OB, OW, OD, …) → startBinary / binaryFragment / endBinary\n * - Everything else → one or more value() calls\n *\n * FMI elements are never sequences (SQ) or undefined-length elements, so\n * those branches from the full emitElement are not needed here.\n */\nfunction emitFmiElement(listener, el) {\n const { tag, vrStr, length, values, rawValues } = el;\n\n const hasBuffer = values.some(\n v => v instanceof ArrayBuffer || ArrayBuffer.isView(v)\n );\n\n listener.startElement(tag, { vr: vrStr, length });\n\n if (hasBuffer) {\n listener.startBinary({ encapsulated: false });\n for (const buf of values) {\n listener.binaryFragment(buf);\n }\n listener.endBinary();\n } else {\n let index = 0;\n for (const v of values) {\n listener.value(v, { index, rawValue: rawValues[index] });\n index++;\n }\n }\n\n listener.endElement();\n}\n\n// ---------------------------------------------------------------------------\n// Input normalization\n// ---------------------------------------------------------------------------\n\n/**\n * Normalize `input` to an `AsyncIterable<Uint8Array | ArrayBuffer>`.\n *\n * Dispatch order:\n * 1. ArrayBuffer / TypedArray → single-item async iterable\n * 2. WHATWG ReadableStream → AsyncIterable (native) or reader-loop adapter\n * 3. AsyncIterable (generator, etc.) → returned as-is\n *\n * @param {*} input\n * @returns {AsyncIterable<Uint8Array|ArrayBuffer>}\n */\nfunction normalizeInput(input) {\n // Case 1: flat buffer — degenerate single-chunk\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\n return singleChunkIterable(input);\n }\n\n // Case 2: WHATWG ReadableStream\n if (isWhatwgReadableStream(input)) {\n // Modern Node (≥ 16.14) and modern browsers expose Symbol.asyncIterator\n // on ReadableStream natively — use it directly.\n if (Symbol.asyncIterator in input) {\n return input;\n }\n // Fallback for environments where ReadableStream is defined but not\n // yet AsyncIterable (older browsers, certain polyfills).\n return readableStreamToAsyncIterable(input);\n }\n\n // Case 3: AsyncIterable (async generators, Node.js streams, etc.)\n if (input != null && typeof input[Symbol.asyncIterator] === \"function\") {\n return input;\n }\n\n throw new TypeError(\n \"fromPart10Stream: `input` must be an ArrayBuffer, Uint8Array, \" +\n \"AsyncIterable<Uint8Array|ArrayBuffer>, or a WHATWG ReadableStream. \" +\n `Got: ${Object.prototype.toString.call(input)}`\n );\n}\n\n/** True if `input` is a WHATWG ReadableStream (works in browser and Node). */\nfunction isWhatwgReadableStream(input) {\n return (\n typeof ReadableStream !== \"undefined\" && input instanceof ReadableStream\n );\n}\n\n/** Single-item async iterable that yields `buffer` as a Uint8Array chunk. */\nasync function* singleChunkIterable(buffer) {\n yield buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n}\n\n/**\n * Adapter: wrap a WHATWG ReadableStream in an async generator for\n * environments where the stream does not implement Symbol.asyncIterator.\n * This is dependency-free and works in both browser and Node.\n */\nasync function* readableStreamToAsyncIterable(stream) {\n const reader = stream.getReader();\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n yield value;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Chunk helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Coerce a chunk from the async iterable to an ArrayBuffer for\n * `stream.addBuffer()`. Handles Uint8Array, Buffer (Node), other typed\n * arrays, and plain ArrayBuffers.\n *\n * @param {Uint8Array|ArrayBuffer} chunk\n * @returns {ArrayBuffer}\n */\nfunction toArrayBuffer(chunk) {\n if (chunk instanceof ArrayBuffer) return chunk;\n if (ArrayBuffer.isView(chunk)) {\n // Typed array (Uint8Array, Buffer, etc.): slice to own ArrayBuffer.\n return chunk.buffer.slice(\n chunk.byteOffset,\n chunk.byteOffset + chunk.byteLength\n );\n }\n throw new TypeError(\n `fromPart10Stream: expected Uint8Array|ArrayBuffer chunk from iterable, ` +\n `got ${Object.prototype.toString.call(chunk)}`\n );\n}\n","import { fromPart10Stream } from \"./fromPart10Stream.js\";\nexport { emitValues, emitDecodedLeaf } from \"./emit.js\";\n\n/**\n * fromPart10 — whole-buffer Part 10 bytes → event stream.\n *\n * A thin wrapper: the buffer is fed to the streaming reader as a single\n * chunk. Earlier drafts of the rewrite implemented this on a vendored\n * copy of the dicom-parser tokenizer; that package is removed from 1.0,\n * so the streaming reader's tokenizer is the only one in the library and\n * this wrapper keeps the buffered entry point working unchanged.\n *\n * @param {ArrayBuffer|ArrayBufferView} buffer - complete Part 10 bytes\n * @param {EventStreamListener} listener - the event consumer\n * @param {object} [options] - forwarded to fromPart10Stream\n */\nexport async function fromPart10(buffer, listener, options = {}) {\n const bytes =\n buffer instanceof Uint8Array\n ? buffer\n : ArrayBuffer.isView(buffer)\n ? new Uint8Array(\n buffer.buffer,\n buffer.byteOffset,\n buffer.byteLength\n )\n : new Uint8Array(buffer);\n await fromPart10Stream(bytes, listener, options);\n}\n"],"names":["lookupTagHex","isMultiVM","addAccessors","log","lookupPrivateTag","dicomJson","transferSyntaxOf","Tag","DicomMetaDictionary","ValueRepresentation","singleVRs","VM_DELIMITER","ReadBufferStream","UNDEFINED_LENGTH","resolveCharsetDecoder","DEFLATED_EXPLICIT_LITTLE_ENDIAN","EXPLICIT_BIG_ENDIAN","IMPLICIT_LITTLE_ENDIAN","EXPLICIT_LITTLE_ENDIAN","VALID_VRS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AC,MAAM,EAAE;AAClD,QAAQ,YAAY,EAAE,MAAM,CAAC;AAC7B,KAAK,CAAC;;AAEN,IAAI,OAAO;AACX,QAAQ,OAAO;AACf,QAAQ,UAAU;AAClB;AACA;AACA,QAAQ,cAAc,EAAE,MAAM;AAC9B,QAAQ,SAAS,EAAE;AACnB;AACA,YAAY,MAAM,EAAE,CAAC,YAAY,CAAC;AAClC,YAAY;AACZ;AACA,KAAK;AACL;;AChZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAsBA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,KAAK;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,KAAK;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,GAAG;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE;AAChE;AACA;AACA;AACA;AACA,IAAI,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE;AACzD,IAAI,UAAU,CAAC,WAAW,GAAG,IAAI,OAAO;AACxC,QAAQ,OAAO,KAAK,UAAU,CAAC,WAAW,GAAG,OAAO;AACpD,KAAK;AACL,IAAI,OAAO,oBAAoB,CAAC,KAAK,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