@treeviz/gedcom-parser 2.1.8 → 2.1.11
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/classes/common.d.ts.map +1 -1
- package/dist/classes/gedcom.d.ts +5 -0
- package/dist/classes/gedcom.d.ts.map +1 -1
- package/dist/classes/index.js +588 -75
- package/dist/classes/indi.d.ts.map +1 -1
- package/dist/classes/obje.d.ts.map +1 -1
- package/dist/cli/index.js +588 -75
- package/dist/constants/index.js +557 -70
- package/dist/factories/index.js +557 -70
- package/dist/index.js +593 -85
- package/dist/interfaces/indi.d.ts +1 -0
- package/dist/interfaces/indi.d.ts.map +1 -1
- package/dist/kinship-translator/index.d.ts +2 -0
- package/dist/kinship-translator/index.d.ts.map +1 -1
- package/dist/kinship-translator/index.js +558 -71
- package/dist/kinship-translator/kinship-translator.ja.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.ja.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.zh.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.zh.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.ja.d.ts +2 -0
- package/dist/kinship-translator/patterns.ja.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.zh.d.ts +2 -0
- package/dist/kinship-translator/patterns.zh.d.ts.map +1 -0
- package/dist/kinship-translator/translators.d.ts +2 -0
- package/dist/kinship-translator/translators.d.ts.map +1 -1
- package/dist/kinship-translator/types.d.ts +1 -1
- package/dist/kinship-translator/types.d.ts.map +1 -1
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/gedzip.d.ts.map +1 -1
- package/dist/utils/index.js +593 -85
- package/dist/utils/local-media.d.ts +7 -3
- package/dist/utils/local-media.d.ts.map +1 -1
- package/dist/utils/media-utils.d.ts +20 -0
- package/dist/utils/media-utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/utils/index.js
CHANGED
|
@@ -93,11 +93,8 @@ var storeCache = {
|
|
|
93
93
|
getCacheDbs().relativesOnDegreeCache.setItem(value);
|
|
94
94
|
}
|
|
95
95
|
}, 50),
|
|
96
|
-
//
|
|
96
|
+
// Image bytes are stored as one IndexedDB record per photo.
|
|
97
97
|
profilePictureCache: debounce((value) => {
|
|
98
|
-
if (value) {
|
|
99
|
-
getCacheDbs().profilePictureCache.setItem(value);
|
|
100
|
-
}
|
|
101
98
|
}, 100)
|
|
102
99
|
};
|
|
103
100
|
var cacheInitialized = false;
|
|
@@ -106,13 +103,6 @@ var initializeCache = async () => {
|
|
|
106
103
|
return;
|
|
107
104
|
}
|
|
108
105
|
cacheInitialized = true;
|
|
109
|
-
try {
|
|
110
|
-
const profilePictureData = await getCacheDbs().profilePictureCache.getItem();
|
|
111
|
-
if (profilePictureData) {
|
|
112
|
-
caches.profilePictureCache = profilePictureData;
|
|
113
|
-
}
|
|
114
|
-
} catch (_error) {
|
|
115
|
-
}
|
|
116
106
|
};
|
|
117
107
|
var resetRelativesCache = () => {
|
|
118
108
|
caches.relativesOnDegreeCache = {};
|
|
@@ -318,6 +308,82 @@ var appendGedcomTrailer = (serialized) => {
|
|
|
318
308
|
}
|
|
319
309
|
return `${trimmed}${newline}0 TRLR`;
|
|
320
310
|
};
|
|
311
|
+
|
|
312
|
+
// src/utils/media-utils.ts
|
|
313
|
+
var getFileExtension = (filename) => {
|
|
314
|
+
if (!filename) {
|
|
315
|
+
return "";
|
|
316
|
+
}
|
|
317
|
+
if (filename.startsWith("data:")) {
|
|
318
|
+
const mime = filename.slice(5).split(";")[0] || "";
|
|
319
|
+
const subtype = (mime.split("/")[1] || "").toLowerCase();
|
|
320
|
+
if (subtype === "jpeg") {
|
|
321
|
+
return "jpg";
|
|
322
|
+
}
|
|
323
|
+
return subtype.split("+")[0] || "";
|
|
324
|
+
}
|
|
325
|
+
const withoutQuery = filename.split(/[?#]/)[0] || filename;
|
|
326
|
+
const match = withoutQuery.match(/\.([^.]+)$/);
|
|
327
|
+
return match ? match[1].toLowerCase() : "";
|
|
328
|
+
};
|
|
329
|
+
var isImageFormat = (format2) => {
|
|
330
|
+
if (!format2) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
let normalized = format2.toLowerCase().trim();
|
|
334
|
+
if (normalized.startsWith("data:")) {
|
|
335
|
+
normalized = getFileExtension(normalized);
|
|
336
|
+
} else if (normalized.includes("/")) {
|
|
337
|
+
normalized = normalized.split("/")[1]?.split("+")[0] || "";
|
|
338
|
+
if (normalized === "jpeg") {
|
|
339
|
+
normalized = "jpg";
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const imageFormats = [
|
|
343
|
+
"jpg",
|
|
344
|
+
"jpeg",
|
|
345
|
+
"png",
|
|
346
|
+
"gif",
|
|
347
|
+
"bmp",
|
|
348
|
+
"webp",
|
|
349
|
+
"svg",
|
|
350
|
+
"tiff",
|
|
351
|
+
"tif"
|
|
352
|
+
];
|
|
353
|
+
return imageFormats.includes(normalized);
|
|
354
|
+
};
|
|
355
|
+
var resolveObjeForm = (obje) => {
|
|
356
|
+
const value = obje?.get?.("FILE.FORM")?.toValue?.() ?? obje?.get?.("FORM")?.toValue?.();
|
|
357
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
358
|
+
};
|
|
359
|
+
var mediaIdValue = (obje, path) => {
|
|
360
|
+
const value = obje?.get?.(path)?.toValue?.();
|
|
361
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
362
|
+
};
|
|
363
|
+
var resolveObjeMediaId = (obje) => mediaIdValue(obje, "RIN") || mediaIdValue(obje, "_CLON._OID") || mediaIdValue(obje, "_MSER._LKID") || mediaIdValue(obje, "_OID") || mediaIdValue(obje, "_LKID");
|
|
364
|
+
var ANCESTRY_MEDIA_RETRIEVAL_PREFIX = "https://www.ancestry.com/api/media/retrieval/v2/image";
|
|
365
|
+
var ANCESTRY_MEDIA_QUERY = "client=trees-mediaservice&imageQuality=hq";
|
|
366
|
+
var ancestryMediaPath = (namespace, imgId) => `/namespaces/${namespace}/media/${imgId}?${ANCESTRY_MEDIA_QUERY}`;
|
|
367
|
+
var ancestryMediaFileUrl = (namespace, imgId) => {
|
|
368
|
+
if (!namespace || !imgId) {
|
|
369
|
+
return void 0;
|
|
370
|
+
}
|
|
371
|
+
return `${ANCESTRY_MEDIA_RETRIEVAL_PREFIX}${ancestryMediaPath(namespace, imgId)}`;
|
|
372
|
+
};
|
|
373
|
+
var objeXrefKey = (obje, fallback = 0) => {
|
|
374
|
+
if (typeof obje?.id === "string" && obje.id) {
|
|
375
|
+
return obje.id;
|
|
376
|
+
}
|
|
377
|
+
const value = obje?.toValue?.();
|
|
378
|
+
if (typeof value === "string" && value.trim()) {
|
|
379
|
+
return value.trim();
|
|
380
|
+
}
|
|
381
|
+
if (typeof fallback === "string" && fallback.trim()) {
|
|
382
|
+
return fallback.trim();
|
|
383
|
+
}
|
|
384
|
+
return `@O${fallback}@`;
|
|
385
|
+
};
|
|
386
|
+
var objeNoteValue = (obje) => mediaIdValue(obje, "FILE.NOTE") || mediaIdValue(obje, "NOTE") || "";
|
|
321
387
|
var List = class _List {
|
|
322
388
|
// length = 0;
|
|
323
389
|
constructor(items) {
|
|
@@ -967,7 +1033,7 @@ var Common = class _Common {
|
|
|
967
1033
|
this,
|
|
968
1034
|
options.obje.namespace,
|
|
969
1035
|
options.obje.override,
|
|
970
|
-
void 0,
|
|
1036
|
+
this.isAncestry() ? ancestryMediaFileUrl : void 0,
|
|
971
1037
|
options.gedcomVersion
|
|
972
1038
|
);
|
|
973
1039
|
}
|
|
@@ -1422,7 +1488,9 @@ __export(translators_exports, {
|
|
|
1422
1488
|
es: () => KinshipTranslatorEs,
|
|
1423
1489
|
fr: () => KinshipTranslatorFr,
|
|
1424
1490
|
hu: () => KinshipTranslatorHU,
|
|
1425
|
-
|
|
1491
|
+
ja: () => KinshipTranslatorJa,
|
|
1492
|
+
ru: () => KinshipTranslatorRu,
|
|
1493
|
+
zh: () => KinshipTranslatorZh
|
|
1426
1494
|
});
|
|
1427
1495
|
|
|
1428
1496
|
// src/constants/filters.ts
|
|
@@ -2707,15 +2775,21 @@ var isRemoteOrEmbeddedMediaUrl = (path) => {
|
|
|
2707
2775
|
}
|
|
2708
2776
|
return path.startsWith("data:") || path.startsWith("blob:") || /^https?:\/\//i.test(path);
|
|
2709
2777
|
};
|
|
2710
|
-
var resolveLocalMediaUrl = async (path) => {
|
|
2778
|
+
var resolveLocalMediaUrl = async (path, context) => {
|
|
2711
2779
|
if (!path) {
|
|
2712
2780
|
return void 0;
|
|
2713
2781
|
}
|
|
2714
|
-
if (
|
|
2782
|
+
if (path.startsWith("data:") || path.startsWith("blob:")) {
|
|
2715
2783
|
return path;
|
|
2716
2784
|
}
|
|
2717
|
-
const resolved = await localMediaResolver?.(path);
|
|
2718
|
-
|
|
2785
|
+
const resolved = await localMediaResolver?.(path, context);
|
|
2786
|
+
if (resolved) {
|
|
2787
|
+
return resolved;
|
|
2788
|
+
}
|
|
2789
|
+
if (/^https?:\/\//i.test(path)) {
|
|
2790
|
+
return path;
|
|
2791
|
+
}
|
|
2792
|
+
return void 0;
|
|
2719
2793
|
};
|
|
2720
2794
|
var blobToDataUrl = async (blob) => {
|
|
2721
2795
|
const buffer = await blob.arrayBuffer();
|
|
@@ -2771,54 +2845,6 @@ var implemented = (type, ...args) => {
|
|
|
2771
2845
|
var notImplemented = (type, ...args) => {
|
|
2772
2846
|
console.error(`[Not Implemented] ${type}`, ...args);
|
|
2773
2847
|
};
|
|
2774
|
-
|
|
2775
|
-
// src/utils/media-utils.ts
|
|
2776
|
-
var getFileExtension = (filename) => {
|
|
2777
|
-
if (!filename) {
|
|
2778
|
-
return "";
|
|
2779
|
-
}
|
|
2780
|
-
if (filename.startsWith("data:")) {
|
|
2781
|
-
const mime = filename.slice(5).split(";")[0] || "";
|
|
2782
|
-
const subtype = (mime.split("/")[1] || "").toLowerCase();
|
|
2783
|
-
if (subtype === "jpeg") {
|
|
2784
|
-
return "jpg";
|
|
2785
|
-
}
|
|
2786
|
-
return subtype.split("+")[0] || "";
|
|
2787
|
-
}
|
|
2788
|
-
const withoutQuery = filename.split(/[?#]/)[0] || filename;
|
|
2789
|
-
const match = withoutQuery.match(/\.([^.]+)$/);
|
|
2790
|
-
return match ? match[1].toLowerCase() : "";
|
|
2791
|
-
};
|
|
2792
|
-
var isImageFormat = (format2) => {
|
|
2793
|
-
if (!format2) {
|
|
2794
|
-
return false;
|
|
2795
|
-
}
|
|
2796
|
-
let normalized = format2.toLowerCase().trim();
|
|
2797
|
-
if (normalized.startsWith("data:")) {
|
|
2798
|
-
normalized = getFileExtension(normalized);
|
|
2799
|
-
} else if (normalized.includes("/")) {
|
|
2800
|
-
normalized = normalized.split("/")[1]?.split("+")[0] || "";
|
|
2801
|
-
if (normalized === "jpeg") {
|
|
2802
|
-
normalized = "jpg";
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
const imageFormats = [
|
|
2806
|
-
"jpg",
|
|
2807
|
-
"jpeg",
|
|
2808
|
-
"png",
|
|
2809
|
-
"gif",
|
|
2810
|
-
"bmp",
|
|
2811
|
-
"webp",
|
|
2812
|
-
"svg",
|
|
2813
|
-
"tiff",
|
|
2814
|
-
"tif"
|
|
2815
|
-
];
|
|
2816
|
-
return imageFormats.includes(normalized);
|
|
2817
|
-
};
|
|
2818
|
-
var resolveObjeForm = (obje) => {
|
|
2819
|
-
const value = obje?.get?.("FILE.FORM")?.toValue?.() ?? obje?.get?.("FORM")?.toValue?.();
|
|
2820
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
2821
|
-
};
|
|
2822
2848
|
var uniqueItemsCache = /* @__PURE__ */ new WeakMap();
|
|
2823
2849
|
var setNestedGroup = (obj, key, value, uniqueCounting = true) => {
|
|
2824
2850
|
const parts = Array.isArray(key) ? key : key.split(/,\s*/);
|
|
@@ -4100,22 +4126,19 @@ var Indi = class extends Common {
|
|
|
4100
4126
|
if (objeList) {
|
|
4101
4127
|
await Promise.all(
|
|
4102
4128
|
objeList.map(async (objeRef) => {
|
|
4103
|
-
const key = objeRef
|
|
4129
|
+
const key = objeXrefKey(objeRef, 0);
|
|
4104
4130
|
const obje = objeRef?.standardizeMedia(
|
|
4105
4131
|
namespace,
|
|
4106
4132
|
true,
|
|
4107
|
-
|
|
4108
|
-
return ns && iId ? `https://mediasvc.ancestry.com/v2/image/namespaces/${ns}/media/${iId}?client=trees-mediaservice&imageQuality=hq` : void 0;
|
|
4109
|
-
}
|
|
4133
|
+
ancestryMediaFileUrl
|
|
4110
4134
|
);
|
|
4111
4135
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4112
|
-
const media =
|
|
4113
|
-
const clone = obje?.get("_CLON._OID")?.toValue();
|
|
4114
|
-
const mser = obje?.get("_MSER._LKID")?.toValue();
|
|
4136
|
+
const media = resolveObjeMediaId(obje);
|
|
4115
4137
|
let url = obje?.get("FILE")?.toValue();
|
|
4116
4138
|
const title = obje?.get("FILE.TITL")?.toValue() ?? obje?.get("TITL")?.toValue() ?? "";
|
|
4139
|
+
const note = objeNoteValue(obje);
|
|
4117
4140
|
const type = resolveObjeForm(obje) ?? (url ? getFileExtension(url) : void 0) ?? "raw";
|
|
4118
|
-
let imgId =
|
|
4141
|
+
let imgId = media;
|
|
4119
4142
|
const hasEmbeddedOrLocalFile = !!url && (url.startsWith("data:") || url.startsWith("blob:") || !/^https?:\/\//i.test(url));
|
|
4120
4143
|
if (!hasEmbeddedOrLocalFile && (!www || !tree || !this.id)) {
|
|
4121
4144
|
return;
|
|
@@ -4151,6 +4174,7 @@ var Indi = class extends Common {
|
|
|
4151
4174
|
imgId,
|
|
4152
4175
|
person: this.id,
|
|
4153
4176
|
title,
|
|
4177
|
+
note,
|
|
4154
4178
|
url,
|
|
4155
4179
|
contentType: type,
|
|
4156
4180
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4189,7 +4213,7 @@ var Indi = class extends Common {
|
|
|
4189
4213
|
return;
|
|
4190
4214
|
}
|
|
4191
4215
|
const obje = o;
|
|
4192
|
-
const key =
|
|
4216
|
+
const key = objeXrefKey(obje, index);
|
|
4193
4217
|
obje.standardizeMedia();
|
|
4194
4218
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4195
4219
|
const url = obje?.get("FILE")?.toValue();
|
|
@@ -4208,6 +4232,7 @@ var Indi = class extends Common {
|
|
|
4208
4232
|
imgId,
|
|
4209
4233
|
person: this.id,
|
|
4210
4234
|
title,
|
|
4235
|
+
note: objeNoteValue(obje),
|
|
4211
4236
|
url,
|
|
4212
4237
|
contentType: type,
|
|
4213
4238
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4316,7 +4341,7 @@ var Indi = class extends Common {
|
|
|
4316
4341
|
if (!obje) {
|
|
4317
4342
|
return;
|
|
4318
4343
|
}
|
|
4319
|
-
const key =
|
|
4344
|
+
const key = objeXrefKey(obje, index);
|
|
4320
4345
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4321
4346
|
const url = obje?.get("FILE")?.toValue();
|
|
4322
4347
|
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
@@ -4333,6 +4358,7 @@ var Indi = class extends Common {
|
|
|
4333
4358
|
imgId,
|
|
4334
4359
|
person: this.id,
|
|
4335
4360
|
title,
|
|
4361
|
+
note: objeNoteValue(obje),
|
|
4336
4362
|
url,
|
|
4337
4363
|
contentType: type,
|
|
4338
4364
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4356,7 +4382,7 @@ var Indi = class extends Common {
|
|
|
4356
4382
|
if (!obje) {
|
|
4357
4383
|
return;
|
|
4358
4384
|
}
|
|
4359
|
-
const key =
|
|
4385
|
+
const key = objeXrefKey(obje, index);
|
|
4360
4386
|
obje.standardizeMedia();
|
|
4361
4387
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4362
4388
|
const url = obje?.get("FILE")?.toValue();
|
|
@@ -4373,6 +4399,7 @@ var Indi = class extends Common {
|
|
|
4373
4399
|
imgId,
|
|
4374
4400
|
person: this.id,
|
|
4375
4401
|
title,
|
|
4402
|
+
note: objeNoteValue(obje),
|
|
4376
4403
|
url,
|
|
4377
4404
|
contentType: type,
|
|
4378
4405
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4404,7 +4431,12 @@ var Indi = class extends Common {
|
|
|
4404
4431
|
);
|
|
4405
4432
|
if (cached !== void 0) {
|
|
4406
4433
|
if (cached?.file && !isRemoteOrEmbeddedMediaUrl(cached.file)) {
|
|
4407
|
-
const resolvedCached = await resolveLocalMediaUrl(cached.file
|
|
4434
|
+
const resolvedCached = await resolveLocalMediaUrl(cached.file, {
|
|
4435
|
+
url: cached.file,
|
|
4436
|
+
person: this.id,
|
|
4437
|
+
tree: this.getTreeId?.(),
|
|
4438
|
+
treeName: this.getTreeName?.()
|
|
4439
|
+
});
|
|
4408
4440
|
if (resolvedCached && isRemoteOrEmbeddedMediaUrl(resolvedCached)) {
|
|
4409
4441
|
const refreshed = { ...cached, file: resolvedCached };
|
|
4410
4442
|
profilePictureCache(
|
|
@@ -4429,7 +4461,16 @@ var Indi = class extends Common {
|
|
|
4429
4461
|
}
|
|
4430
4462
|
const mediaArray = Object.values(mediaList);
|
|
4431
4463
|
const toDisplayableProfile = async (media, isPrimary) => {
|
|
4432
|
-
const resolvedFile = await resolveLocalMediaUrl(media.url
|
|
4464
|
+
const resolvedFile = await resolveLocalMediaUrl(media.url, {
|
|
4465
|
+
url: media.url,
|
|
4466
|
+
id: media.id,
|
|
4467
|
+
imgId: media.imgId,
|
|
4468
|
+
key: media.key,
|
|
4469
|
+
contentType: media.contentType,
|
|
4470
|
+
person: media.person || this.id,
|
|
4471
|
+
tree: media.tree || this.getTreeId?.(),
|
|
4472
|
+
treeName: this.getTreeName?.()
|
|
4473
|
+
});
|
|
4433
4474
|
if (!resolvedFile || !isRemoteOrEmbeddedMediaUrl(resolvedFile)) {
|
|
4434
4475
|
return void 0;
|
|
4435
4476
|
}
|
|
@@ -7624,6 +7665,445 @@ var KinshipTranslatorRu = class extends KinshipTranslatorBasic {
|
|
|
7624
7665
|
}
|
|
7625
7666
|
};
|
|
7626
7667
|
|
|
7668
|
+
// src/kinship-translator/patterns.ja.ts
|
|
7669
|
+
var InLawsJa = {
|
|
7670
|
+
"(\u5B50|\u5A18|\u606F\u5B50)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5B50",
|
|
7671
|
+
"(\u5B50|\u5A18|\u606F\u5B50)\u306E\u59BB": "\u5AC1",
|
|
7672
|
+
"(\u5B50|\u5A18|\u606F\u5B50)\u306E\u592B": "\u5A7F",
|
|
7673
|
+
"(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u6BCD": "\u7FA9\u6BCD",
|
|
7674
|
+
"(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u7236": "\u7FA9\u7236",
|
|
7675
|
+
"(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u89AA": "\u7FA9\u7406\u306E\u89AA",
|
|
7676
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u59BB": "\u7FA9\u7406\u306E\u59C9\u59B9",
|
|
7677
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u592B": "\u7FA9\u7406\u306E\u5144\u5F1F",
|
|
7678
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
|
|
7679
|
+
"(\u7570\u7236\u6BCD\u306E)?\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u59C9\u59B9",
|
|
7680
|
+
"(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F",
|
|
7681
|
+
"(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
|
|
7682
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u59C9\u59B9": "\u7FA9\u7406\u306E\u59C9\u59B9",
|
|
7683
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F": "\u7FA9\u7406\u306E\u5144\u5F1F",
|
|
7684
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F\u59C9\u59B9": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9"
|
|
7685
|
+
};
|
|
7686
|
+
|
|
7687
|
+
// src/kinship-translator/kinship-translator.ja.ts
|
|
7688
|
+
var sexOf2 = (person) => {
|
|
7689
|
+
if (person?.isMale?.()) {
|
|
7690
|
+
return "m";
|
|
7691
|
+
}
|
|
7692
|
+
if (person?.isFemale?.()) {
|
|
7693
|
+
return "f";
|
|
7694
|
+
}
|
|
7695
|
+
return "n";
|
|
7696
|
+
};
|
|
7697
|
+
var pick = (sex, male, female, neutral) => {
|
|
7698
|
+
if (sex === "m") {
|
|
7699
|
+
return male;
|
|
7700
|
+
}
|
|
7701
|
+
if (sex === "f") {
|
|
7702
|
+
return female;
|
|
7703
|
+
}
|
|
7704
|
+
return neutral;
|
|
7705
|
+
};
|
|
7706
|
+
var lineal = (level, sex, kind) => {
|
|
7707
|
+
const L = Math.max(1, level);
|
|
7708
|
+
if (kind === "asc") {
|
|
7709
|
+
if (L <= 1) {
|
|
7710
|
+
return pick(sex, "\u7236", "\u6BCD", "\u89AA");
|
|
7711
|
+
}
|
|
7712
|
+
if (L === 2) {
|
|
7713
|
+
return pick(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
|
|
7714
|
+
}
|
|
7715
|
+
if (L === 3) {
|
|
7716
|
+
return pick(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
|
|
7717
|
+
}
|
|
7718
|
+
if (L === 4) {
|
|
7719
|
+
return pick(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
|
|
7720
|
+
}
|
|
7721
|
+
return pick(
|
|
7722
|
+
sex,
|
|
7723
|
+
`${L - 1}\u4E16\u306E\u7956\u7236`,
|
|
7724
|
+
`${L - 1}\u4E16\u306E\u7956\u6BCD`,
|
|
7725
|
+
`${L - 1}\u4E16\u306E\u7956\u7236\u6BCD`
|
|
7726
|
+
);
|
|
7727
|
+
}
|
|
7728
|
+
if (L <= 1) {
|
|
7729
|
+
return pick(sex, "\u606F\u5B50", "\u5A18", "\u5B50");
|
|
7730
|
+
}
|
|
7731
|
+
if (L === 2) {
|
|
7732
|
+
return "\u5B6B";
|
|
7733
|
+
}
|
|
7734
|
+
if (L === 3) {
|
|
7735
|
+
return "\u66FE\u5B6B";
|
|
7736
|
+
}
|
|
7737
|
+
if (L === 4) {
|
|
7738
|
+
return "\u7384\u5B6B";
|
|
7739
|
+
}
|
|
7740
|
+
return `${L - 1}\u4E16\u306E\u5B6B`;
|
|
7741
|
+
};
|
|
7742
|
+
var cousinPlain = (degree) => {
|
|
7743
|
+
if (degree <= 1) {
|
|
7744
|
+
return "\u3044\u3068\u3053";
|
|
7745
|
+
}
|
|
7746
|
+
if (degree === 2) {
|
|
7747
|
+
return "\u307E\u305F\u3044\u3068\u3053";
|
|
7748
|
+
}
|
|
7749
|
+
if (degree === 3) {
|
|
7750
|
+
return "\u306F\u3068\u3053";
|
|
7751
|
+
}
|
|
7752
|
+
return `${degree}\u89AA\u7B49\u306E\u3044\u3068\u3053`;
|
|
7753
|
+
};
|
|
7754
|
+
var KinshipTranslatorJa = class extends KinshipTranslatorBasic {
|
|
7755
|
+
indirect() {
|
|
7756
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7757
|
+
if (degree > 0) {
|
|
7758
|
+
degree = degree - 1;
|
|
7759
|
+
}
|
|
7760
|
+
return cousinPlain(degree);
|
|
7761
|
+
}
|
|
7762
|
+
removal() {
|
|
7763
|
+
const level = this.pathN?.level ?? 0;
|
|
7764
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7765
|
+
if (degree > 0) {
|
|
7766
|
+
degree = degree - 1;
|
|
7767
|
+
}
|
|
7768
|
+
if (!degree) {
|
|
7769
|
+
return level < 0 ? this.nibling() : this.auncle();
|
|
7770
|
+
}
|
|
7771
|
+
const removed = Math.abs(level);
|
|
7772
|
+
return `${cousinPlain(degree)}\uFF08${removed}\u4E16\u4EE3\u9055\u3044\uFF09`;
|
|
7773
|
+
}
|
|
7774
|
+
auncle() {
|
|
7775
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
7776
|
+
const sex = sexOf2(this.personN);
|
|
7777
|
+
if (level <= 2) {
|
|
7778
|
+
return pick(sex, "\u304A\u3058", "\u304A\u3070", "\u304A\u3058/\u304A\u3070");
|
|
7779
|
+
}
|
|
7780
|
+
if (level === 3) {
|
|
7781
|
+
return pick(sex, "\u5927\u304A\u3058", "\u5927\u304A\u3070", "\u5927\u304A\u3058/\u5927\u304A\u3070");
|
|
7782
|
+
}
|
|
7783
|
+
return pick(
|
|
7784
|
+
sex,
|
|
7785
|
+
`${level - 2}\u4EE3\u524D\u306E\u304A\u3058`,
|
|
7786
|
+
`${level - 2}\u4EE3\u524D\u306E\u304A\u3070`,
|
|
7787
|
+
`${level - 2}\u4EE3\u524D\u306E\u304A\u3058/\u304A\u3070`
|
|
7788
|
+
);
|
|
7789
|
+
}
|
|
7790
|
+
nibling() {
|
|
7791
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
7792
|
+
const sex = sexOf2(this.personN);
|
|
7793
|
+
if (level <= 2) {
|
|
7794
|
+
return pick(sex, "\u7525", "\u59EA", "\u7525/\u59EA");
|
|
7795
|
+
}
|
|
7796
|
+
if (level === 3) {
|
|
7797
|
+
return pick(sex, "\u5927\u7525", "\u5927\u59EA", "\u5927\u7525/\u5927\u59EA");
|
|
7798
|
+
}
|
|
7799
|
+
return pick(
|
|
7800
|
+
sex,
|
|
7801
|
+
`${level - 2}\u4EE3\u4E0B\u306E\u7525`,
|
|
7802
|
+
`${level - 2}\u4EE3\u4E0B\u306E\u59EA`,
|
|
7803
|
+
`${level - 2}\u4EE3\u4E0B\u306E\u7525/\u59EA`
|
|
7804
|
+
);
|
|
7805
|
+
}
|
|
7806
|
+
parent() {
|
|
7807
|
+
return lineal(
|
|
7808
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
7809
|
+
sexOf2(this.personN),
|
|
7810
|
+
"asc"
|
|
7811
|
+
);
|
|
7812
|
+
}
|
|
7813
|
+
child() {
|
|
7814
|
+
return lineal(
|
|
7815
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
7816
|
+
sexOf2(this.personN),
|
|
7817
|
+
"desc"
|
|
7818
|
+
);
|
|
7819
|
+
}
|
|
7820
|
+
sibling() {
|
|
7821
|
+
return pick(sexOf2(this.personN), "\u5144\u5F1F", "\u59C9\u59B9", "\u5144\u5F1F\u59C9\u59B9");
|
|
7822
|
+
}
|
|
7823
|
+
halfBlood(relation) {
|
|
7824
|
+
if (!relation || !this.isHalfBlood) {
|
|
7825
|
+
return relation ?? "";
|
|
7826
|
+
}
|
|
7827
|
+
return `\u7570\u7236\u6BCD\u306E${relation}`;
|
|
7828
|
+
}
|
|
7829
|
+
spouse() {
|
|
7830
|
+
return pick(sexOf2(this.personN), "\u592B", "\u59BB", "\u914D\u5076\u8005");
|
|
7831
|
+
}
|
|
7832
|
+
ofSpouse(relation) {
|
|
7833
|
+
if (!relation) {
|
|
7834
|
+
return "";
|
|
7835
|
+
}
|
|
7836
|
+
const spouseType = pick(
|
|
7837
|
+
sexOf2(this.path?.[1].indi),
|
|
7838
|
+
"\u592B",
|
|
7839
|
+
"\u59BB",
|
|
7840
|
+
"\u914D\u5076\u8005"
|
|
7841
|
+
);
|
|
7842
|
+
return `${spouseType}\u306E${relation}`;
|
|
7843
|
+
}
|
|
7844
|
+
spouseOf(relation) {
|
|
7845
|
+
if (!relation) {
|
|
7846
|
+
return "";
|
|
7847
|
+
}
|
|
7848
|
+
const spouse = this.path?.[this.path.length - 1].indi;
|
|
7849
|
+
const spouseType = pick(sexOf2(spouse), "\u592B", "\u59BB", "\u914D\u5076\u8005");
|
|
7850
|
+
return `${relation}\u306E${spouseType}`;
|
|
7851
|
+
}
|
|
7852
|
+
of(relation) {
|
|
7853
|
+
const formattedName = nameFormatter(this.path?.[0]?.indi, {
|
|
7854
|
+
nameOrder: "last-first"
|
|
7855
|
+
});
|
|
7856
|
+
let name = formattedName.inOrder.filter(Boolean).join(" ");
|
|
7857
|
+
if (this.displayName === "none") {
|
|
7858
|
+
name = "";
|
|
7859
|
+
} else if (this.displayName === "givenname") {
|
|
7860
|
+
name = formattedName.givenname;
|
|
7861
|
+
} else if (this.displayName === "surname") {
|
|
7862
|
+
name = `${formattedName.surname}`;
|
|
7863
|
+
}
|
|
7864
|
+
if (!name || !relation) {
|
|
7865
|
+
return relation ?? "";
|
|
7866
|
+
}
|
|
7867
|
+
return `${name}\u306E${relation}`;
|
|
7868
|
+
}
|
|
7869
|
+
inLaw(relation) {
|
|
7870
|
+
let inLawRelation = relation;
|
|
7871
|
+
Object.keys(InLawsJa).find((pattern) => {
|
|
7872
|
+
const regex = new RegExp(`^${pattern}$`);
|
|
7873
|
+
if (relation?.match(regex)) {
|
|
7874
|
+
inLawRelation = InLawsJa[pattern];
|
|
7875
|
+
return true;
|
|
7876
|
+
}
|
|
7877
|
+
return false;
|
|
7878
|
+
});
|
|
7879
|
+
return inLawRelation ?? "";
|
|
7880
|
+
}
|
|
7881
|
+
relationType(relation) {
|
|
7882
|
+
if (!relation || !this.pathN?.relation) {
|
|
7883
|
+
return relation ?? "";
|
|
7884
|
+
}
|
|
7885
|
+
return `${this.pathN.relation}\u306E${relation}`;
|
|
7886
|
+
}
|
|
7887
|
+
};
|
|
7888
|
+
|
|
7889
|
+
// src/kinship-translator/patterns.zh.ts
|
|
7890
|
+
var InLawsZh = {
|
|
7891
|
+
"(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u914D\u5076": "\u513F\u5AB3/\u5973\u5A7F",
|
|
7892
|
+
"(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u59BB\u5B50": "\u513F\u5AB3",
|
|
7893
|
+
"(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u4E08\u592B": "\u5973\u5A7F",
|
|
7894
|
+
"(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u6BCD\u4EB2": "\u5CB3\u6BCD/\u5A46\u5A46",
|
|
7895
|
+
"(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u4EB2": "\u5CB3\u7236/\u516C\u516C",
|
|
7896
|
+
"(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u6BCD": "\u5CB3\u7236\u5CB3\u6BCD/\u516C\u516C\u5A46\u5A46",
|
|
7897
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u59BB\u5B50": "\u5AC2\u5B50/\u5F1F\u59B9",
|
|
7898
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u4E08\u592B": "\u59D0\u592B/\u59B9\u592B",
|
|
7899
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u914D\u5076": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
|
|
7900
|
+
"(\u5F02\u7236\u6BCD\u7684)?\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59D0\u592B/\u59B9\u592B",
|
|
7901
|
+
"(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u5AC2\u5B50/\u5F1F\u59B9",
|
|
7902
|
+
"(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
|
|
7903
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u59D0\u59B9": "\u59D1\u5B50/\u59E8\u5B50",
|
|
7904
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F": "\u5927\u4F2F/\u5C0F\u53D4/\u5185\u5144/\u5185\u5F1F",
|
|
7905
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F\u59D0\u59B9": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9"
|
|
7906
|
+
};
|
|
7907
|
+
|
|
7908
|
+
// src/kinship-translator/kinship-translator.zh.ts
|
|
7909
|
+
var sexOf3 = (person) => {
|
|
7910
|
+
if (person?.isMale?.()) {
|
|
7911
|
+
return "m";
|
|
7912
|
+
}
|
|
7913
|
+
if (person?.isFemale?.()) {
|
|
7914
|
+
return "f";
|
|
7915
|
+
}
|
|
7916
|
+
return "n";
|
|
7917
|
+
};
|
|
7918
|
+
var pick2 = (sex, male, female, neutral) => {
|
|
7919
|
+
if (sex === "m") {
|
|
7920
|
+
return male;
|
|
7921
|
+
}
|
|
7922
|
+
if (sex === "f") {
|
|
7923
|
+
return female;
|
|
7924
|
+
}
|
|
7925
|
+
return neutral;
|
|
7926
|
+
};
|
|
7927
|
+
var lineal2 = (level, sex, kind) => {
|
|
7928
|
+
const L = Math.max(1, level);
|
|
7929
|
+
if (kind === "asc") {
|
|
7930
|
+
if (L <= 1) {
|
|
7931
|
+
return pick2(sex, "\u7236\u4EB2", "\u6BCD\u4EB2", "\u7236\u6BCD");
|
|
7932
|
+
}
|
|
7933
|
+
if (L === 2) {
|
|
7934
|
+
return pick2(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
|
|
7935
|
+
}
|
|
7936
|
+
if (L === 3) {
|
|
7937
|
+
return pick2(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
|
|
7938
|
+
}
|
|
7939
|
+
if (L === 4) {
|
|
7940
|
+
return pick2(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
|
|
7941
|
+
}
|
|
7942
|
+
return pick2(sex, `${L}\u4E16\u7956`, `${L}\u4E16\u7956\u6BCD`, `${L}\u4E16\u7956\u7236\u6BCD`);
|
|
7943
|
+
}
|
|
7944
|
+
if (L <= 1) {
|
|
7945
|
+
return pick2(sex, "\u513F\u5B50", "\u5973\u513F", "\u5B50\u5973");
|
|
7946
|
+
}
|
|
7947
|
+
if (L === 2) {
|
|
7948
|
+
return pick2(sex, "\u5B59\u5B50", "\u5B59\u5973", "\u5B59\u5B50\u5973");
|
|
7949
|
+
}
|
|
7950
|
+
if (L === 3) {
|
|
7951
|
+
return pick2(sex, "\u66FE\u5B59", "\u66FE\u5B59\u5973", "\u66FE\u5B59\u5B50\u5973");
|
|
7952
|
+
}
|
|
7953
|
+
if (L === 4) {
|
|
7954
|
+
return pick2(sex, "\u7384\u5B59", "\u7384\u5B59\u5973", "\u7384\u5B59\u5B50\u5973");
|
|
7955
|
+
}
|
|
7956
|
+
return pick2(sex, `${L}\u4E16\u5B59`, `${L}\u4E16\u5B59\u5973`, `${L}\u4E16\u5B59\u5B50\u5973`);
|
|
7957
|
+
};
|
|
7958
|
+
var cousinPlain2 = (degree, sex) => {
|
|
7959
|
+
if (degree <= 1) {
|
|
7960
|
+
return pick2(sex, "\u5802\u8868\u5144\u5F1F", "\u5802\u8868\u59D0\u59B9", "\u5802\u8868\u4EB2");
|
|
7961
|
+
}
|
|
7962
|
+
if (degree === 2) {
|
|
7963
|
+
return pick2(sex, "\u4ECE\u5802\u8868\u5144\u5F1F", "\u4ECE\u5802\u8868\u59D0\u59B9", "\u4ECE\u5802\u8868\u4EB2");
|
|
7964
|
+
}
|
|
7965
|
+
return pick2(
|
|
7966
|
+
sex,
|
|
7967
|
+
`${degree}\u4EE3\u5802\u8868\u5144\u5F1F`,
|
|
7968
|
+
`${degree}\u4EE3\u5802\u8868\u59D0\u59B9`,
|
|
7969
|
+
`${degree}\u4EE3\u5802\u8868\u4EB2`
|
|
7970
|
+
);
|
|
7971
|
+
};
|
|
7972
|
+
var KinshipTranslatorZh = class extends KinshipTranslatorBasic {
|
|
7973
|
+
indirect() {
|
|
7974
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7975
|
+
if (degree > 0) {
|
|
7976
|
+
degree = degree - 1;
|
|
7977
|
+
}
|
|
7978
|
+
return cousinPlain2(degree, sexOf3(this.personN));
|
|
7979
|
+
}
|
|
7980
|
+
removal() {
|
|
7981
|
+
const level = this.pathN?.level ?? 0;
|
|
7982
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7983
|
+
if (degree > 0) {
|
|
7984
|
+
degree = degree - 1;
|
|
7985
|
+
}
|
|
7986
|
+
if (!degree) {
|
|
7987
|
+
return level < 0 ? this.nibling() : this.auncle();
|
|
7988
|
+
}
|
|
7989
|
+
const removed = Math.abs(level);
|
|
7990
|
+
return `${cousinPlain2(degree, sexOf3(this.personN))}\uFF08\u9694${removed}\u4EE3\uFF09`;
|
|
7991
|
+
}
|
|
7992
|
+
auncle() {
|
|
7993
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
7994
|
+
const sex = sexOf3(this.personN);
|
|
7995
|
+
if (level <= 2) {
|
|
7996
|
+
return pick2(sex, "\u53D4\u53D4", "\u963F\u59E8", "\u53D4\u4F2F/\u59D1\u59E8");
|
|
7997
|
+
}
|
|
7998
|
+
if (level === 3) {
|
|
7999
|
+
return pick2(sex, "\u4F2F\u53D4\u7956\u7236", "\u59D1\u7956\u6BCD", "\u4F2F\u53D4\u7956\u7236\u6BCD");
|
|
8000
|
+
}
|
|
8001
|
+
return pick2(
|
|
8002
|
+
sex,
|
|
8003
|
+
`${level - 2}\u4EE3\u524D\u7684\u53D4\u53D4`,
|
|
8004
|
+
`${level - 2}\u4EE3\u524D\u7684\u963F\u59E8`,
|
|
8005
|
+
`${level - 2}\u4EE3\u524D\u7684\u53D4\u4F2F/\u59D1\u59E8`
|
|
8006
|
+
);
|
|
8007
|
+
}
|
|
8008
|
+
nibling() {
|
|
8009
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
8010
|
+
const sex = sexOf3(this.personN);
|
|
8011
|
+
if (level <= 2) {
|
|
8012
|
+
return pick2(sex, "\u4F84\u5B50", "\u4F84\u5973", "\u4F84\u5B50\u5973");
|
|
8013
|
+
}
|
|
8014
|
+
if (level === 3) {
|
|
8015
|
+
return pick2(sex, "\u4F84\u5B59", "\u4F84\u5B59\u5973", "\u4F84\u5B59\u5B50\u5973");
|
|
8016
|
+
}
|
|
8017
|
+
return pick2(
|
|
8018
|
+
sex,
|
|
8019
|
+
`${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50`,
|
|
8020
|
+
`${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5973`,
|
|
8021
|
+
`${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50\u5973`
|
|
8022
|
+
);
|
|
8023
|
+
}
|
|
8024
|
+
parent() {
|
|
8025
|
+
return lineal2(
|
|
8026
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
8027
|
+
sexOf3(this.personN),
|
|
8028
|
+
"asc"
|
|
8029
|
+
);
|
|
8030
|
+
}
|
|
8031
|
+
child() {
|
|
8032
|
+
return lineal2(
|
|
8033
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
8034
|
+
sexOf3(this.personN),
|
|
8035
|
+
"desc"
|
|
8036
|
+
);
|
|
8037
|
+
}
|
|
8038
|
+
sibling() {
|
|
8039
|
+
return pick2(sexOf3(this.personN), "\u5144\u5F1F", "\u59D0\u59B9", "\u5144\u5F1F\u59D0\u59B9");
|
|
8040
|
+
}
|
|
8041
|
+
halfBlood(relation) {
|
|
8042
|
+
if (!relation || !this.isHalfBlood) {
|
|
8043
|
+
return relation ?? "";
|
|
8044
|
+
}
|
|
8045
|
+
return `\u5F02\u7236\u6BCD\u7684${relation}`;
|
|
8046
|
+
}
|
|
8047
|
+
spouse() {
|
|
8048
|
+
return pick2(sexOf3(this.personN), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
|
|
8049
|
+
}
|
|
8050
|
+
ofSpouse(relation) {
|
|
8051
|
+
if (!relation) {
|
|
8052
|
+
return "";
|
|
8053
|
+
}
|
|
8054
|
+
const spouseType = pick2(
|
|
8055
|
+
sexOf3(this.path?.[1].indi),
|
|
8056
|
+
"\u4E08\u592B",
|
|
8057
|
+
"\u59BB\u5B50",
|
|
8058
|
+
"\u914D\u5076"
|
|
8059
|
+
);
|
|
8060
|
+
return `${spouseType}\u7684${relation}`;
|
|
8061
|
+
}
|
|
8062
|
+
spouseOf(relation) {
|
|
8063
|
+
if (!relation) {
|
|
8064
|
+
return "";
|
|
8065
|
+
}
|
|
8066
|
+
const spouse = this.path?.[this.path.length - 1].indi;
|
|
8067
|
+
const spouseType = pick2(sexOf3(spouse), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
|
|
8068
|
+
return `${relation}\u7684${spouseType}`;
|
|
8069
|
+
}
|
|
8070
|
+
of(relation) {
|
|
8071
|
+
const formattedName = nameFormatter(this.path?.[0]?.indi, {
|
|
8072
|
+
nameOrder: "last-first"
|
|
8073
|
+
});
|
|
8074
|
+
let name = formattedName.inOrder.filter(Boolean).join(" ");
|
|
8075
|
+
if (this.displayName === "none") {
|
|
8076
|
+
name = "";
|
|
8077
|
+
} else if (this.displayName === "givenname") {
|
|
8078
|
+
name = formattedName.givenname;
|
|
8079
|
+
} else if (this.displayName === "surname") {
|
|
8080
|
+
name = `${formattedName.surname}`;
|
|
8081
|
+
}
|
|
8082
|
+
if (!name || !relation) {
|
|
8083
|
+
return relation ?? "";
|
|
8084
|
+
}
|
|
8085
|
+
return `${name}\u7684${relation}`;
|
|
8086
|
+
}
|
|
8087
|
+
inLaw(relation) {
|
|
8088
|
+
let inLawRelation = relation;
|
|
8089
|
+
Object.keys(InLawsZh).find((pattern) => {
|
|
8090
|
+
const regex = new RegExp(`^${pattern}$`);
|
|
8091
|
+
if (relation?.match(regex)) {
|
|
8092
|
+
inLawRelation = InLawsZh[pattern];
|
|
8093
|
+
return true;
|
|
8094
|
+
}
|
|
8095
|
+
return false;
|
|
8096
|
+
});
|
|
8097
|
+
return inLawRelation ?? "";
|
|
8098
|
+
}
|
|
8099
|
+
relationType(relation) {
|
|
8100
|
+
if (!relation || !this.pathN?.relation) {
|
|
8101
|
+
return relation ?? "";
|
|
8102
|
+
}
|
|
8103
|
+
return `${this.pathN.relation}${relation}`;
|
|
8104
|
+
}
|
|
8105
|
+
};
|
|
8106
|
+
|
|
7627
8107
|
// src/kinship-translator/kinship-translator.ts
|
|
7628
8108
|
var KinshipTranslator = class {
|
|
7629
8109
|
constructor(person1, person2, lang = "en", entirePath, displayName = "givenname") {
|
|
@@ -8399,7 +8879,9 @@ var downloadGedzipMedia = async (media, onProgress) => {
|
|
|
8399
8879
|
id: item.id,
|
|
8400
8880
|
imgId: item.imgId,
|
|
8401
8881
|
key: "key" in item ? item.key : void 0,
|
|
8402
|
-
contentType: item.contentType
|
|
8882
|
+
contentType: item.contentType,
|
|
8883
|
+
person: "person" in item ? item.person : void 0,
|
|
8884
|
+
tree: "tree" in item ? item.tree : void 0
|
|
8403
8885
|
});
|
|
8404
8886
|
if (!resolved?.content) {
|
|
8405
8887
|
return;
|
|
@@ -8924,7 +9406,7 @@ var collectExtensionTagsFrom = (node, into = /* @__PURE__ */ new Set()) => {
|
|
|
8924
9406
|
// package.json
|
|
8925
9407
|
var package_default = {
|
|
8926
9408
|
name: "@treeviz/gedcom-parser",
|
|
8927
|
-
version: "2.1.
|
|
9409
|
+
version: "2.1.11"};
|
|
8928
9410
|
|
|
8929
9411
|
// src/utils/get-product-details.ts
|
|
8930
9412
|
var isDevelopment = () => {
|
|
@@ -9009,16 +9491,26 @@ var Obje = class extends Common {
|
|
|
9009
9491
|
if (!this._gedcom) {
|
|
9010
9492
|
return this;
|
|
9011
9493
|
}
|
|
9494
|
+
if (typeof this.value === "string" && isId(this.value) && this.refType === "OBJE") {
|
|
9495
|
+
const resolved = this.ref;
|
|
9496
|
+
if (resolved && resolved !== this && typeof resolved.standardizeMedia === "function") {
|
|
9497
|
+
resolved.standardizeMedia(
|
|
9498
|
+
namespace,
|
|
9499
|
+
override,
|
|
9500
|
+
urlGetter,
|
|
9501
|
+
gedcomVersion
|
|
9502
|
+
);
|
|
9503
|
+
return this;
|
|
9504
|
+
}
|
|
9505
|
+
}
|
|
9012
9506
|
const rin = this?.get("RIN")?.toValue();
|
|
9013
|
-
const clone = this?.get("_CLON._OID")?.toValue();
|
|
9014
|
-
const mser = this?.get("_MSER._LKID")?.toValue();
|
|
9015
9507
|
const title = this?.get("FILE.TITL")?.toValue() ?? this?.get("TITL")?.toValue() ?? "";
|
|
9016
9508
|
const note = this?.get("FILE.NOTE")?.toValue() ?? this?.get("NOTE")?.toValue() ?? "";
|
|
9017
9509
|
const formRaw = this?.get("FILE.FORM")?.toValue() ?? this?.get("FORM")?.toValue();
|
|
9018
9510
|
const mediType = this?.get("FILE.FORM.TYPE")?.toValue() ?? this?.get("FORM.TYPE")?.toValue() ?? this?.get("MEDI")?.toValue();
|
|
9019
9511
|
const file = this?.get("FILE")?.toValue();
|
|
9020
|
-
const imgId =
|
|
9021
|
-
const url = file || namespace && urlGetter?.(namespace, imgId);
|
|
9512
|
+
const imgId = resolveObjeMediaId(this);
|
|
9513
|
+
const url = file || this.isAncestry() && namespace && urlGetter?.(namespace, imgId);
|
|
9022
9514
|
if (!url) {
|
|
9023
9515
|
return this;
|
|
9024
9516
|
}
|
|
@@ -9531,6 +10023,22 @@ var GedCom = class extends Common {
|
|
|
9531
10023
|
obje(index) {
|
|
9532
10024
|
return this.getMain(this.objes(), index);
|
|
9533
10025
|
}
|
|
10026
|
+
/**
|
|
10027
|
+
* People who link a shared multimedia record (`1 OBJE @On@`), i.e. Ancestry
|
|
10028
|
+
* face tags / everyone the photo is attached to.
|
|
10029
|
+
*/
|
|
10030
|
+
indisLinkingObje(objeKey) {
|
|
10031
|
+
const people = [];
|
|
10032
|
+
this.indis()?.forEach((indi) => {
|
|
10033
|
+
const linked = indi?.get("OBJE")?.toList()?.values()?.some(
|
|
10034
|
+
(item) => item?.toValue?.() === objeKey || item?.id === objeKey
|
|
10035
|
+
);
|
|
10036
|
+
if (linked && indi) {
|
|
10037
|
+
people.push(indi);
|
|
10038
|
+
}
|
|
10039
|
+
});
|
|
10040
|
+
return people;
|
|
10041
|
+
}
|
|
9534
10042
|
sour(index) {
|
|
9535
10043
|
return this.getMain(this.sours(), index);
|
|
9536
10044
|
}
|
|
@@ -10576,4 +11084,4 @@ var hydrateFromContentAsync = async (content, options) => {
|
|
|
10576
11084
|
return hydrateFromContent(content, options);
|
|
10577
11085
|
};
|
|
10578
11086
|
|
|
10579
|
-
export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, DEFAULT_GEDCOM_EXPORT_VERSION, GEDCOM7_CALENDARS, GEDCOM7_PEDI_VALUES, GEDCOM7_RESN_VALUES, GEDCOM7_ROLE_VALUES, GEDCOM7_SEX_VALUES, GEDCOM_EXPORT_VERSIONS, GEDCOM_TRAILER_TAG, GEDZIP_EXTENSION, GEDZIP_GEDCOM_ENTRY, GEDZIP_MIME, parser_default as GedcomTree, PEDIGREE_VALUES, PlaceType, STRUCTURAL_FORMAT, STRUCTURAL_VERSION, TREEVIZ_EXTENSION_BASE_URI, TREEVIZ_EXTENSION_URIS, addFamilyFact, addIndividualFact, addNonEvent, appendGedcomTrailer, applyGedcom7DatePhrases, applyGedcom7Enumerations, applyGedcom7RecordMetadata, attachChildToFamily, attachSpouseToFamily, buildGedzip, buildGedzipBlob, bytesToDataUrl, cacheDiscoveredPath, canAttachAsSpouse, collectExtensionTagsFrom, commonDateFormatter, consolidateChildIntoFamily, coupleKeyForFam, create, createEmptyGedcom, createGedcomUid, dateFormatter, deleteIndividual, downloadGedzipMedia, ensureExtensionSchema, extractGedzip, extractGedzipGedcom, extractSeparationYears, extractSplitPoints, familyHasChild, familyHasParent, findDegenerateFamiliesForIndi, findDuplicateCoupleFamiliesForIndi, findMatchingRangeForSplitRange, findReusableParentChildFamily, firstPointerId, formatGedcom7Timestamp, fromObject, fromObjectAsync, fromTuple, generateSplitRanges, getAllProp, getExtensionSchema, getFamilyWith, getFileExtension, getName, getPlaceParts, getPlaces, getRawSize, getVersion, hungarianOrdinalize, hydrateFromContent, hydrateFromContentAsync, implemented, inRange, inferMediaForm, initializeCache, isDegenerateFamily, isDevelopment, isGedcom7, isGedcomTrailerLine, isGedcomTrailerTag, isGedzipContainer, isImageFormat, isIntersectedRange, isObjePointer, isRangeContained, isRemoteOrEmbeddedMediaUrl, isStructuralEnvelope, makePointer, marriageDateFormatter, mergeDuplicateCoupleFamilies, mergeMediaLists, nameFormatter, nextRecordId, normalizeGedcomVersion, notImplemented, noteDateFormatter, ordinalize, parseGedcom7CalendarPrefix, parseRangeBounds, parseStructuralEnvelope, pathCache, placeTranslator, pointerIds, profilePictureCache, pruneEmptyFamilies, pruneFamiliesByIds, registerExtensionTag, relativesCache, remountGedzipMediaAsDataUrls, removePointerByValue, resetRelativesCache, resolveLocalMediaUrl, resolveMediaContent, resolveObjeForm, rewriteGedcomFilePaths, serializeStructural, setCauseOfDeath, setChildPedigree, setDeceased, setFamilyMarriage, setLocalMediaResolver, setMediaContentResolver, setNestedGroup, splitOverlappingRanges, splitRange, spouseTagFor, toGedcomPedigree, unlinkRelative, updateFactRecord, withGedcom7Calendar };
|
|
11087
|
+
export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, ANCESTRY_MEDIA_RETRIEVAL_PREFIX, DEFAULT_GEDCOM_EXPORT_VERSION, GEDCOM7_CALENDARS, GEDCOM7_PEDI_VALUES, GEDCOM7_RESN_VALUES, GEDCOM7_ROLE_VALUES, GEDCOM7_SEX_VALUES, GEDCOM_EXPORT_VERSIONS, GEDCOM_TRAILER_TAG, GEDZIP_EXTENSION, GEDZIP_GEDCOM_ENTRY, GEDZIP_MIME, parser_default as GedcomTree, PEDIGREE_VALUES, PlaceType, STRUCTURAL_FORMAT, STRUCTURAL_VERSION, TREEVIZ_EXTENSION_BASE_URI, TREEVIZ_EXTENSION_URIS, addFamilyFact, addIndividualFact, addNonEvent, ancestryMediaFileUrl, appendGedcomTrailer, applyGedcom7DatePhrases, applyGedcom7Enumerations, applyGedcom7RecordMetadata, attachChildToFamily, attachSpouseToFamily, buildGedzip, buildGedzipBlob, bytesToDataUrl, cacheDiscoveredPath, canAttachAsSpouse, collectExtensionTagsFrom, commonDateFormatter, consolidateChildIntoFamily, coupleKeyForFam, create, createEmptyGedcom, createGedcomUid, dateFormatter, deleteIndividual, downloadGedzipMedia, ensureExtensionSchema, extractGedzip, extractGedzipGedcom, extractSeparationYears, extractSplitPoints, familyHasChild, familyHasParent, findDegenerateFamiliesForIndi, findDuplicateCoupleFamiliesForIndi, findMatchingRangeForSplitRange, findReusableParentChildFamily, firstPointerId, formatGedcom7Timestamp, fromObject, fromObjectAsync, fromTuple, generateSplitRanges, getAllProp, getExtensionSchema, getFamilyWith, getFileExtension, getName, getPlaceParts, getPlaces, getRawSize, getVersion, hungarianOrdinalize, hydrateFromContent, hydrateFromContentAsync, implemented, inRange, inferMediaForm, initializeCache, isDegenerateFamily, isDevelopment, isGedcom7, isGedcomTrailerLine, isGedcomTrailerTag, isGedzipContainer, isImageFormat, isIntersectedRange, isObjePointer, isRangeContained, isRemoteOrEmbeddedMediaUrl, isStructuralEnvelope, makePointer, marriageDateFormatter, mergeDuplicateCoupleFamilies, mergeMediaLists, nameFormatter, nextRecordId, normalizeGedcomVersion, notImplemented, noteDateFormatter, objeNoteValue, objeXrefKey, ordinalize, parseGedcom7CalendarPrefix, parseRangeBounds, parseStructuralEnvelope, pathCache, placeTranslator, pointerIds, profilePictureCache, pruneEmptyFamilies, pruneFamiliesByIds, registerExtensionTag, relativesCache, remountGedzipMediaAsDataUrls, removePointerByValue, resetRelativesCache, resolveLocalMediaUrl, resolveMediaContent, resolveObjeForm, resolveObjeMediaId, rewriteGedcomFilePaths, serializeStructural, setCauseOfDeath, setChildPedigree, setDeceased, setFamilyMarriage, setLocalMediaResolver, setMediaContentResolver, setNestedGroup, splitOverlappingRanges, splitRange, spouseTagFor, toGedcomPedigree, unlinkRelative, updateFactRecord, withGedcom7Calendar };
|