marc-ts 0.2.0 → 0.4.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.
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { n as p, t as S } from "./types-c4Mo9m9u.js";
2
- var V = 27, m = "", G = /* @__PURE__ */ new Map([
1
+ import { n as p, t as S } from "./types-BMKDHD1l.js";
2
+ import { t as Q } from "./warnings-Bt6wvWFe.js";
3
+ var ee = 27, v = "�", W = /* @__PURE__ */ new Map([
3
4
  [33, "Ł"],
4
5
  [34, "Ø"],
5
6
  [35, "Đ"],
@@ -28,7 +29,7 @@ var V = 27, m = "�", G = /* @__PURE__ */ new Map([
28
29
  [59, "ơ"],
29
30
  [60, "ư"],
30
31
  [63, "°"]
31
- ]), k = /* @__PURE__ */ new Map([
32
+ ]), G = /* @__PURE__ */ new Map([
32
33
  [96, "̉"],
33
34
  [97, "̀"],
34
35
  [98, "́"],
@@ -58,7 +59,7 @@ var V = 27, m = "�", G = /* @__PURE__ */ new Map([
58
59
  [122, "︢"],
59
60
  [123, "︣"],
60
61
  [126, "̓"]
61
- ]), X = new Map(Array.from(k.entries()).map(([e, t]) => [t, e + 128])), Q = new Map(Array.from(G.entries()).map(([e, t]) => [t, e + 128])), ee = M(65, "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ", 97, "αβγδεζηθικλμνξοπρστυφχψω"), te = M(96, "אבגדהוזחטיךכלםמןנסעףפץצקרשת"), ne = M(65, "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ", 97, "абвгдежзийклмнопрстуфхцчшщъыьэюя"), re = /* @__PURE__ */ new Map([
62
+ ]), te = new Map(Array.from(G.entries()).map(([e, t]) => [t, e + 128])), ne = new Map(Array.from(W.entries()).map(([e, t]) => [t, e + 128])), re = T(65, "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ", 97, "αβγδεζηθικλμνξοπρστυφχψω"), ie = T(96, "אבגדהוזחטיךכלםמןנסעףפץצקרשת"), se = T(65, "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ", 97, "абвгдежзийклмнопрстуфхцчшщъыьэюя"), oe = /* @__PURE__ */ new Map([
62
63
  [33, "ء"],
63
64
  [34, "آ"],
64
65
  [35, "أ"],
@@ -95,7 +96,7 @@ var V = 27, m = "�", G = /* @__PURE__ */ new Map([
95
96
  [72, "و"],
96
97
  [73, "ى"],
97
98
  [74, "ي"]
98
- ]), ie = /* @__PURE__ */ new Map([
99
+ ]), ae = /* @__PURE__ */ new Map([
99
100
  [40, "₍"],
100
101
  [41, "₎"],
101
102
  [43, "₊"],
@@ -110,7 +111,7 @@ var V = 27, m = "�", G = /* @__PURE__ */ new Map([
110
111
  [55, "₇"],
111
112
  [56, "₈"],
112
113
  [57, "₉"]
113
- ]), se = /* @__PURE__ */ new Map([
114
+ ]), ce = /* @__PURE__ */ new Map([
114
115
  [40, "⁽"],
115
116
  [41, "⁾"],
116
117
  [43, "⁺"],
@@ -126,7 +127,7 @@ var V = 27, m = "�", G = /* @__PURE__ */ new Map([
126
127
  [56, "⁸"],
127
128
  [57, "⁹"],
128
129
  [110, "ⁿ"]
129
- ]), oe = /* @__PURE__ */ new Map([
130
+ ]), le = /* @__PURE__ */ new Map([
130
131
  [2171169, "一"],
131
132
  [2171170, "丁"],
132
133
  [2171171, "七"],
@@ -161,98 +162,98 @@ var V = 27, m = "�", G = /* @__PURE__ */ new Map([
161
162
  [2171200, "丫"],
162
163
  [2171201, "中"],
163
164
  [2171202, "丰"]
164
- ]), ae = {
165
+ ]), de = {
165
166
  ascii: /* @__PURE__ */ new Map(),
166
- ansel: ce(G, k),
167
- greek: ee,
168
- hebrew: te,
169
- cyrillic: ne,
170
- arabic: re,
171
- subscript: ie,
172
- superscript: se
167
+ ansel: fe(W, G),
168
+ greek: re,
169
+ hebrew: ie,
170
+ cyrillic: se,
171
+ arabic: oe,
172
+ subscript: ae,
173
+ superscript: ce
173
174
  };
174
- function M(...e) {
175
+ function T(...e) {
175
176
  const t = /* @__PURE__ */ new Map();
176
177
  for (let n = 0; n < e.length; n += 2) {
177
- const r = e[n], i = e[n + 1];
178
- Array.from(i).forEach((s, o) => t.set(r + o, s));
178
+ const i = e[n], r = e[n + 1];
179
+ Array.from(r).forEach((s, o) => t.set(i + o, s));
179
180
  }
180
181
  return t;
181
182
  }
182
- function ce(...e) {
183
+ function fe(...e) {
183
184
  const t = /* @__PURE__ */ new Map();
184
- for (const n of e) for (const [r, i] of n) t.set(r, i);
185
+ for (const n of e) for (const [i, r] of n) t.set(i, r);
185
186
  return t;
186
187
  }
187
- function T(e) {
188
+ function M(e) {
188
189
  const t = e.codePointAt(0);
189
190
  return t >= 768 && t <= 879 || t >= 65056 && t <= 65071;
190
191
  }
191
- function N(e, t) {
192
+ function C(e, t) {
192
193
  return t ? e - 128 : e;
193
194
  }
194
- function le(e, t, n) {
195
- const r = N(e, n);
196
- return t === "ascii" ? r >= 32 && r <= 126 ? String.fromCharCode(r) : m : ae[t].get(r) ?? m;
195
+ function ue(e, t, n) {
196
+ const i = C(e, n);
197
+ return t === "ascii" ? i >= 32 && i <= 126 ? String.fromCharCode(i) : v : de[t].get(i) ?? v;
197
198
  }
198
- function de(e, t, n) {
199
+ function ge(e, t, n) {
199
200
  if (t + 2 >= e.length) return {
200
- char: m,
201
+ char: v,
201
202
  next: e.length
202
203
  };
203
- const r = N(e[t], n), i = N(e[t + 1], n), s = N(e[t + 2], n), o = r << 16 | i << 8 | s;
204
+ const i = C(e[t], n), r = C(e[t + 1], n), s = C(e[t + 2], n), o = i << 16 | r << 8 | s;
204
205
  return {
205
- char: oe.get(o) ?? m,
206
+ char: le.get(o) ?? v,
206
207
  next: t + 3
207
208
  };
208
209
  }
209
- function fe(e, t, n) {
210
+ function he(e, t, n) {
210
211
  if (t + 1 >= e.length) return {
211
- char: m,
212
+ char: v,
212
213
  next: e.length
213
214
  };
214
- const r = e[t + 1];
215
- let i, s;
216
- if (r === 40 || r === 44)
217
- i = "g0", s = t + 2;
218
- else if (r === 41 || r === 45)
219
- i = "g1", s = t + 2;
220
- else if (r === 36) {
215
+ const i = e[t + 1];
216
+ let r, s;
217
+ if (i === 40 || i === 44)
218
+ r = "g0", s = t + 2;
219
+ else if (i === 41 || i === 45)
220
+ r = "g1", s = t + 2;
221
+ else if (i === 36) {
221
222
  const l = e[t + 2];
222
223
  if (l === void 0) return {
223
- char: m,
224
+ char: v,
224
225
  next: e.length
225
226
  };
226
- l === 40 || l === 44 ? (i = "g0", s = t + 3) : l === 41 || l === 45 ? (i = "g1", s = t + 3) : (i = "g0", s = t + 2);
227
+ l === 40 || l === 44 ? (r = "g0", s = t + 3) : l === 41 || l === 45 ? (r = "g1", s = t + 3) : (r = "g0", s = t + 2);
227
228
  } else return {
228
- char: m,
229
+ char: v,
229
230
  next: t + 2
230
231
  };
231
232
  if (s >= e.length) return {
232
- char: m,
233
+ char: v,
233
234
  next: e.length
234
235
  };
235
236
  let o = e[s];
236
237
  if (o === 33) {
237
238
  if (s++, s >= e.length) return {
238
- char: m,
239
+ char: v,
239
240
  next: e.length
240
241
  };
241
242
  o = e[s];
242
243
  }
243
- const c = ge(o);
244
- return c ? {
244
+ const a = we(o);
245
+ return a ? {
245
246
  char: "",
246
- next: ue(n, i, c, s + 1)
247
+ next: pe(n, r, a, s + 1)
247
248
  } : {
248
- char: m,
249
+ char: v,
249
250
  next: s + 1
250
251
  };
251
252
  }
252
- function ue(e, t, n, r) {
253
- return e[t] = n, r;
253
+ function pe(e, t, n, i) {
254
+ return e[t] = n, i;
254
255
  }
255
- function ge(e) {
256
+ function we(e) {
256
257
  switch (e) {
257
258
  case 49:
258
259
  return "eacc";
@@ -280,344 +281,349 @@ function ge(e) {
280
281
  return;
281
282
  }
282
283
  }
283
- function he(e) {
284
+ function Ee(e) {
284
285
  const t = {
285
286
  g0: "ascii",
286
287
  g1: "ansel"
287
288
  }, n = [];
288
- let r = "", i = 0;
289
+ let i = "", r = 0;
289
290
  const s = (o) => {
290
291
  if (o) {
291
- if (T(o)) {
292
- r += o;
292
+ if (M(o)) {
293
+ i += o;
293
294
  return;
294
295
  }
295
- n.push(o + r), r = "";
296
+ n.push(o + i), i = "";
296
297
  }
297
298
  };
298
- for (; i < e.length; ) {
299
- const o = e[i];
300
- if (o === V) {
301
- const d = fe(e, i, t);
302
- s(d.char), i = d.next;
299
+ for (; r < e.length; ) {
300
+ const o = e[r];
301
+ if (o === ee) {
302
+ const d = he(e, r, t);
303
+ s(d.char), r = d.next;
303
304
  continue;
304
305
  }
305
306
  if (o < 32) {
306
- s(String.fromCharCode(o)), i++;
307
+ s(String.fromCharCode(o)), r++;
307
308
  continue;
308
309
  }
309
- const c = o >= 160, l = c ? t.g1 : t.g0;
310
+ const a = o >= 160, l = a ? t.g1 : t.g0;
310
311
  if (l === "eacc") {
311
- const d = de(e, i, c);
312
- s(d.char), i = d.next;
312
+ const d = ge(e, r, a);
313
+ s(d.char), r = d.next;
313
314
  continue;
314
315
  }
315
- s(le(o, l, c)), i++;
316
+ s(ue(o, l, a)), r++;
316
317
  }
317
- return r && n.push(r), n.join("");
318
+ return i && n.push(i), n.join("");
318
319
  }
319
- function De(e) {
320
- return W(e).bytes;
320
+ function Ue(e) {
321
+ return k(e).bytes;
321
322
  }
322
- function W(e) {
323
+ function k(e) {
323
324
  const t = e.normalize("NFD"), n = [];
324
- let r = 0, i = 0;
325
- for (; i < t.length; ) {
326
- const s = t.codePointAt(i), o = t[i];
327
- if (T(o)) {
328
- n.push(63), r++, i++;
325
+ let i = 0, r = 0;
326
+ for (; r < t.length; ) {
327
+ const s = t.codePointAt(r), o = t[r];
328
+ if (M(o)) {
329
+ n.push(63), i++, r++;
329
330
  continue;
330
331
  }
331
- let c = i + (s > 65535 ? 2 : 1);
332
+ let a = r + (s > 65535 ? 2 : 1);
332
333
  const l = [];
333
- for (; c < t.length && T(t[c]); ) {
334
- const d = X.get(t[c]);
335
- d !== void 0 ? l.push(d) : (l.push(63), r++), c++;
334
+ for (; a < t.length && M(t[a]); ) {
335
+ const d = te.get(t[a]);
336
+ d !== void 0 ? l.push(d) : (l.push(63), i++), a++;
336
337
  }
337
338
  if (n.push(...l), s < 128) n.push(s);
338
339
  else {
339
- const d = Q.get(o);
340
- d !== void 0 ? n.push(d) : (n.push(63), r++);
340
+ const d = ne.get(o);
341
+ d !== void 0 ? n.push(d) : (n.push(63), i++);
341
342
  }
342
- i = c;
343
+ r = a;
343
344
  }
344
345
  return {
345
346
  bytes: new Uint8Array(n),
346
- lossyCount: r
347
+ lossyCount: i
347
348
  };
348
349
  }
349
- var D = 31, H = 30, y = 24, C = 12, _ = 3, U = 4, F = new TextDecoder("utf-8", { fatal: !1 });
350
- function J(e) {
351
- return F.decode(e);
350
+ var U = 31, z = 30, _ = 24, I = 12, B = 3, x = new TextDecoder("utf-8", { fatal: !1 });
351
+ function H(e) {
352
+ return x.decode(e);
352
353
  }
353
- function j(e, t = 16) {
354
- const n = e.slice(0, t), r = Array.from(n, (i) => i.toString(16).padStart(2, "0")).join(" ");
355
- return e.length > t ? `${r} … (${e.length} bytes)` : r;
354
+ function J(e, t = 16) {
355
+ const n = e.slice(0, t), i = Array.from(n, (r) => r.toString(16).padStart(2, "0")).join(" ");
356
+ return e.length > t ? `${i} … (${e.length} bytes)` : i;
356
357
  }
357
- function O(e, t = {}) {
358
- const n = t.strict ?? !1, r = t.maxWarnings ?? 100, i = [];
359
- if (e.length < y + 1) {
360
- const a = g("truncated_record", `Record too short: ${e.length} bytes`);
361
- if (n) throw new Error(a.message);
362
- return i.push(a), {
358
+ function N(e, t = {}) {
359
+ const n = t.strict ?? !1, i = t.maxWarnings ?? 100, r = [];
360
+ if (e.length < 25) {
361
+ const c = u("truncated_record", `Record too short: ${e.length} bytes`);
362
+ if (n) throw new Error(c.message);
363
+ return r.push(c), {
363
364
  record: null,
364
- warnings: i
365
+ warnings: r
365
366
  };
366
367
  }
367
- const s = we(e);
368
- if (!Ee(s, i, n) && (n || i.length >= r))
368
+ const s = me(e);
369
+ if (!ve(s, r, n) && (n || r.length >= i))
369
370
  return {
370
371
  record: null,
371
- warnings: i
372
+ warnings: r
372
373
  };
373
374
  const o = parseInt(s.substring(0, 5), 10);
374
375
  if (isNaN(o) || o > e.length) {
375
- const a = g("invalid_leader", `Invalid record length in leader: ${s.substring(0, 5)}`);
376
- if (n) throw new Error(a.message);
377
- i.push(a);
376
+ const c = u("invalid_leader", `Invalid record length in leader: ${s.substring(0, 5)}`);
377
+ if (n) throw new Error(c.message);
378
+ r.push(c);
378
379
  } else if (o < e.length) {
379
- const a = g("truncated_record", `Buffer is longer than the record length declared in the leader: leader says ${o}, buffer is ${e.length} bytes. Trailing bytes ignored (likely a concatenated stream — split on 0x1D first).`);
380
- if (n) throw new Error(a.message);
381
- i.push(a), e = e.slice(0, o);
382
- }
383
- const c = parseInt(s.substring(12, 17), 10);
384
- if (isNaN(c)) {
385
- const a = g("invalid_leader", `Invalid base address in leader: ${s.substring(12, 17)}`);
386
- if (n) throw new Error(a.message);
387
- return i.push(a), {
380
+ const c = u("truncated_record", `Buffer is longer than the record length declared in the leader: leader says ${o}, buffer is ${e.length} bytes. Trailing bytes ignored (likely a concatenated stream — split on 0x1D first).`);
381
+ if (n) throw new Error(c.message);
382
+ r.push(c), e = e.slice(0, o);
383
+ }
384
+ const a = parseInt(s.substring(12, 17), 10);
385
+ if (isNaN(a)) {
386
+ const c = u("invalid_leader", `Invalid base address in leader: ${s.substring(12, 17)}`);
387
+ if (n) throw new Error(c.message);
388
+ return r.push(c), {
388
389
  record: null,
389
- warnings: i
390
+ warnings: r
390
391
  };
391
392
  }
392
- const l = y, d = e.indexOf(H, l);
393
+ const l = _, d = e.indexOf(z, l);
393
394
  if (d === -1) {
394
- const a = g("invalid_directory", "Directory terminator not found");
395
- if (n) throw new Error(a.message);
396
- return i.push(a), {
395
+ const c = u("invalid_directory", "Directory terminator not found");
396
+ if (n) throw new Error(c.message);
397
+ return r.push(c), {
397
398
  record: null,
398
- warnings: i
399
+ warnings: r
399
400
  };
400
401
  }
401
- const u = ve(e.slice(l, d), i, n, r);
402
- if (u.length === 0) {
403
- const a = g("invalid_directory", "No directory entries found");
404
- if (n) throw new Error(a.message);
405
- return i.push(a), {
402
+ const g = Se(e.slice(l, d), r, n, i);
403
+ if (g.length === 0) {
404
+ const c = u("invalid_directory", "No directory entries found");
405
+ if (n) throw new Error(c.message);
406
+ return r.push(c), {
406
407
  record: null,
407
- warnings: i
408
+ warnings: r
408
409
  };
409
410
  }
410
411
  const f = s[9] === " ";
411
412
  if (s[9] !== " " && s[9] !== "a") {
412
- const a = g("invalid_leader", `Leader position 9 (encoding flag) is '${s[9]}'; expected 'a' (UTF-8) or ' ' (MARC-8). Defaulting to UTF-8.`);
413
- if (n) throw new Error(a.message);
414
- i.push(a);
413
+ const c = u("invalid_leader", `Leader position 9 (encoding flag) is '${s[9]}'; expected 'a' (UTF-8) or ' ' (MARC-8). Defaulting to UTF-8.`);
414
+ if (n) throw new Error(c.message);
415
+ r.push(c);
415
416
  }
416
417
  return {
417
418
  record: {
418
419
  leader: s,
419
- fields: me(e, u, c, f ? he : (a) => F.decode(a), i, n, r)
420
+ fields: be(e, g, a, f ? Ee : (c) => x.decode(c), r, n, i)
420
421
  },
421
- warnings: i
422
+ warnings: r
422
423
  };
423
424
  }
424
- var pe = 29;
425
- function Ue(e, t) {
425
+ var j = 29;
426
+ function Be(e, t) {
426
427
  const n = [];
427
- let r = 0;
428
- for (let i = 0; i < e.length; i++) if (e[i] === pe) {
429
- const s = e.slice(r, i + 1);
428
+ let i = 0;
429
+ for (let r = 0; r < e.length; r++) if (e[r] === j) {
430
+ const s = e.slice(i, r + 1);
430
431
  if (s.length > 0) {
431
- const o = O(s, t);
432
+ const o = N(s, t);
432
433
  o.record && n.push(o.record);
433
434
  }
434
- r = i + 1;
435
+ i = r + 1;
435
436
  }
436
- if (r < e.length) {
437
- const i = O(e.slice(r), t);
438
- i.record && n.push(i.record);
437
+ if (i < e.length) {
438
+ const r = N(e.slice(i), t);
439
+ r.record && n.push(r.record);
439
440
  }
440
441
  return n;
441
442
  }
442
- function we(e) {
443
- const t = e.slice(0, y);
444
- return F.decode(t);
443
+ function Oe(e, t) {
444
+ const n = [];
445
+ let i = 0;
446
+ for (let r = 0; r < e.length; r++) if (e[r] === j) {
447
+ const s = e.slice(i, r + 1);
448
+ s.length > 0 && n.push(N(s, t)), i = r + 1;
449
+ }
450
+ if (i < e.length) {
451
+ const r = e.slice(i);
452
+ n.push(N(r, t));
453
+ }
454
+ return { results: n };
455
+ }
456
+ function me(e) {
457
+ const t = e.slice(0, _);
458
+ return x.decode(t);
445
459
  }
446
- function Ee(e, t, n) {
447
- if (e.length !== y) {
448
- const r = g("invalid_leader", `Leader length is ${e.length}, expected ${y}`);
449
- if (n) throw new Error(r.message);
450
- return t.push(r), !1;
460
+ function ve(e, t, n) {
461
+ if (e.length !== _) {
462
+ const i = u("invalid_leader", `Leader length is ${e.length}, expected ${_}`);
463
+ if (n) throw new Error(i.message);
464
+ return t.push(i), !1;
451
465
  }
452
466
  if (e[10] !== "2") {
453
- const r = g("invalid_leader", `Leader position 10 (indicator count) is '${e[10]}', expected '2'`);
454
- t.push(r);
467
+ const i = u("invalid_leader", `Leader position 10 (indicator count) is '${e[10]}', expected '2'`);
468
+ t.push(i);
455
469
  }
456
470
  if (e[11] !== "2") {
457
- const r = g("invalid_leader", `Leader position 11 (subfield code length) is '${e[11]}', expected '2'`);
458
- t.push(r);
471
+ const i = u("invalid_leader", `Leader position 11 (subfield code length) is '${e[11]}', expected '2'`);
472
+ t.push(i);
459
473
  }
460
474
  return !0;
461
475
  }
462
- function ve(e, t, n, r) {
463
- const i = [];
464
- for (let s = 0; s < e.length; s += C) {
465
- if (t.length >= r) {
466
- t.push(g("truncated_record", `Directory parsing halted after reaching maxWarnings limit (${r}); remaining ${e.length - s} bytes of directory not parsed.`));
476
+ function Se(e, t, n, i) {
477
+ const r = [];
478
+ for (let s = 0; s < e.length; s += I) {
479
+ if (t.length >= i) {
480
+ t.push(u("truncated_record", `Directory parsing halted after reaching maxWarnings limit (${i}); remaining ${e.length - s} bytes of directory not parsed.`));
467
481
  break;
468
482
  }
469
- if (s + C > e.length) break;
470
- const o = e.slice(s, s + C), c = F.decode(o), l = c.substring(0, _), d = c.substring(_, _ + U), u = c.substring(_ + U, C), f = parseInt(d, 10), a = parseInt(u, 10);
471
- if (isNaN(f) || isNaN(a)) {
472
- const w = g("invalid_directory", `Invalid directory entry for tag ${l}: length=${d}, position=${u}`);
483
+ if (s + I > e.length) break;
484
+ const o = e.slice(s, s + I), a = x.decode(o), l = a.substring(0, B), d = a.substring(B, 7), g = a.substring(7, I), f = parseInt(d, 10), c = parseInt(g, 10);
485
+ if (isNaN(f) || isNaN(c)) {
486
+ const w = u("invalid_directory", `Invalid directory entry for tag ${l}: length=${d}, position=${g}`);
473
487
  if (n) throw new Error(w.message);
474
488
  t.push(w);
475
489
  continue;
476
490
  }
477
- i.push({
491
+ r.push({
478
492
  tag: l,
479
493
  fieldLength: f,
480
- startingPosition: a
494
+ startingPosition: c
481
495
  });
482
496
  }
483
- return i;
497
+ return r;
484
498
  }
485
- function me(e, t, n, r, i, s, o) {
486
- const c = [];
499
+ function be(e, t, n, i, r, s, o) {
500
+ const a = [];
487
501
  for (const l of t) {
488
- if (i.length >= o) {
489
- i.push(g("truncated_record", `Field parsing halted after reaching maxWarnings limit (${o}); not all directory entries were processed.`, void 0, l.tag));
502
+ if (r.length >= o) {
503
+ r.push(u("truncated_record", `Field parsing halted after reaching maxWarnings limit (${o}); not all directory entries were processed.`, void 0, l.tag));
490
504
  break;
491
505
  }
492
- const d = n + l.startingPosition, u = d + l.fieldLength - 1;
493
- if (d >= e.length || u > e.length) {
494
- const a = g("invalid_field", `Field ${l.tag} out of bounds: start=${d}, end=${u}, buffer length=${e.length}`, d, l.tag);
495
- if (s) throw new Error(a.message);
496
- i.push(a);
506
+ const d = n + l.startingPosition, g = d + l.fieldLength - 1;
507
+ if (d >= e.length || g > e.length) {
508
+ const c = u("invalid_field", `Field ${l.tag} out of bounds: start=${d}, end=${g}, buffer length=${e.length}`, d, l.tag);
509
+ if (s) throw new Error(c.message);
510
+ r.push(c);
497
511
  continue;
498
512
  }
499
513
  let f;
500
- if (e[u] !== H) {
501
- const a = g("invalid_field", `Field ${l.tag} does not end with a field terminator at byte ${u} (found 0x${(e[u] ?? 0).toString(16).padStart(2, "0")}); using the full declared length without stripping a terminator byte.`, d, l.tag);
502
- if (s) throw new Error(a.message);
503
- i.push(a), f = e.slice(d, d + l.fieldLength);
504
- } else f = e.slice(d, u);
514
+ if (e[g] !== z) {
515
+ const c = u("invalid_field", `Field ${l.tag} does not end with a field terminator at byte ${g} (found 0x${(e[g] ?? 0).toString(16).padStart(2, "0")}); using the full declared length without stripping a terminator byte.`, d, l.tag);
516
+ if (s) throw new Error(c.message);
517
+ r.push(c), f = e.slice(d, d + l.fieldLength);
518
+ } else f = e.slice(d, g);
505
519
  if (l.tag.startsWith("00")) {
506
520
  try {
507
- const a = r(f);
508
- c.push({
521
+ const c = i(f);
522
+ a.push({
509
523
  tag: l.tag,
510
- data: a
524
+ data: c
511
525
  });
512
- } catch (a) {
513
- const w = g("encoding_error", `Failed to decode control field ${l.tag}: ${a instanceof Error ? a.message : String(a)}. Raw bytes (hex): ${j(f)}.`, d, l.tag);
526
+ } catch (c) {
527
+ const w = u("encoding_error", `Failed to decode control field ${l.tag}: ${c instanceof Error ? c.message : String(c)}. Raw bytes (hex): ${J(f)}.`, d, l.tag);
514
528
  if (s) throw new Error(w.message);
515
- i.push(w), c.push({
529
+ r.push(w), a.push({
516
530
  tag: l.tag,
517
- data: J(f)
531
+ data: H(f)
518
532
  });
519
533
  }
520
534
  continue;
521
535
  }
522
536
  if (f.length < 2) {
523
- const a = g("invalid_field", `Data field ${l.tag} too short for indicators: ${f.length} bytes`, d, l.tag);
524
- if (s) throw new Error(a.message);
525
- i.push(a);
537
+ const c = u("invalid_field", `Data field ${l.tag} too short for indicators: ${f.length} bytes`, d, l.tag);
538
+ if (s) throw new Error(c.message);
539
+ r.push(c);
526
540
  continue;
527
541
  }
528
542
  try {
529
- const a = String.fromCharCode(f[0] ?? 0), w = String.fromCharCode(f[1] ?? 0), I = Se(f.slice(2), r, l.tag, i, s, o);
530
- c.push({
543
+ const c = String.fromCharCode(f[0] ?? 0), w = String.fromCharCode(f[1] ?? 0), A = ye(f.slice(2), i, l.tag, r, s, o);
544
+ a.push({
531
545
  tag: l.tag,
532
- indicator1: a,
546
+ indicator1: c,
533
547
  indicator2: w,
534
- subfields: I
548
+ subfields: A
535
549
  });
536
- } catch (a) {
537
- const w = g("invalid_field", `Failed to parse data field ${l.tag}: ${a instanceof Error ? a.message : String(a)}`, d, l.tag);
550
+ } catch (c) {
551
+ const w = u("invalid_field", `Failed to parse data field ${l.tag}: ${c instanceof Error ? c.message : String(c)}`, d, l.tag);
538
552
  if (s) throw new Error(w.message);
539
- i.push(w);
553
+ r.push(w);
540
554
  }
541
555
  }
542
- return c;
556
+ return a;
543
557
  }
544
- function Se(e, t, n, r, i, s) {
558
+ function ye(e, t, n, i, r, s) {
545
559
  const o = [];
546
- let c = 0;
547
- for (; c < e.length; ) {
548
- if (r.length >= s) {
549
- r.push(g("truncated_record", `Subfield parsing halted after reaching maxWarnings limit (${s}) in field ${n}; not all subfields were processed.`, void 0, n));
560
+ let a = 0;
561
+ for (; a < e.length; ) {
562
+ if (i.length >= s) {
563
+ i.push(u("truncated_record", `Subfield parsing halted after reaching maxWarnings limit (${s}) in field ${n}; not all subfields were processed.`, void 0, n));
550
564
  break;
551
565
  }
552
- if (e[c] !== D) {
553
- const f = g("invalid_field", `Expected subfield delimiter in field ${n} at position ${c}`, void 0, n);
554
- if (i) throw new Error(f.message);
555
- r.push(f);
566
+ if (e[a] !== U) {
567
+ const f = u("invalid_field", `Expected subfield delimiter in field ${n} at position ${a}`, void 0, n);
568
+ if (r) throw new Error(f.message);
569
+ i.push(f);
556
570
  break;
557
571
  }
558
- if (c++, c >= e.length) break;
559
- const l = String.fromCharCode(e[c] ?? 0);
560
- c++;
561
- const d = c;
562
- for (; c < e.length && e[c] !== D; ) c++;
563
- const u = e.slice(d, c);
572
+ if (a++, a >= e.length) break;
573
+ const l = String.fromCharCode(e[a] ?? 0);
574
+ a++;
575
+ const d = a;
576
+ for (; a < e.length && e[a] !== U; ) a++;
577
+ const g = e.slice(d, a);
564
578
  try {
565
- const f = t(u);
579
+ const f = t(g);
566
580
  o.push({
567
581
  code: l,
568
582
  value: f
569
583
  });
570
584
  } catch (f) {
571
- const a = g("encoding_error", `Failed to decode subfield ${n}$${l}: ${f instanceof Error ? f.message : String(f)}. Raw bytes (hex): ${j(u)}.`, void 0, n);
572
- if (i) throw new Error(a.message);
573
- r.push(a), o.push({
585
+ const c = u("encoding_error", `Failed to decode subfield ${n}$${l}: ${f instanceof Error ? f.message : String(f)}. Raw bytes (hex): ${J(g)}.`, void 0, n);
586
+ if (r) throw new Error(c.message);
587
+ i.push(c), o.push({
574
588
  code: l,
575
- value: J(u)
589
+ value: H(g)
576
590
  });
577
591
  }
578
592
  }
579
593
  return o;
580
594
  }
581
- function g(e, t, n, r) {
582
- return {
583
- type: e,
584
- message: t,
585
- position: n,
586
- tag: r
587
- };
588
- }
589
- function be(e, t, n, r) {
595
+ function u(e, t, n, i) {
590
596
  return {
591
597
  type: e,
592
598
  message: t,
593
599
  position: n,
594
- tag: r
600
+ tag: i
595
601
  };
596
602
  }
597
- var $e = 31, B = 30, Ae = 29, R = 24, ye = 3, Ie = 4, Ce = 5;
598
- function _e(e, t = {}) {
599
- return Ne(e, t).bytes;
600
- }
603
+ var $e = 31, O = 30, Ae = 29, R = 24, Ie = 3, Ce = 4, _e = 5;
601
604
  function Ne(e, t = {}) {
605
+ return Y(e, t).bytes;
606
+ }
607
+ function Y(e, t = {}) {
602
608
  Re(e);
603
- const n = [], r = t.encoding === "marc8", i = new TextEncoder(), s = r ? (E, b) => {
604
- const $ = W(E);
605
- return $.lossyCount > 0 && n.push(be("encoding_error", `MARC-8 encoding substituted ${$.lossyCount} character(s) with '?' because they have no MARC-8 equivalent.`, void 0, b)), $.bytes;
606
- } : (E) => i.encode(E), o = [], c = [];
607
- let l = 0;
609
+ const n = [], i = t.maxWarnings ?? 100, r = t.encoding === "marc8", s = new TextEncoder(), o = r ? (E, b) => {
610
+ const y = k(E);
611
+ return y.lossyCount > 0 && n.length < i && n.push(Q("encoding_error", `MARC-8 encoding substituted ${y.lossyCount} character(s) with '?' because they have no MARC-8 equivalent.`, void 0, b)), y.bytes;
612
+ } : (E) => s.encode(E), a = [], l = [];
613
+ let d = 0;
608
614
  for (const E of e.fields) {
609
- const b = Fe(E, (K) => s(K, E.tag)), $ = b.length + 1, Z = E.tag.padEnd(ye, " ") + $.toString().padStart(Ie, "0") + l.toString().padStart(Ce, "0");
610
- o.push(Z), c.push(b), c.push(new Uint8Array([B])), l += $;
611
- }
612
- const d = i.encode(o.join("")), u = new Uint8Array(d.length + 1);
613
- u.set(d), u[d.length] = B;
614
- const f = R + u.length, a = c.reduce((E, b) => E + b.length, 0), w = new Uint8Array(a);
615
- let I = 0;
616
- for (const E of c)
617
- w.set(E, I), I += E.length;
618
- const x = f + a + 1, q = xe(e.leader, x, f, r), A = new Uint8Array(x);
619
- return A.set(i.encode(q), 0), A.set(u, R), A.set(w, f), A[x - 1] = Ae, {
620
- bytes: A,
615
+ const b = xe(E, (X) => o(X, E.tag)), y = b.length + 1, V = E.tag.padEnd(Ie, " ") + y.toString().padStart(Ce, "0") + d.toString().padStart(_e, "0");
616
+ a.push(V), l.push(b), l.push(new Uint8Array([O])), d += y;
617
+ }
618
+ const g = s.encode(a.join("")), f = new Uint8Array(g.length + 1);
619
+ f.set(g), f[g.length] = O;
620
+ const c = R + f.length, w = l.reduce((E, b) => E + b.length, 0), A = new Uint8Array(w);
621
+ let D = 0;
622
+ for (const E of l)
623
+ A.set(E, D), D += E.length;
624
+ const F = c + w + 1, K = Fe(e.leader, F, c, r), $ = new Uint8Array(F);
625
+ return $.set(s.encode(K), 0), $.set(f, R), $.set(A, c), $[F - 1] = Ae, {
626
+ bytes: $,
621
627
  warnings: n
622
628
  };
623
629
  }
@@ -640,189 +646,204 @@ function Re(e) {
640
646
  }
641
647
  }
642
648
  }
643
- function Fe(e, t) {
649
+ function xe(e, t) {
644
650
  if (S(e)) return t(e.data);
645
651
  const n = [new Uint8Array([e.indicator1.charCodeAt(0), e.indicator2.charCodeAt(0)])];
646
652
  for (const o of e.subfields) {
647
- const c = new Uint8Array([$e, o.code.charCodeAt(0)]);
648
- n.push(c, t(o.value));
653
+ const a = new Uint8Array([$e, o.code.charCodeAt(0)]);
654
+ n.push(a, t(o.value));
649
655
  }
650
- const r = n.reduce((o, c) => o + c.length, 0), i = new Uint8Array(r);
656
+ const i = n.reduce((o, a) => o + a.length, 0), r = new Uint8Array(i);
651
657
  let s = 0;
652
658
  for (const o of n)
653
- i.set(o, s), s += o.length;
654
- return i;
659
+ r.set(o, s), s += o.length;
660
+ return r;
655
661
  }
656
- function xe(e, t, n, r) {
657
- let i = e.padEnd(R, " ").substring(0, R);
662
+ function Fe(e, t, n, i) {
663
+ let r = e.padEnd(R, " ").substring(0, R);
658
664
  const s = t.toString().padStart(5, "0");
659
665
  if (s.length > 5) throw new Error(`Record length ${t} exceeds maximum (99999)`);
660
- i = s + i.substring(5);
666
+ r = s + r.substring(5);
661
667
  const o = n.toString().padStart(5, "0");
662
668
  if (o.length > 5) throw new Error(`Base address ${n} exceeds maximum (99999)`);
663
- return i = i.substring(0, 12) + o + i.substring(17), i = i.substring(0, 9) + (r ? " " : "a") + i.substring(10), i;
669
+ return r = r.substring(0, 12) + o + r.substring(17), r = r.substring(0, 9) + (i ? " " : "a") + r.substring(10), r;
664
670
  }
665
- function Oe(e, t = {}) {
666
- const n = e.map((o) => _e(o, t)), r = n.reduce((o, c) => o + c.length, 0), i = new Uint8Array(r);
671
+ function Pe(e, t = {}) {
672
+ const n = e.map((o) => Ne(o, t)), i = n.reduce((o, a) => o + a.length, 0), r = new Uint8Array(i);
667
673
  let s = 0;
668
674
  for (const o of n)
669
- i.set(o, s), s += o.length;
670
- return i;
675
+ r.set(o, s), s += o.length;
676
+ return r;
677
+ }
678
+ function We(e, t = {}) {
679
+ const n = [], i = [];
680
+ for (const a of e) {
681
+ const l = Y(a, t);
682
+ n.push(l), i.push(l.bytes);
683
+ }
684
+ const r = i.reduce((a, l) => a + l.length, 0), s = new Uint8Array(r);
685
+ let o = 0;
686
+ for (const a of i)
687
+ s.set(a, o), o += a.length;
688
+ return {
689
+ bytes: s,
690
+ results: n
691
+ };
671
692
  }
672
- function v(e, t) {
693
+ function m(e, t) {
673
694
  return e.fields.find((n) => n.tag === t);
674
695
  }
675
- function Be(e, t) {
696
+ function Ge(e, t) {
676
697
  return e.fields.filter((n) => n.tag === t);
677
698
  }
678
699
  function h(e, t) {
679
700
  return e.subfields.find((n) => n.code === t)?.value;
680
701
  }
681
- function Pe(e, t) {
702
+ function ke(e, t) {
682
703
  return e.subfields.filter((n) => n.code === t).map((n) => n.value);
683
704
  }
684
- function Ge(e) {
705
+ function ze(e) {
685
706
  return e.subfields.map((t) => ({
686
707
  code: t.code,
687
708
  value: t.value
688
709
  }));
689
710
  }
690
- function ke(e) {
691
- const t = v(e, "245");
711
+ function He(e) {
712
+ const t = m(e, "245");
692
713
  if (!t || !p(t)) return;
693
- const n = h(t, "a") ?? "", r = h(t, "b") ?? "";
694
- return (n + " " + r).trim() || void 0;
714
+ const n = h(t, "a") ?? "", i = h(t, "b") ?? "";
715
+ return (n + " " + i).trim() || void 0;
695
716
  }
696
- function We(e) {
697
- const t = v(e, "245");
717
+ function Je(e) {
718
+ const t = m(e, "245");
698
719
  if (!(!t || !p(t)))
699
720
  return h(t, "a");
700
721
  }
701
- function He(e) {
702
- const t = v(e, "100");
722
+ function je(e) {
723
+ const t = m(e, "100");
703
724
  if (t && p(t)) return h(t, "a");
704
- const n = v(e, "110");
725
+ const n = m(e, "110");
705
726
  if (n && p(n)) return h(n, "a");
706
727
  }
707
- function Je(e) {
708
- const t = v(e, "250");
728
+ function Ye(e) {
729
+ const t = m(e, "250");
709
730
  if (!(!t || !p(t)))
710
731
  return h(t, "a");
711
732
  }
712
- function je(e) {
713
- const t = v(e, "264");
733
+ function qe(e) {
734
+ const t = m(e, "264");
714
735
  if (t && p(t)) {
715
- const r = h(t, "b");
716
- if (r) return r;
736
+ const i = h(t, "b");
737
+ if (i) return i;
717
738
  }
718
- const n = v(e, "260");
739
+ const n = m(e, "260");
719
740
  if (n && p(n)) return h(n, "b");
720
741
  }
721
- function ze(e) {
722
- const t = v(e, "264");
742
+ function Ze(e) {
743
+ const t = m(e, "264");
723
744
  if (t && p(t)) {
724
- const r = h(t, "c");
725
- if (r) return r;
745
+ const i = h(t, "c");
746
+ if (i) return i;
726
747
  }
727
- const n = v(e, "260");
748
+ const n = m(e, "260");
728
749
  if (n && p(n)) return h(n, "c");
729
750
  }
730
- function Ye(e) {
751
+ function Ke(e) {
731
752
  const t = [];
732
753
  for (const n of e.fields) if (n.tag === "020" && p(n)) {
733
- const r = h(n, "a");
734
- r && t.push(r);
754
+ const i = h(n, "a");
755
+ i && t.push(i);
735
756
  }
736
757
  return t;
737
758
  }
738
- function qe(e) {
739
- const t = v(e, "022");
759
+ function Ve(e) {
760
+ const t = m(e, "022");
740
761
  if (!(!t || !p(t)))
741
762
  return h(t, "a");
742
763
  }
743
- function Ze(e) {
744
- const t = v(e, "010");
764
+ function Xe(e) {
765
+ const t = m(e, "010");
745
766
  if (!(!t || !p(t)))
746
767
  return h(t, "a");
747
768
  }
748
- function Ke(e) {
769
+ function Qe(e) {
749
770
  const t = [];
750
771
  for (const n of e.fields) if (n.tag.startsWith("6") && p(n)) {
751
- const r = h(n, "a");
752
- r && t.push(r);
772
+ const i = h(n, "a");
773
+ i && t.push(i);
753
774
  }
754
775
  return t;
755
776
  }
756
- function Ve(e) {
757
- const t = v(e, "490");
777
+ function et(e) {
778
+ const t = m(e, "490");
758
779
  if (!(!t || !p(t)))
759
780
  return h(t, "a");
760
781
  }
761
- function z(e, t) {
782
+ function q(e, t) {
762
783
  if (e.length !== 3 || t.length !== 3) return !1;
763
784
  for (let n = 0; n < 3; n++) {
764
- const r = t[n], i = e[n];
765
- if (r === "." || r?.toUpperCase() === "X") {
766
- if (i && !/\d/.test(i)) return !1;
785
+ const i = t[n], r = e[n];
786
+ if (i === "." || i?.toUpperCase() === "X") {
787
+ if (r && !/\d/.test(r)) return !1;
767
788
  continue;
768
789
  }
769
- if (r !== i) return !1;
790
+ if (i !== r) return !1;
770
791
  }
771
792
  return !0;
772
793
  }
773
- function Xe(e, t) {
774
- return e.fields.filter((n) => z(n.tag, t));
794
+ function tt(e, t) {
795
+ return e.fields.filter((n) => q(n.tag, t));
775
796
  }
776
- function Qe(e, t) {
777
- return e.fields.find((n) => z(n.tag, t));
797
+ function nt(e, t) {
798
+ return e.fields.find((n) => q(n.tag, t));
778
799
  }
779
- function Y(e, t) {
800
+ function Z(e, t) {
780
801
  return {
781
802
  ...e,
782
803
  fields: [...e.fields, t]
783
804
  };
784
805
  }
785
- function et(e, t, n) {
786
- const r = e.fields.findIndex((s) => s.tag === t);
787
- if (r === -1) return Y(e, n);
788
- const i = Array.from(e.fields);
789
- return i.splice(r, 0, n), {
806
+ function rt(e, t, n) {
807
+ const i = e.fields.findIndex((s) => s.tag === t);
808
+ if (i === -1) return Z(e, n);
809
+ const r = Array.from(e.fields);
810
+ return r.splice(i, 0, n), {
790
811
  ...e,
791
- fields: i
812
+ fields: r
792
813
  };
793
814
  }
794
- function tt(e, t, n) {
795
- const r = e.fields.findIndex((s) => s.tag === t);
796
- if (r === -1) return Y(e, n);
797
- const i = Array.from(e.fields);
798
- return i.splice(r + 1, 0, n), {
815
+ function it(e, t, n) {
816
+ const i = e.fields.findIndex((s) => s.tag === t);
817
+ if (i === -1) return Z(e, n);
818
+ const r = Array.from(e.fields);
819
+ return r.splice(i + 1, 0, n), {
799
820
  ...e,
800
- fields: i
821
+ fields: r
801
822
  };
802
823
  }
803
- function nt(e, t) {
824
+ function st(e, t) {
804
825
  const n = parseInt(t.tag, 10);
805
- let r = e.fields.length;
826
+ let i = e.fields.length;
806
827
  for (let s = 0; s < e.fields.length; s++) {
807
828
  const o = e.fields[s];
808
829
  if (o && parseInt(o.tag, 10) > n) {
809
- r = s;
830
+ i = s;
810
831
  break;
811
832
  }
812
833
  }
813
- const i = Array.from(e.fields);
814
- return i.splice(r, 0, t), {
834
+ const r = Array.from(e.fields);
835
+ return r.splice(i, 0, t), {
815
836
  ...e,
816
- fields: i
837
+ fields: r
817
838
  };
818
839
  }
819
- function rt(e, t) {
840
+ function ot(e, t) {
820
841
  return {
821
842
  ...e,
822
843
  fields: e.fields.filter((n) => n.tag !== t)
823
844
  };
824
845
  }
825
- function it(e, t) {
846
+ function at(e, t) {
826
847
  return {
827
848
  ...e,
828
849
  fields: e.fields.filter((n) => n !== t)
@@ -837,46 +858,46 @@ function Le(e, t, n) {
837
858
  }]
838
859
  };
839
860
  }
840
- function st(e, t) {
861
+ function ct(e, t) {
841
862
  return {
842
863
  ...e,
843
864
  subfields: e.subfields.filter((n) => n.code !== t)
844
865
  };
845
866
  }
846
- function ot(e, t, n) {
847
- const r = e.subfields.findIndex((s) => s.code === t);
848
- if (r === -1) return Le(e, t, n);
849
- const i = [...e.subfields];
850
- return i[r] = {
867
+ function lt(e, t, n) {
868
+ const i = e.subfields.findIndex((s) => s.code === t);
869
+ if (i === -1) return Le(e, t, n);
870
+ const r = [...e.subfields];
871
+ return r[i] = {
851
872
  code: t,
852
873
  value: n
853
874
  }, {
854
875
  ...e,
855
- subfields: i
876
+ subfields: r
856
877
  };
857
878
  }
858
- function at(e) {
879
+ function dt(e) {
859
880
  const t = new Array(e.fields.length);
860
881
  for (let n = 0; n < e.fields.length; n++) {
861
- const r = e.fields[n];
862
- if (S(r)) t[n] = {
863
- tag: r.tag,
864
- data: r.data
882
+ const i = e.fields[n];
883
+ if (S(i)) t[n] = {
884
+ tag: i.tag,
885
+ data: i.data
865
886
  };
866
887
  else {
867
- const i = new Array(r.subfields.length);
868
- for (let s = 0; s < r.subfields.length; s++) {
869
- const o = r.subfields[s];
870
- i[s] = {
888
+ const r = new Array(i.subfields.length);
889
+ for (let s = 0; s < i.subfields.length; s++) {
890
+ const o = i.subfields[s];
891
+ r[s] = {
871
892
  code: o.code,
872
893
  value: o.value
873
894
  };
874
895
  }
875
896
  t[n] = {
876
- tag: r.tag,
877
- indicator1: r.indicator1,
878
- indicator2: r.indicator2,
879
- subfields: i
897
+ tag: i.tag,
898
+ indicator1: i.indicator1,
899
+ indicator2: i.indicator2,
900
+ subfields: r
880
901
  };
881
902
  }
882
903
  }
@@ -885,23 +906,23 @@ function at(e) {
885
906
  fields: t
886
907
  };
887
908
  }
888
- function ct(e, t, n = !1) {
909
+ function ft(e, t, n = !1) {
889
910
  if (e.leader !== t.leader || e.fields.length !== t.fields.length) return !1;
890
- const r = n ? [...e.fields].sort(P) : e.fields, i = n ? [...t.fields].sort(P) : t.fields;
891
- for (let s = 0; s < r.length; s++) {
892
- const o = r[s], c = i[s];
893
- if (!o || !c || !Te(o, c)) return !1;
911
+ const i = n ? [...e.fields].sort(P) : e.fields, r = n ? [...t.fields].sort(P) : t.fields;
912
+ for (let s = 0; s < i.length; s++) {
913
+ const o = i[s], a = r[s];
914
+ if (!o || !a || !Me(o, a)) return !1;
894
915
  }
895
916
  return !0;
896
917
  }
897
- function Te(e, t) {
918
+ function Me(e, t) {
898
919
  if (e.tag !== t.tag) return !1;
899
920
  if (S(e) && S(t)) return e.data === t.data;
900
921
  if (!S(e) && !S(t)) {
901
922
  if (e.indicator1 !== t.indicator1 || e.indicator2 !== t.indicator2 || e.subfields.length !== t.subfields.length) return !1;
902
923
  for (let n = 0; n < e.subfields.length; n++) {
903
- const r = e.subfields[n], i = t.subfields[n];
904
- if (!r || !i || r.code !== i.code || r.value !== i.value) return !1;
924
+ const i = e.subfields[n], r = t.subfields[n];
925
+ if (!i || !r || i.code !== r.code || i.value !== r.value) return !1;
905
926
  }
906
927
  return !0;
907
928
  }
@@ -912,43 +933,45 @@ function P(e, t) {
912
933
  }
913
934
  export {
914
935
  Le as addSubfield,
915
- Y as appendField,
916
- He as author,
917
- at as cloneRecord,
918
- be as createWarning,
919
- Je as edition,
920
- Te as fieldsEqual,
921
- Ge as getAllSubfields,
922
- v as getField,
923
- Be as getFields,
924
- Xe as getFieldsByPattern,
925
- Qe as getFirstFieldByPattern,
936
+ Z as appendField,
937
+ je as author,
938
+ dt as cloneRecord,
939
+ Q as createWarning,
940
+ Ye as edition,
941
+ Me as fieldsEqual,
942
+ ze as getAllSubfields,
943
+ m as getField,
944
+ Ge as getFields,
945
+ tt as getFieldsByPattern,
946
+ nt as getFirstFieldByPattern,
926
947
  h as getSubfield,
927
- Pe as getSubfields,
928
- tt as insertFieldAfter,
929
- et as insertFieldBefore,
930
- nt as insertGroupedField,
948
+ ke as getSubfields,
949
+ it as insertFieldAfter,
950
+ rt as insertFieldBefore,
951
+ st as insertGroupedField,
931
952
  S as isControlField,
932
953
  p as isDataField,
933
- Ye as isbn,
934
- qe as issn,
935
- Ze as lccn,
936
- he as marc8ToUnicode,
937
- Ue as parseMarcBinary,
938
- ze as publicationDate,
939
- je as publisher,
940
- ct as recordsEqual,
941
- it as removeField,
942
- rt as removeFields,
943
- st as removeSubfield,
944
- ot as replaceSubfield,
945
- Oe as serializeMarcBinary,
946
- Ve as seriesStatement,
947
- Ke as subjects,
948
- ke as title,
949
- We as titleProper,
950
- De as unicodeToMarc8,
951
- W as unicodeToMarc8WithStats
954
+ Ke as isbn,
955
+ Ve as issn,
956
+ Xe as lccn,
957
+ Ee as marc8ToUnicode,
958
+ Be as parseMarcBinary,
959
+ Oe as parseMarcBinaryWithWarnings,
960
+ Ze as publicationDate,
961
+ qe as publisher,
962
+ ft as recordsEqual,
963
+ at as removeField,
964
+ ot as removeFields,
965
+ ct as removeSubfield,
966
+ lt as replaceSubfield,
967
+ Pe as serializeMarcBinary,
968
+ We as serializeMarcBinaryWithWarnings,
969
+ et as seriesStatement,
970
+ Qe as subjects,
971
+ He as title,
972
+ Je as titleProper,
973
+ Ue as unicodeToMarc8,
974
+ k as unicodeToMarc8WithStats
952
975
  };
953
976
 
954
977
  //# sourceMappingURL=index.js.map