@treeviz/gedcom-parser 2.0.8 → 2.0.10
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/index.js +627 -159
- package/dist/classes/indi.d.ts.map +1 -1
- package/dist/cli/index.js +627 -159
- package/dist/constants/index.js +626 -158
- package/dist/factories/index.js +626 -158
- package/dist/index.js +628 -160
- package/dist/kinship-translator/index.d.ts +1 -0
- package/dist/kinship-translator/index.d.ts.map +1 -1
- package/dist/kinship-translator/index.js +627 -159
- package/dist/kinship-translator/kinship-translator.basic.d.ts +11 -0
- package/dist/kinship-translator/kinship-translator.basic.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.de.d.ts +2 -1
- package/dist/kinship-translator/kinship-translator.de.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.en.d.ts +2 -1
- package/dist/kinship-translator/kinship-translator.en.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.es.d.ts +2 -1
- package/dist/kinship-translator/kinship-translator.es.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.fr.d.ts +2 -1
- package/dist/kinship-translator/kinship-translator.fr.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.hu.d.ts +8 -1
- package/dist/kinship-translator/kinship-translator.hu.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.interface.d.ts +1 -0
- package/dist/kinship-translator/kinship-translator.interface.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.ru.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.ru.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.es.d.ts.map +1 -1
- package/dist/kinship-translator/patterns.ru.d.ts +2 -0
- package/dist/kinship-translator/patterns.ru.d.ts.map +1 -0
- package/dist/kinship-translator/translators.d.ts +1 -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 +14 -1
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/index.js +628 -160
- package/package.json +1 -1
package/dist/utils/index.js
CHANGED
|
@@ -161,6 +161,135 @@ var profilePictureCache = (gedcom, key, value) => {
|
|
|
161
161
|
const cached = caches.profilePictureCache?.[fullKey];
|
|
162
162
|
return cached;
|
|
163
163
|
};
|
|
164
|
+
var isNonBiologicalPath = (path) => path.some(
|
|
165
|
+
(item) => item.relation && item.relation !== "biological" /* BIOLOGICAL */
|
|
166
|
+
);
|
|
167
|
+
var invertHop = (kinship) => {
|
|
168
|
+
if (kinship === "parent") {
|
|
169
|
+
return "child";
|
|
170
|
+
}
|
|
171
|
+
if (kinship === "child") {
|
|
172
|
+
return "parent";
|
|
173
|
+
}
|
|
174
|
+
return kinship;
|
|
175
|
+
};
|
|
176
|
+
var hopRelation = (from, toIndi, kinship, inherited) => {
|
|
177
|
+
if (kinship === "parent" || kinship === "child") {
|
|
178
|
+
const parent = kinship === "parent" ? toIndi : from.indi;
|
|
179
|
+
const child = kinship === "parent" ? from.indi : toIndi;
|
|
180
|
+
const currentRelation = child.getParentType(parent);
|
|
181
|
+
if (currentRelation && currentRelation !== "biological" /* BIOLOGICAL */) {
|
|
182
|
+
return currentRelation;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (inherited && inherited !== "biological" /* BIOLOGICAL */) {
|
|
186
|
+
return inherited;
|
|
187
|
+
}
|
|
188
|
+
return void 0;
|
|
189
|
+
};
|
|
190
|
+
var rebuildPathFromHops = (hops, skipRelation = false) => {
|
|
191
|
+
if (hops.length === 0) {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
const path = [
|
|
195
|
+
{
|
|
196
|
+
indi: hops[0].indi,
|
|
197
|
+
kinship: "self",
|
|
198
|
+
level: 0,
|
|
199
|
+
levelUp: 0,
|
|
200
|
+
levelDown: 0,
|
|
201
|
+
degree: 0
|
|
202
|
+
}
|
|
203
|
+
];
|
|
204
|
+
for (let i = 1; i < hops.length; i++) {
|
|
205
|
+
const prev = path[i - 1];
|
|
206
|
+
const { indi, kinship } = hops[i];
|
|
207
|
+
const relation = skipRelation ? void 0 : hopRelation(prev, indi, kinship, prev.relation);
|
|
208
|
+
if (kinship === "parent") {
|
|
209
|
+
path.push({
|
|
210
|
+
indi,
|
|
211
|
+
kinship,
|
|
212
|
+
relation,
|
|
213
|
+
level: prev.level + 1,
|
|
214
|
+
levelUp: prev.levelUp + 1,
|
|
215
|
+
levelDown: prev.levelDown,
|
|
216
|
+
degree: prev.degree
|
|
217
|
+
});
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (kinship === "child") {
|
|
221
|
+
path.push({
|
|
222
|
+
indi,
|
|
223
|
+
kinship,
|
|
224
|
+
relation,
|
|
225
|
+
level: prev.level - 1,
|
|
226
|
+
levelUp: prev.levelUp,
|
|
227
|
+
levelDown: prev.levelDown + 1,
|
|
228
|
+
degree: prev.levelUp ? prev.level > 0 ? prev.levelUp - prev.level + 1 : prev.levelDown - Math.abs(prev.level) : 0
|
|
229
|
+
});
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
path.push({
|
|
233
|
+
indi,
|
|
234
|
+
kinship,
|
|
235
|
+
relation,
|
|
236
|
+
level: prev.level,
|
|
237
|
+
levelUp: prev.levelUp,
|
|
238
|
+
levelDown: prev.levelDown,
|
|
239
|
+
degree: prev.degree
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return path;
|
|
243
|
+
};
|
|
244
|
+
var storePathIfBetter = (gedcom, fromId, toId, path) => {
|
|
245
|
+
const key = `${fromId}|${toId}`;
|
|
246
|
+
const existing = pathCache(gedcom, key);
|
|
247
|
+
if (existing && (!isNonBiologicalPath(existing) || isNonBiologicalPath(path))) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
pathCache(gedcom, key, path);
|
|
251
|
+
};
|
|
252
|
+
var cacheDiscoveredPath = (gedcom, path) => {
|
|
253
|
+
const n = path.length;
|
|
254
|
+
if (n < 2) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
for (let i = 0; i < n; i++) {
|
|
258
|
+
const fromId = path[i].indi.id;
|
|
259
|
+
if (!fromId) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
for (let j = i + 1; j < n; j++) {
|
|
263
|
+
const toId = path[j].indi.id;
|
|
264
|
+
if (!toId) {
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
const isOriginalPair = i === 0 && j === n - 1;
|
|
268
|
+
const isDirectHop = j === i + 1;
|
|
269
|
+
const slice = path.slice(i, j + 1);
|
|
270
|
+
const sliceMixed = isNonBiologicalPath(slice);
|
|
271
|
+
if (!isOriginalPair && !isDirectHop && sliceMixed) {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
const forward = i === 0 ? slice : rebuildPathFromHops(slice, !sliceMixed);
|
|
275
|
+
const reverseHops = [
|
|
276
|
+
{
|
|
277
|
+
indi: slice[slice.length - 1].indi,
|
|
278
|
+
kinship: "self"
|
|
279
|
+
}
|
|
280
|
+
];
|
|
281
|
+
for (let k = slice.length - 2; k >= 0; k--) {
|
|
282
|
+
reverseHops.push({
|
|
283
|
+
indi: slice[k].indi,
|
|
284
|
+
kinship: invertHop(slice[k + 1].kinship)
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
const reverse = rebuildPathFromHops(reverseHops, !sliceMixed);
|
|
288
|
+
storePathIfBetter(gedcom, fromId, toId, forward);
|
|
289
|
+
storePathIfBetter(gedcom, toId, fromId, reverse);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
};
|
|
164
293
|
|
|
165
294
|
// src/constants/constants.ts
|
|
166
295
|
var REF_LINE_REG = /^0 (?:(@[_a-zA-Z0-9]*@) )?(?<type>_[_A-Z][_a-zA-Z]{2,}|_?[A-Z][a-zA-Z]{2,}) ?(?<value>.*)/gm;
|
|
@@ -1234,7 +1363,8 @@ __export(translators_exports, {
|
|
|
1234
1363
|
en: () => KinshipTranslatorEn,
|
|
1235
1364
|
es: () => KinshipTranslatorEs,
|
|
1236
1365
|
fr: () => KinshipTranslatorFr,
|
|
1237
|
-
hu: () => KinshipTranslatorHU
|
|
1366
|
+
hu: () => KinshipTranslatorHU,
|
|
1367
|
+
ru: () => KinshipTranslatorRu
|
|
1238
1368
|
});
|
|
1239
1369
|
|
|
1240
1370
|
// src/constants/filters.ts
|
|
@@ -3709,7 +3839,6 @@ var Indi = class extends Common {
|
|
|
3709
3839
|
if (cache) {
|
|
3710
3840
|
return cache;
|
|
3711
3841
|
}
|
|
3712
|
-
const visited = new Individuals().append(this);
|
|
3713
3842
|
const mainItem = {
|
|
3714
3843
|
indi: this,
|
|
3715
3844
|
level: 0,
|
|
@@ -3718,129 +3847,155 @@ var Indi = class extends Common {
|
|
|
3718
3847
|
degree: 0,
|
|
3719
3848
|
kinship: "self"
|
|
3720
3849
|
};
|
|
3721
|
-
const
|
|
3850
|
+
const mainPath = [mainItem];
|
|
3722
3851
|
if (this.id === usedIndi.id) {
|
|
3723
|
-
return
|
|
3852
|
+
return mainPath;
|
|
3724
3853
|
}
|
|
3725
|
-
const
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
let helper = 0;
|
|
3732
|
-
while (queue.length > 0) {
|
|
3733
|
-
if (helper++ > 1e6) {
|
|
3734
|
-
break;
|
|
3735
|
-
}
|
|
3736
|
-
const {
|
|
3737
|
-
indi,
|
|
3738
|
-
path: path2,
|
|
3739
|
-
kinship,
|
|
3740
|
-
relation,
|
|
3741
|
-
level,
|
|
3742
|
-
levelUp,
|
|
3743
|
-
levelDown,
|
|
3744
|
-
degree,
|
|
3745
|
-
breakOnNext,
|
|
3746
|
-
breakAfterNext,
|
|
3747
|
-
inLaw
|
|
3748
|
-
} = queue.shift();
|
|
3749
|
-
if (usedIndi.id === indi.id) {
|
|
3750
|
-
if (breakOnNext) {
|
|
3751
|
-
return void 0;
|
|
3854
|
+
const bfs = (biologicalOnly) => {
|
|
3855
|
+
const visited = new Individuals().append(this);
|
|
3856
|
+
const queue = [
|
|
3857
|
+
{
|
|
3858
|
+
...mainItem,
|
|
3859
|
+
path: mainPath
|
|
3752
3860
|
}
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
if (breakOnNext || breakAfterNext) {
|
|
3759
|
-
additional.breakOnNext = breakOnNext || breakAfterNext;
|
|
3760
|
-
}
|
|
3761
|
-
if (inLaw) {
|
|
3762
|
-
additional.inLaw = inLaw;
|
|
3763
|
-
}
|
|
3764
|
-
if (kinship === "spouse" && breakAfterSpouse) {
|
|
3765
|
-
if (path2.length <= 2) {
|
|
3766
|
-
additional.inLaw = true;
|
|
3767
|
-
} else {
|
|
3768
|
-
additional.breakOnNext = true;
|
|
3861
|
+
];
|
|
3862
|
+
let helper = 0;
|
|
3863
|
+
while (queue.length > 0) {
|
|
3864
|
+
if (helper++ > 1e6) {
|
|
3865
|
+
break;
|
|
3769
3866
|
}
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3867
|
+
const {
|
|
3868
|
+
indi,
|
|
3869
|
+
path,
|
|
3870
|
+
kinship,
|
|
3871
|
+
relation,
|
|
3872
|
+
level,
|
|
3873
|
+
levelUp,
|
|
3874
|
+
levelDown,
|
|
3875
|
+
degree,
|
|
3876
|
+
breakOnNext,
|
|
3877
|
+
breakAfterNext,
|
|
3878
|
+
inLaw
|
|
3879
|
+
} = queue.shift();
|
|
3880
|
+
if (usedIndi.id === indi.id) {
|
|
3881
|
+
if (breakOnNext) {
|
|
3882
|
+
return void 0;
|
|
3883
|
+
}
|
|
3884
|
+
return path;
|
|
3885
|
+
}
|
|
3886
|
+
visited.append(indi);
|
|
3887
|
+
const additional = {};
|
|
3888
|
+
if (breakOnNext || breakAfterNext) {
|
|
3889
|
+
additional.breakOnNext = breakOnNext || breakAfterNext;
|
|
3890
|
+
}
|
|
3891
|
+
if (inLaw) {
|
|
3892
|
+
additional.inLaw = inLaw;
|
|
3893
|
+
}
|
|
3894
|
+
if (!biologicalOnly && kinship === "spouse" && breakAfterSpouse) {
|
|
3895
|
+
if (path.length <= 2) {
|
|
3896
|
+
additional.inLaw = true;
|
|
3897
|
+
} else {
|
|
3898
|
+
additional.breakOnNext = true;
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
if (kinship !== "child" || !breakAfterSpouse) {
|
|
3902
|
+
indi.getBiologicalFathers().copy().merge(indi.getBiologicalMothers()).merge(indi.getFathers().copy().merge(indi.getMothers())).forEach((relative) => {
|
|
3903
|
+
if (!visited.has(relative)) {
|
|
3904
|
+
const currentRelation = indi.getParentType(relative);
|
|
3905
|
+
const isNonBiological = !!currentRelation && currentRelation !== "biological" /* BIOLOGICAL */;
|
|
3906
|
+
if (biologicalOnly && isNonBiological) {
|
|
3907
|
+
return;
|
|
3908
|
+
}
|
|
3909
|
+
if (!biologicalOnly && breakAfterNonBiological && isNonBiological) {
|
|
3910
|
+
additional.breakAfterNext = true;
|
|
3911
|
+
}
|
|
3912
|
+
const newItem = {
|
|
3913
|
+
indi: relative,
|
|
3914
|
+
kinship: "parent",
|
|
3915
|
+
relation: isNonBiological ? currentRelation : relation,
|
|
3916
|
+
level: level + 1,
|
|
3917
|
+
levelUp: levelUp + 1,
|
|
3918
|
+
levelDown,
|
|
3919
|
+
degree,
|
|
3920
|
+
...additional
|
|
3921
|
+
};
|
|
3922
|
+
queue.push({
|
|
3923
|
+
...newItem,
|
|
3924
|
+
path: [...path, newItem]
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
});
|
|
3928
|
+
}
|
|
3929
|
+
indi.getChildren().forEach((relative) => {
|
|
3773
3930
|
if (!visited.has(relative)) {
|
|
3774
|
-
const currentRelation =
|
|
3775
|
-
|
|
3931
|
+
const currentRelation = relative.getParentType(indi);
|
|
3932
|
+
const isNonBiological = !!currentRelation && currentRelation !== "biological" /* BIOLOGICAL */;
|
|
3933
|
+
if (biologicalOnly && isNonBiological) {
|
|
3934
|
+
return;
|
|
3935
|
+
}
|
|
3936
|
+
if (!biologicalOnly && breakAfterNonBiological && isNonBiological) {
|
|
3776
3937
|
additional.breakAfterNext = true;
|
|
3777
3938
|
}
|
|
3778
3939
|
const newItem = {
|
|
3779
3940
|
indi: relative,
|
|
3780
|
-
kinship: "
|
|
3781
|
-
relation:
|
|
3782
|
-
level: level
|
|
3783
|
-
levelUp
|
|
3784
|
-
levelDown,
|
|
3785
|
-
degree,
|
|
3941
|
+
kinship: "child",
|
|
3942
|
+
relation: isNonBiological ? currentRelation : relation,
|
|
3943
|
+
level: level - 1,
|
|
3944
|
+
levelUp,
|
|
3945
|
+
levelDown: levelDown + 1,
|
|
3946
|
+
degree: levelUp ? level > 0 ? levelUp - level + 1 : levelDown - Math.abs(level) : 0,
|
|
3786
3947
|
...additional
|
|
3787
3948
|
};
|
|
3788
3949
|
queue.push({
|
|
3789
3950
|
...newItem,
|
|
3790
|
-
path: [...
|
|
3951
|
+
path: [...path, newItem]
|
|
3791
3952
|
});
|
|
3792
3953
|
}
|
|
3793
3954
|
});
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
if (!visited.has(relative)) {
|
|
3797
|
-
const currentRelation = relative.getParentType(indi);
|
|
3798
|
-
if (breakAfterNonBiological && currentRelation !== "biological" /* BIOLOGICAL */) {
|
|
3799
|
-
additional.breakAfterNext = true;
|
|
3800
|
-
}
|
|
3801
|
-
const newItem = {
|
|
3802
|
-
indi: relative,
|
|
3803
|
-
kinship: "child",
|
|
3804
|
-
relation: currentRelation && currentRelation !== "biological" /* BIOLOGICAL */ ? currentRelation : relation,
|
|
3805
|
-
level: level - 1,
|
|
3806
|
-
levelUp,
|
|
3807
|
-
levelDown: levelDown + 1,
|
|
3808
|
-
degree: levelUp ? level > 0 ? levelUp - level + 1 : levelDown - Math.abs(level) : 0,
|
|
3809
|
-
...additional
|
|
3810
|
-
};
|
|
3811
|
-
queue.push({
|
|
3812
|
-
...newItem,
|
|
3813
|
-
path: [...path2, newItem]
|
|
3814
|
-
});
|
|
3955
|
+
if (biologicalOnly) {
|
|
3956
|
+
continue;
|
|
3815
3957
|
}
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3958
|
+
indi.getCoParents().forEach((relative) => {
|
|
3959
|
+
if (!visited.has(relative)) {
|
|
3960
|
+
const currentAddition = {};
|
|
3961
|
+
if (relation && relation !== "biological" /* BIOLOGICAL */) {
|
|
3962
|
+
currentAddition.relation = relation;
|
|
3963
|
+
}
|
|
3964
|
+
if (inLaw) {
|
|
3965
|
+
currentAddition.breakOnNext = true;
|
|
3966
|
+
}
|
|
3967
|
+
const newItem = {
|
|
3968
|
+
indi: relative,
|
|
3969
|
+
kinship: "spouse",
|
|
3970
|
+
level,
|
|
3971
|
+
levelUp,
|
|
3972
|
+
levelDown,
|
|
3973
|
+
degree,
|
|
3974
|
+
...additional,
|
|
3975
|
+
...currentAddition
|
|
3976
|
+
};
|
|
3977
|
+
queue.push({
|
|
3978
|
+
...newItem,
|
|
3979
|
+
path: [...path, newItem]
|
|
3980
|
+
});
|
|
3825
3981
|
}
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
path: [...path2, newItem]
|
|
3839
|
-
});
|
|
3840
|
-
}
|
|
3841
|
-
});
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
return void 0;
|
|
3985
|
+
};
|
|
3986
|
+
const foundPath = bfs(false);
|
|
3987
|
+
const lastItem = foundPath?.[foundPath.length - 1];
|
|
3988
|
+
if (lastItem?.relation && lastItem.relation !== "biological" /* BIOLOGICAL */) {
|
|
3989
|
+
const biologicalPath = bfs(true);
|
|
3990
|
+
if (biologicalPath) {
|
|
3991
|
+
cacheDiscoveredPath(this._gedcom, biologicalPath);
|
|
3992
|
+
return biologicalPath;
|
|
3993
|
+
}
|
|
3842
3994
|
}
|
|
3843
|
-
|
|
3995
|
+
if (foundPath) {
|
|
3996
|
+
cacheDiscoveredPath(this._gedcom, foundPath);
|
|
3997
|
+
}
|
|
3998
|
+
return foundPath;
|
|
3844
3999
|
}
|
|
3845
4000
|
kinship(other, showMainPerson, lang = "en", entirePath, displayName = "givenname") {
|
|
3846
4001
|
const KinshipTranslatorClass2 = getKinshipTranslatorClass();
|
|
@@ -4819,6 +4974,44 @@ var KinshipTranslatorBasic = class {
|
|
|
4819
4974
|
}
|
|
4820
4975
|
return this.pathN?.indi;
|
|
4821
4976
|
}
|
|
4977
|
+
/**
|
|
4978
|
+
* True when the path goes through a common ancestor whose two children
|
|
4979
|
+
* (the person we came from and the person we go to) share fewer than two
|
|
4980
|
+
* biological parents — i.e. they are half-siblings, so every collateral
|
|
4981
|
+
* relative on this path is a half-aunt/half-cousin/... too.
|
|
4982
|
+
*
|
|
4983
|
+
* Direct ancestors/descendants and paths that already use a
|
|
4984
|
+
* step/adopted/foster edge are never half-blood.
|
|
4985
|
+
*/
|
|
4986
|
+
get isHalfBlood() {
|
|
4987
|
+
const path = this.path;
|
|
4988
|
+
if (!path || path.length < 3) {
|
|
4989
|
+
return false;
|
|
4990
|
+
}
|
|
4991
|
+
if (path.some(
|
|
4992
|
+
(item) => item.relation && item.relation !== "biological" /* BIOLOGICAL */
|
|
4993
|
+
)) {
|
|
4994
|
+
return false;
|
|
4995
|
+
}
|
|
4996
|
+
let peakIndex = -1;
|
|
4997
|
+
for (let i = 1; i < path.length; i++) {
|
|
4998
|
+
if (path[i].kinship === "parent") {
|
|
4999
|
+
peakIndex = i;
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
if (peakIndex <= 0 || peakIndex >= path.length - 1) {
|
|
5003
|
+
return false;
|
|
5004
|
+
}
|
|
5005
|
+
if (path[peakIndex + 1].kinship !== "child") {
|
|
5006
|
+
return false;
|
|
5007
|
+
}
|
|
5008
|
+
const siblingA = path[peakIndex - 1].indi;
|
|
5009
|
+
const siblingB = path[peakIndex + 1].indi;
|
|
5010
|
+
const parentsA = siblingA.getBiologicalParents();
|
|
5011
|
+
const parentsB = siblingB.getBiologicalParents();
|
|
5012
|
+
const inter = parentsA.intersection(parentsB);
|
|
5013
|
+
return inter.length === 1 && (parentsA.length > 1 || parentsB.length > 1);
|
|
5014
|
+
}
|
|
4822
5015
|
indirect() {
|
|
4823
5016
|
return "";
|
|
4824
5017
|
}
|
|
@@ -4846,6 +5039,9 @@ var KinshipTranslatorBasic = class {
|
|
|
4846
5039
|
relationType(relation) {
|
|
4847
5040
|
return relation ?? "";
|
|
4848
5041
|
}
|
|
5042
|
+
halfBlood(relation) {
|
|
5043
|
+
return relation ?? "";
|
|
5044
|
+
}
|
|
4849
5045
|
of(relation) {
|
|
4850
5046
|
return relation ?? "";
|
|
4851
5047
|
}
|
|
@@ -5084,14 +5280,34 @@ var KinshipTranslatorHU = class extends KinshipTranslatorBasic {
|
|
|
5084
5280
|
return `${prefix.replace(/nagy$/, "")}unoka`;
|
|
5085
5281
|
}
|
|
5086
5282
|
sibling() {
|
|
5087
|
-
const parents1 = this.person1?.getBiologicalParents();
|
|
5088
|
-
const parentsN = this.personN?.getBiologicalParents();
|
|
5089
|
-
const inter = parents1?.intersection(parentsN);
|
|
5090
|
-
if (!inter || inter.length < 2) {
|
|
5091
|
-
return "f\xE9ltestv\xE9r";
|
|
5092
|
-
}
|
|
5093
5283
|
return "testv\xE9r";
|
|
5094
5284
|
}
|
|
5285
|
+
halfBlood(relation) {
|
|
5286
|
+
if (!relation || !this.isHalfBlood) {
|
|
5287
|
+
return relation ?? "";
|
|
5288
|
+
}
|
|
5289
|
+
const [head, ...rest] = relation.split(" ");
|
|
5290
|
+
if (!head) {
|
|
5291
|
+
return relation;
|
|
5292
|
+
}
|
|
5293
|
+
const prefixed = this.prefixHalf(head);
|
|
5294
|
+
return [prefixed, ...rest].join(" ");
|
|
5295
|
+
}
|
|
5296
|
+
/**
|
|
5297
|
+
* AkH. 139: compounds of more than two members stay closed up to 6
|
|
5298
|
+
* syllables; longer ones are hyphenated at the main boundary. A head
|
|
5299
|
+
* that is already hyphenated also takes a hyphenated half- prefix.
|
|
5300
|
+
*/
|
|
5301
|
+
prefixHalf(head) {
|
|
5302
|
+
if (head.includes("-") || !/[aáeéiíoóöőuúüű]/i.test(head)) {
|
|
5303
|
+
return `f\xE9l-${head}`;
|
|
5304
|
+
}
|
|
5305
|
+
const syllables = (head.match(/[aáeéiíoóöőuúüű]/gi) ?? []).length + 1;
|
|
5306
|
+
if (syllables > 6) {
|
|
5307
|
+
return `f\xE9l-${head}`;
|
|
5308
|
+
}
|
|
5309
|
+
return `f\xE9l${head}`;
|
|
5310
|
+
}
|
|
5095
5311
|
spouse() {
|
|
5096
5312
|
if (this.personN?.isMale()) {
|
|
5097
5313
|
return "f\xE9rj";
|
|
@@ -5290,20 +5506,22 @@ var KinshipTranslatorEn = class extends KinshipTranslatorBasic {
|
|
|
5290
5506
|
return `${prefix}child`;
|
|
5291
5507
|
}
|
|
5292
5508
|
sibling() {
|
|
5293
|
-
const parents1 = this.person1?.getBiologicalParents();
|
|
5294
|
-
const parentsN = this.personN?.getBiologicalParents();
|
|
5295
|
-
const inter = parents1?.intersection(parentsN);
|
|
5296
|
-
let prefix = "";
|
|
5297
|
-
if (!inter || inter.length < 2) {
|
|
5298
|
-
prefix = "half-";
|
|
5299
|
-
}
|
|
5300
5509
|
if (this.personN?.isMale()) {
|
|
5301
|
-
return
|
|
5510
|
+
return "brother";
|
|
5302
5511
|
}
|
|
5303
5512
|
if (this.personN?.isFemale()) {
|
|
5304
|
-
return
|
|
5513
|
+
return "sister";
|
|
5514
|
+
}
|
|
5515
|
+
return "sibling";
|
|
5516
|
+
}
|
|
5517
|
+
halfBlood(relation) {
|
|
5518
|
+
if (!relation || !this.isHalfBlood) {
|
|
5519
|
+
return relation ?? "";
|
|
5520
|
+
}
|
|
5521
|
+
if (relation.includes(" ")) {
|
|
5522
|
+
return `half ${relation}`;
|
|
5305
5523
|
}
|
|
5306
|
-
return
|
|
5524
|
+
return `half-${relation}`;
|
|
5307
5525
|
}
|
|
5308
5526
|
spouse() {
|
|
5309
5527
|
if (this.personN?.isMale()) {
|
|
@@ -5485,20 +5703,22 @@ var KinshipTranslatorDe = class extends KinshipTranslatorBasic {
|
|
|
5485
5703
|
return `${prefix}kind`;
|
|
5486
5704
|
}
|
|
5487
5705
|
sibling() {
|
|
5488
|
-
const parents1 = this.person1?.getBiologicalParents();
|
|
5489
|
-
const parentsN = this.personN?.getBiologicalParents();
|
|
5490
|
-
const inter = parents1?.intersection(parentsN);
|
|
5491
|
-
let prefix = "";
|
|
5492
|
-
if (!inter || inter.length < 2) {
|
|
5493
|
-
prefix = "Halb";
|
|
5494
|
-
}
|
|
5495
5706
|
if (this.personN?.isMale()) {
|
|
5496
|
-
return
|
|
5707
|
+
return "bruder";
|
|
5497
5708
|
}
|
|
5498
5709
|
if (this.personN?.isFemale()) {
|
|
5499
|
-
return
|
|
5710
|
+
return "schwester";
|
|
5711
|
+
}
|
|
5712
|
+
return "geschwister";
|
|
5713
|
+
}
|
|
5714
|
+
halfBlood(relation) {
|
|
5715
|
+
if (!relation || !this.isHalfBlood) {
|
|
5716
|
+
return relation ?? "";
|
|
5717
|
+
}
|
|
5718
|
+
if (/^[A-ZÄÖÜ]/.test(relation) || /[-\s]/.test(relation)) {
|
|
5719
|
+
return `Halb-${relation}`;
|
|
5500
5720
|
}
|
|
5501
|
-
return
|
|
5721
|
+
return `Halb${relation}`;
|
|
5502
5722
|
}
|
|
5503
5723
|
spouse() {
|
|
5504
5724
|
if (this.personN?.isMale()) {
|
|
@@ -5680,20 +5900,19 @@ var KinshipTranslatorFr = class extends KinshipTranslatorBasic {
|
|
|
5680
5900
|
return `${prefix}enfant`;
|
|
5681
5901
|
}
|
|
5682
5902
|
sibling() {
|
|
5683
|
-
const parents1 = this.person1?.getBiologicalParents();
|
|
5684
|
-
const parentsN = this.personN?.getBiologicalParents();
|
|
5685
|
-
const inter = parents1?.intersection(parentsN);
|
|
5686
|
-
let prefix = "";
|
|
5687
|
-
if (!inter || inter.length < 2) {
|
|
5688
|
-
prefix = "demi-";
|
|
5689
|
-
}
|
|
5690
5903
|
if (this.personN?.isMale()) {
|
|
5691
|
-
return
|
|
5904
|
+
return "fr\xE8re";
|
|
5692
5905
|
}
|
|
5693
5906
|
if (this.personN?.isFemale()) {
|
|
5694
|
-
return
|
|
5907
|
+
return "s\u0153ur";
|
|
5908
|
+
}
|
|
5909
|
+
return "fr\xE8re/s\u0153ur";
|
|
5910
|
+
}
|
|
5911
|
+
halfBlood(relation) {
|
|
5912
|
+
if (!relation || !this.isHalfBlood) {
|
|
5913
|
+
return relation ?? "";
|
|
5695
5914
|
}
|
|
5696
|
-
return
|
|
5915
|
+
return `demi-${relation}`;
|
|
5697
5916
|
}
|
|
5698
5917
|
spouse() {
|
|
5699
5918
|
if (this.personN?.isMale()) {
|
|
@@ -5790,12 +6009,12 @@ var InLawsEs = {
|
|
|
5790
6009
|
"madre del (c\xF3nyuge|esposa|esposo)": "suegra",
|
|
5791
6010
|
"padre del (c\xF3nyuge|esposa|esposo)": "suegro",
|
|
5792
6011
|
"padre/madre del (c\xF3nyuge|esposa|esposo)": "suegro/suegra",
|
|
5793
|
-
"esposa de (medio )?(hermano/hermana|hermana|hermano)": "cu\xF1ada",
|
|
5794
|
-
"esposo de (medio )?(hermano/hermana|hermana|hermano)": "cu\xF1ado",
|
|
5795
|
-
"c\xF3nyuge de (medio )?(hermano/hermana|hermana|hermano)": "cu\xF1ado/cu\xF1ada",
|
|
5796
|
-
"(medio )?hermana del (c\xF3nyuge|esposa|esposo)": "cu\xF1ada",
|
|
5797
|
-
"(medio )?hermano del (c\xF3nyuge|esposa|esposo)": "cu\xF1ado",
|
|
5798
|
-
"(medio )?hermano/hermana del (c\xF3nyuge|esposa|esposo)": "cu\xF1ado/cu\xF1ada"
|
|
6012
|
+
"esposa de (medio |media |medio/a )?(hermano/hermana|hermana|hermano)": "cu\xF1ada",
|
|
6013
|
+
"esposo de (medio |media |medio/a )?(hermano/hermana|hermana|hermano)": "cu\xF1ado",
|
|
6014
|
+
"c\xF3nyuge de (medio |media |medio/a )?(hermano/hermana|hermana|hermano)": "cu\xF1ado/cu\xF1ada",
|
|
6015
|
+
"(medio |media |medio/a )?hermana del (c\xF3nyuge|esposa|esposo)": "cu\xF1ada",
|
|
6016
|
+
"(medio |media |medio/a )?hermano del (c\xF3nyuge|esposa|esposo)": "cu\xF1ado",
|
|
6017
|
+
"(medio |media |medio/a )?hermano/hermana del (c\xF3nyuge|esposa|esposo)": "cu\xF1ado/cu\xF1ada"
|
|
5799
6018
|
};
|
|
5800
6019
|
|
|
5801
6020
|
// src/kinship-translator/kinship-translator.es.ts
|
|
@@ -5875,20 +6094,25 @@ var KinshipTranslatorEs = class extends KinshipTranslatorBasic {
|
|
|
5875
6094
|
return `${prefix}hijo/hija`;
|
|
5876
6095
|
}
|
|
5877
6096
|
sibling() {
|
|
5878
|
-
const parents1 = this.person1?.getBiologicalParents();
|
|
5879
|
-
const parentsN = this.personN?.getBiologicalParents();
|
|
5880
|
-
const inter = parents1?.intersection(parentsN);
|
|
5881
|
-
let prefix = "";
|
|
5882
|
-
if (!inter || inter.length < 2) {
|
|
5883
|
-
prefix = "medio ";
|
|
5884
|
-
}
|
|
5885
6097
|
if (this.personN?.isMale()) {
|
|
5886
|
-
return
|
|
6098
|
+
return "hermano";
|
|
6099
|
+
}
|
|
6100
|
+
if (this.personN?.isFemale()) {
|
|
6101
|
+
return "hermana";
|
|
6102
|
+
}
|
|
6103
|
+
return "hermano/hermana";
|
|
6104
|
+
}
|
|
6105
|
+
halfBlood(relation) {
|
|
6106
|
+
if (!relation || !this.isHalfBlood) {
|
|
6107
|
+
return relation ?? "";
|
|
5887
6108
|
}
|
|
5888
6109
|
if (this.personN?.isFemale()) {
|
|
5889
|
-
return
|
|
6110
|
+
return `media ${relation}`;
|
|
6111
|
+
}
|
|
6112
|
+
if (this.personN?.isMale()) {
|
|
6113
|
+
return `medio ${relation}`;
|
|
5890
6114
|
}
|
|
5891
|
-
return
|
|
6115
|
+
return `medio/a ${relation}`;
|
|
5892
6116
|
}
|
|
5893
6117
|
spouse() {
|
|
5894
6118
|
if (this.personN?.isMale()) {
|
|
@@ -5977,6 +6201,249 @@ var KinshipTranslatorEs = class extends KinshipTranslatorBasic {
|
|
|
5977
6201
|
}
|
|
5978
6202
|
};
|
|
5979
6203
|
|
|
6204
|
+
// src/kinship-translator/patterns.ru.ts
|
|
6205
|
+
var InLawsRu = {
|
|
6206
|
+
"\u0441\u0443\u043F\u0440\u0443\u0433(?:\u0430)? (\u0440\u0435\u0431\u0451\u043D\u043A\u0430|\u0434\u043E\u0447\u0435\u0440\u0438|\u0441\u044B\u043D\u0430)": "\u0437\u044F\u0442\u044C/\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
|
|
6207
|
+
"\u0436\u0435\u043D\u0430 (\u0440\u0435\u0431\u0451\u043D\u043A\u0430|\u0434\u043E\u0447\u0435\u0440\u0438|\u0441\u044B\u043D\u0430)": "\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
|
|
6208
|
+
"\u043C\u0443\u0436 (\u0440\u0435\u0431\u0451\u043D\u043A\u0430|\u0434\u043E\u0447\u0435\u0440\u0438|\u0441\u044B\u043D\u0430)": "\u0437\u044F\u0442\u044C",
|
|
6209
|
+
"\u043C\u0430\u0442\u044C (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0442\u0451\u0449\u0430",
|
|
6210
|
+
"\u043E\u0442\u0435\u0446 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0442\u0435\u0441\u0442\u044C",
|
|
6211
|
+
"\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0442\u0435\u0441\u0442\u044C/\u0442\u0451\u0449\u0430",
|
|
6212
|
+
"\u0436\u0435\u043D\u0430 (\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?(\u0431\u0440\u0430\u0442\u0430|\u0441\u0435\u0441\u0442\u0440\u044B|\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430)": "\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
|
|
6213
|
+
"\u043C\u0443\u0436 (\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?(\u0431\u0440\u0430\u0442\u0430|\u0441\u0435\u0441\u0442\u0440\u044B|\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430)": "\u0437\u044F\u0442\u044C",
|
|
6214
|
+
"\u0441\u0443\u043F\u0440\u0443\u0433(?:\u0430)? (\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?(\u0431\u0440\u0430\u0442\u0430|\u0441\u0435\u0441\u0442\u0440\u044B|\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430)": "\u0437\u044F\u0442\u044C/\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
|
|
6215
|
+
"(\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?\u0441\u0435\u0441\u0442\u0440\u0430 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0437\u043E\u043B\u043E\u0432\u043A\u0430",
|
|
6216
|
+
"(\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?\u0431\u0440\u0430\u0442 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0448\u0443\u0440\u0438\u043D",
|
|
6217
|
+
"(\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?\u0441\u0438\u0431\u043B\u0438\u043D\u0433 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0448\u0443\u0440\u0438\u043D/\u0437\u043E\u043B\u043E\u0432\u043A\u0430"
|
|
6218
|
+
};
|
|
6219
|
+
|
|
6220
|
+
// src/kinship-translator/kinship-translator.ru.ts
|
|
6221
|
+
var GENITIVE = {
|
|
6222
|
+
\u0441\u044B\u043D: "\u0441\u044B\u043D\u0430",
|
|
6223
|
+
\u0434\u043E\u0447\u044C: "\u0434\u043E\u0447\u0435\u0440\u0438",
|
|
6224
|
+
\u0440\u0435\u0431\u0451\u043D\u043E\u043A: "\u0440\u0435\u0431\u0451\u043D\u043A\u0430",
|
|
6225
|
+
\u0431\u0440\u0430\u0442: "\u0431\u0440\u0430\u0442\u0430",
|
|
6226
|
+
\u0441\u0435\u0441\u0442\u0440\u0430: "\u0441\u0435\u0441\u0442\u0440\u044B",
|
|
6227
|
+
\u0441\u0438\u0431\u043B\u0438\u043D\u0433: "\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430",
|
|
6228
|
+
\u043E\u0442\u0435\u0446: "\u043E\u0442\u0446\u0430",
|
|
6229
|
+
\u043C\u0430\u0442\u044C: "\u043C\u0430\u0442\u0435\u0440\u0438",
|
|
6230
|
+
\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C: "\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044F",
|
|
6231
|
+
\u043C\u0443\u0436: "\u043C\u0443\u0436\u0430",
|
|
6232
|
+
\u0436\u0435\u043D\u0430: "\u0436\u0435\u043D\u044B",
|
|
6233
|
+
\u0441\u0443\u043F\u0440\u0443\u0433: "\u0441\u0443\u043F\u0440\u0443\u0433\u0430",
|
|
6234
|
+
\u0441\u0443\u043F\u0440\u0443\u0433\u0430: "\u0441\u0443\u043F\u0440\u0443\u0433\u0438"
|
|
6235
|
+
};
|
|
6236
|
+
var toGenitive = (word) => GENITIVE[word] ?? word;
|
|
6237
|
+
var cousinWord = (degree, sex) => {
|
|
6238
|
+
const stem = degree <= 1 ? "\u0434\u0432\u043E\u044E\u0440\u043E\u0434\u043D" : degree === 2 ? "\u0442\u0440\u043E\u044E\u0440\u043E\u0434\u043D" : degree === 3 ? "\u0447\u0435\u0442\u0432\u0435\u0440\u043E\u044E\u0440\u043E\u0434\u043D" : `${degree + 1}-\u044E\u0440\u043E\u0434\u043D`;
|
|
6239
|
+
if (sex === "m") {
|
|
6240
|
+
return `${stem}\u044B\u0439 \u0431\u0440\u0430\u0442`;
|
|
6241
|
+
}
|
|
6242
|
+
if (sex === "f") {
|
|
6243
|
+
return `${stem}\u0430\u044F \u0441\u0435\u0441\u0442\u0440\u0430`;
|
|
6244
|
+
}
|
|
6245
|
+
return `${stem}\u044B\u0439 \u0431\u0440\u0430\u0442/\u0441\u0435\u0441\u0442\u0440\u0430`;
|
|
6246
|
+
};
|
|
6247
|
+
var praRepeat = (count) => count > 0 ? "\u043F\u0440\u0430".repeat(count) : "";
|
|
6248
|
+
var sexOf = (person) => {
|
|
6249
|
+
if (person?.isMale?.()) {
|
|
6250
|
+
return "m";
|
|
6251
|
+
}
|
|
6252
|
+
if (person?.isFemale?.()) {
|
|
6253
|
+
return "f";
|
|
6254
|
+
}
|
|
6255
|
+
return "n";
|
|
6256
|
+
};
|
|
6257
|
+
var KinshipTranslatorRu = class extends KinshipTranslatorBasic {
|
|
6258
|
+
indirect() {
|
|
6259
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
6260
|
+
if (degree > 0) {
|
|
6261
|
+
degree = degree - 1;
|
|
6262
|
+
}
|
|
6263
|
+
return cousinWord(degree, sexOf(this.personN));
|
|
6264
|
+
}
|
|
6265
|
+
removal() {
|
|
6266
|
+
const level = this.pathN?.level ?? 0;
|
|
6267
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
6268
|
+
if (degree > 0) {
|
|
6269
|
+
degree = degree - 1;
|
|
6270
|
+
}
|
|
6271
|
+
if (!degree) {
|
|
6272
|
+
return level < 0 ? this.nibling() : this.auncle();
|
|
6273
|
+
}
|
|
6274
|
+
const removed = Math.abs(level);
|
|
6275
|
+
return `${cousinWord(degree, sexOf(this.personN))} (${removed}\xD7 \u0447\u0435\u0440\u0435\u0437 \u043F\u043E\u043A\u043E\u043B\u0435\u043D\u0438\u0435)`;
|
|
6276
|
+
}
|
|
6277
|
+
auncle() {
|
|
6278
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
6279
|
+
const pra = praRepeat(Math.max(0, level - 2));
|
|
6280
|
+
const sex = sexOf(this.personN);
|
|
6281
|
+
if (sex === "m") {
|
|
6282
|
+
return `${pra}\u0434\u044F\u0434\u044F`;
|
|
6283
|
+
}
|
|
6284
|
+
if (sex === "f") {
|
|
6285
|
+
return `${pra}\u0442\u0451\u0442\u044F`;
|
|
6286
|
+
}
|
|
6287
|
+
return `${pra}\u0434\u044F\u0434\u044F/\u0442\u0451\u0442\u044F`;
|
|
6288
|
+
}
|
|
6289
|
+
nibling() {
|
|
6290
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
6291
|
+
const pra = praRepeat(Math.max(0, level - 2));
|
|
6292
|
+
const sex = sexOf(this.personN);
|
|
6293
|
+
if (sex === "m") {
|
|
6294
|
+
return `${pra}\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u043A`;
|
|
6295
|
+
}
|
|
6296
|
+
if (sex === "f") {
|
|
6297
|
+
return `${pra}\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u0446\u0430`;
|
|
6298
|
+
}
|
|
6299
|
+
return `${pra}\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u043A/\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u0446\u0430`;
|
|
6300
|
+
}
|
|
6301
|
+
parent() {
|
|
6302
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
6303
|
+
const sex = sexOf(this.personN);
|
|
6304
|
+
if (level <= 1) {
|
|
6305
|
+
if (sex === "m") {
|
|
6306
|
+
return "\u043E\u0442\u0435\u0446";
|
|
6307
|
+
}
|
|
6308
|
+
if (sex === "f") {
|
|
6309
|
+
return "\u043C\u0430\u0442\u044C";
|
|
6310
|
+
}
|
|
6311
|
+
return "\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C";
|
|
6312
|
+
}
|
|
6313
|
+
if (level === 2) {
|
|
6314
|
+
if (sex === "m") {
|
|
6315
|
+
return "\u0434\u0435\u0434";
|
|
6316
|
+
}
|
|
6317
|
+
if (sex === "f") {
|
|
6318
|
+
return "\u0431\u0430\u0431\u0443\u0448\u043A\u0430";
|
|
6319
|
+
}
|
|
6320
|
+
return "\u0434\u0435\u0434/\u0431\u0430\u0431\u0443\u0448\u043A\u0430";
|
|
6321
|
+
}
|
|
6322
|
+
const pra = praRepeat(level - 2);
|
|
6323
|
+
if (sex === "m") {
|
|
6324
|
+
return `${pra}\u0434\u0435\u0434`;
|
|
6325
|
+
}
|
|
6326
|
+
if (sex === "f") {
|
|
6327
|
+
return `${pra}\u0431\u0430\u0431\u0443\u0448\u043A\u0430`;
|
|
6328
|
+
}
|
|
6329
|
+
return `${pra}\u0434\u0435\u0434/\u0431\u0430\u0431\u0443\u0448\u043A\u0430`;
|
|
6330
|
+
}
|
|
6331
|
+
child() {
|
|
6332
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
6333
|
+
const sex = sexOf(this.personN);
|
|
6334
|
+
if (level <= 1) {
|
|
6335
|
+
if (sex === "m") {
|
|
6336
|
+
return "\u0441\u044B\u043D";
|
|
6337
|
+
}
|
|
6338
|
+
if (sex === "f") {
|
|
6339
|
+
return "\u0434\u043E\u0447\u044C";
|
|
6340
|
+
}
|
|
6341
|
+
return "\u0440\u0435\u0431\u0451\u043D\u043E\u043A";
|
|
6342
|
+
}
|
|
6343
|
+
if (level === 2) {
|
|
6344
|
+
if (sex === "m") {
|
|
6345
|
+
return "\u0432\u043D\u0443\u043A";
|
|
6346
|
+
}
|
|
6347
|
+
if (sex === "f") {
|
|
6348
|
+
return "\u0432\u043D\u0443\u0447\u043A\u0430";
|
|
6349
|
+
}
|
|
6350
|
+
return "\u0432\u043D\u0443\u043A/\u0432\u043D\u0443\u0447\u043A\u0430";
|
|
6351
|
+
}
|
|
6352
|
+
const pra = praRepeat(level - 2);
|
|
6353
|
+
if (sex === "m") {
|
|
6354
|
+
return `${pra}\u0432\u043D\u0443\u043A`;
|
|
6355
|
+
}
|
|
6356
|
+
if (sex === "f") {
|
|
6357
|
+
return `${pra}\u0432\u043D\u0443\u0447\u043A\u0430`;
|
|
6358
|
+
}
|
|
6359
|
+
return `${pra}\u0432\u043D\u0443\u043A/\u0432\u043D\u0443\u0447\u043A\u0430`;
|
|
6360
|
+
}
|
|
6361
|
+
sibling() {
|
|
6362
|
+
const sex = sexOf(this.personN);
|
|
6363
|
+
if (sex === "m") {
|
|
6364
|
+
return "\u0431\u0440\u0430\u0442";
|
|
6365
|
+
}
|
|
6366
|
+
if (sex === "f") {
|
|
6367
|
+
return "\u0441\u0435\u0441\u0442\u0440\u0430";
|
|
6368
|
+
}
|
|
6369
|
+
return "\u0441\u0438\u0431\u043B\u0438\u043D\u0433";
|
|
6370
|
+
}
|
|
6371
|
+
halfBlood(relation) {
|
|
6372
|
+
if (!relation || !this.isHalfBlood) {
|
|
6373
|
+
return relation ?? "";
|
|
6374
|
+
}
|
|
6375
|
+
if (/сестра|дочь|мать|тётя|бабушка|жена|племянница|внучка/.test(
|
|
6376
|
+
relation
|
|
6377
|
+
)) {
|
|
6378
|
+
return `\u0441\u0432\u043E\u0434\u043D\u0430\u044F ${relation}`;
|
|
6379
|
+
}
|
|
6380
|
+
return `\u0441\u0432\u043E\u0434\u043D\u044B\u0439 ${relation}`;
|
|
6381
|
+
}
|
|
6382
|
+
spouse() {
|
|
6383
|
+
const sex = sexOf(this.personN);
|
|
6384
|
+
if (sex === "m") {
|
|
6385
|
+
return "\u043C\u0443\u0436";
|
|
6386
|
+
}
|
|
6387
|
+
if (sex === "f") {
|
|
6388
|
+
return "\u0436\u0435\u043D\u0430";
|
|
6389
|
+
}
|
|
6390
|
+
return "\u0441\u0443\u043F\u0440\u0443\u0433";
|
|
6391
|
+
}
|
|
6392
|
+
ofSpouse(relation) {
|
|
6393
|
+
if (!relation) {
|
|
6394
|
+
return "";
|
|
6395
|
+
}
|
|
6396
|
+
const spouse = this.path?.[1].indi;
|
|
6397
|
+
const sex = sexOf(spouse);
|
|
6398
|
+
const spouseType = sex === "m" ? "\u043C\u0443\u0436" : sex === "f" ? "\u0436\u0435\u043D\u0430" : "\u0441\u0443\u043F\u0440\u0443\u0433";
|
|
6399
|
+
return `${relation} ${toGenitive(spouseType)}`;
|
|
6400
|
+
}
|
|
6401
|
+
spouseOf(relation) {
|
|
6402
|
+
if (!relation) {
|
|
6403
|
+
return "";
|
|
6404
|
+
}
|
|
6405
|
+
const spouse = this.path?.[this.path.length - 1].indi;
|
|
6406
|
+
const sex = sexOf(spouse);
|
|
6407
|
+
const spouseType = sex === "m" ? "\u043C\u0443\u0436" : sex === "f" ? "\u0436\u0435\u043D\u0430" : "\u0441\u0443\u043F\u0440\u0443\u0433";
|
|
6408
|
+
return `${spouseType} ${toGenitive(relation)}`;
|
|
6409
|
+
}
|
|
6410
|
+
of(relation) {
|
|
6411
|
+
const formattedName = nameFormatter(this.path?.[0]?.indi, {
|
|
6412
|
+
nameOrder: "first-last"
|
|
6413
|
+
});
|
|
6414
|
+
let name = formattedName.inOrder.filter(Boolean).join(" ");
|
|
6415
|
+
if (this.displayName === "none") {
|
|
6416
|
+
name = "";
|
|
6417
|
+
} else if (this.displayName === "givenname") {
|
|
6418
|
+
name = formattedName.givenname;
|
|
6419
|
+
} else if (this.displayName === "surname") {
|
|
6420
|
+
name = `${formattedName.surname}`;
|
|
6421
|
+
}
|
|
6422
|
+
if (!name || !relation) {
|
|
6423
|
+
return relation ?? "";
|
|
6424
|
+
}
|
|
6425
|
+
return `${name}: ${relation}`;
|
|
6426
|
+
}
|
|
6427
|
+
inLaw(relation) {
|
|
6428
|
+
let inLawRelation = relation;
|
|
6429
|
+
Object.keys(InLawsRu).find((pattern) => {
|
|
6430
|
+
const regex = new RegExp(`^${pattern}$`);
|
|
6431
|
+
if (relation?.match(regex)) {
|
|
6432
|
+
inLawRelation = InLawsRu[pattern];
|
|
6433
|
+
return true;
|
|
6434
|
+
}
|
|
6435
|
+
return false;
|
|
6436
|
+
});
|
|
6437
|
+
return inLawRelation ?? "";
|
|
6438
|
+
}
|
|
6439
|
+
relationType(relation) {
|
|
6440
|
+
if (!relation || !this.pathN?.relation) {
|
|
6441
|
+
return relation ?? "";
|
|
6442
|
+
}
|
|
6443
|
+
return `${this.pathN.relation} ${relation}`;
|
|
6444
|
+
}
|
|
6445
|
+
};
|
|
6446
|
+
|
|
5980
6447
|
// src/kinship-translator/kinship-translator.ts
|
|
5981
6448
|
var KinshipTranslator = class {
|
|
5982
6449
|
constructor(person1, person2, lang = "en", entirePath, displayName = "givenname") {
|
|
@@ -6070,6 +6537,7 @@ var KinshipTranslator = class {
|
|
|
6070
6537
|
} else if (personN.level !== 0) {
|
|
6071
6538
|
relation = this.removal();
|
|
6072
6539
|
}
|
|
6540
|
+
relation = this.translator?.halfBlood(relation);
|
|
6073
6541
|
relation = this.translator?.relationType(relation);
|
|
6074
6542
|
if (this.translator?.isOfSpouse) {
|
|
6075
6543
|
relation = this.translator?.ofSpouse(relation);
|
|
@@ -6530,7 +6998,7 @@ var isCommonDate = (value) => {
|
|
|
6530
6998
|
// package.json
|
|
6531
6999
|
var package_default = {
|
|
6532
7000
|
name: "@treeviz/gedcom-parser",
|
|
6533
|
-
version: "2.0.
|
|
7001
|
+
version: "2.0.10"};
|
|
6534
7002
|
|
|
6535
7003
|
// src/utils/get-product-details.ts
|
|
6536
7004
|
var isDevelopment = () => {
|
|
@@ -7604,4 +8072,4 @@ if (isDev) {
|
|
|
7604
8072
|
}
|
|
7605
8073
|
var parser_default = GedcomTree;
|
|
7606
8074
|
|
|
7607
|
-
export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, parser_default as GedcomTree, PlaceType, commonDateFormatter, create, dateFormatter, extractSeparationYears, extractSplitPoints, findMatchingRangeForSplitRange, fromTuple, generateSplitRanges, getAllProp, getFamilyWith, getFileExtension, getName, getPlaceParts, getPlaces, getRawSize, getVersion, hungarianOrdinalize, implemented, inRange, initializeCache, isDevelopment, isImageFormat, isIntersectedRange, isRangeContained, marriageDateFormatter, nameFormatter, notImplemented, noteDateFormatter, ordinalize, parseRangeBounds, pathCache, placeTranslator, profilePictureCache, relativesCache, resetRelativesCache, setNestedGroup, splitOverlappingRanges, splitRange };
|
|
8075
|
+
export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, parser_default as GedcomTree, PlaceType, cacheDiscoveredPath, commonDateFormatter, create, dateFormatter, extractSeparationYears, extractSplitPoints, findMatchingRangeForSplitRange, fromTuple, generateSplitRanges, getAllProp, getFamilyWith, getFileExtension, getName, getPlaceParts, getPlaces, getRawSize, getVersion, hungarianOrdinalize, implemented, inRange, initializeCache, isDevelopment, isImageFormat, isIntersectedRange, isRangeContained, marriageDateFormatter, nameFormatter, notImplemented, noteDateFormatter, ordinalize, parseRangeBounds, pathCache, placeTranslator, profilePictureCache, relativesCache, resetRelativesCache, setNestedGroup, splitOverlappingRanges, splitRange };
|