@treeviz/gedcom-parser 1.0.15 → 1.0.17

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.
@@ -1,2 +1,2 @@
1
- export { ao as Common, az as CommonDate, aQ as CommonName, aS as CommonNote, an as CustomTags, am as Existed, aC as Fam, aj as FamType, aE as Families, aL as FamilySearchMatch, aM as FamilySearchSource, aF as GedCom, ak as GedComType, a3 as GenealogyMember, aa as GenerationIndiType, a9 as GenerationSpouseType, aK as Indi, a5 as IndiGenealogy, ab as IndiGenealogyGenerations, ac as IndiGenealogyResult, a6 as IndiMarker, a4 as IndiTree, a1 as IndiType, aO as Individuals, aP as List, a8 as MemberMain, a7 as MemberSide, ad as NonNullIndiGenealogyResult, aU as Obje, al as ObjeType, aW as Objects, af as Path, ae as PathItem, Z as ProxyOriginal, ai as Queue, ah as QueueItem, ag as ReducedPath, aX as Repo, $ as RepoType, aZ as Repositories, a_ as Sour, _ as SourType, b0 as Sources, b1 as Subm, a0 as SubmType, b3 as Submitters, a2 as TreeMember, aq as createCommon, aA as createCommonDate, aR as createCommonName, aT as createCommonNote, aD as createFam, aG as createGedCom, aN as createIndi, aV as createObje, ap as createProxy, aY as createRepo, a$ as createSour, b2 as createSubm, av as getListTag, aw as getValidKey, at as getValidKeys, au as getValidTag, ay as idGetter, aB as isCommonDate, aH as isGedcomString, ax as isId, ar as isOnlyMainProp, as as isValidKey, aJ as mergeGedcoms, aI as validateGedcomContent } from '../index-BvW-KWJP.js';
1
+ export { ao as Common, az as CommonDate, aQ as CommonName, aS as CommonNote, an as CustomTags, am as Existed, aC as Fam, aj as FamType, aE as Families, aL as FamilySearchMatch, aM as FamilySearchSource, aF as GedCom, ak as GedComType, a3 as GenealogyMember, aa as GenerationIndiType, a9 as GenerationSpouseType, aK as Indi, a5 as IndiGenealogy, ab as IndiGenealogyGenerations, ac as IndiGenealogyResult, a6 as IndiMarker, a4 as IndiTree, a1 as IndiType, aO as Individuals, aP as List, a8 as MemberMain, a7 as MemberSide, ad as NonNullIndiGenealogyResult, aU as Obje, al as ObjeType, aW as Objects, af as Path, ae as PathItem, Z as ProxyOriginal, ai as Queue, ah as QueueItem, ag as ReducedPath, aX as Repo, $ as RepoType, aZ as Repositories, a_ as Sour, _ as SourType, b0 as Sources, b1 as Subm, a0 as SubmType, b3 as Submitters, a2 as TreeMember, aq as createCommon, aA as createCommonDate, aR as createCommonName, aT as createCommonNote, aD as createFam, aG as createGedCom, aN as createIndi, aV as createObje, ap as createProxy, aY as createRepo, a$ as createSour, b2 as createSubm, av as getListTag, aw as getValidKey, at as getValidKeys, au as getValidTag, ay as idGetter, aB as isCommonDate, aH as isGedcomString, ax as isId, ar as isOnlyMainProp, as as isValidKey, aJ as mergeGedcoms, aI as validateGedcomContent } from '../index-DFTsiD5J.js';
2
2
  import 'date-fns';
@@ -369,7 +369,7 @@ var List = class _List {
369
369
  const [key, { getter }] = Object.entries(
370
370
  typeof groups === "string" ? { [groups]: {} } : groups
371
371
  )[0];
372
- const raw = item.get(key)?.toList().index(0);
372
+ const raw = item.get(key)?.index(0);
373
373
  let value = raw?.toValue();
374
374
  if (getter && typeof getter === "function") {
375
375
  value = getter(value, raw);
@@ -702,6 +702,9 @@ var Common = class _Common {
702
702
  this.id ? { [this.id]: this } : { ...[this] }
703
703
  );
704
704
  }
705
+ index(i) {
706
+ return this.toList()?.index(i);
707
+ }
705
708
  toValueList() {
706
709
  return new List().concat(
707
710
  this.value ? { [this.value]: this } : (
@@ -1008,7 +1011,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
1008
1011
  maxSurnames = 0
1009
1012
  } = settings ?? {};
1010
1013
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
1011
- const name = rawName?.toList().index(0);
1014
+ const name = rawName?.index(0);
1012
1015
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
1013
1016
  let surname = name?.SURN?.toValueList().first()?.value || "";
1014
1017
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -2988,8 +2991,8 @@ chars.reduce((acc, curr, idx) => {
2988
2991
  return acc;
2989
2992
  }, {});
2990
2993
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
2991
- const birthA = itemA?.BIRT?.toList().index(0);
2992
- const birthB = itemB?.BIRT?.toList().index(0);
2994
+ const birthA = itemA?.BIRT?.index(0);
2995
+ const birthB = itemB?.BIRT?.index(0);
2993
2996
  const valueA = birthA?.DATE?.rawValue;
2994
2997
  const valueB = birthB?.DATE?.rawValue;
2995
2998
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -3240,8 +3243,8 @@ var Individuals = class _Individuals extends List {
3240
3243
  getFirstEvent() {
3241
3244
  const firstBirthPerson = this.getFirstBirth();
3242
3245
  const firstDeathPerson = this.getFirstDeath();
3243
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
3244
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
3246
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
3247
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
3245
3248
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
3246
3249
  return void 0;
3247
3250
  }
@@ -3259,8 +3262,8 @@ var Individuals = class _Individuals extends List {
3259
3262
  getLastEvent() {
3260
3263
  const lastDeathPerson = this.getLastDeath();
3261
3264
  const lastBirthPerson = this.getLastBirth();
3262
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
3263
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
3265
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
3266
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
3264
3267
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
3265
3268
  return void 0;
3266
3269
  }
@@ -3277,7 +3280,7 @@ var Individuals = class _Individuals extends List {
3277
3280
  }
3278
3281
  getFirstBirth() {
3279
3282
  return this.filter((item) => {
3280
- const birth = item.BIRT?.toList().index(0);
3283
+ const birth = item.BIRT?.index(0);
3281
3284
  if (birth?.DATE?.rawValue?.getTime() === 0) {
3282
3285
  return true;
3283
3286
  }
@@ -3286,7 +3289,7 @@ var Individuals = class _Individuals extends List {
3286
3289
  }
3287
3290
  getLastBirth() {
3288
3291
  return this.filter((item) => {
3289
- const birth = item.BIRT?.toList().index(0);
3292
+ const birth = item.BIRT?.index(0);
3290
3293
  if (birth?.DATE?.rawValue?.getTime() === 0) {
3291
3294
  return true;
3292
3295
  }
@@ -3295,7 +3298,7 @@ var Individuals = class _Individuals extends List {
3295
3298
  }
3296
3299
  getFirstDeath() {
3297
3300
  return this.filter((item) => {
3298
- const death = item.DEAT?.toList().index(0);
3301
+ const death = item.DEAT?.index(0);
3299
3302
  if (death?.DATE?.rawValue?.getTime() === 0) {
3300
3303
  return true;
3301
3304
  }
@@ -3304,7 +3307,7 @@ var Individuals = class _Individuals extends List {
3304
3307
  }
3305
3308
  getLastDeath() {
3306
3309
  return this.filter((item) => {
3307
- const death = item.DEAT?.toList().index(0);
3310
+ const death = item.DEAT?.index(0);
3308
3311
  if (death?.DATE?.rawValue?.getTime() === 0) {
3309
3312
  return true;
3310
3313
  }
@@ -4094,7 +4097,7 @@ var Indi = class extends Common {
4094
4097
  });
4095
4098
  }
4096
4099
  getGenealogy(onlyStraight = false, showDescendants = false) {
4097
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
4100
+ const id = this.get("FAMC")?.index(0)?.toValue();
4098
4101
  if (!id) {
4099
4102
  return;
4100
4103
  }
@@ -4587,11 +4590,11 @@ var Indi = class extends Common {
4587
4590
  return dates.death || void 0;
4588
4591
  }
4589
4592
  getBirthPlace() {
4590
- const birthEvent = this.get("BIRT")?.toList().index(0);
4593
+ const birthEvent = this.get("BIRT")?.index(0);
4591
4594
  return birthEvent?.PLAC?.value;
4592
4595
  }
4593
4596
  getDeathPlace() {
4594
- const deathEvent = this.get("DEAT")?.toList().index(0);
4597
+ const deathEvent = this.get("DEAT")?.index(0);
4595
4598
  return deathEvent?.PLAC?.value;
4596
4599
  }
4597
4600
  isDead() {
@@ -5745,7 +5748,7 @@ var createIndi = (gedcom, id, main, parent) => {
5745
5748
 
5746
5749
  // package.json
5747
5750
  var package_default = {
5748
- version: "1.0.15"};
5751
+ version: "1.0.17"};
5749
5752
 
5750
5753
  // src/utils/get-product-details.ts
5751
5754
  var getVersion = () => package_default.version;
@@ -6118,7 +6121,7 @@ var GedCom = class extends Common {
6118
6121
  });
6119
6122
  const surnames = /* @__PURE__ */ new Map();
6120
6123
  indis?.forEach((indi) => {
6121
- const name = indi.NAME?.toValue();
6124
+ const name = indi.NAME?.index(0)?.toValue();
6122
6125
  if (name) {
6123
6126
  const match = name.match(/\/(.+?)\//);
6124
6127
  if (match) {
@@ -6130,7 +6133,7 @@ var GedCom = class extends Common {
6130
6133
  const topSurnames = Array.from(surnames.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([surname, count]) => ({ surname, count }));
6131
6134
  const birthPlaces = /* @__PURE__ */ new Map();
6132
6135
  indis?.forEach((indi) => {
6133
- const place = indi.BIRT?.PLAC?.value;
6136
+ const place = indi.BIRT?.index(0)?.PLAC?.index(0)?.toValue();
6134
6137
  if (place) {
6135
6138
  birthPlaces.set(place, (birthPlaces.get(place) || 0) + 1);
6136
6139
  }
@@ -6138,14 +6141,14 @@ var GedCom = class extends Common {
6138
6141
  const topBirthPlaces = Array.from(birthPlaces.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([place, count]) => ({ place, count }));
6139
6142
  const years = [];
6140
6143
  indis?.forEach((indi) => {
6141
- const birthDate = indi.BIRT?.DATE?.toValue();
6144
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6142
6145
  if (birthDate) {
6143
6146
  const match = birthDate.match(/\d{4}/);
6144
6147
  if (match) {
6145
6148
  years.push(parseInt(match[0], 10));
6146
6149
  }
6147
6150
  }
6148
- const deathDate = indi.DEAT?.DATE?.toValue();
6151
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6149
6152
  if (deathDate) {
6150
6153
  const match = deathDate.match(/\d{4}/);
6151
6154
  if (match) {
@@ -6157,8 +6160,8 @@ var GedCom = class extends Common {
6157
6160
  const maxYear = years.length > 0 ? Math.max(...years) : null;
6158
6161
  const lifespans = [];
6159
6162
  indis?.forEach((indi) => {
6160
- const birthDate = indi.BIRT?.DATE?.toValue();
6161
- const deathDate = indi.DEAT?.DATE?.toValue();
6163
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6164
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6162
6165
  if (birthDate && deathDate) {
6163
6166
  const birthMatch = birthDate.match(/\d{4}/);
6164
6167
  const deathMatch = deathDate.match(/\d{4}/);
@@ -6173,8 +6176,8 @@ var GedCom = class extends Common {
6173
6176
  });
6174
6177
  const avgLifespan = lifespans.length > 0 ? lifespans.reduce((sum, age) => sum + age, 0) / lifespans.length : null;
6175
6178
  const firstPerson = indis?.getFirstEvent();
6176
- const firstBirth = firstPerson?.BIRT?.toList().index(0);
6177
- const firstDeath = firstPerson?.DEAT?.toList().index(0);
6179
+ const firstBirth = firstPerson?.BIRT.index(0);
6180
+ const firstDeath = firstPerson?.DEAT?.index(0);
6178
6181
  let firstPersonEvent = null;
6179
6182
  const firstBirthDate = firstBirth?.DATE?.rawValue;
6180
6183
  const firstDeathDate = firstDeath?.DATE?.rawValue;
@@ -6187,8 +6190,8 @@ var GedCom = class extends Common {
6187
6190
  };
6188
6191
  }
6189
6192
  const lastPerson = indis?.getLastEvent();
6190
- const lastBirth = lastPerson?.BIRT?.toList().index(0);
6191
- const lastDeath = lastPerson?.DEAT?.toList().index(0);
6193
+ const lastBirth = lastPerson?.BIRT?.index(0);
6194
+ const lastDeath = lastPerson?.DEAT?.index(0);
6192
6195
  let lastPersonEvent = null;
6193
6196
  const lastBirthDate = lastBirth?.DATE?.rawValue;
6194
6197
  const lastDeathDate = lastDeath?.DATE?.rawValue;
@@ -6709,5 +6712,3 @@ var Submitters = class _Submitters extends List {
6709
6712
  };
6710
6713
 
6711
6714
  export { Common, CommonDate, CommonName, CommonNote, CustomTags, Existed, Fam, Families, GedCom, Indi, Individuals, List, Obje, Objects, Repo, Repositories, Sour, Sources, Subm, Submitters, createCommon, createCommonDate, createCommonName, createCommonNote, createFam, createGedCom, createIndi, createObje, createProxy, createRepo, createSour, createSubm, getListTag, getValidKey, getValidKeys, getValidTag, idGetter, isCommonDate, isGedcomString, isId, isOnlyMainProp, isValidKey, mergeGedcoms, validateGedcomContent };
6712
- //# sourceMappingURL=index.js.map
6713
- //# sourceMappingURL=index.js.map
package/dist/cli/index.js CHANGED
@@ -305,7 +305,7 @@ var List = class _List {
305
305
  const [key, { getter }] = Object.entries(
306
306
  typeof groups === "string" ? { [groups]: {} } : groups
307
307
  )[0];
308
- const raw = item.get(key)?.toList().index(0);
308
+ const raw = item.get(key)?.index(0);
309
309
  let value = raw?.toValue();
310
310
  if (getter && typeof getter === "function") {
311
311
  value = getter(value, raw);
@@ -638,6 +638,9 @@ var Common = class _Common {
638
638
  this.id ? { [this.id]: this } : { ...[this] }
639
639
  );
640
640
  }
641
+ index(i) {
642
+ return this.toList()?.index(i);
643
+ }
641
644
  toValueList() {
642
645
  return new List().concat(
643
646
  this.value ? { [this.value]: this } : (
@@ -1660,7 +1663,7 @@ var Indi = class extends Common {
1660
1663
  });
1661
1664
  }
1662
1665
  getGenealogy(onlyStraight = false, showDescendants = false) {
1663
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
1666
+ const id = this.get("FAMC")?.index(0)?.toValue();
1664
1667
  if (!id) {
1665
1668
  return;
1666
1669
  }
@@ -2153,11 +2156,11 @@ var Indi = class extends Common {
2153
2156
  return dates.death || void 0;
2154
2157
  }
2155
2158
  getBirthPlace() {
2156
- const birthEvent = this.get("BIRT")?.toList().index(0);
2159
+ const birthEvent = this.get("BIRT")?.index(0);
2157
2160
  return birthEvent?.PLAC?.value;
2158
2161
  }
2159
2162
  getDeathPlace() {
2160
- const deathEvent = this.get("DEAT")?.toList().index(0);
2163
+ const deathEvent = this.get("DEAT")?.index(0);
2161
2164
  return deathEvent?.PLAC?.value;
2162
2165
  }
2163
2166
  isDead() {
@@ -3317,7 +3320,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
3317
3320
  maxSurnames = 0
3318
3321
  } = settings ?? {};
3319
3322
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
3320
- const name = rawName?.toList().index(0);
3323
+ const name = rawName?.index(0);
3321
3324
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
3322
3325
  let surname = name?.SURN?.toValueList().first()?.value || "";
3323
3326
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -5101,8 +5104,8 @@ chars.reduce((acc, curr, idx) => {
5101
5104
  return acc;
5102
5105
  }, {});
5103
5106
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
5104
- const birthA = itemA?.BIRT?.toList().index(0);
5105
- const birthB = itemB?.BIRT?.toList().index(0);
5107
+ const birthA = itemA?.BIRT?.index(0);
5108
+ const birthB = itemB?.BIRT?.index(0);
5106
5109
  const valueA = birthA?.DATE?.rawValue;
5107
5110
  const valueB = birthB?.DATE?.rawValue;
5108
5111
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -5225,8 +5228,8 @@ var Individuals = class _Individuals extends List {
5225
5228
  getFirstEvent() {
5226
5229
  const firstBirthPerson = this.getFirstBirth();
5227
5230
  const firstDeathPerson = this.getFirstDeath();
5228
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
5229
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
5231
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
5232
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
5230
5233
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
5231
5234
  return void 0;
5232
5235
  }
@@ -5244,8 +5247,8 @@ var Individuals = class _Individuals extends List {
5244
5247
  getLastEvent() {
5245
5248
  const lastDeathPerson = this.getLastDeath();
5246
5249
  const lastBirthPerson = this.getLastBirth();
5247
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
5248
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
5250
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
5251
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
5249
5252
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
5250
5253
  return void 0;
5251
5254
  }
@@ -5262,7 +5265,7 @@ var Individuals = class _Individuals extends List {
5262
5265
  }
5263
5266
  getFirstBirth() {
5264
5267
  return this.filter((item) => {
5265
- const birth = item.BIRT?.toList().index(0);
5268
+ const birth = item.BIRT?.index(0);
5266
5269
  if (birth?.DATE?.rawValue?.getTime() === 0) {
5267
5270
  return true;
5268
5271
  }
@@ -5271,7 +5274,7 @@ var Individuals = class _Individuals extends List {
5271
5274
  }
5272
5275
  getLastBirth() {
5273
5276
  return this.filter((item) => {
5274
- const birth = item.BIRT?.toList().index(0);
5277
+ const birth = item.BIRT?.index(0);
5275
5278
  if (birth?.DATE?.rawValue?.getTime() === 0) {
5276
5279
  return true;
5277
5280
  }
@@ -5280,7 +5283,7 @@ var Individuals = class _Individuals extends List {
5280
5283
  }
5281
5284
  getFirstDeath() {
5282
5285
  return this.filter((item) => {
5283
- const death = item.DEAT?.toList().index(0);
5286
+ const death = item.DEAT?.index(0);
5284
5287
  if (death?.DATE?.rawValue?.getTime() === 0) {
5285
5288
  return true;
5286
5289
  }
@@ -5289,7 +5292,7 @@ var Individuals = class _Individuals extends List {
5289
5292
  }
5290
5293
  getLastDeath() {
5291
5294
  return this.filter((item) => {
5292
- const death = item.DEAT?.toList().index(0);
5295
+ const death = item.DEAT?.index(0);
5293
5296
  if (death?.DATE?.rawValue?.getTime() === 0) {
5294
5297
  return true;
5295
5298
  }
@@ -5738,7 +5741,7 @@ var Families = class _Families extends List {
5738
5741
 
5739
5742
  // package.json
5740
5743
  var package_default = {
5741
- version: "1.0.15"};
5744
+ version: "1.0.17"};
5742
5745
 
5743
5746
  // src/utils/get-product-details.ts
5744
5747
  var isDevelopment = () => {
@@ -6114,7 +6117,7 @@ var GedCom = class extends Common {
6114
6117
  });
6115
6118
  const surnames = /* @__PURE__ */ new Map();
6116
6119
  indis?.forEach((indi) => {
6117
- const name = indi.NAME?.toValue();
6120
+ const name = indi.NAME?.index(0)?.toValue();
6118
6121
  if (name) {
6119
6122
  const match = name.match(/\/(.+?)\//);
6120
6123
  if (match) {
@@ -6126,7 +6129,7 @@ var GedCom = class extends Common {
6126
6129
  const topSurnames = Array.from(surnames.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([surname, count]) => ({ surname, count }));
6127
6130
  const birthPlaces = /* @__PURE__ */ new Map();
6128
6131
  indis?.forEach((indi) => {
6129
- const place = indi.BIRT?.PLAC?.value;
6132
+ const place = indi.BIRT?.index(0)?.PLAC?.index(0)?.toValue();
6130
6133
  if (place) {
6131
6134
  birthPlaces.set(place, (birthPlaces.get(place) || 0) + 1);
6132
6135
  }
@@ -6134,14 +6137,14 @@ var GedCom = class extends Common {
6134
6137
  const topBirthPlaces = Array.from(birthPlaces.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([place, count]) => ({ place, count }));
6135
6138
  const years = [];
6136
6139
  indis?.forEach((indi) => {
6137
- const birthDate = indi.BIRT?.DATE?.toValue();
6140
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6138
6141
  if (birthDate) {
6139
6142
  const match = birthDate.match(/\d{4}/);
6140
6143
  if (match) {
6141
6144
  years.push(parseInt(match[0], 10));
6142
6145
  }
6143
6146
  }
6144
- const deathDate = indi.DEAT?.DATE?.toValue();
6147
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6145
6148
  if (deathDate) {
6146
6149
  const match = deathDate.match(/\d{4}/);
6147
6150
  if (match) {
@@ -6153,8 +6156,8 @@ var GedCom = class extends Common {
6153
6156
  const maxYear = years.length > 0 ? Math.max(...years) : null;
6154
6157
  const lifespans = [];
6155
6158
  indis?.forEach((indi) => {
6156
- const birthDate = indi.BIRT?.DATE?.toValue();
6157
- const deathDate = indi.DEAT?.DATE?.toValue();
6159
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6160
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6158
6161
  if (birthDate && deathDate) {
6159
6162
  const birthMatch = birthDate.match(/\d{4}/);
6160
6163
  const deathMatch = deathDate.match(/\d{4}/);
@@ -6169,8 +6172,8 @@ var GedCom = class extends Common {
6169
6172
  });
6170
6173
  const avgLifespan = lifespans.length > 0 ? lifespans.reduce((sum, age) => sum + age, 0) / lifespans.length : null;
6171
6174
  const firstPerson = indis?.getFirstEvent();
6172
- const firstBirth = firstPerson?.BIRT?.toList().index(0);
6173
- const firstDeath = firstPerson?.DEAT?.toList().index(0);
6175
+ const firstBirth = firstPerson?.BIRT.index(0);
6176
+ const firstDeath = firstPerson?.DEAT?.index(0);
6174
6177
  let firstPersonEvent = null;
6175
6178
  const firstBirthDate = firstBirth?.DATE?.rawValue;
6176
6179
  const firstDeathDate = firstDeath?.DATE?.rawValue;
@@ -6183,8 +6186,8 @@ var GedCom = class extends Common {
6183
6186
  };
6184
6187
  }
6185
6188
  const lastPerson = indis?.getLastEvent();
6186
- const lastBirth = lastPerson?.BIRT?.toList().index(0);
6187
- const lastDeath = lastPerson?.DEAT?.toList().index(0);
6189
+ const lastBirth = lastPerson?.BIRT?.index(0);
6190
+ const lastDeath = lastPerson?.DEAT?.index(0);
6188
6191
  let lastPersonEvent = null;
6189
6192
  const lastBirthDate = lastBirth?.DATE?.rawValue;
6190
6193
  const lastDeathDate = lastDeath?.DATE?.rawValue;
@@ -7838,5 +7841,3 @@ program.parse(process.argv);
7838
7841
  if (!process.argv.slice(2).length) {
7839
7842
  program.outputHelp();
7840
7843
  }
7841
- //# sourceMappingURL=index.js.map
7842
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { x as Filter, y as RequiredFilter, W as RelationType, X as PartnerType, A as Order, K as NameOrder, B as OrderIterator, a1 as IndiType, n as IndiKey } from '../index-BvW-KWJP.js';
1
+ import { x as Filter, y as RequiredFilter, W as RelationType, X as PartnerType, A as Order, K as NameOrder, B as OrderIterator, a1 as IndiType, n as IndiKey } from '../index-DFTsiD5J.js';
2
2
  import 'date-fns';
3
3
 
4
4
  /**
@@ -559,6 +559,9 @@ var Common = class _Common {
559
559
  this.id ? { [this.id]: this } : { ...[this] }
560
560
  );
561
561
  }
562
+ index(i) {
563
+ return this.toList()?.index(i);
564
+ }
562
565
  toValueList() {
563
566
  return new List().concat(
564
567
  this.value ? { [this.value]: this } : (
@@ -1095,7 +1098,7 @@ var List = class _List {
1095
1098
  const [key, { getter }] = Object.entries(
1096
1099
  typeof groups === "string" ? { [groups]: {} } : groups
1097
1100
  )[0];
1098
- const raw = item.get(key)?.toList().index(0);
1101
+ const raw = item.get(key)?.index(0);
1099
1102
  let value = raw?.toValue();
1100
1103
  if (getter && typeof getter === "function") {
1101
1104
  value = getter(value, raw);
@@ -1373,8 +1376,8 @@ var Individuals = class _Individuals extends List {
1373
1376
  getFirstEvent() {
1374
1377
  const firstBirthPerson = this.getFirstBirth();
1375
1378
  const firstDeathPerson = this.getFirstDeath();
1376
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
1377
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
1379
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
1380
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
1378
1381
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
1379
1382
  return void 0;
1380
1383
  }
@@ -1392,8 +1395,8 @@ var Individuals = class _Individuals extends List {
1392
1395
  getLastEvent() {
1393
1396
  const lastDeathPerson = this.getLastDeath();
1394
1397
  const lastBirthPerson = this.getLastBirth();
1395
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
1396
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
1398
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
1399
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
1397
1400
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
1398
1401
  return void 0;
1399
1402
  }
@@ -1410,7 +1413,7 @@ var Individuals = class _Individuals extends List {
1410
1413
  }
1411
1414
  getFirstBirth() {
1412
1415
  return this.filter((item) => {
1413
- const birth = item.BIRT?.toList().index(0);
1416
+ const birth = item.BIRT?.index(0);
1414
1417
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1415
1418
  return true;
1416
1419
  }
@@ -1419,7 +1422,7 @@ var Individuals = class _Individuals extends List {
1419
1422
  }
1420
1423
  getLastBirth() {
1421
1424
  return this.filter((item) => {
1422
- const birth = item.BIRT?.toList().index(0);
1425
+ const birth = item.BIRT?.index(0);
1423
1426
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1424
1427
  return true;
1425
1428
  }
@@ -1428,7 +1431,7 @@ var Individuals = class _Individuals extends List {
1428
1431
  }
1429
1432
  getFirstDeath() {
1430
1433
  return this.filter((item) => {
1431
- const death = item.DEAT?.toList().index(0);
1434
+ const death = item.DEAT?.index(0);
1432
1435
  if (death?.DATE?.rawValue?.getTime() === 0) {
1433
1436
  return true;
1434
1437
  }
@@ -1437,7 +1440,7 @@ var Individuals = class _Individuals extends List {
1437
1440
  }
1438
1441
  getLastDeath() {
1439
1442
  return this.filter((item) => {
1440
- const death = item.DEAT?.toList().index(0);
1443
+ const death = item.DEAT?.index(0);
1441
1444
  if (death?.DATE?.rawValue?.getTime() === 0) {
1442
1445
  return true;
1443
1446
  }
@@ -2255,7 +2258,7 @@ var Indi = class extends Common {
2255
2258
  });
2256
2259
  }
2257
2260
  getGenealogy(onlyStraight = false, showDescendants = false) {
2258
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
2261
+ const id = this.get("FAMC")?.index(0)?.toValue();
2259
2262
  if (!id) {
2260
2263
  return;
2261
2264
  }
@@ -2748,11 +2751,11 @@ var Indi = class extends Common {
2748
2751
  return dates.death || void 0;
2749
2752
  }
2750
2753
  getBirthPlace() {
2751
- const birthEvent = this.get("BIRT")?.toList().index(0);
2754
+ const birthEvent = this.get("BIRT")?.index(0);
2752
2755
  return birthEvent?.PLAC?.value;
2753
2756
  }
2754
2757
  getDeathPlace() {
2755
- const deathEvent = this.get("DEAT")?.toList().index(0);
2758
+ const deathEvent = this.get("DEAT")?.index(0);
2756
2759
  return deathEvent?.PLAC?.value;
2757
2760
  }
2758
2761
  isDead() {
@@ -3912,7 +3915,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
3912
3915
  maxSurnames = 0
3913
3916
  } = settings ?? {};
3914
3917
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
3915
- const name = rawName?.toList().index(0);
3918
+ const name = rawName?.index(0);
3916
3919
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
3917
3920
  let surname = name?.SURN?.toValueList().first()?.value || "";
3918
3921
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -5733,8 +5736,8 @@ var getNameAsc = (nameOrder = "first-last") => (itemA, _keyA, itemB, _keyB) => {
5733
5736
  );
5734
5737
  };
5735
5738
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
5736
- const birthA = itemA?.BIRT?.toList().index(0);
5737
- const birthB = itemB?.BIRT?.toList().index(0);
5739
+ const birthA = itemA?.BIRT?.index(0);
5740
+ const birthB = itemB?.BIRT?.index(0);
5738
5741
  const valueA = birthA?.DATE?.rawValue;
5739
5742
  const valueB = birthB?.DATE?.rawValue;
5740
5743
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -5793,5 +5796,3 @@ var getMarriageAscAndBirth = (person) => (itemA, keyA, itemB, keyB) => {
5793
5796
  };
5794
5797
 
5795
5798
  export { ADOPTED, BIOLOGICAL, BIRTH, BIRTH_ASC, BIRTH_DESC, DATE_ASC, DATE_DESC, DEATH_ASC, DEATH_DESC, DEFAULT, EVERY, FEMALE, FOSTER, FRIEND, ID_GETTER_REG, ID_REG, ID_SPLIT_REG, LINE_REG, MALE, MAX_FILE_SIZE_TO_SYNC, OTHER, PARTNER, REF_LINE_REG, SEALING, SINGLE, SPOUSE, STEP, UNKOWN, getBirthAsc, getMarriageAsc, getMarriageAscAndBirth, getMarriageAscAndChildBirth, getNameAsc, getNameAscAndBirth, getNameDesc };
5796
- //# sourceMappingURL=index.js.map
5797
- //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- import { I as ICacheManager, P as PlaceParts } from '../place-parser-RlXCXZ8F.js';
1
+ import { I as ICacheManager, P as PlaceParts } from '../place-parser-BsrTDadc.js';
2
2
  import { Locale } from 'date-fns';
3
- import { a1 as IndiType, n as IndiKey, L as Language } from '../index-BvW-KWJP.js';
3
+ import { a1 as IndiType, n as IndiKey, L as Language } from '../index-DFTsiD5J.js';
4
4
 
5
5
  /**
6
6
  * Factory function type for creating cache manager instances.
@@ -628,7 +628,7 @@ var List = class _List {
628
628
  const [key, { getter }] = Object.entries(
629
629
  typeof groups === "string" ? { [groups]: {} } : groups
630
630
  )[0];
631
- const raw = item.get(key)?.toList().index(0);
631
+ const raw = item.get(key)?.index(0);
632
632
  let value = raw?.toValue();
633
633
  if (getter && typeof getter === "function") {
634
634
  value = getter(value, raw);
@@ -961,6 +961,9 @@ var Common = class _Common {
961
961
  this.id ? { [this.id]: this } : { ...[this] }
962
962
  );
963
963
  }
964
+ index(i) {
965
+ return this.toList()?.index(i);
966
+ }
964
967
  toValueList() {
965
968
  return new List().concat(
966
969
  this.value ? { [this.value]: this } : (
@@ -1520,8 +1523,8 @@ chars.reduce((acc, curr, idx) => {
1520
1523
  return acc;
1521
1524
  }, {});
1522
1525
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
1523
- const birthA = itemA?.BIRT?.toList().index(0);
1524
- const birthB = itemB?.BIRT?.toList().index(0);
1526
+ const birthA = itemA?.BIRT?.index(0);
1527
+ const birthB = itemB?.BIRT?.index(0);
1525
1528
  const valueA = birthA?.DATE?.rawValue;
1526
1529
  const valueB = birthB?.DATE?.rawValue;
1527
1530
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -1796,8 +1799,8 @@ var Individuals = class _Individuals extends List {
1796
1799
  getFirstEvent() {
1797
1800
  const firstBirthPerson = this.getFirstBirth();
1798
1801
  const firstDeathPerson = this.getFirstDeath();
1799
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
1800
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
1802
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
1803
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
1801
1804
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
1802
1805
  return void 0;
1803
1806
  }
@@ -1815,8 +1818,8 @@ var Individuals = class _Individuals extends List {
1815
1818
  getLastEvent() {
1816
1819
  const lastDeathPerson = this.getLastDeath();
1817
1820
  const lastBirthPerson = this.getLastBirth();
1818
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
1819
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
1821
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
1822
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
1820
1823
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
1821
1824
  return void 0;
1822
1825
  }
@@ -1833,7 +1836,7 @@ var Individuals = class _Individuals extends List {
1833
1836
  }
1834
1837
  getFirstBirth() {
1835
1838
  return this.filter((item) => {
1836
- const birth = item.BIRT?.toList().index(0);
1839
+ const birth = item.BIRT?.index(0);
1837
1840
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1838
1841
  return true;
1839
1842
  }
@@ -1842,7 +1845,7 @@ var Individuals = class _Individuals extends List {
1842
1845
  }
1843
1846
  getLastBirth() {
1844
1847
  return this.filter((item) => {
1845
- const birth = item.BIRT?.toList().index(0);
1848
+ const birth = item.BIRT?.index(0);
1846
1849
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1847
1850
  return true;
1848
1851
  }
@@ -1851,7 +1854,7 @@ var Individuals = class _Individuals extends List {
1851
1854
  }
1852
1855
  getFirstDeath() {
1853
1856
  return this.filter((item) => {
1854
- const death = item.DEAT?.toList().index(0);
1857
+ const death = item.DEAT?.index(0);
1855
1858
  if (death?.DATE?.rawValue?.getTime() === 0) {
1856
1859
  return true;
1857
1860
  }
@@ -1860,7 +1863,7 @@ var Individuals = class _Individuals extends List {
1860
1863
  }
1861
1864
  getLastDeath() {
1862
1865
  return this.filter((item) => {
1863
- const death = item.DEAT?.toList().index(0);
1866
+ const death = item.DEAT?.index(0);
1864
1867
  if (death?.DATE?.rawValue?.getTime() === 0) {
1865
1868
  return true;
1866
1869
  }
@@ -2682,7 +2685,7 @@ var Indi = class extends Common {
2682
2685
  });
2683
2686
  }
2684
2687
  getGenealogy(onlyStraight = false, showDescendants = false) {
2685
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
2688
+ const id = this.get("FAMC")?.index(0)?.toValue();
2686
2689
  if (!id) {
2687
2690
  return;
2688
2691
  }
@@ -3175,11 +3178,11 @@ var Indi = class extends Common {
3175
3178
  return dates.death || void 0;
3176
3179
  }
3177
3180
  getBirthPlace() {
3178
- const birthEvent = this.get("BIRT")?.toList().index(0);
3181
+ const birthEvent = this.get("BIRT")?.index(0);
3179
3182
  return birthEvent?.PLAC?.value;
3180
3183
  }
3181
3184
  getDeathPlace() {
3182
- const deathEvent = this.get("DEAT")?.toList().index(0);
3185
+ const deathEvent = this.get("DEAT")?.index(0);
3183
3186
  return deathEvent?.PLAC?.value;
3184
3187
  }
3185
3188
  isDead() {
@@ -4339,7 +4342,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
4339
4342
  maxSurnames = 0
4340
4343
  } = settings ?? {};
4341
4344
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
4342
- const name = rawName?.toList().index(0);
4345
+ const name = rawName?.index(0);
4343
4346
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
4344
4347
  let surname = name?.SURN?.toValueList().first()?.value || "";
4345
4348
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -5778,5 +5781,3 @@ var resetKinshipTranslatorClass = () => {
5778
5781
  };
5779
5782
 
5780
5783
  export { getCacheManagerFactory, getDateLocale, getI18n, getKinshipTranslatorClass, getPlaceParserProvider, getPlaceTranslatorProvider, i18n, resetCacheManagerFactory, resetDateLocaleProvider, resetI18nProvider, resetKinshipTranslatorClass, resetPlaceParserProvider, resetPlaceTranslatorProvider, setCacheManagerFactory, setDateLocaleProvider, setI18nProvider, setKinshipTranslatorClass, setPlaceParserProvider, setPlaceTranslatorProvider };
5781
- //# sourceMappingURL=index.js.map
5782
- //# sourceMappingURL=index.js.map
@@ -1611,6 +1611,7 @@ declare class Common<T = string, I extends IdType = IdType> implements ICommon<T
1611
1611
  toValue(): T;
1612
1612
  toProp(tag: MultiTag): Common<T, I> | undefined;
1613
1613
  toList(): List<IdType, Common<string, IdType>>;
1614
+ index(i: number): Common<string, IdType>;
1614
1615
  toValueList(): List<IdType, Common<string, IdType>>;
1615
1616
  private standardizeObject;
1616
1617
  toJson(tag?: MultiTag, options?: ConvertOptions): string;